Mesh class does not have removeMorphTarget

The Mesh class does not have any way to remove a morph target, AKA, no removeMorphTarget(int index)

Would everyone be OK with me opening a PR adding:
public void removeMorphTarget(int index)

Optional:
public void removeMorphTarget(MorphTarget target)
public MorphTarget getMorphTarget(int index)

This will make it much easier to work with MorphTargets when modifying meshes.

Thanks,
Trevor

3 Likes

OK with me. I regard morph animations as a WIP. Plenty of work to be done in that area.

Of course, when it comes to PRs, getting the details right is important. Plus, our PR review process is very slow these days, so don’t expect overnight approval.

1 Like

I’m not too familiar with how morph targets are handled now, but being able to remove them is important. I’d welcome this PR, and I’m happy to review when you’ve got something ready to go.

1 Like

Thanks @danielp, JME’s MorphTargets are fairly simple. I added the ability to add names to them not long ago so that the gltf importer could import shape key names for them.

2 Likes
2 Likes

It will be nice if you can also add return values on both of the removeMorphTarget methods. :slightly_smiling_face:

2 Likes

@Ali_RS would you want the boolean as to if they were removed returned?
EDIT:
Like so?

/**
     * Remove the given MorphTarget from the Mesh
     * @param target The MorphTarget to remove
     * @return If the MorphTarget was removed              
     */
    public boolean removeMorphTarget(MorphTarget target) {
        return morphTargets.remove(target);
    }

    /**
     * Remove the MorphTarget from the Mesh at the given index
     * @param index Index of the MorphTarget to remove
     * @return The MorphTarget that was removed 
     */
    public MorphTarget removeMorphTarget(int index) {
        return morphTargets.remove(index);
    }
1 Like

Yes, please.

2 Likes

Done!

1 Like

Thanks

1 Like