这是indexloc提供的服务,不要输入任何密码
Skip to content

Mesh clone incorrect, geometry and material not actually cloned #113

@Sergii-Khomenko

Description

@Sergii-Khomenko

Hello!
At first, thanks a lot for a great package!
There is a wrong behavior fo Mesh.clone for geometry and material cloning.
There is a problem:
@OverRide
Mesh clone([bool? recursive = true]) {
return Mesh(geometry?.clone(), material?.clone()).copy(this, recursive);
}

New Mesh with cloned geometry and material created, but after .copy(this, recursive) executed they are restored to source's.

copy function code snippet:
@OverRide
Mesh copy(Object3D source, [bool? recursive]) {
super.copy(source, false);
if (source is Mesh) {
if (source.morphTargetInfluences.isNotEmpty) {
morphTargetInfluences = source.morphTargetInfluences.sublist(0);
}
if (source.morphTargetDictionary != null) {
morphTargetDictionary = json.decode(json.encode(source.morphTargetDictionary));
}
material = source.material;
geometry = source.geometry;

}
return this;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions