When trying to figure out how to do things, it's useful to search 
through the SDK source code for examples.  You know that you want to 
change a skin, but don't know how to do it.  Start by searching the 
Valve Developer Community wiki pages...

http://developer.valvesoftware.com/wiki/Main_Page

I put "skin" in the search box on how to create skins for models.  No 
programming example of how to change a skin jumps out at me, so I search 
the SDK source code (using "Find in Files" in Visual Studio, or using my 
favorite tool WinGrep).

I start by searching all .cpp files for "skin" and this gives me lots of 
results (in fact, too many to look through), so I search for "Skin" 
using a case-sensitive search assuming that there will be some function 
that allows me to change a skin and it will have the name "Skin" (with 
that case) somewhere in it.

Lo and behold, I find things like "GetSkin()" and "SetSkin()" in various 
places (for example, weapon_crossbow.cpp has a SetSkin() member 
function).  By looking at this example code, I can determine how to set 
a skin on a model.

"Give a man a fish, feed him for a day.  Teach a man to fish, feed him 
for life."

-- 
Jeffrey "botman" Broome


On 3/18/2009 11:16 PM, Idrox Gedrono wrote:
> Well, right, I don't want to change the actual materials, I just want
> to set the skin number of the model.  For example, if 0 is the HEV
> suit and 1 is rebel hands and 2 is combine hands, I want to know how
> to set that number in code.
>
> Ryan Sheffer wrote:
>> You don't, you can override the materials of a model but I think
>> that is about it. You will have to make either modifications to the
>> current texture or recompile the model with multiple skins.
>>
>> On Wed, Mar 18, 2009 at 6:22 PM, Idrox Gedrono  wrote:
>>
>>> Very well.   The arms model must not change, then, but instead
>>> the skin on the arms.   Half-Life 2 Deathmatch has skins for both
>>> rebels and combine. The question is, then, how (and where) do you
>>> change the skin of the player's weapon in code?
>>>
>>> Ben Mears wrote:
>>>> Good point. But you would still have to compile the new skin
>>>> into the model, right? I think you would still need to
>>>> decompile the model and apply the new texture/skin to the model
>>>> in a 3D program and then export the new reference SMD for the
>>>> model with the new texture/skin. You would also need to
>>>> reference the new texture in the .QC file and designate it as a
>>>> skin that can be used.
>>>>
>>>> botman wrote:
>>>>> Models can have multiple skins.  You can switch between the
>>>>> skin for different materials on the model.
>>>>>
>
> _________________________________________________________________
> HotmailĀ® is up to 70% faster. Now good news travels really fast.
> http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009
>
>
_______________________________________________
> To unsubscribe, edit your list preferences, or view the list
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to