Пример #1
0
def addAnimationTool():
    select_assets = hou.selectedNodes()
    if select_assets:
        if len(select_assets) == 1:
            asset = select_assets[0]
            s_file = hou.ui.selectFile()
            if s_file:
                a_folder = os.path.dirname(s_file)
                
                hasset.addAnimationFromFolder(asset, a_folder)
        else:
            print "Select just one asset."
    else:
        print "Please select a asset."
Пример #2
0
def loadCamera(folder):
    camera_file_name = folder + "/_camera.txt"
    mydef = loadJsonFile(camera_file_name)
    if mydef:
        try:
            source_name = str(mydef.get('name', 'asset1'))
            source_type = str(mydef.get('type', ''))
            new_asset = hasset.createAsset(name = source_name, type = source_type, def_path = folder)
            hasset.addContent(new_asset)
            hasset.addAnimationFromFolder(new_asset, folder)
            return new_asset
        except:
            print "This is not a source file"
            return None
Пример #3
0
def loadScene(folder, proj_folder):
    ## load camera
    camera_folder = "%s/camera" % folder
    cam = loadCamera(camera_folder)
    
    ## load assets
    anim_assets_def_file = "%s/mdd/_assets.txt" % folder
    assets_name = loadJsonFile(anim_assets_def_file)
    if not assets_name:
        return False
    
    for asset_name in assets_name:
        asset_name_str = str(asset_name)
        asset_folder = "%s/asset/%s" % (proj_folder, asset_name_str)
        loadAsset(str(asset_folder))
        anim_folder = "%s/mdd/%s" % (folder, asset_name_str)
        
        asset = hou.node("/obj/%s" % asset_name_str)
        if asset:
            hasset.addAnimationFromFolder(asset, str(anim_folder))
        
    return True