Modify MaterialDef Programaticaly

Hi all well this is the question can i modify the MaterialDef programaticaly, i mean add vars, modify etc…
regards!

Just recreate them. They are normal java objects.

What is it you want to do exactly?

basicaly what i intend to do is modify values to a j3m file … as an example, if i have something like this

[java]
Material My Material : MatDefs/Sprites/Sprites.j3md {
MaterialParameters {
AniTexMap : Flip Repeat Textures/globlin/goblin.png
numTilesU : 28
numTilesV : 12
Speed : 24
}
[/java]
i want to modify a parameter like… speed or add a new var like backword … its any way to do programaticaly ?

Well that var would have to do something in the shader, so no, you can’t just add variables and expect they will do something.

ok i see thanks!

@juglarx said: basicaly what i intend to do is modify values to a j3m file .... as an example, if i have something like this

[java]
Material My Material : MatDefs/Sprites/Sprites.j3md {
MaterialParameters {
AniTexMap : Flip Repeat Textures/globlin/goblin.png
numTilesU : 28
numTilesV : 12
Speed : 24
}
[/java]
i want to modify a parameter like… speed or add a new var like backword … its any way to do programaticaly ?

No by “what do you really want to do”, I mean what do you want to achieve with this.
You just expose how you think you can do it, but that not very conventional, maybe we can guide you to a more conventional and easy way if we know what you want to achieve in the end.

Thanks nehon, what i really want to do is make a animation sprite shader centric, but with the control of the animation from java, but i figure out how to do a workaround, i create a j3m file for each animation (walk, run, etc) and apply it when i need it, what are your thought about it ?
thanks for your help…

@juglarx said: Thanks nehon, what i really want to do is make a animation sprite shader centric, but with the control of the animation from java, but i figure out how to do a workaround, i create a j3m file for each animation (walk, run, etc) and apply it when i need it, what are your thought about it ? thanks for your help....
Sounds like a better solution yes.