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

A way to copy a node? #258

Open
toniuyt123 opened this Issue Feb 17, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@toniuyt123
Copy link

toniuyt123 commented Feb 17, 2019

Is there a way to copy a node? Right now I've created a NodeBuilder and have set all of it's components to be the same as the node I want to copy. Then I build the new node and add it to the corresponding parent. What I get from this is that the old Node becomes an empty node with node geometry and the new one constructs correctly. I assume the geometry gets referenced to the new node and transfers there. Is there a way to keep both nodes?

        Node.NodeBuilder builder = new Node.NodeBuilder<>();
        builder.name(node.getName())
            .geometry(node.getGeometry())
            .clickListener(node.getClickListener())
            .children((ArrayList<Node>) node.getChildNodes())
            .scale(node.getScaleRealtime())
            .position(node.getWorldTransformRealTime().extractTranslation())
            .visible(true);
        Node newNode = builder.build();
        node.getParentNode().addChildNode(newNode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.