Notifications
Clear all

[Closed] filter selectByName crash

basically I want append node from scene to maxObjectTab param in plugin with selectByName and node which already appended dont show in selectByName. the problem is my filter function for selectByName will crash if object in scene more than 500. this is my sample code

plugin modifier 'test'
   name:"test"
   classID:#(0x1ea7bd37, 0x4eb53fab)
   (
   	parameters setup
   	(
   		expNodeArray type:#maxObjectTab tabSize:0 tabSizeVariable:true
   	)
   	fn selByName fltr=
   	(
   		obj= selectByName title:"Add node" buttonText:"Add" filter:fltr
   		if obj != undefined do
   		(
   			for o in obj do append expNodeArray (nodeTransformMonitor node:o forwardTransformChangeMsgs:false)
   		)
   	)
   	fn selByNameFilter obj=
   	(
   		local maxTabed=for o in expNodeArray collect o.node;
   
   		local bool=appendifunique maxTabed obj
   
   		bool
   	)
   	rollout pluginRoll "Offset Control" category:2
   	(
   		listbox listControl height:20 width:140 align:#center
   		button addByName "addByName" align:#center
   
   		fn updateRoll=
   		(
   			listControl.items=for o in expNodeArray collect o.node.name;
   		)
   		on addByName pressed do
   		(
   			selByName selByNameFilter
   			updateRoll()
   		)
   		on pluginRoll open do
   		(
   			updateRoll()
   		)
   	)
   )

is there any other method to achieve my goal?

9 Replies

first, i have a question.
why do you store NodeTransformMonitor objects instead of just simply nodes?

first, i have a question.
why do you store NodeTransformMonitor objects instead of just simply nodes?

along time ago i used to store all node in nodeTab denis, but if node which have modifier test also i want to store in, it will return dependency loop. so now i change all nodeTab param in my modifier plugin to maxObjectTab. is your question is clue to my solution?

if you need a weak reference to a node and you don’t need to monitor its transform you can use nodeMonitor object. It’s cheapper than nodeTransformMonitor with forwardTransformChangeMsgs set to OFF.
but when you use nodeMonitor (or nodeTransformMonitor) you miss many notification messages. for example the referenced node deleted. How do you suppose do update the UI list in this case?

2 Replies
(@eugenio)
Joined: 11 months ago

Posts: 0

Never heard about nodeMonitor. There’s not even a single word about it in maxscript help. How to you get to know about it and how to use it?

(@denist)
Joined: 11 months ago

Posts: 0

hmm… i’ve double checked and found that there is really no a word about the nodemonitor in the mxs help. how did i know about it? i don’t remember. i’m an old man… i live a long time in mxs world…
what is it? it’s true weak reference to the node. it’s probably the first implementation of a weak node dependency. being wrapped in the nodemonitor object a node doesn’t send any notification message to their ‘dependents’ which makes them clearly independent from this node. the nodetransformmonitor object is probably the next generation of this idea, which can transfer or can receive transform messages.

other benefit of the using node tab instead of maxobject tab is easy way to find a node in the list which makes your filter function much easier.
like:


fn filter node = (findItem list node == 0)

#1 I would use a scripted Helper instead of the scripted Modifier in your case. A modifier can be applied to multiple objects. It’s not easy to prevent it.
#2 I would prohibit the adding of the node itself to its own node list

#1 I would use a scripted Helper instead of the scripted Modifier in your case.
but I need to instance it, because some of my modifiers plugin have cutomAtt to drive character

#2 I would prohibit the adding of the node itself to its own node list
what do you mean ‘adding of the node itself to its own node list’?

I have 2 modifiers plugin, 1 modifier rule all controller of my character and another to manage pose of my character. if i use nodeTab instead of maxObjectTab i cannot instance my modifier. though nodeTab is faster than maxObjectTab

Interesting info. Thanks for the answer Denis!