Export j3m Material file

@Momoko_Fan what do you think? about the getAsString?
@tsr, imo this could be integrated in the jme-plugin project. That’s where we have the importers for Ogre, fbx and the xml exporter.

i really had to look up what “imo” means;)) Anyway, I’ve made the changes in the Exporter and the example material file now looks like:

Material female_casualsuit02 : Common/MatDefs/Light/Lighting.j3md {

    MaterialParameters {
      Diffuse : 1.0 1.0 1.0 1.0
      UseMaterialColors : true
      ParallaxHeight : 0.05
      Ambient : 1.0 1.0 1.0 1.0
      DiffuseMap : Flip WrapRepeat_S WrapRepeat_T MinNearestNoMipMaps MagNearest "Textures/characters/female_casualsuit02_diffuse.png"
      Specular : 0.01375 0.01375 0.01375 1.0
      Shininess : 50.0
    }

    AdditionalRenderState {
    }
}

Is this alright?

When this is ok I will put it up to my github repository and then later I might integrate it into jme-plugin project and give you the pull request;)

1 Like

:)) yeah sorry bad chat habit :wink:

This looks perfect, thanks a lot

1 Like

Actually I read this “imo” quite a lot, but so far it never has been important enough for me to actually think about its meaning;) My github repo already includes this latest patch if you want to check it out. The jme-plugins stuff will probably take some days.

1 Like

I’ll take care of the integration in the jme-plugin project. this way on next release, you’ll be able to use it and remove what’ sin your repo

1 Like

Thats great!

Actually now I have problems with the material files when using them:

Mar 07, 2016 3:29:28 PM com.jme3.material.plugins.J3MLoader parseTextureType
WARNING: Cannot locate WrapRepeat_S WrapRepeat_T MinNearestNoMipMaps MagNearest "Textures/characters/young_lightskinned_female_diffuse2.png (Flipped) (Mipmapped) for material Materials/characters/young_caucasian_female2.j3m

When I change it back to:

DiffuseMap : Flip Repeat "Textures/characters/female_casualsuit02_diffuse.png"

it works again. Is this because the changes for these texture parameters are only in the current master and I still have some “old” version?

They should be in 3.1.0-alpha2.
I’ll test tonight.

Ok, then its strange, because this is the version i am using: “3.1.0-alpha2” from JCenter

There might be an issue then, I’ll check it out.
In the mean time you can revert back to your old version

The entire purpose of getValueAsString() is for the SDK to use it. If we have a J3MExporter of sorts, then the method could be moved there.

1 Like

I think I know what is causing this. In the J3MLoader there is a bit of logic that tries to determine if you are using the old supported way or the new texture options. This logic thinks that if the value starts with "Flip " it should load it using the “old” way which is essentially substringing everything after "Flip ". Perhaps we could fix this by when we loop over the values in the string which are separated by space, once we hit a value which is not found to be a valid texture option we simply assume that the texture path starts there.

Edit: Should be resolved as of commit Fixed an issue with J3MLoader thinking certain texture path patterns … · jMonkeyEngine/jmonkeyengine@9f9cb82 · GitHub

@Momoko_Fan Its now already within the J3MExporter.
@DannyJo: Thanks - nice thing that this also helped in finding some bug in the core;)
@nehon: Its currently no problem that the texture is missing in my little project - I am currently working on some procedural locomotion system and there it does not really matter anyway. Even no model and only a skeleton would work out just fine :wink:

Thank you all! This is really a great community here!

Thank you for the help @tsr

The unit test was also expanded to ensure this case is covered.

1 Like

So be it, IMO it’s a lot cleaner.