Posts

Showing posts from February, 2019

Math: Distance by python and MEL

Math: Distance by python and MEL # python: cmds def py_distance1():    import maya.cmds as mc;    dest = False;    sel = mc.ls(sl=1,l=1);    if len(sel)==2:        a = mc.xform(sel[0],q=1,ws=1,t=1);        b = mc.xform(sel[1],q=1,ws=1,t=1);        import math;        dist = math.sqrt(math.pow(a[0]-b[0],2)+math.pow(a[1]-b[1],2)+math.pow(a[2]-b[2],2));    return(dist); print py_distance1(); # python: pymel def py_distance2():    import pymel.core as pm;    dist = False;    sel = pm.selected();    if len(sel)==2:        a = sel[0].translate.get();        b = sel[1].translate.get();        dist = (a-b).length();    return(dist); print py_distance2(); # python: api.OpenMaya def py_distance3():    import maya.cmds as m...

Maya GUI Tool: Renamer (Old version)

Image
GUI: Renamer (Old version) Prefix:     Adds prefix string in left text field to selected nodes. Postfix:     Appends postfix string in right text field to selected nodes. Replace:     Replace name string of selected nodes. From string in left text field to the one in right. Serial No:     Rename selected nodes with serial number in order of selection. Upper right integer:     Digit number for Serial No renaming. Prerequisites: Download i3d pyc files. https://ironthreed.blogspot.com/2019/02/i3d-2019-version-i3d-python-script-files.html Python command: import i3d,i3d_GUI as i3d_G;i3d_G.renamer().GUI("i3d_G"); Prefix "Head_" is added at the beginning. Postfix "_Tail" is appended at the end. Replace "_T" is replaced with "_mid_T" Serial No Below, 2 digits starting number is 8. Selection order is Serial_08, Serial_09, Serial_10 then Serial_11

Maya GUI Tool: Following Camera

Image
GUI: Following Camera Create:     Create(Duplicate) a camera follows the selected object along selected axis in the active panel. Change:     Change following axis of active camera in the active panel. Delete:     Delete all following camera generated by this tool. Prerequisites: Download i3d pyc files. https://ironthreed.blogspot.com/2019/02/i3d-2019-version-i3d-python-script-files.html Python command: import i3d,i3d_GUI;i3d_GUI.followCam().GUI("i3d_GUI");

Maya GUI Tool: Pose/Selection Manager

Image
GUI: Pose and Selection Manager LEFT: 4 slots to save/load poses. (Pose: Local SRTXYZ values) RIGHT: 4 slots to save/load selections. Prerequisites: Download i3d pyc files. https://ironthreed.blogspot.com/2019/02/i3d-2019-version-i3d-python-script-files.html Python command: import i3d,i3d_GUI;i3d_GUI.poseSelectionManager().GUI("i3d_GUI"); Notes: Saved pose can be applied to same names with different namespace in different scene(s).

Maya GUI Tool: Locator Creator

Image
GUI: Locator Creator Integer under Create button:     Set locator size. Create:     Creates a new locator if nothing selected. Create Parent:     Creates locator(s) under selected node(s) as child. Create Point Constraint:  >>*1     Creates locator(s) point-constrained to each of selected node(s). Create Orient Constraint:  >>*1     Creates locator(s) orient-constrainted to each of selected node(s). Create Parent Constraint:  >>*1     Creates locator(s) parent-constrained to each of selected node(s). Checkbox:   <<*1     When checked, all constrained locators will be baked and selected will be constrained to them. Prerequisites: Download i3d pyc files. https://ironthreed.blogspot.com/2019/02/i3d-2019-version-i3d-python-script-files.html Python command: import i3d,i3d_GUI;i3d_GUI.spaceLoc().GUI("i3d_GUI",3);

i3d Python Script Files

Image
Updated: 20190810 Python files(compiled) Directory to save i3d.pyc User script folder/ i3d_anim.pyc User script folder/i3d/ i3d_GUI.pyc User script folder/i3d/ i3d_main.pyc User script folder/i3d/ i3d_rig.pyc User script folder/i3d/ i3d_skin.pyc User script folder/i3d/ i3d_utility.pyc User script folder/i3d/ Disclaimer ** Use at your own risk** -------------------------------------------------------------------- Documents/maya/scripts/ Files:   i3d.pyc #i3d core    i3d_samples.py   #scripting sample codes -------------------------------------------------------------------- Documents/maya/scripts/i3d/ Files:   i3d.pref  #i3d preference, will be automatically created    i3d_anima.pyc   # animation related functions   i3d_GUI.pyc   # GUI related functions    i3d_main.pyc   # i3d main    i3d_rig.pyc   # rig related functions  ...

Python: GUI and scriptJob Maya python sample codes.

Image
Setting values to/from GUI. This is one of Maya python sample codes from my technical animation lectures in 2017. I hope this will help you further explore to create your scripting tools in Maya. A) Getting values to GUI. Press left button to get translateX value to the right floatField. *One object must be selected. B) Setting values from GUI. Enter a new float value in right floatField to set it to the translateX of a selected object. Python command in Maya. import i3d_samples as _samp;_samp._GUI()._main(" _samp" ); Link to the sample codes of python file you save in your user folder. https://drive.google.com/file/d/1uzcm8aFGVbvYK6jYTMEsE-wexXTyFZGg scriptJob using uiDeleted flag. Sample scripts using "Selection Changed" event and uiDeleted flag. When selection is changed, it prints the updated selection of object(s) in script editor. The scriptJob ID is displayed on the button, and it will kill the ID job when button is pressed. It a...