FetchEntityMaterial() - nonsense Function?!

Everything related to 3D programming
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

FetchEntityMaterial() - nonsense Function?!

Post by Bananenfreak »

Heyho,

I have a question about materialnumber = FetchEntityMaterial(#Entity, #Material [, SubEntity]). First, I don´t know how to use this, because I have to set a materialnumber to get a materialnumber?! Even if first materialnumber is only the second materialnumber, which numbers can I use for FetchEntityMaterial()?
I mean, if I use #Material = 1 and I already got an Material with number "1", what shall I do?
Ah, one more question: Is there Support for #PB_Any?

EDIT: There is Support for #PB_Any with #Material. Could you add this to the Documentation.
There´s another Thing wrong with this function. In the bottomline of the IDE (I forgot the Name of that line) there is an issue with this function... Too much arguments.
Image
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: FetchEntityMaterial() - nonsense Function?!

Post by Fred »

This command should assign the mesh material to a #Material number, so you can use the material library command on it. Does it works as expected ?
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: FetchEntityMaterial() - nonsense Function?!

Post by applePi »

refer to the FetchEntityMaterial.pb example
if you want to use the matNumber as this
matNumber = FetchEntityMaterial(#Entity0, #Material1)
then this works:
CreateEntity(#Entity1, MeshID(#Mesh1), MaterialID(#Material1), 60, 0, 0)
also this will work:
CreateEntity(#Entity1, MeshID(#Mesh1), matNumber, 60, 0, 0)
i guess matNumber is a pointer to the material (long number), correct me if wrong
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: FetchEntityMaterial() - nonsense Function?!

Post by Bananenfreak »

Ah, then FetchEntityMaterial() gives you pointer to the "fetched" material back as result and #Material is the PB-intern value; Material will set to this #Material.
Ok, now it´s clear why we need a #Material for a materialnumber.

Personally, I don´t like this command, because there are 2 (different) functions in 1 command...
Image
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: FetchEntityMaterial() - nonsense Function?!

Post by Fred »

No, only the #Material number is valid. It returns the materialID, but it's not documented. You have to use MaterialID() if you want it

http://www.purebasic.com/documentation/ ... erial.html
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: FetchEntityMaterial() - nonsense Function?!

Post by Bananenfreak »

Aha, then the german Documentation isn't up-to-date. I will post it in the german forum.
Image
Post Reply