def writeCamerasToAlembic(node): sequence = node.name().split("_")[2][0] children = node.children() for c in children: name = c.name() if "shot" in name: shot = name.split("_")[1] camDir = os.path.join(os.environ["SHOTS_DIR"], sequence + shot, "camera") abcName = sequence + shot + "_camera" + ".abc" sFrame, eFrame = hou.playbar.playbackRange() sSize = hou.playbar.frameIncrement() abcFilePath = writeToAlembic( camDir, abcName, node, objects=c.path(), trange="normal", startFrame=sFrame, endFrame=eFrame, stepSize=sSize, ) mayaFilePath = os.path.join(camDir, sequence + shot + "_camera" + ".mb") if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath)
def writeSetToAlembic(node): exclude_objects = ("owned_jeff_couch", "owned_jeffs_controller", "owned_abby_controller", "owned_cyclopes_toy") assetName = getAssetName(node) print(assetName) abcName = assetName + ".abc" setDir = os.path.join(os.environ["PRODUCTION_DIR"], "set_cache", assetName) include_objects = "" for c in node.children(): name = getAssetName(c) if name != None and name not in exclude_objects and "wall" not in name and "layout" not in name: include_objects += " " + c.path() abcFilePath = writeToAlembic(setDir, abcName, node, objects=include_objects) mayaFilePath = os.path.join(setDir, assetName + ".mb") if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath)
def writeSetToAlembic(node): exclude_objects = ('owned_jeff_couch', 'owned_jeffs_controller', 'owned_abby_controller', 'owned_cyclopes_toy') assetName = getAssetName(node) print(assetName) abcName = assetName+'.abc' setDir = os.path.join(os.environ['PRODUCTION_DIR'], 'set_cache', assetName) include_objects = '' for c in node.children(): name = getAssetName(c) if name != None and name not in exclude_objects and 'wall' not in name and 'layout' not in name: include_objects += ' '+c.path() abcFilePath = writeToAlembic(setDir, abcName, node, objects=include_objects) mayaFilePath = os.path.join(setDir, assetName+'.mb') if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath)
def writeSetToAlembic(node): exclude_objects = ('owned_jeff_couch', 'owned_jeffs_controller', 'owned_abby_controller', 'owned_cyclopes_toy') assetName = getAssetName(node) print(assetName) abcName = assetName+'.abc' setDir = os.path.join(os.environ['PRODUCTION_DIR'], 'set_cache', assetName) include_objects = '' for c in node.children(): name = getAssetName(c) if name != None and name not in exclude_objects and 'wall' not in name and 'layout' not in name: include_objects += ' '+c.path() abcFilePath = writeToAlembic(setDir, abcName, node, objects=include_objects) mayaFilePath = os.path.join(setDir, assetName+'.mb') if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath)
def writeCameraToAlembic(sequence, parentNode, c): name = c.name() shot = name.split('_')[1] camDir = os.path.join(os.environ['SHOTS_DIR'], sequence+shot, 'camera') abcName = sequence+shot+'_camera'+'.abc' sFrame, eFrame = hou.playbar.playbackRange() sSize = hou.playbar.frameIncrement() abcFilePath = writeToAlembic(camDir, abcName, parentNode , objects=os.path.join(c.path(), 'cam1') , trange='normal' , startFrame=sFrame , endFrame=eFrame , stepSize=sSize) mayaFilePath = os.path.join(camDir, sequence+shot+'_camera'+'.mb') if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath) print hou.node(os.path.join(c.path(),'cam1')).evalParm('focal') amu.setFocalLengthMaya(mayaFilePath, hou.node(os.path.join(c.path(),'cam1')).evalParm('focal'))
def writeCamerasToAlembic(node): sequence = node.name().split('_')[2][0] children = node.children() for c in children: name = c.name() if 'shot' in name: shot = name.split('_')[1] camDir = os.path.join(os.environ['SHOTS_DIR'], sequence+shot, 'camera') abcName = sequence+shot+'_camera'+'.abc' sFrame, eFrame = hou.playbar.playbackRange() sSize = hou.playbar.frameIncrement() abcFilePath = writeToAlembic(camDir, abcName, node , objects=os.path.join(c.path(), 'cam1') , trange='normal' , startFrame=sFrame , endFrame=eFrame , stepSize=sSize) mayaFilePath = os.path.join(camDir, sequence+shot+'_camera'+'.mb') if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath)
def writeCamerasToAlembic(node): sequence = node.name().split('_')[2][0] children = node.children() for c in children: name = c.name() if 'shot' in name: shot = name.split('_')[1] camDir = os.path.join(os.environ['SHOTS_DIR'], sequence+shot, 'camera') abcName = sequence+shot+'_camera'+'.abc' sFrame, eFrame = hou.playbar.playbackRange() sSize = hou.playbar.frameIncrement() abcFilePath = writeToAlembic(camDir, abcName, node , objects=os.path.join(c.path(), 'cam1') , trange='normal' # , startFrame=sFrame # , endFrame=eFrame , stepSize=sSize) mayaFilePath = os.path.join(camDir, sequence+shot+'_camera'+'.mb') if os.path.exists(mayaFilePath): os.remove(mayaFilePath) amu.mayaImportAlembicFile(mayaFilePath, abcFilePath) print hou.node(os.path.join(c.path(),'cam1')).evalParm('focal') amu.setFocalLengthMaya(mayaFilePath, hou.node(os.path.join(c.path(),'cam1')).evalParm('focal'))