Beispiel #1
0
def ueSaveVers():
    if maya.cmds.file(q=True, sn=True) == "":
        ueSaveAs()
        return

    fi = ueMaya.parseFileInfo(maya.cmds.fileInfo(query=True))

    spec = ueSpec.Spec(fi["ueproj"], fi["uegrp"], fi["ueasst"], fi["ueclass"], fi["uetype"], fi["uename"])

    ueMayaUtils.saveUtility(spec)
Beispiel #2
0
def ueSaveVers():
    if maya.cmds.file(q=True, sn=True) == "":
        ueSaveAs()
        return

    fi = ueMaya.parseFileInfo(maya.cmds.fileInfo(query=True))

    spec = ueSpec.Spec(fi["ueproj"], fi["uegrp"], fi["ueasst"], fi["ueclass"],
                       fi["uetype"], fi["uename"])

    ueMayaUtils.saveUtility(spec)
Beispiel #3
0
    def export(self):
        spec, dbMeta = ueCommonSave.getValues()
        selection = []
        for i in self.itemMenu.selectedItems():
            selection.append(i.text())
        maya.cmds.select(selection, ne=True, r=True)
        ueMayaUtils.saveUtility(spec, dbMeta=dbMeta, fileType="obj", export=True, animated=True)
        spec.elclass = "ms"
        ueMayaUtils.saveUtility(spec, dbMeta=dbMeta, fileType="ma", export=True)
#        ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))
        self.close()
Beispiel #4
0
 def save(self):
     spec, dbMeta = ueCommonSave.getValues()
     ueMayaUtils.saveUtility(spec, dbMeta=dbMeta)
     #        ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))
     self.close()
Beispiel #5
0
 def save(self):
     spec, dbMeta = ueCommonSave.getValues()
     ueMayaUtils.saveUtility(spec, dbMeta=dbMeta)
     #        ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))
     self.close()
Beispiel #6
0
Datei: Render.py Projekt: hdd/ue
    def save(self):
        spec, dbMeta = ueCommonSave.getValues()

        # Check if the scene has been saved       
        if maya.cmds.file(q=True, sn=True) == "":
            ueSave.ueSaveAs()

        sourceSpec = ueSpec.Spec(maya.cmds.fileInfo("ueproj", query=True)[0],
                                 maya.cmds.fileInfo("uegrp", query=True)[0],
                                 maya.cmds.fileInfo("ueasst", query=True)[0],
                                 maya.cmds.fileInfo("ueclass", query=True)[0],
                                 maya.cmds.fileInfo("uetype", query=True)[0],
                                 maya.cmds.fileInfo("uename", query=True)[0],
                                 int(maya.cmds.fileInfo("uevers", query=True)[0]))
        destSpec = spec

        # Create the element(s)/version(s) to render into
        dbMeta = {}
        if len(self.renderOpts[1]) > 1:
            dbMeta["passes"] = ",".join(self.renderOpts[1])
        dbMeta["comment"] = "Render from %s" % str(sourceSpec)

        e = ueAssetUtils.getElement(destSpec)
        if e == {}:
            e = ueCreate.createElement(destSpec, dbMeta=dbMeta)

        # If we're rendering into the last existing version, delete it
        if not renderOpts[2]["newVersion"]:
            versions = ueAssetUtils.getVersions(destSpec)
            destSpec.vers = len(versions)
            ueDestroy.destroyVersion(destSpec)

        if renderOpts[2]["clearLastVersion"]:
            print "deleting files"

        # Create a new version
        v = ueCreate.createVersion(destSpec, dbMeta=dbMeta)

        destSpec.vers = v["version"]

        path = v["path"]
        name = v["file_name"]

        # Set up the render globals
        maya.cmds.setAttr("defaultRenderGlobals.extensionPadding", 4)
        maya.cmds.setAttr("defaultRenderGlobals.putFrameBeforeExt", 1)
        if len(self.renderOpts[1]) == 1:
            p = os.path.join(path.replace(os.path.join(os.getenv("ASST_ROOT"), "render")+"/", ""), name)
            maya.cmds.setAttr("defaultRenderGlobals.imageFilePrefix", p, type="string")
        else:
            p = os.path.join(path.replace(os.path.join(os.getenv("ASST_ROOT"), "render")+\
                                          "/", ""), "<RenderPass", name+"_<RenderPass>")
            p = os.path.join("<RenderPass", name+"_<RenderPass>")
            maya.cmds.setAttr("defaultRenderGlobals.imageFilePrefix", p, type="string")

        dbMeta = {}
        dbMeta["comment"] = "Auto-save of render %s" % str(destSpec)

        ueMayaUtils.saveUtility(sourceSpec, dbMeta=dbMeta)
        ueMayaUtils.saveUtility(sourceSpec)

        if self.renderOpts[0] == 0:
            print "Rendering %s ..." % str(destSpec)
            maya.mel.eval("mayaBatchRender")
        elif self.renderOpts[0] == 1:
            print "Spooling %s ..." % str(destSpec)
        elif self.renderOpts[0] == 2:
            print "Spooling to cloud currently not avaliable"

        self.close()
