Hi guys,
okay, I haven't done any MAXScripting at all but now I'm in need of some desperate coding (I'm a Max noob in general)!!
What I need is a little script that will assign all selected objects a unique object ID (starting at 00 and an increment would work fine).
Anyone have any ideas where I should start with this?
I think eventually I would like it to give the id's and then create and prefill the exact amount of VRay Multimatte elements for the scene.
Any help would be greatly appreciated.
Thanks in advance.
C
Replies
Im confused whether this is a genuine 'please help me learn' thread or a 'please post the finished script'
off the top of my head this is what you need.
Hey Fletch, I didn't mean to be so rude, so I'll come clean! I have a little programming knowledge, but it's been years since I've done anything, and even then I wasn't to good at it. And yes, it was basically can someone write this for me. Shame shame, I know!
Max isn't my software, I work in post with Nuke. What I'm trying to do is set up a workflow that will make things ten times easier for me. Using the MME for this is something I've worked with before and it's a Godsend. When I need masks, they are there, animated and all. It saves so much time in post you wouldn't believe. The thing is, my two 3D guys don't care for such things (and aren't that great at scripting either) so I'm the one that has to do all the legwork (since it's for my benefit they say, the cheeky feckers!).
Anyway, I got the ID setter working, it took me ages to find the gbufferchannel. That's what was killing me.
So anyway, I'm going to come straight out here and ask for part two (or some pointers) of this little workflow that I'd need...
What I would like would be that after the ID's are set the script creates as many VRay MultiMatteElement's as are needed and prefills them with all the ID's to create the mattes that will be included in the EXR's.
Again, sorry if I'm being rude, but I really don't know where to start on this, like I said, I don't use Max. (Plus, to win some brownie points, I'd highly recommend that you suggest this workflow to your inhouse compositors, they'd love you for it!)
Any help would be greatly appreciated.
Thanks again guys.
C
Im afraid i dont have Vray, but it shouldnt be to hard to get the information you need.
90% of script commmands in max can be really easily found simply using the listener.
in max press f11 of go to "maxscript->maxscript listener"
in the listener window there is the 'macro recorder' menu. click it and make sure its enabled. now when you do something the equivilent script command will be output in the pink area of the window.
if you create the element manually you should see its name in the listener. or else it should be in the Vray reference.
out of interest what are you using this for? per object masks or something? if so this does the job, it collects the objects. gives them obj ids, adds a matte element for each object and names it after the objects scene name
The macro recorder sounds like it just might work, even to get the basic set up, ie, to show me how to create the MME's with a script, but I still might need some help elobrating on the script!
- What it does is create an RGB pass in the EXR file with the name MultiMatteElement and assigns one object ID to one colour.
- You can create as many MME's as you need for the objects, ie, 6 objects would require two MME's.
- You can custom name and number the MME's too, so you would know that object 5 would be in MME_02 Green channel and can thus (as I use Nuke it would be the shuffle node to pull out the green channel for MME_02, a simple operation) create a perfect matte from it, completely animated for post work. It's a savage little tool.
Anyway, thanks for helping a fellow out I'm sure I'll be back in order to get this working the way I want, ha, or just working even at a basic level.
Go raith maith agat (sorry, can't remember where the fada's go, lol)
The recorder thingy didn't work when I changed options in the render settings, it just showed how to open it and that was all
Again, muchos gracias for the help.
So by switching out the MatteRenderElement for MultiMatteElement I can get the MME created. Perfect, but now is where the real fun starts... :poly121:
Okay, I see how you are turning on the gbufID but the thing with the MME is that it has three, one each for RGB.
gbufIDOn doesn't work, it doesn't exist in the MME so I need to find out what these are called. The VRay help page is not the best, if anyone knows off the bat then that's cool, otherwise I'll keep looking then I can turn them on.
I'm sure there'll be similar names for the actual ID number, so hopefully that should be okay (once I find the names within the elements).
Right, so here's another thing, it creates one MME per object, but I only want one per 3 objects. I need to increment the creaton of the MME's to every third gbufID.
Thanks again folks for any help.
without being able to see how to interface with the elements i cant really help.
http://www.cgplusplus.com/online-reference/vray-properties/
And have created this... This will create one MME and fill it out 123 for RGB. But if I select more than one object (I'm using 3 in my test scene) it will create 3 MME's and fill out the RGB as 123, 234 and 345. I only want it to create one MME per 3 object selected and when there are more then it will start at 456, then 789 etc...
If you know what I mean....:poly122:
Okay BIG EDIT...
okay, I think I know how to do it, but I just don't know the syntax...
If I do something like this... I know this doesn't work. What I think I need to do is this - set a new vaiable for the gbuffer that will increment by three everytime the loop ends and keep going until it reaches the end of the selection.count.
Something like
And stick it in at the start of the MME creation loop??
The only thing that throws up an error is the name
But when I remove the + mmreCount it works perfectly!
sometime somewhere you shall buy me a beer
I need the name to increment, otherwise the EXR only contains the last MME created...
As for that beer, I'm flying home to Ireland on Wednesday to play at this
http://www.bluesonthebay.co.uk/index.html
so if you're about I'll get you a pint! But only if you can figure out the naming problem
unfortunately that gig on on the other side of country, thanks for the offer though
did you keep the bracketing?
it should be +(mmreCount as string)
other wise it will try and combined a string and an integer which it wont like
Okay, the Listener is not giving me any errors and it says...
2
3
1
Ok
True
Ok
I thought it might have been something else as I added a bit at the start to select VRay as the renderer and also added a bit at the end to add other elements, but even when I strip the script down it doesn't increment the last MME when there are not 3 objects in it.
Now that I am this far with the script, I really want to develop it so that it's a complete one click VRay EXR render setup (hence already adding the rest of the elements) so I'll probably (actually, there's no probably about it, I will!!) need lots more help...