Open JekSun97 opened 1 month ago
From a cursory glance at the code, I see you are using Surface tool, and I don't see any surface_clear
which might resolve the issue - https://docs.godotengine.org/en/stable/tutorials/3d/procedural_geometry/immediatemesh.html#using-immediatemesh
@mrjustaguy This is unlikely to solve the problem, especially since SurfceTool also has a "clear" method
What happens is that editor copies all child nodes (trunk and leash nodes are just invisible to editor) but you create nodes on constructor again.
I think what you need to do:
Also you need to expose MeshInstances3D to editor because user might want and need to use them. (For example when he well be creating custom culling system, or he might want to save mesh to disk because mesh instance allows that end etc.)
Also I don't think you need parent as node3d. Might be better to inherit it from MeshInstance3d and to not create one more node.
@RonYanDaik I have made the MeshInstance3D available to the editor using
void Tree3D::_ready() {
trunk_inst->set_owner(get_owner());
twig_inst->set_owner(get_owner());
}
and when we open the demo the MeshInstance3D are available to the editor, but when we create a new tree in the editor they are not available to the editor until we reload the project.
Also memnew
in _ready()
causes a crash, I tried to do this
I noticed a problem when duplicating a Tree3D node using Ctrl+D: if we change any leaf or branch value, we see that the old mesh of the duplicate node remains and it looks like one tree is overlaid on top of another.
This multi-level tree disappears after the project is restarted.
I don't know how to solve this problem yet, if anyone has any ideas, I'd be glad for your help.