[Bf-python] api style/doc question

alex mole nal at blueyonder.co.uk
Mon Nov 17 01:53:51 CET 2003


 >
 > setTexture(num,tex)- set channel _num_ to texture _tex_
 >


What should Material.setTexture() accept as its tex parameter- an MTex 
or a Texture?

If it accepts a Texture, then the user will have to call getTextures() 
again to retrieve the MTex object that gets created, which could be seen 
as being inconvenient.

On the other hand, if it accepts an MTex, then there will need to be an 
MTex creation function. In itself this isn't a problem, but it would 
need to be implemented very carefully to avoid memory leaks: MTex 
structs aren't stored in any central place, so once the pointer has been 
lost, the memory can never be freed. In addition, they have no user 
count, so it would be very hard to know whether an MTex has been 
assigned to a material at the time the python MTex comes to be 
destroyed. MTex assignments would need to be performed by data copying, 
rather than pointer assignment.


My gut feeling is to have setTexture take Texture objects, so I'll go 
with this unless someone tells me otherwise :)


alex






________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________



More information about the Bf-python mailing list