Quadratic bezier curve


#Get the locator position
P0 = cmds.getAttr('loc1.translate')[0]
P1 = cmds.getAttr('loc2.translate')[0]
P2 = cmds.getAttr('loc3.translate')[0]

def quadraticBezier(P0, P1, P2, numSteps):
    curvePnts = []
    for i in range(numSteps):
        t = float(i)/(numSteps-1)
        PointX = (1-t)**2 * P0[0] + 2 * (1-t) * t * P1[0] + t**2 * P2[0]
        PointY = (1-t)**2 * P0[1] + 2 * (1-t) * t * P1[1] + t**2 * P2[1]
        PointZ = (1-t)**2 * P0[2] + 2 * (1-t) * t * P1[2] + t**2 * P2[2]
        curvePnts.append([PointX, PointY, PointZ])
        
    cmds.curve(p=curvePnts, d=1)

quadraticBezier(P0, P1, P2, 10)

Zenno Extra CTRL UI

This is my personal project that I’m working a long time ago…but I never had time to finish…whatever. This tool is for create extra control in facial or other types of rigs.

Zenno Extra CTRL UI

 

Maya Python API Undo/Redo callback

#Description:
#Create a undo/redo callback using maya python api
#Usage:
#Call the undoRedoCallback function with "add" to create the undo/redo callbacks. Or call the 
#undoRedoCallback function with "remove" as argument to remove the created callbacks.
#
#Info:
#Reference from undoRedoMsgCmd.cpp exemple
#By Rosenio Pinto
#kenio3d@gmail.com

import maya.OpenMaya as om

def undoTest(*args):
    print 'Checking Undo callback'
    
def redoTest(*args):
    print 'Checking ReDo callback'

def undoRedoCallback(arg):
    global callbackIDs
    
    undoStr = str('Undo')
    redoStr = str('Redo')
    Null = om.MObject()
    
    if arg == 'add':

        undoID = om.MEventMessage.addEventCallback(undoStr, undoTest, Null)
        redoID = om.MEventMessage.addEventCallback(redoStr, redoTest, Null)
        
        callbackIDs = [undoID, redoID]
    
    elif arg == 'remove':
        try:
            for i in callbackIDs:
                om.MEventMessage.removeCallback(i)
        except:
            print 'There is no ID to delete'

    else:
        print 'The argument must be "add" or "remove"'



            

Maya Python MNodeMessage sample

This is a simple example of the MNodeMessage usage.

import maya.cmds as cmds
import maya.OpenMaya as om

#Ref http://pastebin.com/mntSGhex

cmds.polySphere()
cmds.select('polySphere1')

def changed_radius( msg, mplug, otherMplug, clientData):
    nodeName, attrName = mplug.name().split('.')
    #if msg & om.MNodeMessage.kAttributeSet:
    if msg == 2056:
        if nodeName == 'polySphere1':
            if attrName == 'radius':
                print "Radius Changed"
                rd = cmds.getAttr('polySphere1.radius')
                cmds.setAttr('polySphere1.subdivisionsAxis', rd*3)

def getNode():
    #Get the node as MObject and set the id message
    MSelectionList = om.MSelectionList()
    om.MGlobal.getActiveSelectionList(MSelectionList)
    node = om.MObject()
    MSelectionList.getDependNode(0, node)
    clientData = None
    id = om.MNodeMessage.addAttributeChangedCallback(node, changed_radius,clientData)


getNode()


            

zenno extra control

This script creates a extra control for facial rig and other specific stuff.
I’m using softmod node to do the deformation.

zennoJointReflect

Just a tool that mirror and orient the joint in time creation. It is a base for other tool I’m developing.

zennoMPath node

This is a demonstration of my multi motion path node. It consists in manage objects in a path curve at once. I still need to do some improvements. Any sugestion or question, send me a message kenio3d@gmail.com…

I also used my zennoRamp and zennoTwist node in conjunction to zennoMPath to get the behavior shown below.

zennoMPath hypergraph

Reference material:

http://ewertb.soundlinker.com/mel/mel.105.php

http://www.rtrowbridge.com/blog/2009/02/python-api-mtransformationmatrixgetrotation-bug/

Thanks my friends!

rp_sensor v1.0

Updated!
A custom python plugin for maya. I’ll use this plugins for calculate aproximation, and trigger some other nodes like corretive blendshapes, LOD calculations, etc…Now with fallOff!.

rp_sensor

A custom python plugin for maya. I’ll use this plugins for calculate aproximation, and trigger some other nodes like corretive blendshapes…

Normal Check

##
##
#Description: Help to check of the normals direction of the selected objects.
#Usage:
#from rpNormal import *
#winNormCheck()
#Any questions you can ask me on kenio3d@gmail.com


import maya.cmds as cmds

def checkNorm():
    global count
    global sel
    if count == 0:
        sel = cmds.ls(sl=True)
    else:
        pass
                
    if count >= len(sel):
        cmds.select(sel)
        cmds.FrameSelected()
        cmds.isolateSelect('modelPanel4', s=0)
        cmds.ToggleFaceNormalDisplay()
        cmds.deleteUI('winNormCheck')
        cmds.refresh()

    else:
        cmds.select(sel[count])
        cmds.polyNormal(nm=2, ch=False)
        cmds.ToggleFaceNormalDisplay()
        cmds.SelectIsolate()
        cmds.FrameSelected()
        count = count+1
        print '%s'%count+' of '+'%s'%len(sel)
        

def reverseDef():
    cmds.polyNormal(nm=0, ch=False)
    checkNorm()
    

def winNormCheck():
    global count
    count = 0
    if cmds.window('winNormCheck', ex=True):
        cmds.deleteUI('winNormCheck')
    else:
        winNormCheck = cmds.window('winNormCheck', title='winNormCheck')
        cmds.rowLayout( numberOfColumns=3, columnWidth3=(80, 80, 80), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
        cmds.button(l='Next', command='checkNorm()')
        cmds.button(l='Reverse', command='reverseDef()')
        cmds.button(l='FaceNormals', command='cmds.ToggleFaceNormalDisplay()')
        cmds.showWindow(winNormCheck)
##
##
Return top