I have my models/materials initially all created in blender, and they import just fine, however Now I would like to apply a new material on some of the objects, but then I would like to toggle back to the original material, this leads me to the following 2 questions.
Is there no way to obtain a reference to an existing objects material? i.e. I see Spatial defines setMaterial, but there is no getMaterial function?
Given my materials are initially created in blender, is there any way to generate the .j3m files from those? or is this a manual process where I have to build out the j3m file piece by piece?
The Geometry has getMaterial() as only Geometry can have materials. Cast the Spatial to Geometry.
You can do that in the SDK. Open a model file and select a Geometry inside in the SceneExplorer, then select “create j3m” in the properties window under “Material”.
Using the j3o version appeared to enable the editing as you said
but…some observations:
When I did selected create new j3m file, it created a new j3m file in the model directly (I was expecting it to pop into the material directory).
The j3m file also appeared…to be template and did not actually have the material data from blender.
i.e. this is what it created:
Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
}
}
The color/texture information was not generated.
Not a big deal…I don’t actualy need a j3m file, for the default materials, since I can just grab that from the geomerty itself once they are loaded up.
I did actually try a sdk update today, when it restarted, and fired up my game, it complained about not being able load assets of type: ‘blend’
I just ended up rolling back to my previous version of the sdk, and its working again.
I built a new unshaded j3m file…In the editor the color does not appear to show up correctly…my j3m file:
Material rollovermat : Common/MatDefs/Misc/Unshaded.j3md {
MaterialParameters {
Color : 0 0.71 0 0
ColorMap : Textures/rollover_light2.png
}
AdditionalRenderState {
}
}
(note: the rollover_light2 png is just a 2 tone png (1 is alpha, the other is not)
in the game it shows up green, in the editor it just shows up white…not a big deal…I’m probably missing something, but anyhow thanx for the pointers…back to coding