Files
P42_UI/app/views/editors/KeyframeView.js
T
2025-10-18 18:30:02 +00:00

44 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 => ({ markup: `<i>${aname}</i>`, 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){
console.log('onChangeAgent',this.outputs.agentsSelector.value)
if(this.outputs.agentsSelector.value) this.agentPreview.setAgent(this.outputs.agentsSelector.value)
}
}
app.registerClass('KeyframeView', KeyframeView)