Example #1
0
def gear_ApplyZipperOp_Execute():

    if xsi.Selection.Count < 2:
        gear.log("Select 2 curve", gear.sev_error)
        return

    crv_A = xsi.Selection(0)
    crv_B = xsi.Selection(1)

    if crv_A.Type not in ["crvlist"] or crv_B.Type not in ["crvlist"]:
        gear.log("Select 2 curve", gear.sev_error)
        return

    # Apply Operator ----------------------
    op = XSIFactory.CreateObject("gear_ZipperOp")

    op.AddIOPort(crv_A.ActivePrimitive)
    op.AddIOPort(crv_B.ActivePrimitive)

    pStart_fcv = op.Parameters("Start_FCurve").Value
    fcv.drawFCurve(pStart_fcv, [[0, 0], [1, 1]], c.siLinearKeyInterpolation)

    pSpeed_fcv = op.Parameters("Speed_FCurve").Value
    fcv.drawFCurve(pStart_fcv, [[0, 0], [1, 1]], c.siLinearKeyInterpolation)

    op.Connect()

    xsi.InspectObj(op)

    return op
Example #2
0
def gear_ApplyZipperOp_Execute():

    if xsi.Selection.Count < 2:
        gear.log("Select 2 curve", gear.sev_error)
        return

    crv_A = xsi.Selection(0)
    crv_B = xsi.Selection(1)

    if crv_A.Type not in ["crvlist"] or crv_B.Type not in ["crvlist"]:
        gear.log("Select 2 curve", gear.sev_error)
        return


    # Apply Operator ----------------------
    op = XSIFactory.CreateObject("gear_ZipperOp")

    op.AddIOPort(crv_A.ActivePrimitive)
    op.AddIOPort(crv_B.ActivePrimitive)

    pStart_fcv = op.Parameters("Start_FCurve").Value
    fcv.drawFCurve(pStart_fcv, [[0,0],[1,1]], c.siLinearKeyInterpolation)

    pSpeed_fcv = op.Parameters("Speed_FCurve").Value
    fcv.drawFCurve(pStart_fcv, [[0,0],[1,1]], c.siLinearKeyInterpolation)

    op.Connect()

    xsi.InspectObj(op)

    return op
Example #3
0
def gear_zipper_op(crv0, crv1):

    # -----------------------------------------------------
    # JSCRIPT
    paramDefs = []
    paramDefs.append(XSIFactory.CreateParamDef("zip", c.siDouble, 0, c.siPersistable|c.siAnimatable, "", "", 0, 0, 1, 0, 1))
    paramDefs.append(XSIFactory.CreateParamDef("bias", c.siDouble, 0, c.siPersistable|c.siAnimatable, "", "", .5, 0, 1, 0, 1))
    paramDefs.append(XSIFactory.CreateFCurveParamDef("start_fcv"))
    paramDefs.append(XSIFactory.CreateFCurveParamDef("speed_fcv"))

    outputPorts = [ (crv0.ActivePrimitive, "out_0"), (crv1.ActivePrimitive, "out_1") ]
    inputPorts = [ (crv0.ActivePrimitive, "crv0"), (crv1.ActivePrimitive, "crv1") ]

    op = createJSOpFromFile("gear_zipper", os.path.join(JSOPPATH, "gear_zipper_op.js"), outputPorts, inputPorts, paramDefs)

    op.Connect()

    # FCurve profile
    fcv.drawFCurve(op.Parameters("start_fcv").Value, [[0,0],[1,1]], c.siLinearKeyInterpolation)
    fcv.drawFCurve(op.Parameters("speed_fcv").Value, [[0,0],[1,1]], c.siLinearKeyInterpolation)

    # Layout
    layout = op.PPGLayout
    layout.Clear()

    layout.AddGroup("Zipper")
    layout.AddItem("Mute", "Mute")
    layout.AddItem("zip", "Zip")
    layout.AddItem("bias", "Bias")
    layout.EndGroup()

    layout.AddGroup("Profile")
    item = layout.AddFCurve("start_fcv")
    item.SetAttribute(c.siUIFCurveLabelX, "Points")
    item.SetAttribute(c.siUIFCurveLabelY, "Start")
    item.SetAttribute(c.siUIFCurveViewMinX,-.1)
    item.SetAttribute(c.siUIFCurveViewMaxX,1.1)
    item.SetAttribute(c.siUIFCurveViewMinY,-.1)
    item.SetAttribute(c.siUIFCurveViewMaxY,1.1)
    item.SetAttribute(c.siUIFCurveGridSpaceX, .1)
    item.SetAttribute(c.siUIFCurveGridSpaceY, .1)
    layout.EndGroup()

    layout.AddGroup("Speed")
    item = layout.AddFCurve("speed_fcv")
    item.SetAttribute(c.siUIFCurveLabelX, "Points")
    item.SetAttribute(c.siUIFCurveLabelY, "Speed")
    item.SetAttribute(c.siUIFCurveViewMinX,-.1)
    item.SetAttribute(c.siUIFCurveViewMaxX,2.1)
    item.SetAttribute(c.siUIFCurveViewMinY,-.1)
    item.SetAttribute(c.siUIFCurveViewMaxY,1.1)
    item.SetAttribute(c.siUIFCurveGridSpaceX, .1)
    item.SetAttribute(c.siUIFCurveGridSpaceY, .1)
    layout.EndGroup()

    return op