Beispiel #7
0
    def export(self):
        destSpec, dbMeta = ueCommonSave.getValues()

        fi = ueMaya.parseFileInfo(maya.cmds.fileInfo(query=True))

        sourceSpec = ueSpec.Spec(fi["ueproj"], fi["uegrp"], fi["ueasst"],
                                 fi["ueclass"], fi["uetype"], fi["uename"],
                                 fi["uevers"])

        dbMeta["comment"] = "Exported from %s" % str(sourceSpec)

        # Get the selected nodes from the dialog list
        selection = []
        for i in self.itemMenu.selectedItems():
            selection.append(str(i.text()))

        # If we're exporting all our seleted items into one element,
        # add the entire list into another list so when we iterate over
        # it, we return the list once and export everything
        if not self.exportAsSeparateElements.isChecked():
            newSelection = []
            newSelection.append(selection)
            selection = newSelection

        # Iterate over our selection and export
        if destSpec.elclass == "ms":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                ueMayaUtils.saveUtility(destSpec,
                                        dbMeta=dbMeta,
                                        fileType="ma",
                                        export=True)
        elif destSpec.elclass == "cam":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec,
                                        dbMeta=dbMeta,
                                        fileType="ma",
                                        export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "cam"
                    ueMayaUtils.saveUtility(destSpec,
                                            dbMeta=dbMeta,
                                            fileType="fbx",
                                            export=True)
        elif destSpec.elclass == "lgt":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec,
                                        dbMeta=dbMeta,
                                        fileType="ma",
                                        export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "lgt"
                    ueMayaUtils.saveUtility(destSpec,
                                            dbMeta=dbMeta,
                                            fileType="fbx",
                                            export=True)
        elif destSpec.elclass == "geo":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec,
                                        dbMeta=dbMeta,
                                        fileType="ma",
                                        export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "geo"
                    ueMayaUtils.saveUtility(destSpec,
                                            dbMeta=dbMeta,
                                            fileType="obj",
                                            export=True)
        elif destSpec.elclass == "mrs":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                ueMayaUtils.saveUtility(destSpec,
                                        dbMeta=dbMeta,
                                        fileType="ma",
                                        export=True)

#        ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))

        self.close()
Beispiel #8
0
Datei: Export.py Projekt: hdd/ue
    def export(self):
        destSpec, dbMeta = ueCommonSave.getValues()

        fi = ueMaya.parseFileInfo(maya.cmds.fileInfo(query=True))

        sourceSpec = ueSpec.Spec(fi["ueproj"], fi["uegrp"], fi["ueasst"],
                                 fi["ueclass"], fi["uetype"], fi["uename"],
                                 fi["uevers"])

        dbMeta["comment"] = "Exported from %s" % str(sourceSpec)

        # Get the selected nodes from the dialog list
        selection = []
        for i in self.itemMenu.selectedItems():
            selection.append(str(i.text()))

        # If we're exporting all our seleted items into one element,
        # add the entire list into another list so when we iterate over
        # it, we return the list once and export everything
        if not self.exportAsSeparateElements.isChecked():
            newSelection = []
            newSelection.append(selection)
            selection = newSelection

        # Iterate over our selection and export
        if destSpec.elclass == "ms":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="ma", export=True)
        elif destSpec.elclass == "cam":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="ma", export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "cam"
                    ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="fbx", export=True)
        elif destSpec.elclass == "lgt":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="ma", export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "lgt"
                    ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="fbx", export=True)
        elif destSpec.elclass == "geo":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                destSpec.elclass = "ms"
                ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="ma", export=True)
                if self.exportCache.isChecked():
                    destSpec.elclass = "geo"
                    ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="obj", export=True)
        elif destSpec.elclass == "mrs":
            for item in selection:
                if self.exportAsSeparateElements.isChecked():
                    destSpec.elname = item.replace(":", "")
                maya.cmds.select(item, r=True)
                ueMayaUtils.saveUtility(destSpec, dbMeta=dbMeta, fileType="ma", export=True)

