Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MaterialEditor: MorphWeights - wrong parameter type. #594

Closed
capdevon opened this issue Apr 9, 2024 · 1 comment · Fixed by #599
Closed

MaterialEditor: MorphWeights - wrong parameter type. #594

capdevon opened this issue Apr 9, 2024 · 1 comment · Fixed by #599
Assignees

Comments

@capdevon
Copy link
Contributor

capdevon commented Apr 9, 2024

Hi guys,
the MorphWeights parameter is a FloatArray not a Float.

See PBRLighting.j3md

        // For Morph animation
        FloatArray MorphWeights
        Int NumberOfMorphTargets
        Int NumberOfTargetsBuffers

Its representation in the Options tab of the Material Editor is wrong.
image

The problem should be caused by the incorrect defLine.startsWith(string) and defLine.replaceFirst() algorithm when string = "Float" and defLine starts with FloatArray:

https://github.com/jMonkeyEngine/sdk/blob/master/jme3-materialeditor/src/com/jme3/gde/materials/EditableMaterialFile.java#L243

    private static final String[] variableTypes = new String[]{
            "Int", 
            "Boolean", 
            "Float", 
            "Vector2", 
            "Vector3", 
            "Vector4", 
            "Color", 
            "Texture2D", 
            "Texture3D", 
            "TextureArray", 
            "TextureBuffer", 
            "TextureCubeMap" };
        for (String string : variableTypes) {
            if (defLine.startsWith(string)) {
                final String propName = MaterialUtils.trimName(defLine.replaceFirst(string, ""));
                matDefEntries.add(propName);
                ...
            }
        }

Output:
MaterialProperty [type=Float, name=Array ShadowMapSize, value=]

@tonihele
Copy link
Contributor

I don't know would be easier to parse the file with StringTokenizer or something. But I think the easiest fix is to set FloatArray as one of the types. It just needs to be before Float (startsWith...), need to comment this in code. Do we have editor type for float array...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants