コード例 #1
0
def json_audit():
    project = Project()
    environment = Environment()

    asset_dir = project.get_assets_dir()

    failed_str = ""
    for i, asset in enumerate(project.list_assets(AssetType.PROP)):

        try:
            asset_obj = project.get_body(asset)
            element_obj = asset_obj.get_element(Department.MODEL,
                                                force_create=True)
            element_path = element_obj.checkout(
                environment.get_current_username())
            checkout.non_gui_open(element_path, asset)
            json_exporter_non_gui.exportProp(asset_obj)
        except Exception, err:
            error_str = ""
            error_str += "\nError exporting JSON for {0}".format(asset)
            error_str += "\n" + traceback.format_exc()
            print error_str

            failed_str += error_str
            continue
コード例 #2
0
def go():
    global checkout_window
    project = Project()
    environment = Environment()
    
    nodes = hou.selectedNodes()
    if len(nodes) == 1:
        #if selected node is digital asset
        if nodes[0].type().definition() is not None:
            asset = nodes[0]
            asset_name = nodes[0].type().name() #get name of asset
            index = asset_name.find("_main")
            asset_name = asset_name[:index]
            src = nodes[0].type().definition().libraryFilePath()
            current_user = environment.get_current_username()
            
            if asset_name in project.list_assets():
                body = project.get_asset(asset_name)
                
            if os.path.exists(src):
                if body is not None: 
                    if Element.DEFAULT_NAME in body.list_elements(Department.ASSEMBLY):
                        element = body.get_element(Department.ASSEMBLY, Element.DEFAULT_NAME)
                        element_path = element.checkout(current_user)
                        hou.hda.uninstallFile(src, change_oplibraries_file=False)
                        hou.hda.installFile(element_path)
                        asset.allowEditingOfContents()
                        hou.ui.displayMessage("Checkout Successful!", title='Success!')
            
    elif len(nodes) > 1:
        hou.ui.displayMessage("Only one node can be selected for checkout")
    else:
        checkout_window = CheckoutWindow(hou.ui.mainQtWindow(), [Department.LIGHTING, Department.FX])    
        checkout_window.finished.connect(checkout_shot)
コード例 #3
0
def publish_hda():
    project = Project()
    environment = Environment()

    if publish_window.published:
        user = publish_window.user
        comment = publish_window.comment

        if is_asset:
            if asset_name in project.list_assets():
                body = project.get_asset(asset_name)

            if os.path.exists(src):
                if body is not None:
                    if Element.DEFAULT_NAME in body.list_elements(
                            Department.ASSEMBLY):
                        #save node definition
                        asset.type().definition().updateFromNode(asset)
                        asset.matchCurrentDefinition()
                        element = body.get_element(Department.ASSEMBLY,
                                                   Element.DEFAULT_NAME)
                        dst = element.publish(user, src, comment)
                        #Ensure file has correct permissions
                        try:
                            os.chmod(dst, 0660)
                        except:
                            pass
                        hou.hda.uninstallFile(src,
                                              change_oplibraries_file=False)
                        saveFile = asset_name + "_assembly_main.hdanc"
                        dst = os.path.join(environment.get_assembly_dir(),
                                           saveFile)
                        hou.hda.installFile(dst)
            else:
                hou.ui.displayMessage("File does not exist")
コード例 #4
0
def publish_hda():
    project = Project()
    environment = Environment()
    
    if publish_window.published:
        user = publish_window.user
        comment = publish_window.comment
        
        if is_asset:
            if asset_name in project.list_assets():
                body = project.get_asset(asset_name)
                
            if os.path.exists(src):
                if body is not None:
                    if Element.DEFAULT_NAME in body.list_elements(Department.ASSEMBLY):
                        #save node definition
                        asset.type().definition().updateFromNode(asset)
                        asset.matchCurrentDefinition()
                        element = body.get_element(Department.ASSEMBLY, Element.DEFAULT_NAME)
                        dst = element.publish(user, src, comment)
                        #Ensure file has correct permissions
                        try:
                            os.chmod(dst, 0660)
                        except:
                            pass
                        hou.hda.uninstallFile(src, change_oplibraries_file=False)
                        saveFile = asset_name + "_assembly_main.hdanc"
                        dst = os.path.join(environment.get_assembly_dir(), saveFile)
                        hou.hda.installFile(dst)
            else:
                hou.ui.displayMessage("File does not exist")
コード例 #5
0
def mass_xml():
    project = Project()

    errors = []
    for asset in project.list_assets():
        try:
            byu_xml.writeXML(asset)

        except Exception as e:
            print asset
            errors.append(asset)

    if len(errors) > 0:
        print 'failed generating xml for: ' + str(errors)
コード例 #6
0
def audit():
    project = Project()
    environment = Environment()

    asset_dir = project.get_assets_dir()

    for i, asset in enumerate(project.list_assets(AssetType.PROP)):

        asset_obj = project.get_body(asset)
        element_obj = asset_obj.get_element(Department.MODEL,
                                            force_create=True)
        element_path = element_obj.checkout(environment.get_current_username())
        #cmds.file(rename='/tmp/lol'+str(i)+'.mb')
        #cmds.file(save=True)
        checkout.non_gui_open(element_path, asset)

    print 'Done'