This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Template class for docking a Qt widget to maya 2017+. | |
| Author: Lior ben horin | |
| 12-1-2017 | |
| ''' | |
| import weakref | |
| import maya.cmds as cmds | |
| import maya.OpenMayaUI as omui |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This is what you need to do in order to get a qt window to dock next to maya channel box, | |
| In all maya versions, including 2017 with PySide2 | |
| """ | |
| __author__ = "liorbenhorin@gmail.com" | |
| import sys | |
| import os | |
| import logging | |
| import xml.etree.ElementTree as xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import maya.api.OpenMaya as om | |
| import maya.cmds as cmds | |
| TRANSFORM_NODETYPES = ["transform", "joint"] | |
| def has_non_default_locked_attributes(node): | |
| locked_attributes = [] | |
| for attribute in ["translate", "rotate", "scale", "jointOrient"]: | |
| default_value = 1 if attribute == "scale" else 0 | |
| for axis in "XYZ": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #F. Hiba, C. Mendes, B. Lefebvre, P. Hubert | |
| import maya.api.OpenMaya as om | |
| import maya.cmds as cmds | |
| from math import radians, degrees, sin, cos | |
| from random import gauss, random, uniform, shuffle | |
| from copy import copy | |
| #4 utilities function related to transformations | |
| #give the quaternion corresponding to the rottion from vector 1 to vector 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import maya.api.OpenMaya as om | |
| import maya.cmds as cmds | |
| #Returns normal, tangent, at a given point on a curve, given the curve and a position in space. | |
| #result as a list of openmaya MVector() | |
| def getCurveNormal(mayaCurve, pos=[0,0,0]): | |
| selectionList = om.MSelectionList() | |
| selectionList.add(mayaCurve) | |
| dPath= selectionList.getDagPath(0) | |
| mCurve=om.MFnNurbsCurve (dPath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import maya.api.OpenMaya as om | |
| import maya.cmds as cmds | |
| #returns the closest vertex given a mesh and a position [x,y,z] in world space. | |
| #Uses om.MfnMesh.getClosestPoint() returned face ID and iterates through face's vertices. | |
| def getClosestVertex(mayaMesh,pos=[0,0,0]): | |
| mVector = om.MVector(pos)#using MVector type to represent position | |
| selectionList = om.MSelectionList() | |
| selectionList.add(mayaMesh) | |
| dPath= selectionList.getDagPath(0) |