def results(self, value):
        print("Selected asset: " + value[0])
        filename = value[0]

        self.body = Project().get_body(filename)
        self.element = self.body.get_element(Asset.GEO)
        if self.element:
            #just reference in the asset, make sure we're referencing the usda geo
            path = self.element.get_last_publish()[3]
            parts = path.split(".")
            path = parts[0] + ".usda"

            ref = hou.node("/stage").createNode("reference")
            ref.setName(filename + "_geo", 1)
            ref.parm("filepath1").set(path)

            #also clone into the geo context from the obj file
            parts = path.split(".")
            path = parts[0] + ".obj"
            geo = hou.node("/obj").createNode("geo")
            geo.setName(filename + "_geoRef", 1)
            geo.parm("scale").set(0.01)

            fileNode = geo.createNode("file")
            fileNode.parm("file").set(path)

        else:
            qd.error("Nothing was cloned")
    def results(self, value):
        self.asset_name = value[0]

        body = Project().get_asset(self.asset_name)
        if not body:
            body = self.project.create_asset(self.asset_name)
        if not body:
            qd.error("Something broke :'(")
            return
        self.element = body.get_element(Asset.USD)
        self.path = os.path.join(self.element._filepath, "temp.usda")

        selection = hou.selectedNodes()
        if len(selection) != 1:
            qd.error("Please select the last node in the network and try again.")
            return
        
        out = selection[0]

        rop = hou.node("/stage").createNode("usd_rop")
        rop.setInput(0, out)
        rop.parm("lopoutput").set(self.path)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)
        rop.parm("execute").pressButton()

        rop.destroy()

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label

        self.input = qd.HoudiniInput(parent=hou.qt.mainWindow(), title="Comment ", info=publishes_string_list)
        self.input.submitted.connect(self.comment_results)
    def results(self, value):
        type = value[0]
        name = self.name

        # determine if asset was created or not.
        created = True

        if name is None or type is None:
            created = False

        if created:
            project = Project()
            body = project.create_asset(name, asset_type=type)
            if body == None:
                qd.error("Asset with name " + name +
                         " already exists in pipeline.")
            elif self.type == AssetType.SHOT:
                qd.info("Asset created successfully.", "Success")
            else:
                #assembler = Assembler()
                #assembler.create_hda(name, body=body)

                qd.info("Asset created successfully.", "Success")

        else:
            qd.error("Asset creation failed.")
示例#4
0
    def go(self, alembic=False, usd=False, obj=False, mb=False, camera=False):
        self.alembic = alembic
        self.usd = usd
        self.obj = obj
        self.mb = mb
        self.camera = camera

        self.project = Project()
        self.chosen_asset = None

        if self.camera and self.alembic:  #previs publish case
            shot_list = self.project.list_shots()

            self.item_gui = sfl.SelectFromList(
                l=shot_list,
                parent=maya_main_window(),
                title="What shot is this camera in?")
            self.item_gui.submitted.connect(self.shot_results)

        else:
            asset_list = self.project.list_assets()

            self.item_gui = sfl.SelectFromList(
                l=asset_list,
                parent=maya_main_window(),
                title="Select an asset to export to")
            self.item_gui.submitted.connect(self.asset_results)
    def results(self, value):
        print("Selected shot: " + value[0])
        shot_name = value[0]

        self.body = Project().get_body(shot_name)
        self.element = self.body.get_element(Asset.HIP)
        if self.element.get_last_version() >= 0:
            #check if checked out
            if self.element.is_assigned():
                assigned_user = self.element.get_assigned_user()
                username = Environment().get_user().get_username()
                if not assigned_user == username:
                    qd.error("This shot is currently checked out by " +
                             assigned_user)
                    return
            else:
                username = Environment().get_user().get_username()
                self.element.update_assigned_user(username)

            path = self.element.get_last_publish()[3]
            if path:
                hou.hipFile.load(path)

        else:
            qd.error("Nothing was cloned")
class AssetCloner:
    def __init__(self):
        self.project = Project()

    def clone(self):
        asset_list = self.project.list_assets_short()

        self.item_gui = sfl.SelectFromList(l=asset_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select an asset to clone")
        self.item_gui.submitted.connect(self.results)

    def results(self, value):
        print("Selected asset: " + value[0])
        filename = value[0]

        self.body = Project().get_body(filename)
        self.element = self.body.get_element(Asset.USD)
        if self.element:
            path = self.element.get_last_publish()[3]
            if path:
                ref = hou.node("/stage").createNode("reference")
                ref.setName(filename + "_ref", 1)
                ref.parm("filepath1").set(path)
                ref.parm("primpath").set("/layout/" + filename)

        else:
            qd.error("Nothing was cloned")
示例#7
0
 def go(self):
     project = Project()
     asset_list = project.list_assets()
     self.item_gui = sfl.SelectFromList(l=asset_list,
                                        parent=maya_main_window(),
                                        title="Select an asset to clone")
     self.item_gui.submitted.connect(self.results)
class LayoutCloner:
    def __init__(self):
        self.project = Project()

    def clone(self):
        shot_list = self.project.list_shots()

        self.item_gui = sfl.SelectFromList(l=shot_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select a shot to clone from")
        self.item_gui.submitted.connect(self.results)

    def results(self, value):
        self.shot_name = value[0]
        self.shot = self.project.get_shot(self.shot_name)
        if not self.shot:
            self.shot = self.project.create_shot(self.shot_name)
        if not self.shot:
            qd.error("Something's wrong here. Talk to Stephanie")
        self.layout_element = self.shot.get_element(Asset.LAYOUT)
        path = os.path.join(self.layout_element._filepath,
                            self.shot_name + ".usda")
        if not os.path.exists(path):
            # no layout is associated with this shot yet
            layouts = self.project.list_existing_layouts()

            self.item_gui = sfl.SelectFromList(
                l=layouts,
                parent=hou.ui.mainQtWindow(),
                title="Select a layout for this shot")
            self.item_gui.submitted.connect(self.layout_results)
            return

        self.load(path)

    def layout_results(self, value):
        layout_name = value[0]

        # copy ref file into the shot
        layout_body = self.project.get_layout(layout_name)
        element = layout_body.get_element(Asset.LAYOUT)
        src = os.path.join(element._filepath, layout_name + "_ref.usda")
        dst = os.path.join(self.layout_element._filepath,
                           self.shot_name + ".usda")
        shutil.copy(src, dst)
        pio.set_permissions(dst)
        self.load(dst)

    def load(self, file):
        ref = hou.node("/stage").createNode("loadlayer")
        ref.setName("layout_ref", 1)
        ref.parm("filepath").set(file)

        ref.setDisplayFlag(True)

        rop = hou.node("/stage").createNode("usd_rop")
        rop.setInput(0, ref)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)
        rop.parm("lopoutput").set(file)
        rop.setName("save_layout", 1)
    def layout_results(self, value):
        self.layout_name = value[0]
        self.layout = Project().get_layout(self.layout_name)
        if self.layout is None:
            self.layout = Project().create_layout(self.layout_name)
        if self.layout is None:
            qd.error("Stephanie done messed up")
            return
        self.element = self.layout.get_element(Asset.LAYOUT)

        # make a USD ROP node
        rop = hou.node("/stage").createNode("usd_rop")
        # connect the selected node to the ROP
        out = hou.selectedNodes()[0]
        rop.setInput(0, out)
        # set the necessary values in the ROP
        self.savePath = os.path.join(self.element._filepath,
                                     self.layout_name + ".usda")
        rop.parm("lopoutput").set(self.savePath)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)
        # save to disk
        rop.parm("execute").pressButton()
        #add attributes to stage reqired for proper unpacking later
        self.create_attributes(out)
        # publish :)
        self.comment = qd.HoudiniInput(parent=hou.qt.mainWindow(),
                                       title="Comment for publish?")
        self.comment.submitted.connect(self.layout_comment)
    def solaris_asset_results(self, value):
        self.asset_name = value[0]

        body = Project().get_asset(self.asset_name)
        if not body:
            body = Project().create_asset(self.asset_name)
        if not body:
            qd.error("Something broke :'(")
            return
        self.element = body.get_element(Asset.USD)
        self.path = os.path.join(self.element._filepath, "temp.usda")

        selection = hou.selectedNodes()
        if len(selection) != 1:
            qd.error(
                "Please select the last node in the network and try again.")
            return

        out = selection[0]

        rop = hou.node("/stage").createNode("usd_rop")
        rop.setInput(0, out)
        rop.parm("lopoutput").set(self.path)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)
        rop.parm("execute").pressButton()
    def results(self, value):
        self.layout_name = value[0]

        self.layout = self.project.get_layout(self.layout_name)
        if self.layout is None:
            self.layout = Project().create_layout(self.layout_name)
        if self.layout is None:
            qd.error("Stephanie done messed up")
            return

        self.element = self.layout.get_element(Asset.LAYOUT)

        rop = hou.node("/stage").createNode("usd_rop")

        out = hou.selectedNodes()[0]
        rop.setInput(0, out)

        self.savePath = os.path.join(self.element._filepath, self.layout_name + ".usda")
        rop.parm("lopoutput").set(self.savePath)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)

        rop.parm("execute").pressButton()

        rop.destroy()

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label
        
        self.comment = qd.HoudiniInput(
            parent=hou.qt.mainWindow(), title="Comment for publish?", info=publishes_string_list)
        self.comment.submitted.connect(self.comment_results)
示例#12
0
class CameraCreator:
    def __init__(self):
        self.project = Project()

    def go(self):
        #get shot to add camera to
        shotList = self.project.list_existing_shots(
        )  #we shouldn't be adding cameras to shots that haven't been created yet anyway

        self.item_gui = sfl.SelectFromList(
            l=shotList,
            parent=maya_main_window(),
            title="Select shot to add extra camera to")
        self.item_gui.submitted.connect(self.shot_results)

    def shot_results(self, value):
        shot_name = value[0]

        shot = self.project.get_shot(shot_name)
        if shot is None:
            qd.error("There was a problem loading the shot.")
            return

        prevNum = shot.get_camera_number()
        newNum = prevNum + 1
        shot.set_camera_number(newNum)

        message = "There are now " + str(
            newNum) + " cameras in shot " + shot_name

        qd.message(message)
    def results(self, value):
        print("Selected asset: " + value[0])
        filename = value[0]

        self.body = Project().get_body(filename)
        self.element = self.body.get_element(Asset.MATERIALS)
        if self.element.get_last_version() >= 0:

            path = self.element.get_last_publish()[3]
            if path:
                createNewRef = True
                for child in hou.node("/stage").children():
                    if child.name(
                    ) == filename + "_material_ref" and child.parm(
                            "filepath1").eval() == path:
                        child.parm("reload").pressButton()
                        createNewRef = False
                if createNewRef:
                    ref = hou.node("/stage").createNode("reference")
                    ref.setName(filename + "_material_ref", 1)
                    ref.parm("filepath1").set(path)
                    ref.parm("primpath").set("/materials/")

                panes = self.getCurrentNetworkEditorPane()
                paths = []
                for pane in panes:
                    paths.append(pane.pwd())

                hdaPath = path.split(".")[0] + ".hda"
                hou.hda.installFile(hdaPath)

                success = False

                for p in paths:
                    try:
                        for child in p.children():
                            if child.type().name() == re.sub(
                                    r'\W+', '', filename):
                                child.destroy()
                        newMat = p.createNode(re.sub(r'\W+', '', filename))
                        newMat.setName(filename, 1)
                        newMat.setMaterialFlag(True)
                        success = True
                    except:
                        pass

                if not success:
                    for child in hou.node("/mat").children():
                        if child.type().name() == re.sub(r'\W+', '', filename):
                            child.destroy()
                    newMat = hou.node("/mat").createNode(
                        re.sub(r'\W+', '', filename))
                    newMat.setName(filename, 1)
                    newMat.setMaterialFlag(True)

                    qd.message(
                        "Material successfully cloned into /mat context.")

        else:
            qd.error("Nothing was cloned")
class LightPublisher:
    def __init__(self):
        self.project = Project()

    def go(self):
        sequence_list = self.project.list_sequences()

        self.item_gui = sfl.SelectFromList(
            l=sequence_list, parent=hou.ui.mainQtWindow(), title="Select a sequence to publish to")
        self.item_gui.submitted.connect(self.publish)


    def publish(self, value):
        self.name = value[0]
        sequence = self.project.get_sequence(self.name)
        if not sequence:
            sequence = self.project.create_sequence(self.name)
        if not sequence:
            qd.error("Bro, Stephanie really fumbled this one. No such sequence exists.")
            return
        self.element = sequence.get_element(Asset.LIGHTS)

        selection = hou.selectedNodes()
        if len(selection) != 1:
            qd.error(
                'Please select a single Houdini Digital Asset node to publish.')
            return
        if not selection[0].type().definition():
            qd.error(
                'Please select a Houdini Digital Asset node to publish.')
            return

        hda = selection[0]
        definition = hda.type().definition()
        definition.updateFromNode(hda)

        self.nodeName = "sequence_" + self.name + "_lights"
        menuName = "Sequence " + self.name + " Lights"
        self.savePath = os.path.join(self.element._filepath, self.nodeName + "_main.hda")

        definition.copyToHDAFile(self.savePath, new_name=self.nodeName, new_menu_name=menuName)

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label
        
        self.input = qd.HoudiniInput(
            parent=hou.qt.mainWindow(), title="Comment ", info=publishes_string_list)
        self.input.submitted.connect(self.comment_results)


    def comment_results(self, value):
        comment = str(value)
        username = Environment().get_user().get_username()

        self.element.update_app_ext(".hda")
        self.element.publish(username, self.savePath, comment, self.nodeName)
    def create_asset(self):
        project = Project()

        asset_list = project.list_existing_assets()
        self.item_gui = sfl.SelectFromList(l=asset_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select an asset to create")
        self.item_gui.submitted.connect(self.asset_results)
示例#16
0
    def export(self):

        project = Project()
        asset_list = project.list_assets()

        self.item_gui = sfl.SelectFromList(
            l=asset_list,
            parent=maya_main_window(),
            title="Select an asset to export to")
        self.item_gui.submitted.connect(passAlong)
示例#17
0
    def clone(self, quick=True):
        self.quick = quick
        self.project = Project()

        type_list = ["Model", "Rig", "Animation", "Camera"]
        self.item_gui = sfl.SelectFromList(
            l=type_list,
            parent=maya_main_window(),
            title="Select a type of asset to clone")
        self.item_gui.submitted.connect(self.type_results)
class AssetPublisher:
    def __init__(self):
        self.project = Project()

    def publish(self):
        asset_list = self.project.list_assets()

        self.item_gui = sfl.SelectFromList(
            l=asset_list, parent=hou.ui.mainQtWindow(), title="Select an asset to publish")
        self.item_gui.submitted.connect(self.results)
    
    def results(self, value):
        self.asset_name = value[0]

        body = Project().get_asset(self.asset_name)
        if not body:
            body = self.project.create_asset(self.asset_name)
        if not body:
            qd.error("Something broke :'(")
            return
        self.element = body.get_element(Asset.USD)
        self.path = os.path.join(self.element._filepath, "temp.usda")

        selection = hou.selectedNodes()
        if len(selection) != 1:
            qd.error("Please select the last node in the network and try again.")
            return
        
        out = selection[0]

        rop = hou.node("/stage").createNode("usd_rop")
        rop.setInput(0, out)
        rop.parm("lopoutput").set(self.path)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)
        rop.parm("execute").pressButton()

        rop.destroy()

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label

        self.input = qd.HoudiniInput(parent=hou.qt.mainWindow(), title="Comment ", info=publishes_string_list)
        self.input.submitted.connect(self.comment_results)

    def comment_results(self, value):
        comment = str(value)
        
        username = Environment().get_user().get_username()
        name = self.asset_name

        self.element.update_app_ext(".usda")
        self.element.publish(username, self.path, comment, name)
