(SDK) equivalent to mxs "modPanel"

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

REPLY TO THREAD
 
Thread Tools Display Modes
  02 February 2016
Ummm, yes. I suppose it's like you say, because I believe in you.
My knowledge of 3DMax is not fantastic. I can't think about a situation where the second sentence applies, but I'm sure it can be.
__________________
Andrés FC.
P3D_PathScripts

Last edited by aaandres : 02 February 2016 at 07:27 PM.
 
  02 February 2016
refs.dependentNodes recursively enumerates all dependents of a specified reference target by searching and collecting nodes.

the only one criteria for node to be added to the list is the fact of any dependency. But there is an optional flag - baseObjectOnly. it filters only nodes where the specified reference is a base object of these nodes

there is no flag to and a direct way to filter only nodes where a specified reference is an applied modifier.
you have to do this filtering yourself.

but... as i already showed on this forum in general case is cleaner and usually faster do find all 'applied to' nodes as:
for node in objects where (finditem node.modifiers modi > 0) collect node
 
  02 February 2016
That is really faster??!! There's any flag saying "hey, I depend on you"?
Thanks a lot DenisT.
I'll do it this way. It's just what I need.
__________________
Andrés FC.
P3D_PathScripts
 
  02 February 2016
Originally Posted by aaandres: That is really faster??!! There's any flag saying "hey, I depend on you"?
Thanks a lot DenisT.
I'll do it this way. It's just what I need.

you have to use what works better for you. you can make a function that will work faster and do what you need. i don't have max 2015+ right now and can't do and test C# sdk code
 
  02 February 2016
check this setup:
modiTest = attributes modiTest
(
	parameters params 
	(
		modi type:#maxobject
	)
)
delete objects
b = box()
custattributes.add b modiTest baseobject:on
uv_modi = Uvwmap()
b.modiTest.modi = uv_modi

if you ask:
refs.dependentnodes uv_modi

it will return you empty array.


but if you ask:
refs.dependencyLoopTest b uv_modi

it will return you TRUE

these two methods are using different level of tested 'dependency'
if we need all really dependent nodes you have to do something:
fn getAllDependentNodes maxobj nodes:#() = 
(
	objs = refs.dependents maxobj
	for obj in objs do
	(
		if isvalidnode obj do appendifunique nodes obj
		getAllDependentNodes obj nodes:nodes
	)
	nodes
)
getAllDependentNodes uv_modi 
 
  02 February 2016
Originally Posted by denisT: you have to use what works better for you. you can make a function that will work faster and do what you need. i don't have max 2015+ right now and can't do and test C# sdk code

I will like to give you results... but now I'm fighting to find the equivalent to "objects" in the SDK
__________________
Andrés FC.
P3D_PathScripts
 
  02 February 2016
one guy on this forum argued with me about that there is no way to trick refs.dependentnodes with not applied modifier... he said it's 100% safe way to get modifier nodes.

i've asked him to try why he is wrong. he couldn't but here is it:

plugin Helper OpaOpa
name:"OpaOpa"
classID:#(0x00001967, 0x01234567)
category:"Tricks"
extends:Dummy
(
	parameters params
	(
		modi type:#maxobject subanim:on
	)
)
uv_modi = Uvwmap() 
op = OpaOpa modi:uv_modi
refs.dependentnodes uv_modi


there are another ways as well. try to find
 
  02 February 2016
If there's something I've learned here, it's that you are allways right... or in the right way at least.

Back to my problem, do I have to create a recursive function against the rootNode to get all nodes in the scene or is there in the SDK the equivalent to 'objects'?
__________________
Andrés FC.
P3D_PathScripts
 
  02 February 2016
in c++ you have to enumerate all nodes from root. 'objects' is a specific to mxs thing. maybe max.net has something too. i don't know
 
  02 February 2016
I am jumping later on this, so I think almost all have been answered already.

If the only thing you need is to find all objects using an instance of given modifier, then refs.dependentnodes is an overkilling way of finding it, and as Denis mentioned, you can iterate over the nodes.

However, refs.dependentnodes is a very "deep" function, and it does a lot more than just finding references of modifiers.

I don't know if it is 100% safe, but I think it is pretty solid and is in fact what most of us use, if not all. As I mentioned earlier the full source code is in the refs.cpp file, but I wouldn't try to translate it to C# for this very specific task.

Denis, just out of curiosity, what is your example meant to return?
Originally Posted by denisT:
plugin Helper OpaOpa
  name:"OpaOpa"
  classID:#(0x00001967, 0x01234567)
  category:"Tricks"
  extends:Dummy
  (
  	parameters params
  	(
  		modi type:#maxobject subanim:on
  	)
  )
  uv_modi = Uvwmap() 
  op = OpaOpa modi:uv_modi
  refs.dependentnodes uv_modi
Here the returned value is the node, which seems to be right.
__________________
Jorge Rodríguez
PolyTools3D
 
  02 February 2016
it returns a node "opaopa" which depends on the modifier. and it's absolutely correct. but some people using this method (refs.dependentnodes) to find all nodes which a specified modifier is applied to.
this example demonstrates that it's not always correct supposition. the method returns ALL dependent nodes, and needs extra filter to check if dependency comes with modifier stack
 
  02 February 2016
Originally Posted by denisT: the method returns ALL dependent nodes
Thank you. I thought your were saying it faills in some cases.
Yes, it returns all dependent nodes, which is not a trivial task
__________________
Jorge Rodríguez
PolyTools3D
 
  02 February 2016
but you can see another example setup (with custom attribute).

in this case refs.dependentnodes doesn't return owner node. which in my understanding is not correct. because the owner node definitely depends on its custom attribute.
 
  02 February 2016
Yep, that could be a point to discuss. What you say makes sense, even though I don't know if it is supposed to work that way, I mean I don't know if it is a bug or a feature.

I wonder how I would like it to behave if I have a scripted controller that depends on a global variable.
__________________
Jorge Rodríguez
PolyTools3D
 
  02 February 2016
i think it has to be an option - find recursive or direct dependency. in case of recursive dependency the method has to return all dependents which pass dependency loop test (refs.dependencyLoopTest returnes TRUE)
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:23 PM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.