I'm assuming Format is a custom class that you've created?
In either case what Cesar mentioned is still applicable in this instance.
You need to hardcore a look up dictionary based on the format names for
each preset film back:
format_lookup_table = {'16mm Theatrical': [0.404, 0.295],
'Super 16mm': [0.493, 0.292'],
<ETC>}
Then you can use that to convert between the strings that you're listing as
the options and the preset film backs. I didn't check out the AETemplate
that Cesar mentioned but I assume you could source the values from that
file (also depending on if they set more than just the film backs...but I'm
pretty sure that's all they do?). Then you'd just use the code I provided
to actually set the film backs for the specified cameras based on the
values from the key you're giving the look up table.
On Thursday, June 23, 2016 at 2:43:01 PM UTC-4, likage wrote:
>
> While I am able to append the lists of formats by using the following code:
> import maya.cmds as cmds
>
>
> formatLs = Format.showDefaults()
> wrkLs = []
> for i in formatLs:
> if 'Working Extractions' in str(i):
> wrkLs.append(i)
>
>
> def printNewFormat(item):
> print item
>
>
> window = cmds.window()
> cmds.columnLayout()
> cmds.optionMenu (label = 'Select a format', changeCommand = printNewFormat
> )
> for x in wrkLs:
> cmds.menuItem(label=x)
>
>
> cmds.showWindow( window )
>
>
> I am still unable to append / change the film format of the selected
> camera to the option chosen in the ui, which is something I am having
> trouble with at the moment..
>
> Need some insights on that
>
>
> On Wednesday, June 22, 2016 at 2:40:16 AM UTC-7, Cesar Saez wrote:
>>
>> Those are hardcoded presets, you can see what's going on by inspecting.
>>
>> /usr/autodesk/maya/scripts/AETemplates/AEcameraFilmbackNew.mel
>> (/usr/autodesk/maya/ is the directory where maya is installed on linux,
>> replace it for whatever makes sense in your system)
>>
>> Said that, I would not recommend you to modify/hack that file, maintain
>> custom AETemplates is not fun at all.
>> If anything I would create my own generic templates, it's not more than a
>> dictionary mapping attrName/value exported in a markup language (json, yaml
>> or whatever makes sense to you) and a for loop setting those values or
>> populating the dictionary.
>>
>> Good luck!
>>
>
--
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/719c232b-9137-4ebd-8208-1908f447f5e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.