#        ueFileUtils.deleteFiles(os.path.join(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")))

        self.close()
Beispiel #9
0
    def save(self):
        spec, dbMeta = ueCommonSave.getValues()

        # Check if the scene has been saved
        if maya.cmds.file(q=True, sn=True) == "":
            ueSave.ueSaveAs()

        sourceSpec = ueSpec.Spec(
            maya.cmds.fileInfo("ueproj", query=True)[0],
            maya.cmds.fileInfo("uegrp", query=True)[0],
            maya.cmds.fileInfo("ueasst", query=True)[0],
            maya.cmds.fileInfo("ueclass", query=True)[0],
            maya.cmds.fileInfo("uetype", query=True)[0],
            maya.cmds.fileInfo("uename", query=True)[0],
            int(maya.cmds.fileInfo("uevers", query=True)[0]))
        destSpec = spec

        # Create the element(s)/version(s) to render into
        dbMeta = {}
        if len(self.renderOpts[1]) > 1:
            dbMeta["passes"] = ",".join(self.renderOpts[1])
        dbMeta["comment"] = "Render from %s" % str(sourceSpec)

        e = ueAssetUtils.getElement(destSpec)
        if e == {}:
            e = ueCreate.createElement(destSpec, dbMeta=dbMeta)

        # If we're rendering into the last existing version, delete it
        if not renderOpts[2]["newVersion"]:
            versions = ueAssetUtils.getVersions(destSpec)
            destSpec.vers = len(versions)
            ueDestroy.destroyVersion(destSpec)

        if renderOpts[2]["clearLastVersion"]:
            print "deleting files"

        # Create a new version
        v = ueCreate.createVersion(destSpec, dbMeta=dbMeta)

        destSpec.vers = v["version"]

        path = v["path"]
        name = v["file_name"]

        # Set up the render globals
        maya.cmds.setAttr("defaultRenderGlobals.extensionPadding", 4)
        maya.cmds.setAttr("defaultRenderGlobals.putFrameBeforeExt", 1)
        if len(self.renderOpts[1]) == 1:
            p = os.path.join(
                path.replace(
                    os.path.join(os.getenv("ASST_ROOT"), "render") + "/", ""),
                name)
            maya.cmds.setAttr("defaultRenderGlobals.imageFilePrefix",
                              p,
                              type="string")
        else:
            p = os.path.join(path.replace(os.path.join(os.getenv("ASST_ROOT"), "render")+\
                                          "/", ""), "<RenderPass", name+"_<RenderPass>")
            p = os.path.join("<RenderPass", name + "_<RenderPass>")
            maya.cmds.setAttr("defaultRenderGlobals.imageFilePrefix",
                              p,
                              type="string")

        dbMeta = {}
        dbMeta["comment"] = "Auto-save of render %s" % str(destSpec)

        ueMayaUtils.saveUtility(sourceSpec, dbMeta=dbMeta)
        ueMayaUtils.saveUtility(sourceSpec)

        if self.renderOpts[0] == 0:
            print "Rendering %s ..." % str(destSpec)
            maya.mel.eval("mayaBatchRender")
        elif self.renderOpts[0] == 1:
            print "Spooling %s ..." % str(destSpec)
        elif self.renderOpts[0] == 2:
            print "Spooling to cloud currently not avaliable"

        self.close()