ageent preview & select in KF editor

This commit is contained in:
STEINNI
2025-10-16 20:39:09 +00:00
parent 078f60ef51
commit 3912523b0a
14 changed files with 223 additions and 111 deletions
+18 -24
View File
@@ -3,7 +3,6 @@ class KeyframeView extends WindozDomContent {
constructor() {
super()
Object.assign(this, app.helpers.activeAttributes)
//this.tileMarkup = app.Assets.Store.html['/app/assets/html/mailing/tile.html']
}
DOMContentFocused(options) {
@@ -15,36 +14,31 @@ class KeyframeView extends WindozDomContent {
DOMContentBlured(options) { this.wasBlured = true }
DOMContentLoaded(options) {
async DOMContentLoaded(options) {
this.windowPrefsId = `editors.keyframeview`
for(let model in options.models) this[model] = options.models[model]
// this.kfe = options.kfe
this.models = options.models
const components = ui.eicfy(this.el)
this.setupTriggers(components)
this.setupRefs(components)
// this.renderingEngine = this.kfe.startRendering(this.outputs.kfeCanvas, options.mode)
this.output('settingsMenu',app.Assets.Store.html.spaceViewSetting)
this.outputs.settingsMenu.querySelectorAll('input[type="toggler"]').forEach(el => {
const tog = new InputToggler(el)
// if(this.kfe[tog._el.name].layers){
// tog.value = this.renderingEngine.camera.layers.test(this.kfe[tog._el.name].layers) ? 'yes' : 'no'
// }
tog.onToggle = this.settingsToggle.bind(this)
})
this.agentDefs = await this.models.agents.getSprites('Basic 3D')
for(const agentType in this.agentDefs){
const opt = new Option(agentType, agentType)
this.outputs.agentsSelector.add(opt)
}
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
}
settingsToggle(value, object){
if(['grid','axes'].includes(object._el.name)){
const layerId = {'grid':1,'axes':2}[object._el.name]
if(value=='yes'){
this.renderingEngine.camera.layers.enable(layerId)
} else {
this.renderingEngine.camera.layers.disable(layerId)
}
}
//TODO save & restore in prefs
onChangeAgent(event){
this.agentPreview.setAgent(this.outputs.agentsSelector.value)
}
}
app.registerClass('KeyframeView', KeyframeView)