KFEditor adds objects to 3D scene
This commit is contained in:
@@ -41,19 +41,31 @@ class KeyframeView extends WindozDomContent {
|
||||
this.agentPreview.startRendering()
|
||||
this.agentPreview.animation = true
|
||||
|
||||
this.kfArena = new app.LoadedModules.kfArena(this.outputs.kfArenaCanvas, this.agentSprites)
|
||||
this.kfArena.startRendering()
|
||||
|
||||
|
||||
this.outputs.btnAddAgent.disabled = true
|
||||
this.outputs.btnRemoveAgent.disabled = true
|
||||
}
|
||||
|
||||
|
||||
|
||||
async onChangeAgent(event){
|
||||
if(this.outputs.agentsSelector.value) this.agentPreview.setAgent(this.outputs.agentsSelector.value)
|
||||
if(!this.outputs.agentsSelector.value) return
|
||||
console.log('onChangeAgent',this.outputs.agentsSelector.value)
|
||||
const agent = await this.models.agents.getProperties(this.outputs.agentsSelector.value)
|
||||
this.fillAgentProperties(agent.atp_props)
|
||||
}
|
||||
|
||||
fillAgentProperties(agentProps){ console.log('fillAgentProperties', agentProps)
|
||||
onAddAgent(event){
|
||||
const aid = crypto.randomUUIDv7()
|
||||
this.kfArena.addAgent(this.outputs.agentsSelector.value, aid, {
|
||||
x: document.querySelector('[name="position.x"]').value,
|
||||
y: document.querySelector('[name="position.y"]').value,
|
||||
z: document.querySelector('[name="position.z"]').value,
|
||||
})
|
||||
}
|
||||
|
||||
fillAgentProperties(agentProps){
|
||||
this.outputs.agentProperties.innerHTML=''
|
||||
this.outputs.agentProperties.append(...this.fieldsFromJSON(agentProps, 'Internal properties'))
|
||||
this.outputs.agentProperties.append(...this.fieldsFromJSON({
|
||||
@@ -90,8 +102,10 @@ class KeyframeView extends WindozDomContent {
|
||||
default: "0"
|
||||
},
|
||||
}, 'Speed vector'))
|
||||
this.outputs.btnAddAgent.disabled = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.registerClass('KeyframeView', KeyframeView)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user