jMonkeyEngine / sdk

The jMonkeyEngine3 Software Development Kit based on Netbeans
BSD 3-Clause "New" or "Revised" License
314 stars 100 forks source link

Material parsing problem #463

Closed neph1 closed 1 year ago

neph1 commented 1 year ago

As reported in: https://hub.jmonkeyengine.org/t/textures-materials-and-sdk/46413/7

Some material properties have problem parsing: Error while locating rapRepeat_S WrapRepeat_T MinBilinearNoMipMaps "Models/Proto/body_diffuse.jpg com.jme3.asset.AssetNotFoundException: rapRepeat_S WrapRepeat_T MinBilinearNoMipMaps "Models/Proto/body_diffuse.jpg (Flipped)

I did some changes to make the editor parse the values of the materials correctly a while back. It could be related to that. Or, the SDK has had issues parsing the texture line before, the quotation marks, several years ago. Maybe it's a left over from that.

neph1 commented 1 year ago

The problem seems to lie in TexturePanel:

protected void readProperty() {
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                if (property.getValue().startsWith("Flip Repeat ")) {
                    flip = true;
                    repeat = true;
                    textureName = property.getValue().replaceFirst("Flip Repeat ", "").trim();
                } else if (property.getValue().startsWith("Flip ")) {
                    flip = true;
                    textureName = property.getValue().replaceFirst("Flip ", "").trim();
                } else if (property.getValue().startsWith("Repeat ")) {
                    repeat = true;
                    textureName = property.getValue().replaceFirst("Repeat ", "").trim();
                } else {
                    textureName = property.getValue();
                }
                jLabel1.setText(property.getName());
                jLabel1.setToolTipText(property.getName());
                displayPreview();
                texturePreview.setToolTipText(property.getValue());
                MaterialProperty prop = property;
                property = null;
                jCheckBox1.setSelected(flip);
                jCheckBox2.setSelected(repeat);
                property = prop;
            }
        });
    }

This is all that's handled. Commenting out this loads the material, at least...

To be continued...