Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a USceneComponent editable in details panel? #111

Closed
arthursw opened this issue Sep 9, 2016 · 2 comments
Closed

How to make a USceneComponent editable in details panel? #111

arthursw opened this issue Sep 9, 2016 · 2 comments
Labels

Comments

@arthursw
Copy link

arthursw commented Sep 9, 2016

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)?

@nakosung
Copy link
Collaborator

nakosung commented Sep 9, 2016

image

https://answers.unrealengine.com/questions/162087/component-add-in-c-edit-in-blueprint.html

class CustomComponent extends MeshComponent {
    ctor() { }

    properties() {
        this.X /*EditAnywhere+int*/;
    }
}

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.Root /*VisibleAnywhere+BlueprintReadOnly+SceneComponent*/;
        this.CustomComponent /*VisibleAnywhere+BlueprintReadOnly+MeshComponent*/;
    }
}

@nakosung
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants