Notifications
Clear all

[Closed] Getting rid of duplicate prop names

I need to get access to all animatable properties of materials. Well this is rather easy, following code prints all properties of standard material:


myMat = Standard()
for i in getPropNames myMat do
   if isPropertyAnimatable myMat i then
	  format "%
" i

The problem is that there are lots of duplicates. #selfIllumColor equals #Self_Illum_Color, #specularLevel equals #Specular_Level and so on. I however dont need two (or more) names for one property, so how do I get rid of these aliases? I dont see what made them put many aliases for same properties in the first place, its just pointless.

Currently the only way I know to check whether property X is duplicate of property Y is to set X have value Z and then check whether Y also has value Z. Isn’t there any more convenient way to detect duplicates?

2 Replies
 rdg

“Currently the only way I know to check whether property X is duplicate of property Y is to set X have value Z and then check whether Y also has value Z. Isn’t there any more convenient way to detect duplicates?”

I don’t htink that is a good idea. What if property A has value Z, too?

You can hardcode an array of valid properties in your script.

I dont see what made them put many aliases for same properties in the first place, its just pointless.

I think they did this for compatibilty reasons.

Georg

Yeah. I guess I’ll hardcode correct name arrays for default 3dsmax materials and maps. For custom materials/maps like mentalrays, vrays etc. I’ll use the code I posted above because its unlikely they’ll have duplicate property names.

Well, if I’d use the “set value Z” method I’d do it like this:
Store all prop values
Set all props to have value 0.0
Start going trough all props and set value 1.0 for all, when I’d come accross prop which value is already 1.0, I know its duplicate.
Store correct prop name array
Restore original values

However, this would be extreamly uneffective way of doing the duplicate check.