Jump to content

Possible: GetMaterial() returns NULL when material assigned in Editor


Ruki
 Share

Recommended Posts

I *might* not be using this correctly, but if you call GetMaterial() on an entity/model loaded in C++ which has a material assigned to it in the LWEditor, it returns NULL, even though you can see ingame that the model has a material being rendered on it.

 

If you call SetMaterial() and load a material into it, GetMaterial() will return the correct Material.

 

 

Just to clarify, this only fails if you set the material in the LWeditor. Is this the intended use?

 

Windows 7, Visual studio community 2013

Link to comment
Share on other sites

What kind of object is this, a brush or model?

 

A "Model". I did a test snippet and I'm 90% sure it's bugged, unless I'm doing something wrong. I tested it using the default Barrel Model, which definitely does have a material in the LW editor.

 

Model *testModel = Model::Load( "Models/Barrel/barrel.mdl" );
if ( testModel->GetMaterial() )
	myMain->flag( "Barrel has material!" );
else
	myMain->flag( "Barrel has NO material.." );

 

Output says that the barrel has no material, but it shows up ingame as having the blue/yellow material on it

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...