-
Notifications
You must be signed in to change notification settings - Fork 349
Closed
Labels
Description
I tried the following code but the component is not editable:
let Compile = function(x) {
return require('uclass')()(global, x);
}
class CustomComponent extends MeshComponent {
ctor() { }
properties() { }
}
let CustomComponentClass = Compile(CustomComponent)
class CustomActor extends Actor {
ctor() {
console.log("CustomActor ctor")
this.Root = SceneComponent.CreateDefaultSubobject("ActorRootComponent")
this.SetRootComponent(this.Root)
this.CustomComponent = CustomComponentClass.CreateDefaultSubobject("CustomComponent")
this.CustomComponent.AttachTo(this.Root)
}
properties() {
this.CustomComponent /*EditableAnywhere+Category:Javascript:CustomComponent*/;
}
}
const CustomActorClass = Compile(CustomActor)
function initialize() {
global.World = Engine.GetEditorWorld()
global.CustomActor = new CustomActorClass(global.World, { X: 0 })
return function () { $execEditor(function () { if(global.CustomActor.IsValid()) { global.CustomActor.DestroyActor(); } }) }
}
module.exports = function () {
let bye
let alive = true
process.nextTick(function () {
if (!alive) return
bye = initialize()
})
return _ => {
alive = false
if (bye) {
bye()
}
}
}
I would like the component to be editable in order to change the materials applied to it.
Is it possible to change the Object Flags at runtime, or elsewhere (outside the properties() function)?