Notifications
Clear all

[Closed] Verify Property Exists

Is there a way to verify that a property exists on an object?

Specifically i am parsing all the objects in a scene and applying a position to them, the issue is that when i try to run that on a biped object it does not have a ‘bip01.pos’ value.

is there a way to check if that property exists?

2 Replies

See if this helps: hasProperty obj “pos”

From Maxscript help:

The hasProperty() function allows you to test whether an object has a specified property name. Unlike isProperty(), the property name string supports wildcard patterns.

 

hasProperty <obj> <prop_name_or_pattern_string> 

Returns true if the object has the given property or has properties matching the string pattern. 

 

FOR EXAMPLE:
 
 

hasProperty $Box01 "height" --test for height in a Box

true

hasProperty $Box01 "radius" --test for radius in a Box

false

hasProperty $Sphere01 "radius" --test for radius in a Sphere
true

hasProperty $Sphere01 "rad*" --test for any property name 
true --starting with "rad" in a Sphere

 

that doesnt seem to work, its always seems to be returning false.

i can run getProperty on the object though and it returns the value. For some reason it doesnt show up in hasProperty though.

ah ha! isProperty will work, thanks!