SetSkinName question
by James Terry · in Torque Game Engine · 12/27/2006 (10:17 am) · 8 replies
I'd like to create an object, like a playing card that has 2 faces for skins to be on, the front and the back.
On the front, I have the card type, like 8 of hearts or 7 of clubs and on the back I would like the deck type, blue, red, etc.
I assume I could set up my object to have 2 different materials, base.front.png and base.back.png.
My understanding of the setskinname function is that you can pass it 'hearts9.front' and it'll set the front texture to hearts9, but my reading of TDN leads me to believe if I call setskinname('blue.back') it will reset my front texture to 'base.front' and vice versa.
I haven't tried it yet to see if that is the case, but if it is, does anyone have any ideas for an engine modification that would allow me to do this?
i.e. I'd like to:
Thanks
On the front, I have the card type, like 8 of hearts or 7 of clubs and on the back I would like the deck type, blue, red, etc.
I assume I could set up my object to have 2 different materials, base.front.png and base.back.png.
My understanding of the setskinname function is that you can pass it 'hearts9.front' and it'll set the front texture to hearts9, but my reading of TDN leads me to believe if I call setskinname('blue.back') it will reset my front texture to 'base.front' and vice versa.
I haven't tried it yet to see if that is the case, but if it is, does anyone have any ideas for an engine modification that would allow me to do this?
i.e. I'd like to:
card.setSkinName('hearts9.front');
card.setSkinName('blue.back');and have a blue card that is the 9 of heartsThanks
#2
http://tdn.garagegames.com/wiki/Torque_Console_Objects_10#Re-Skinning
which refers me to GPGT page 163-164. Once my artist gets me the new shape I'll test and see if it works as intended
12/27/2006 (11:59 am)
I was looking herehttp://tdn.garagegames.com/wiki/Torque_Console_Objects_10#Re-Skinning
which refers me to GPGT page 163-164. Once my artist gets me the new shape I'll test and see if it works as intended
#3
i believe there is an error in GPGT regarding this.
see Ed's comment dated "Jun 28, 2006 12:19" in this thread.
12/27/2006 (12:06 pm)
Ah, yes.i believe there is an error in GPGT regarding this.
see Ed's comment dated "Jun 28, 2006 12:19" in this thread.
#4
12/27/2006 (1:42 pm)
Alright, here is what happened when I tested itcard.setSkinName('hearts9.front');
Could not locate texture: hearts9.front.front.card.png
Could not locate texture: hearts9.front.back.card.png
card.setSkinName('hearts9');
Could not locate texture: hearts9.back.card.pngThe second one changes the front of the card to my correct image
#5
What I want it card.setSkinName('hearts9.front') to change base.front.card.png to hearts9.front.card.png and card.setSkinName('blue.back') to change base.back.card.png to blue.back.card.png.
I was browsing around the source a bit and it looks like it starts getting convoluted in the reSkin function
12/27/2006 (7:14 pm)
I know of an easy way around this, I could just create 2 dts files and mount them to each other, one called front.dts and one called back.dts, but I'd really like to just do an engine mod so I can work with assets my artists are making for me.What I want it card.setSkinName('hearts9.front') to change base.front.card.png to hearts9.front.card.png and card.setSkinName('blue.back') to change base.back.card.png to blue.back.card.png.
I was browsing around the source a bit and it looks like it starts getting convoluted in the reSkin function
#6
inside tsShapeInstance.cc in the reskin function it goes through all the materials on an object and sets thier base to whatever color skin was sent in setSkin, so I made a setLongSkinName function which takes a 'skin' and a 'slot' and during that check in reSkin it checks if the next dot delimited entry after the base is the same 'slot', if so, it sets the skin for that material to the skin that was sent and for all other materials it skips setting the skin
I'm going to clean up the code and see if I can throw a resource together
12/28/2006 (4:48 pm)
Well, I did it, most of today was spent figuring out how to get information from script to the engineinside tsShapeInstance.cc in the reskin function it goes through all the materials on an object and sets thier base to whatever color skin was sent in setSkin, so I made a setLongSkinName function which takes a 'skin' and a 'slot' and during that check in reSkin it checks if the next dot delimited entry after the base is the same 'slot', if so, it sets the skin for that material to the skin that was sent and for all other materials it skips setting the skin
I'm going to clean up the code and see if I can throw a resource together
#7
hmm, i don't think you should have to do any engine coding to get this to do what you want.
you may just need to implement this resource:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7154
12/28/2006 (4:57 pm)
Hey James -hmm, i don't think you should have to do any engine coding to get this to do what you want.
you may just need to implement this resource:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7154
#8
:(
At least the day wasn't a total waste, I learned a lot
12/28/2006 (5:05 pm)
Well, that looks like exactly what I want to do:(
At least the day wasn't a total waste, I learned a lot
Associate Orion Elenzil
Real Life Plus
it *should* work the way you want.
i have a faint recollection that possibly a resource is required to have more than one replacable texture on a single model, but that may have been incorporated into TGE 1.4+; not sure.
where in TDN are you looking ?