Hi all,
Does anybody know how to access / expose MCG values? I need this for a modifier maxtool. Looking through output types I can see there is a "MAXscript function" - this probably allows you to output any value from within the graph.
But what I need is to access a value from a modifier MCG (output: modifier). I can access parameters (exposed in the UI). I am using a custom UI - very handy - I can define vars and functions nested in the custom UI.
But how do you get an UI defined function or an external maxscipts to "see" a value from the graph itself, that only exists in the graph, not in the UI. All UI parameters I could find are "inputs" and the values flowing inside the graph have no identifiers, they only exists inside the graph.....
Being able to have one single output is kind of limiting (it probably makes MCG more robust / error-proof)
Anybody else stumbled upon this or knows how to do it?
TS
"It's not that you don't know that kills you... It's what you know for sure but ain't true" - Mark Twain
Replies
MAXScript function does only what it says on the tin, if you create a <MAXScript function> graph, it will output maxscript function based that accepts the same parameters as the parameter nodes you created. It's one-purpose and the argument types are limited. You cannot use it for anything else than a global MAXScript function not connected to anything.
Rather than asking how to do this specific thing, tell me what is it that you want to achieve.
Thank you for taking the time to reply.
What I have: I'm using the AVoxelizer.maxtool from the Max Creation Graph (MCG) Sample Pack 1 (I have attached the mcg package). I've written a MAXscript that does all sorts of things with this: exporting obj and parsing different files - all through it's own UI.
As I am processing the resulted voxelized mesh further down, I can break it into elements and count the elements (in fact, I am already counting the elements when I am outputing files from the MAXscript. But, as work with meshes for outputs, things get slow for high count of voxels.
I am applying AVoxelizer modifier to diferent objects, through the MAXscirpt, so I am driving everything from withing my script's UI without touching the modifier itself (I remove the modifier once my script exports needed files).
What I want: It would be nice to have a "total count" feedback while tweak the initial setting of the voxelization, as this piece of information is already existent (but ... not accessible ) in the MCG: as an MCG array node holding all the 'voxels' I've applied a count node to this array but found no way to access this piece of info from outside.
This Int32 value is the only thing I would need from the maxtool (appart from the modifier itself)
If this is not easily doable, I am left with 2 options:
1. clone the AVoxelizer into a MAXscript MCG that will return this value. I could then query the count value at certain times (when parameters change). But this is redundant, max will compute the same thing twice (once for the modifier, once for outputing the count)
2. rewrite the AVoxelizer modifier in MAXscript. this appears to be a more robust approach to me as I will be adding functionality to this little script and I might wont to do other stuff with the voxels in the future.
If I am missing anything, please open my eyes
Thanks again, I would really need to solve this somehow.
TS
"It's not that you don't know that kills you... It's what you know for sure but ain't true" - Mark Twain
In a simple case like this where it's just one parameter, you can work around it in MCG itself with the Evaluate MAXScript node. It won't be pretty and foolproofing it is hard, and if you change something in the graph, it will break since the custom UI replacement will no longer work as expected. But for a one-off thing, it's bearable (also attached the mcg file):
Thank you so much! - I owe you one.
I've also peeked at your scripts page - amazing stuff there!
(though it's on my list of projects I'd like to attempt in MCG)
will result in this:
So depending on whether or not you want to use current selection or create a new one, data channel modifier might be a better choice, since it uses PolyMesh instead of TriMesh: