INDX INDEX_SECTION˜G<6 Sop/ee_mdd_writer˜³G<6  ee_mdd_writer EE MDD OUT*oplib:/Sop/ee_mdd_writer?Sop/ee_mdd_writerSOP_ee_mdd_writerSopG<6 INDX DialogScriptÐG<6 PythonCookІG<6 TypePropertiesOptionsV×G<6 Help -G<6 Tools.shelf -vG<6 CreateScript £6G<6 ExtraFileOptions ÙG<6 # Dialog script for ee_mdd_writer automatically generated 11/15/07 14:05:31 { name ee_mdd_writer script ee_mdd_writer label "EE MDD OUT" help { "" } parm { name "mddfile" label ".mdd file" type file default { "0" } range { 0 1 } export none parmtag { "script_callback_language" "hscript" } } parm { name "startframe" label "Start Frame" type integer default { "1" } range { 0 10 } export none parmtag { "script_callback_language" "hscript" } } parm { name "endframe" label "End Frame" type integer default { "10" } range { 0 10 } export none } parm { name "record" label "Record" type toggle default { "1" } range { 0 1 } export none } } # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. from struct import pack from math import floor, modf x = 1 frametime = 1.0 / hou.fps() filename = hou.Node.evalParm(hou.pwd(), "mddfile") startframe = hou.Node.evalParm(hou.pwd(), "startframe") endframe = hou.Node.evalParm(hou.pwd(), "endframe") record = hou.Node.evalParm(hou.pwd(), "record") totalframes = endframe - startframe + 1 vertices = len(geo.points()) if record == True: if hou.frame() == startframe: f = open(filename, 'wb') f.seek(0) f.write(pack('>L', totalframes)) f.write(pack('>L', vertices)) while x <= totalframes: f.write(pack('>f', hou.frameToTime(x))) x = x + 1 if startframe <= hou.frame() <= endframe: if hou.frame() > startframe: f = open(filename, 'ab') currentframe = endframe - hou.frame() pointnumber_curr = currentframe * vertices offset = 4 * (2 + totalframes + pointnumber_curr * 3) # bytes-per-value * ( totalframes + totalvertices + frametimes + pointnumber * (x+y+z)) # f.seek(offset, 0) f.seek(0, 2) # 2 = seek to end for pt in geo.points(): f.write(pack('>f', pt.position()[0])) f.write(pack('>f', pt.position()[1])) f.write(pack('>f', pt.position()[2])) f.close() ParmsFromVfl := 1; PrefixDroppedParmName := 1; UseDSParms := 1; ForbidOutsideParms := 1; LockContents := 1; CheckExternal := 1; GzipContents := 1; MakeDefault := 1; PrefixDroppedParmLabel := 1; UnlockOnCreate := 0; SOP SOP $HDA_TABLE/$HDA_NAME Digital Assets # Automatically generated script: Thursday November 15, 14:05 \set noalias = 1 # # Creation script for ee_mdd_writer operator # if ( "$arg1" == "" ) then echo This script is intended as a creation script exit endif # Node $arg1 (Sop/ee_mdd_writer) opspareds "" $arg1 opexprlanguage -s hscript $arg1