Saul,

 

Thanks. I quickly added an engine->PreloadModel() to the gamerules
initialization and now it works. Without the same call on the client that
is.

 

Jan

 

Von: hlcoders-boun...@list.valvesoftware.com
[mailto:hlcoders-boun...@list.valvesoftware.com] Im Auftrag von Saul
Rennison
Gesendet: Samstag, 19. Januar 2013 15:32
An: Discussion of Half-Life Programming
Betreff: Re: [hlcoders] Preloading a model to show it on a CModelPanel

 

Correct me if I'm wrong, but the model also need preaching server side, too.


On Saturday, January 19, 2013, Jan Hartung wrote:

Hi list,

 

I'm in another fight with the Source SDK. Currently I'm trying to add a new
panel to the HUD which shows information and a model. Drawing text on the
panel works just fine and basically the CModelPanel which I create in the
panel code works fine as well. Basically, because it only works with models
which have already been pre-loaded, like player models or weapon view/world
models.

So I have tried several things to pre-load the model I want to show on the
CModelPanel (in the panel's LevelInit function).
modelinfo->FindOrLoadModel(), engine->LoadModel(),
C_BaseEntity::PrecacheModel() and CreateEntityByName() to create a new
prop_static. The entity pointer is valid, but calling SetModel on it crashes
the game. The other three function calls return just fine, but a call to
modelinfo->GetModelIndex() with the same model name always returns -1.

The problem here is that the CModelPanel initializes the model by calling
InitializeAsClientEntity() in C_BaseEntity which tries to find the index for
the given model name. In my case it's always -1 which makes the function
return without actually loading the model.

Clearly I'm doing something wrong here so any hint on how to do it correctly
would be nice.

 

Jan



-- 

 

 

Kind regards,

Saul Rennison

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

Reply via email to