class LightPublisher:
    def __init__(self):
        self.project = Project()

    def publish(self):
        shot_list = self.project.list_shots()

        self.item_gui = sfl.SelectFromList(l=shot_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select a shot to publish to")
        self.item_gui.submitted.connect(self.results)

    def results(self, value):
        self.shot_name = value[0]

        shot = self.project.get_shot(self.shot_name)
        if not shot:
            shot = self.project.create_shot(self.shot_name)
        if not shot:
            qd.error("Get Stephanie, because something broke bad.")
        self.element = shot.get_element(Asset.LIGHTS)

        if len(hou.selectedNodes()) != 1:
            qd.error("Only select the last node in the network of lights.")
            return

        last = hou.selectedNodes()[0]
        rop = hou.node("/stage").createNode("usd_rop")
        rop.setInput(0, last)

        self.savePath = os.path.join(self.element._filepath, "temp.usda")
        rop.parm("lopoutput").set(self.savePath)
        rop.parm("enableoutputprocessor_simplerelativepaths").set(0)

        rop.parm("execute").pressButton()

        rop.destroy()

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label

        self.comment = qd.HoudiniInput(parent=hou.qt.mainWindow(),
                                       title="Comment for publish?",
                                       info=publishes_string_list)
        self.comment.submitted.connect(self.comment_results)

    def comment_results(self, value):
        comment = str(value)
        username = Environment().get_user().get_username()
        self.element.update_app_ext(".usda")
        self.element.publish(username, self.savePath, comment, self.shot_name)
    def results(self, value):
        self.asset_name = value[0]

        body = Project().get_asset(self.asset_name)
        if not body:
            body = self.project.create_asset(self.asset_name)
        if not body:
            qd.error("Something broke :'(")
            return
        self.element = body.get_element(Asset.GEO)
        self.usdElem = body.get_element(Asset.GEO)
        path = self.element._filepath

        selectedNodes = hou.selectedNodes()
        if len(selectedNodes) != 1:
            qd.error("Select one node to publish its geometry")
            return
        geo = selectedNodes[0]
        if geo.type().name() != "geo":
            qd.error("You can only publish from geo nodes")
            return

        for child in geo.children():
            if child.isDisplayFlagSet():
                #print("hello there from " + child.name())
                cache = geo.createNode("filecache")
                cache.setInput(0, child)
                usd = geo.createNode("usdexport")
                usd.setInput(0, child)

                cache.parm("filemode").set(2)
                cache.parm("file").set(os.path.join(path, "temp.obj"))
                cache.parm("trange").set(0)
                cache.parm("execute").pressButton()

                usd.parm("authortimesamples").set("Never")
                usd.parm("lopoutput").set(os.path.join(path, "temp.usda"))
                usd.parm("execute").pressButton()

                usd.destroy()
                cache.destroy()

                publishes = self.element.list_publishes()
                publishes_string_list = ""
                for publish in publishes:
                    label = publish[0] + " " + publish[1] + " " + publish[
                        2] + "\n"
                    publishes_string_list += label

                self.input = qd.HoudiniInput(parent=hou.qt.mainWindow(),
                                             title="Comment ",
                                             info=publishes_string_list)
                self.input.submitted.connect(self.comment_results)
    def getFilePath(self, name):
        asset = Project().get_asset(name)
        path = asset.get_filepath()
        path = os.path.join(path, Asset.RIG)

        self.element = asset.get_element(Asset.RIG)

        path = os.path.join(path, name)
        last_version = self.element.get_last_version()
        current_version = last_version + 1
        path = path + "_v" + str(current_version).zfill(3) + ".mb"
        print(path)
        return path
示例#22
0
    def getFilePath(self, name):
        asset = Project().get_asset(name)
        path = asset.get_filepath()
        path = os.path.join(path, Asset.GEO)

        self.element = Element(path)
        self.element.update_app_ext(".obj")

        path = os.path.join(path, name)
        last_version = self.element.get_last_version()
        current_version = last_version + 1
        path = path + "_v" + str(current_version).zfill(3) + ".obj"
        # print(path)
        return path
    def publish_asset(self, solaris):
        '''
        this is what's called when the button is pushed.
        '''
        project = Project()

        asset_list = project.list_assets()
        self.item_gui = sfl.SelectFromList(l=asset_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select an asset to publish")
        # call asset results function here to be used once selected
        if solaris:
            self.item_gui.submitted.connect(self.solaris_asset_results)
        else:
            self.item_gui.submitted.connect(self.asset_results)
    def publish_shot(self):
        '''
        publishes shot (entire .hip file). Nothing needs to be selected for this to work.
        '''
        scene = hou.hipFile.name()
        print('file name is ' + scene)

        project = Project()  # get project and its shots
        asset_list = project.list_shots()

        self.item_gui = sfl.SelectFromList(
            l=asset_list,
            parent=hou.qt.mainWindow(),
            title="Select a shot to publish to, my friend.")
        self.item_gui.submitted.connect(self.shot_results)
    def results(self, value):
        print("Selected asset: " + value[0])
        filename = value[0]

        self.body = Project().get_body(filename)
        self.element = self.body.get_element(Asset.USD)
        if self.element:
            path = self.element.get_last_publish()[3]
            if path:
                ref = hou.node("/stage").createNode("reference")
                ref.setName(filename + "_ref", 1)
                ref.parm("filepath1").set(path)
                ref.parm("primpath").set("/layout/" + filename)

        else:
            qd.error("Nothing was cloned")
class MatUpdater:
    def __init__(self):
        self.project = Project()

    def updateAll(self):
        obj = hou.node("/obj")
        mat = hou.node("/mat")
        for node in obj.allSubChildren():
            if node.isMaterialManager():
                for material in node.children():
                    self.updateOne(material)

        for node in mat.children():
            self.updateOne(node)

        qd.message("Updated all materials")

    def updateOne(self, mat):
        assetList = self.project.list_assets()
        for asset in assetList:
            asset = re.sub(r'\W+', '', asset)

        typeName = mat.type().name()
        if typeName not in assetList:
            return  #not a material from the pipe, move on

        if mat.isLockedHDA():
            mat.allowEditingOfContents()
        mat.matchCurrentDefinition()
        mat.allowEditingOfContents()

        print(mat.name())
class ShotPublisher:
    def __init__(self):
        self.project = Project()

    def publish(self):
        shot_list = self.project.list_shots()

        self.item_gui = sfl.SelectFromList(l=shot_list,
                                           parent=hou.ui.mainQtWindow(),
                                           title="Select a shot to publish")
        self.item_gui.submitted.connect(self.results)

    def results(self, value):
        self.shot_name = value[0]

        shot = self.project.get_shot(self.shot_name)
        if not shot:
            shot = self.project.create_shot(self.shot_name)
        if not shot:
            qd.error("Get Stephanie, because something broke bad.")
        self.element = shot.get_element(Asset.HIP)

        self.path = os.path.join(self.element._filepath, "temp.hipnc")

        hou.hipFile.setName(self.shot_name)
        hou.hipFile.save(file_name=self.path, save_to_recent_files=False)

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label

        self.input = qd.HoudiniInput(parent=hou.qt.mainWindow(),
                                     title="Comment ",
                                     info=publishes_string_list)
        self.input.submitted.connect(self.comment_results)

    def comment_results(self, value):
        comment = str(value)

        username = Environment().get_user().get_username()
        name = self.shot_name

        self.element.update_app_ext(".hipnc")
        self.element.publish(username, self.path, comment, name)
        self.element.update_assigned_user("")
    def asset_results(self, value):
        self.fileName = value[0]
        selection = hou.selectedNodes()
        # If it is more than one or none, abort
        if len(selection) != 1:
            qd.error(
                'Please select a single Houdini Digital Asset node to save and update version on.'
            )
            return
        # If it is not a Houdini Digital Asset, abort
        if not selection[0].type().definition():
            qd.error(
                'Please select a single Houdini Digital Asset node to save and update version on.'
            )
            return

        #add code to force node name/node type name
        hda_node = selection[0]
        definition = hda_node.type().definition()
        libraryFilePath = definition.libraryFilePath()
        self.filepath = libraryFilePath
        '''current_full_name = hda_node.type().name()

        # last index is current version
        current_version_string = hda_node.type().nameComponents()[-1]
        #current_major = current_version_string.split('.')[0]
        #print('major version is ' + current_major)
        #current_minor = current_version_string.split('.')[1]
        # Set the 3 digit revision number to 0 if the HDA is only using the single float versioning (1.0 and not 1.0.005)
        current_revision = 0 if len(current_version_string.split(
            '.')) < 3 else current_version_string.split('.')[2]
        all_definitions = hou.hda.definitionsInFile(libraryFilePath)
        # This sets the node to the latest version of those stored
        hda_node.changeNodeType(all_definitions[-1].nodeTypeName())'''
        definition.updateFromNode(hda_node)

        self.body = Project().create_asset(self.fileName)
        if self.body is None:
            self.body = Project().get_asset(self.fileName)
        if self.body is None:
            print("Stephanie did an oopsie whoopsie :'(")
            return

        self.input = qd.HoudiniInput(parent=hou.qt.mainWindow(),
                                     title="Comment ")
        self.input.submitted.connect(self.comment_results)
示例#29
0
def get_body_from_reference(ref):
    try:
        body = Project().get_body(extract_reference_data(ref)[0])
        return body
    except:
        print(str(ref) + " is not a body")

    return None
示例#30
0
class UpdateShots:
    def __init__(self):
        self.project = Project()

    def update_shots(self):
        shot_list = ShotgunReader().getShotList()
        #print(shot_list)

        list_file = open(
            os.path.join(self.project.get_shots_dir(), ".shot_list"), "w")
        list_file.truncate(0)
        for shot in shot_list:
            #print("shot " + shot)
            list_file.write(shot + "\n")

            self.create_shot(shot)

        list_file.close()

        qd.message("Shots updated successfully.")

    def create_shot(self, shot):
        stage = hou.node("/stage")
        #print(shot)

        #check if there's already a shot hip file, and if so, don't do anything
        body = self.project.get_shot(shot)
        if not body:
            body = self.project.create_shot(shot)
        element = body.get_element(Asset.HIP)
        file_name = os.path.join(element._filepath, shot + "_main.hipnc")
        if os.path.exists(file_name) or element.get_last_version() >= 0:
            #don't save over work already done
            return

        #copy over the template file and publish it
        src = os.path.join(self.project.get_project_dir(), "template.hipnc")
        dst = os.path.join(element._filepath, "temp.hipnc")
        shutil.copyfile(src, dst)

        comment = "blank shot file"
        username = "******"

        element.update_app_ext(".hipnc")
        element.publish(username, dst, comment, shot)