Select object by his properties

Hello,
Tell me how to select an object by its property?
I need to select objects with a specific property :
- display as box
- backface cull
- trajectory
- vertex tricks
It is required to select one property at a time.
I need several buttons, each of which will be bound to one property of the object.
Is it possible?
Thanks :-)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

All those properties are common for all objects(geometry, shapes). So, if you have a script that will select all objects that have property display as box the script will select all objects. If you want to select only objects which property is ON then try this script:

(
	global rol_selObjsByProperty
	try(destroyDialog rol_selObjsByProperty)catch()
	rollout rol_selObjsByProperty "Select objects by property"
	(
		group "Selcet objects with"
		(
			button btn_selByDAB "Display as box" width:120
			button btn_selByBC "Backface cull" width:120
			button btn_selByT "Trajectory" width:120
			button btn_selByVT "Vertex tricks" width:120
		)
 
		function SelectByProperty property: =
		(
			objsToSelArr = #()
			for o in objects where (isProperty o property) do
			(
				if (getProperty o property) == true do
					append objsToSelArr o
			)
			select objsToSelArr
		)
 
		on btn_selByDAB pressed do
		(
			SelectByProperty property:#boxmode
		)
		on btn_selByBC pressed do
		(
			SelectByProperty property:#backfacecull
		)
		on btn_selByT pressed do
		(
			SelectByProperty property:#showTrajectory
		)
		on btn_selByVT pressed do
		(
			SelectByProperty property:#vertexTicks
		)
 
	)
	createdialog rol_selObjsByProperty 
)
Igryl9l's picture

Excellent Thank you very

Excellent
Thank you very much!
Tell me, is animation an object property?
I assumed that with the help of the trajectory properties I could select all animated objects - I made a mistake.
Is it possible to select animated objects in a scene without adding trajectory properties?

miauu's picture

.

fn isNodeAnimated node =
(
animated = off
object = node
if iskindof node SubAnim do
(
animated = (node.keys != undefined) and (node.keys.count > 0)
object = node.object
)
if iskindof object maxwrapper do for ca in object.custattributes while not animated do animated = isNodeAnimated ca
for k=1 to node.numsubs while not animated do animated = isNodeAnimated node[k]
animated
)

fn findAnimatedNodes nodes: =
(
if nodes == unsupplied do nodes = objects as array
for node in nodes where (isNodeAnimated node) collect node
)
fn findAnimatedTransformNodes nodes: =
(
if nodes == unsupplied do nodes = objects as array
for node in nodes where (isNodeAnimated node.controller) collect node
)

Igryl9l's picture

Interesting

I do not understand how this script works.
Please explain how to highlight the animation in the scene.

miauu's picture

.

Use the code below.

The findAnimatedTransformNodes checks if objects's controllers are animated.

The findAnimatedNodes check if the objcet itself is animated.
As the functions is called in the code all objects in the scene will be checked. If you want to check only certain object call the functions this way:
resArr = findAnimatedTransformNodes nodes:(selection as array)

(
	fn isNodeAnimated node =
	(
		animated = off
		object = node
		if iskindof node SubAnim do
		(
			animated = (node.keys != undefined) and (node.keys.count > 0)
			object = node.object
		)
		if iskindof object maxwrapper do for ca in object.custattributes while not animated do animated = isNodeAnimated ca
		for k=1 to node.numsubs while not animated do animated = isNodeAnimated node[k]
		animated
	)
 
	fn findAnimatedNodes nodes: =
	(
		if nodes == unsupplied do nodes = objects as array
		for node in nodes where (isNodeAnimated node) collect node
	)
	fn findAnimatedTransformNodes nodes: =
	(
		if nodes == unsupplied do nodes = objects as array
		for node in nodes where (isNodeAnimated node.controller) collect node
	)
 
	resArr1 = findAnimatedTransformNodes()
	print resArr1
select resArr1
 
	resArr2 = findAnimatedNodes()
	print resArr2
select resArr2
)
Igryl9l's picture

Thank you

Thank you very much!
I did not know how to add selection of objects to your solution.
Now everything works.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.