gamecreator Posted March 14, 2015 Share Posted March 14, 2015 Does anyone have any idea why GetMaterial could return null on a textured model which has 0 children? tempmat = level[j][i].model->GetMaterial(); if(tempmat==NULL) printf("null\n"); else printf("not null\n"); I confirmed in the editor that Surface 0: blue.mat. Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 14, 2015 Share Posted March 14, 2015 Try : model->GetSurface(0)->GetMaterial() 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
gamecreator Posted March 14, 2015 Author Share Posted March 14, 2015 Ah, I now remember seeing this before. Thanks shadmar! We need GetMaterial fix or documentation correction. 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted March 15, 2015 Share Posted March 15, 2015 Yes, it appears that Entity:GetMaterial() only works if the material has been set via code with Entity:SetMaterial(). If not set via code, then Model:GetSurface(index):GetMaterial() has to be used. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
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.