Skip to content

Expose Node::force_parent_owned() to allow avoid duplicate nodes for plugin development #9282

Closed
godotengine/godot
#89442
@Daylily-Zeleen

Description

@Daylily-Zeleen

Describe the project you are working on

Creating a DragonBone plugin by using GDExtension.

Describe the problem or limitation you are having in your project

I need to create an internal tree struct like this:

  • DragonBones (Node2D)
    |- DragonBonesArmature (Node2D)

DragonBonesArmature is created by DragonBones automatically, and need to be an abstract class to avoid created by users.

But duplicate a node will duplicate its children, and duplicated a DragonBonesArmature node will failed because of it is an abstract class and can't be instantiated by ClassDB.

In other words, I can't duplicate a DragonBones node in editor.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

If Node::force_parent_owned() is exposed, I can use it to avoid duplicate internal node, like TileMapLayer::set_as_tile_map_internal_node().

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Just bind it in _bind_methods().

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, it is impossible to change the duplicate logic in script.

Is there a reason why this should be core and not an add-on in the asset library?

Node duplication is core function.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions