Oh and sorry, here's the doc info on masks and why I chose to follow
ai_node_entry to query the int values. You'd do some sort of look-up dict
that was pre-set to check which button is going to give you which
ai_node_entry value and you're better off querying as the ai_node_entry
since if arnold randomly decides to change it you have better futureproofed
code. Either that or just make sure to name the buttons after which node
which you could query a little more dynamically like this but it's a little
hackey:
(let's assume your buttons have names like 'AI_NODE_ALL' and the label
could be "all objects" or something and I'm assuming that the mask value is
just adding all the object mask ints together...)
mask_val = sum([arnold.ai_node_entry.__dict__[button.name()] for button in
buttons])
*mask*: specifies which Arnold node types are included in the .ass export.
See the AtNodeEntry page of the Arnold API for the available node types.
On Wednesday, May 4, 2016 at 3:52:40 PM UTC-4, Andres Weber wrote:
>
> I didn't test this at ALL but after reading the documentation and checking
> out the API very briefly I think you could access the int values via
> something like this:
> arnold.ai_node_entry.AI_NODE_LIGHT
>
> The docs say this:
> AiASSWrite("lightsncams.ass", AI_NODE_LIGHT + AI_NODE_CAMERA, false);
> So assumedly you can do a similar thing with the value for the mask:
> '-mask %s' %
> (arnold.ai_node_entry.AI_NODE_LIGHT+arnold.ai_node_entry.AI_NODE_CAMERA)
>
> On Wednesday, May 4, 2016 at 6:10:08 AM UTC-4, crazygamer wrote:
>>
>> Yes you are right. Its a string format.
>> I did try with creating a string with required variables. (Thanks for the
>> dict format you gave though)
>>
>> The problem is only the int in the "mask 0" changes with different
>> options. So if all options are on it is "mask 255". or if shapes is the
>> only one on, then its "mask 8" etc.
>> Only logical way I can think of is check out each option individually and
>> figure out the digits for that export combination.
>>
>> On Wednesday, May 4, 2016 at 1:06:56 AM UTC+5:30, Andres Weber wrote:
>>>
>>> Forgive me if I'm misunderstanding what exactly you're looking to solve
>>> but it just seems like a string format?
>>>
>>> let's assume "buttons" is a dictionary with keys relating to the option
>>> name with the value of the given buttons in relation to the state that you
>>> mentioned in your GUI that you'd have to write a case switcher for probably.
>>> options_string = "; ".join(["-{LBL} {VAL}".format(LBL=label,
>>> VAL=buttons[label]) for label in buttons.keys()])
>>> pmc.exportSelected(export_file, f=1, type='ASS Export",
>>> options=options_string)
>>>
>>> On Tuesday, May 3, 2016 at 6:55:19 AM UTC-4, crazygamer wrote:
>>>>
>>>> Regarding batch exporting Arnold .ass files using python. I have
>>>> already written a tool which batch exports selected objects in Maya to
>>>> separate .ass files using predefined options. This works great.
>>>>
>>>> Now what I want is to give the user checkboxes in the UI to select the
>>>> options of arnold export (the same which are there in Maya ass export
>>>> options - lights, cameras, shapes, shaders etc)
>>>>
>>>>
>>>> Something like this:
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-5u3j5dmiB6Q/VyiDDlklqZI/AAAAAAAAMe8/6PmKKe7q-sMd7U-idx4ATRdzHBuUOknJACLcB/s1600/arnold_options.png>
>>>>
>>>>
>>>> The thing is: the current command takes a string for options.
>>>>
>>>> pmc.exportSelected(export_file, f=1, typ="ASS Export",
>>>> options="-mask 8;-lightLinks 0;-compressed;-boundingBox;-shadowLinks
>>>> 0")
>>>>
>>>> And the "mask" int changes based on options selected. Can anyone help
>>>> me.
>>>>
>>>>
>>>> *note: pmc is pymel*
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/635e8735-d3ae-4029-b39a-3ade70e6e31a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.