Example #4
0
    def create(self, prop):

        param = prop.AddFCurveParameter(self.scriptName)

        if self.keys is not None:
            fcu.drawFCurve(param.Value, self.keys, self.interpolation, self.extrapolation)
        else:
            param.Value.Interpolation = self.interpolation
            param.Value.Interpolation = self.extrapolation

        self.value = param.Value

        return param
Example #5
0
    def create(self, prop):

        param = prop.AddFCurveParameter(self.scriptName)

        if self.keys is not None:
            fcu.drawFCurve(param.Value, self.keys, self.interpolation, self.extrapolation)
        else:
            param.Value.Interpolation = self.interpolation
            param.Value.Interpolation = self.extrapolation

        self.value = param.Value

        return param
Example #6
0
def gear_zipper_op(crv0, crv1):

    # -----------------------------------------------------
    # JSCRIPT
    paramDefs = []
    paramDefs.append(
        XSIFactory.CreateParamDef("zip", c.siDouble, 0,
                                  c.siPersistable | c.siAnimatable, "", "", 0,
                                  0, 1, 0, 1))
    paramDefs.append(
        XSIFactory.CreateParamDef("bias", c.siDouble, 0,
                                  c.siPersistable | c.siAnimatable, "", "", .5,
                                  0, 1, 0, 1))
    paramDefs.append(XSIFactory.CreateFCurveParamDef("start_fcv"))
    paramDefs.append(XSIFactory.CreateFCurveParamDef("speed_fcv"))

    outputPorts = [(crv0.ActivePrimitive, "out_0"),
                   (crv1.ActivePrimitive, "out_1")]
    inputPorts = [(crv0.ActivePrimitive, "crv0"),
                  (crv1.ActivePrimitive, "crv1")]

    op = createJSOpFromFile("gear_zipper",
                            os.path.join(JSOPPATH, "gear_zipper_op.js"),
                            outputPorts, inputPorts, paramDefs)

    op.Connect()

    # FCurve profile
    fcv.drawFCurve(
        op.Parameters("start_fcv").Value, [[0, 0], [1, 1]],
        c.siLinearKeyInterpolation)
    fcv.drawFCurve(
        op.Parameters("speed_fcv").Value, [[0, 0], [1, 1]],
        c.siLinearKeyInterpolation)

    # Layout
    layout = op.PPGLayout
    layout.Clear()

    layout.AddGroup("Zipper")
    layout.AddItem("Mute", "Mute")
    layout.AddItem("zip", "Zip")
    layout.AddItem("bias", "Bias")
    layout.EndGroup()

    layout.AddGroup("Profile")
    item = layout.AddFCurve("start_fcv")
    item.SetAttribute(c.siUIFCurveLabelX, "Points")
    item.SetAttribute(c.siUIFCurveLabelY, "Start")
    item.SetAttribute(c.siUIFCurveViewMinX, -.1)
    item.SetAttribute(c.siUIFCurveViewMaxX, 1.1)
    item.SetAttribute(c.siUIFCurveViewMinY, -.1)
    item.SetAttribute(c.siUIFCurveViewMaxY, 1.1)
    item.SetAttribute(c.siUIFCurveGridSpaceX, .1)
    item.SetAttribute(c.siUIFCurveGridSpaceY, .1)
    layout.EndGroup()

    layout.AddGroup("Speed")
    item = layout.AddFCurve("speed_fcv")
    item.SetAttribute(c.siUIFCurveLabelX, "Points")
    item.SetAttribute(c.siUIFCurveLabelY, "Speed")
    item.SetAttribute(c.siUIFCurveViewMinX, -.1)
    item.SetAttribute(c.siUIFCurveViewMaxX, 2.1)
    item.SetAttribute(c.siUIFCurveViewMinY, -.1)
    item.SetAttribute(c.siUIFCurveViewMaxY, 1.1)
    item.SetAttribute(c.siUIFCurveGridSpaceX, .1)
    item.SetAttribute(c.siUIFCurveGridSpaceY, .1)
    layout.EndGroup()

    return op