46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
class KeyframeView extends WindozDomContent {
|
|
|
|
constructor() {
|
|
super()
|
|
Object.assign(this, app.helpers.activeAttributes)
|
|
}
|
|
|
|
DOMContentFocused(options) {
|
|
if(this.wasBlured){ // Avoid 2nd refesh on DomContentLoaded
|
|
//this.refreshyoustuff()
|
|
}
|
|
this.wasBlured = false
|
|
}
|
|
|
|
DOMContentBlured(options) { this.wasBlured = true }
|
|
|
|
async DOMContentLoaded(options) {
|
|
this.windowPrefsId = `editors.keyframeview`
|
|
this.models = options.models
|
|
const components = ui.eicfy(this.el)
|
|
this.setupTriggers(components)
|
|
this.setupRefs(components)
|
|
|
|
this.agentDefs = await this.models.agents.getSprites('Basic 3D')
|
|
this.outputs.agentsSelector.fillOptions( Object.keys(this.agentDefs).map(aname => {
|
|
console.log(this.agentDefs[aname])
|
|
return({ markup: `${aname}`, value: aname})
|
|
}))
|
|
this.outputs.agentsSelector.addEventListener('change',this.onChangeAgent.bind(this))
|
|
|
|
this.agentPreview = new app.LoadedModules.AgentPreview(this.outputs.agentSampleCanvas, this.agentDefs)
|
|
this.onChangeAgent()
|
|
this.agentPreview.startRendering()
|
|
this.agentPreview.animation = true
|
|
}
|
|
|
|
|
|
|
|
onChangeAgent(event){
|
|
if(this.outputs.agentsSelector.value) this.agentPreview.setAgent(this.outputs.agentsSelector.value)
|
|
}
|
|
|
|
}
|
|
|
|
app.registerClass('KeyframeView', KeyframeView)
|