diff --git a/Softimage/AlembicImport.cpp b/Softimage/AlembicImport.cpp index 5ae86fd7..531d0dbb 100644 --- a/Softimage/AlembicImport.cpp +++ b/Softimage/AlembicImport.cpp @@ -28,7 +28,7 @@ CString getTimeControlExpression(CString timeControlName) { return timeControlName + L".current * " + timeControlName + L".factor + " + timeControlName + L".offset + " + timeControlName + - L".frameOffset / PlayControl.Rate"; + L".frameOffset / Fr"; } ESS_CALLBACK_START(alembic_import_Init, CRef&) diff --git a/Softimage/Workgroup/Addons/ExocortexAlembic/Application/Plugins/ExocortexAlembicForceStandinUpdate.py b/Softimage/Workgroup/Addons/ExocortexAlembic/Application/Plugins/ExocortexAlembicForceStandinUpdate.py new file mode 100644 index 00000000..5d127885 --- /dev/null +++ b/Softimage/Workgroup/Addons/ExocortexAlembic/Application/Plugins/ExocortexAlembicForceStandinUpdate.py @@ -0,0 +1,88 @@ +# ExocortexAlembicForceStandinUpdate Plug-in +# Initial code generated by Softimage SDK Wizard +# Executed Tue Jan 17 12:40:35 EST 2017 by ahmidou +# +# Tip: To add a command to this plug-in, right-click in the +# script editor and choose Tools > Add Command. +import win32com.client +from win32com.client import constants +c = constants + +null = None +false = 0 +true = 1 + +def XSILoadPlugin( in_reg ): + in_reg.Author = "ahmidou" + in_reg.Name = "ExocortexAlembicForceStandinUpdate Plug-in" + in_reg.Major = 1 + in_reg.Minor = 0 + + in_reg.RegisterEvent("BeginFrame",constants.siOnBeginFrame) + + #RegisttimeStepnInsertionPoint - do not remove this line + + return true + +def XSIUnloadPlugin( in_reg ): + strPluginName = in_reg.Name + Application.LogMessage(str(strPluginName) + str(" has been unloaded."),constants.siVerbose) + return true + + +# Callback for the BeginFrame event. +def BeginFrame_OnEvent( in_ctxt ): + """Application.LogMessage("BeginFrame_OnEvent called",constants.siVerbose) + + Application.LogMessage("RenderType: " + str(in_ctxt.GetAttribute("RenderType")),constants.siVerbose) + + attrArray = in_ctxt.GetAttribute("FileName") + for attr in attrArray: + Application.LogMessage("FileName: " + str(attr),constants.siVerbose) + + Application.LogMessage("Frame: " + str(in_ctxt.GetAttribute("Frame")),constants.siVerbose) + + Application.LogMessage("Sequence: " + str(in_ctxt.GetAttribute("Sequence")),constants.siVerbose) + + Application.LogMessage("RenderField: " + str(in_ctxt.GetAttribute("RenderField")),constants.siVerbose) +""" +# TODO: Put your code here. + remote_control = Application.ActiveProject.Properties( "Play Control" ) + properties = Application.FindObjects2( c.siCustomPropertyID) + currpass = Application.GetCurrentPass() + for prop in properties: + if prop.IsKindOf("arnold_standin"): + children = prop.NestedObjects + for child in children: + if child.Type == "alembic_standinop": + Application.Logmessage("Update Alembic Procedural Timestep and MotionBlur Keys") + + data = prop.Parameters("dsoData").Value.split("&") + timeStep = 1.0/remote_control.Parameters( "Rate" ).Value + time = timeStep * in_ctxt.GetAttribute("Frame") + + data[-2] = "currtime="+str(time) + data[-3] = "time="+str(time) + + cPass = Application.GetCurrentPass() + r = cPass.Renderer + rProp = cPass.Properties(r.PropertyName(0, False)) + shutter = rProp.Parameters("motion_shutter_onframe").Value + length = rProp.Parameters("motion_shutter_length").Value + sVal = "mbkeys=" + if shutter == 0: + sVal += str(time)+";"+str(time+(timeStep*length)) + elif shutter == 1: + halfLength=length*0.5 + sVal += str(time-(timeStep*halfLength))+";"+str(time+(timeStep*halfLength)) + elif shutter == 2: + sVal += str(time -(timeStep*length))+";"+str(time) + else: + min = str(time+(timeStep*rProp.Parameters("motion_shutter_custom_start").Value)) + max = str(time+(timeStep*rProp.Parameters("motion_shutter_custom_end").Value)) + sVal += min+";"+max + data[-1] = sVal + prop.Parameters("dsoData").Value = "&".join(data) + +# This event can be aborted by returning true or false if you don't want to abort. + return false