Transform And Mesh Cloning Child Names

Yo @Deltakosh … I have a problem where the child nodes of deep cloning ALWAYS prefixes the new parent clone name with the child name: TransformNode.clone and Mesh.Constructor

if ((<any>child).clone) {
    (<any>child).clone(name + "." + child.name, result);
}

This is renaming my whole hierarchy and really messing things up when cloning with children.
Can we please add some sort of switch or something on the scene (scene.prefixClonedChildNames - default true)

if (scene.prefixClonedChildNames === true) {
  if ((<any>child).clone) {
    (<any>child).clone(name + "." + child.name, result);
  }
}
else
{
  if ((<any>child).clone) {
    (<any>child).clone(child.name, result);
  }
}

That way i can turn that off and have the same name as my clone source children by setting scene.prefixClonedChildNames = false;

Please let me know if something like that is kool and i will make a PR :slight_smile:

3 Likes

I am having the same issue. We use the mesh name in our UI and we end up with duplicated string in the mesh name after cloning.

Maybe adding a new argument in the clone method would better than setting a scene property?
Willing to make a PR if needed too :wink:

Please feel free to make a PR for it, and the best might be to pass in a custom function to generate the name which defaults to our current behavior so anybody can rename as they prefer.

I am also facing this issue, is there any progress on this matter? TIA.

This has not been tackled but do you want to make a PR @Hashiinngg ?

A custom naming function would be cool here :slight_smile: