This commit is contained in:
2025-12-08 13:38:53 +02:00
parent e6f5db010e
commit 887e3a2114
2 changed files with 16 additions and 11 deletions
@@ -48,7 +48,11 @@ export default{
gameEngine?.stop();
},
watch:{
object(n){
this.obj = n;
},
async obj(){
if (!this.obj) return;
gameEngine = new GameEngine();
this.gameEngine = gameEngine;
await gameEngine.init(this.$refs.target, {gizmo: true});
+12 -11
View File
@@ -4,7 +4,7 @@
<v-tab value="edit">
<v-icon icon="mdi-pencil"></v-icon> {{ id == 'add' ? l.createGameObject : l.editGameObject }}
</v-tab>
<v-tab value="preview" v-if="object.asset">
<v-tab value="preview" v-show="object.asset">
<v-icon icon="mdi-panorama-outline"></v-icon> {{ l.preview }}
</v-tab>
</v-tabs>
@@ -28,13 +28,13 @@
:disabled="!valid">
{{ l.saveAndPreview }}
</v-btn>
<v-btn @click="publish" prepend-icon="mdi-publish" color="success" v-if="false && object.id">{{ l.publish
}}</v-btn>
<v-btn @click="publish" prepend-icon="mdi-publish" color="success" v-if="false && object.id">
{{ l.publish }}</v-btn>
</v-card-actions>
</v-card>
</v-tabs-window-item>
<v-tabs-window-item value="preview">
<v-card :title="l.preview" class="container my-3" v-show="object.asset">
<v-card :title="l.preview" class="container my-3" v-if="object.asset">
<AssetPreview :object="object" ref="assetPreview" ></AssetPreview>
<v-card-actions>
<v-btn @click="captureThumbnail" v-if="forRendering" prepend-icon="mdi-camera" color="secondary">
@@ -52,7 +52,7 @@
export default {
data() {
return {
panel: 'edit',
panel: this.$route.query?.tab || 'edit',
object: {},
valid: false,
rules: {
@@ -92,16 +92,17 @@ export default {
let result = await this.$api.gameObject.save(fd);
Object.assign(this.object, result.data.object);
if (this.id == 'add') {
this.$router.replace({ params: { id: this.object.id } });
this.$router.replace({ params: { id: this.object.id }, query:{ tab:'preview' } });
}
this.panel = 'preview';
await this.$nextTick();
if (!params?.thumbOnly) await this.$refs.assetPreview.loadAsset();
// await this.$nextTick();
// this.panel = 'preview';
// if (!params?.thumbOnly) await this.$refs.assetPreview.loadAsset();
} catch (err) {
console.error(err);
}
this.loading = false
this.panel = 'preview';
this.loading = false;
// await this.$nextTick();
// this.panel = 'preview';
},
async captureThumbnail() {