Hey Marcus,

Sorry to keep code from you guys. I am not sure how much I generally should
post online since it is for work and the code is split up into serveal
chunks in batch and separate files, but I will make it a bit clearer for
you guys :) Hope it is a bit clearer now

Also, my reply about sketchy file nodes, things like this happen a lot
during development when people throw things around quickly or carelessly
but being able to open it individually and not have it crash really threw
me on it...


*set BATCH_CONVERT=%CGROOT%folder\export_units_wrapper.melset
MAYA_EXE=C:\Program Files\Autodesk\Maya%MAYA_VERSION%\bin\maya.exe*

The *MAYA_EXE *variable is simply the executable path to Maya2015
The *BATCH_CONVERT *variable is a mel wrapper that I pass into Maya when it
boots that runs the python code I want it to :)

mel code:
*python("import maya_run");*
*python("maya_run.main()");*

*d is the result of splitting my dictionary up into chunks to process each
bit individually:*

def linch_dict_divider(raw_dict, num):

        list_result = []
        len_raw_dict = len(raw_dict)
        if len_raw_dict > num:
                base_num = len_raw_dict / num
                addr_num = len_raw_dict % num
                for i in range(num):
                        this_dict = dict()
                        keys = list()
                        if addr_num > 0:
                                keys = raw_dict.keys()[:base_num + 1]
                                addr_num -= 1
                        else:
                                keys = raw_dict.keys()[:base_num]
                        for key in keys:
                                this_dict[key] = raw_dict[key]
                                del raw_dict[key]
                        list_result.append(this_dict)

        else:
                for d in raw_dict:
                        this_dict = dict()
                        this_dict[d] = raw_dict[d]
                        list_result.append(this_dict)

        return list_result

-- 
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/CAM2ybkUa3AVtweJkHCkxOVP683y4t_ba6BHBTDEtr22%3DoVM9pQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to