コード例 #1
0
def CreateRotationControl(Obj, DIRECTION_WHEELS, parent):
    posObjx = app.GetValue(str(Obj.Name) + ".kine.local.posx")
    posObjy = app.GetValue(str(Obj.Name) + ".kine.local.posy")
    posObjz = app.GetValue(str(Obj.Name) + ".kine.local.posz")

    SIZE = Tools.GetBoundingSize(Obj)
    radio = (SIZE[1][1] - SIZE[1][0]) / 2
    #define a direction controll for each wheel
    DIR = Tools.CreateNullByPose("DIR", parent, posObjx, posObjz)
    DIRECTION_WHEELS.append(DIR)

    DIR.shadow_colour_custom = True
    DIR.size = radio
    DIR.primary_icon = 6
    DIR.shadow_icon = 7
    DIR.shadow_offsetY = 2.5
    DIR.shadow_scaleZ = 0.5
    DIR.shadow_scaleY = 0.5
    DIR.shadow_scaleX = 0.5
    #Define a Circle to rotate the whel
    Cv = Tools.AddWheelsCurves(DIR, posObjx, posObjy, radio)
    #Translate the controller to the good position
    posDIRx = app.SetValue(DIR.Name + ".kine.local.posx", posObjx, "")
    posDIRz = app.SetValue(DIR.Name + ".kine.local.posz", posObjz, "")
    app.ParentObj(Cv.Name, Obj.Name)  #Parent the object unther the curve
    R = [DIR, Cv]
    return R