Beispiel #1
0
def addGizmosFromAsset(asst):
    gizmos = False
    a = ueAssetUtils.getElements(ueSpec.Spec(asst[0], asst[1], asst[2]))
    if "giz" in a:
        for n in a["giz"]:
            for p in a["giz"][n]:
                spec = ueSpec.Spec(asst[0], asst[1], asst[2], "giz", n, p)
                versions = ueAssetUtils.getVersions(spec)
                version = versions[len(versions) - 1]
                menu = "%s:%s:%s/%s/%s" % (spec.proj, spec.grp, spec.asst, n,
                                           p)
                # Add a 'ueGizVers' knob to hold the version of the gizmo
                # we're bringing in. This can be used for version control later.
                # When you add a custom knob, Nuke makes the User tab active,
                # so a hack around that is to add the node with the prefs panel
                # disabled, add the custom knobs, then show the prefs.
                command = str('n = nuke.createNode("' + version["file_name"] +
                              '", \
                           "name ' + p + '", inpanel=False); \
                           n.addKnob(nuke.Int_Knob("ueGizmoVers", "gizmo version")); \
                           n.knob("ueGizmoVers").setValue(' +
                              str(len(versions)) + '); \
                           n.showControlPanel()')
                nuke.toolbar("Nodes").addCommand("ueTools/" + menu, command)
                nuke.menu("Nuke").addCommand("ueTools/gizmos/" + menu, command)
                gizmos = True
    if gizmos:
        nuke.toolbar("Nodes").addCommand("ueTools/-", "")
Beispiel #2
0
 def loadElements(self):
     global asst
     asst = str(self.asstMenu.currentText())
     spec = ueSpec.Spec(proj, grp, asst)
     self.elements = ueAssetUtils.getElements(spec)
     #        self.eltypeList.clear()
     self.loadTypes()
Beispiel #3
0
 def loadElements(self):
     global asst, elements
     asst = str(self.asstMenu.currentText())
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.animationTab.reload()
     self.backgroundTab.reload()
     self.renderTab.reload()
Beispiel #4
0
 def loadElements(self):
     global asst, elements
     asst = str(self.asstMenu.currentText())
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.animationTab.reload()
     self.backgroundTab.reload()
     self.renderTab.reload()
Beispiel #5
0
    def loadElements(self):
        global asst
        asst = str(self.asstMenu.currentText())
        spec = ueSpec.Spec(proj, grp, asst)
        self.elements = ueAssetUtils.getElements(spec)
#        self.eltypeList.clear()
        self.loadTypes()
Beispiel #6
0
 def loadLayerLists(self):
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.layerListPickerBox.clear()
     if __layerClass__ in elements:
         if __layerType__ in elements[__layerClass__]:
             for layerList in sorted(elements[__layerClass__][__layerType__]):
                 self.layerListPickerBox.addItem(layerList)
Beispiel #7
0
 def loadLayerLists(self):
     elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))
     self.layerListPickerBox.clear()
     if __layerClass__ in elements:
         if __layerType__ in elements[__layerClass__]:
             for layerList in sorted(
                     elements[__layerClass__][__layerType__]):
                 self.layerListPickerBox.addItem(layerList)
Beispiel #8
0
def loadGizmosFromAsset(asst):
    path = []
    a = ueAssetUtils.getElements(ueSpec.Spec(asst[0], asst[1], asst[2]))
    if "giz" in a:
        for n in a["giz"]:
            for p in a["giz"][n]:
                path.append(a["giz"][n][p]["path"])
    return path
Beispiel #9
0
 def loadEdits(self):
     elements = ueAssetUtils.getElements(self.spec)
     self.editMenu.clear()
     if self.spec.elclass in elements:
         if self.spec.eltype in elements[self.spec.elclass]:
             for name in elements[self.spec.elclass][self.spec.eltype]:
                 self.editMenu.addItem(name)
             self.spec.elname = str(self.editMenu.currentText())
             self.loadEditVersions()
Beispiel #10
0
Datei: EditUI.py Projekt: hdd/ue
 def loadEdits(self):
     elements = ueAssetUtils.getElements(self.spec)
     self.editMenu.clear()
     if self.spec.elclass in elements:
         if self.spec.eltype in elements[self.spec.elclass]:
             for name in elements[self.spec.elclass][self.spec.eltype]:
                 self.editMenu.addItem(name)
             self.spec.elname = str(self.editMenu.currentText())
             self.loadEditVersions()
Beispiel #11
0
 def loadElements(self):
     self.elements = ueAssetUtils.getElements(self.spec)
     if "arc" in self.elements:
         spec = copy.deepcopy(self.spec)
         spec.elclass = "arc"
         for eltype in self.elements["arc"]:
             spec.eltype = eltype
             self.libraryWidgets.append(LibraryWidget(self.elements["arc"][eltype], parent=self))
         self.drawLibraryWidgets()
Beispiel #12
0
 def loadElements(self):
     global asst
     asst = str(self.asstMenu.currentText())
     spec = ueSpec.Spec(proj, grp, asst)
     self.elements = ueAssetUtils.getElements(spec)
     if elclass in self.elements:
         self.loadTypes()
     else:
         self.eltypeMenu.clear()
         self.elnameMenu.clear()
Beispiel #13
0
Datei: Save.py Projekt: hdd/ue
 def loadElements(self):
     global asst
     asst = str(self.asstMenu.currentText())
     spec = ueSpec.Spec(proj, grp, asst)
     self.elements = ueAssetUtils.getElements(spec)
     if elclass in self.elements:
         self.loadTypes()
     else:
         self.eltypeMenu.clear()
         self.elnameMenu.clear()
Beispiel #14
0
def listElements():
    elements = ueAssetUtils.getElements(settings["spec"])

    for e in sorted(elements):
        for t in sorted(elements[e]):
            for n in sorted(elements[e][t]):
                a = ueSpec.Spec(settings["spec"].proj, settings["spec"].grp,
                                settings["spec"].asst, e, t, n)
                element = str(a)
                if "paths" in settings:
                    element = "%s -> %s" % (element, n["path"])
                print element
Beispiel #15
0
def listElements():
    elements = ueAssetUtils.getElements(settings["spec"])

    for e in sorted(elements):
        for t in sorted(elements[e]):
            for n in sorted(elements[e][t]):
                a = ueSpec.Spec(settings["spec"].proj,
                                settings["spec"].grp,
                                settings["spec"].asst,
                                e, t, n)
                element = str(a)
                if "paths" in settings:
                    element = "%s -> %s" % (element, n["path"])
                print element
Beispiel #16
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        global proj, grp, asst
        global elements

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        zero = QtGui.QWidget()
        one = QtGui.QWidget()

        zero.setLayout(QtGui.QHBoxLayout())
        zero.layout().setContentsMargins(2, 2, 2, 2)
        zero.layout().setSpacing(2)
        one.setLayout(QtGui.QHBoxLayout())
        one.layout().setContentsMargins(2, 2, 2, 2)
        one.layout().setSpacing(2)

        zero.layout().addWidget(QtGui.QLabel("project"))
        zero.layout().addWidget(self.projMenu)
        zero.layout().addWidget(QtGui.QLabel("group"))
        zero.layout().addWidget(self.grpMenu)
        zero.layout().addWidget(QtGui.QLabel("asset"))
        zero.layout().addWidget(self.asstMenu)
        zero.layout().addStretch(0)

        tabs = QtGui.QTabWidget()

        elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        self.animationTab = AnimationTab()
        self.backgroundTab = BackgroundTab()
        self.renderTab = RenderTab()

        tabs.addTab(self.animationTab, "Animation")
        tabs.addTab(self.backgroundTab, "Background")
        tabs.addTab(self.renderTab, "Render")

        one.layout().addWidget(tabs)

        self.layout().addWidget(zero)
        self.layout().addWidget(one)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
Beispiel #17
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        global proj, grp, asst, elclass, eltype, elname, vers, elpass

        self.elclasses = elclasses

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")
        elclass = None
        eltype = None
        elname = None
        vers = None
        elpass = None

        self.setLayout(QtGui.QGridLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()
        self.elclassMenu = QtGui.QComboBox()
        self.eltypeList = QtGui.QListWidget()
        self.elnameList = QtGui.QListWidget()
        self.versList = QtGui.QListWidget()

        self.passList = QtGui.QListWidget()

        self.elCreatedBy = QtGui.QLabel("N/A")
        self.elCreatedAt = QtGui.QLabel("N/A")
        self.elComment = QtGui.QLabel("N/A")
        self.elThumb = QtGui.QLabel()

        self.verCreatedBy = QtGui.QLabel("N/A")
        self.verCreatedAt = QtGui.QLabel("N/A")
        self.verComment = QtGui.QLabel("N/A")
        self.verThumb = QtGui.QLabel()
        self.verFilesList = QtGui.QListWidget()

        img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png"))
        imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
        self.elThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))
        self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        for c in sorted(self.elclasses):
            self.elclassMenu.addItem(c)
        elclass = str(self.elclassMenu.currentText())

        self.elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        if elclass in self.elements:
            for t in sorted(self.elements[elclass]):
                self.eltypeList.addItem(QtGui.QListWidgetItem(t))
            self.eltypeList.setCurrentItem(self.eltypeList.item(0))
            eltype = str(self.eltypeList.currentItem().text())

            if eltype in self.elements[elclass]:
                for n in sorted(self.elements[elclass][eltype]):
                    self.elnameList.addItem(QtGui.QListWidgetItem(n))
                self.elnameList.setCurrentItem(self.elnameList.item(0))
                elname = str(self.elnameList.currentItem().text())

                self.updateElInfo()

                self.versions = ueAssetUtils.getVersions(ueSpec.Spec(proj, grp, asst,
                                                         elclass, eltype, elname))
                if len(self.versions) > 0:
                    for v in sorted(range(len(self.versions)), reverse=True):
                        self.versList.addItem(QtGui.QListWidgetItem("%04d" % int(v+1)))
                    self.versList.setCurrentItem(self.versList.item(0))
                    vers = int(self.versList.currentItem().text())

                    self.loadPasses()

                    self.updateVersInfo()

        asstBox = QtGui.QGroupBox("Asset")
        asstBox.setLayout(QtGui.QHBoxLayout())

        asstBox.layout().addWidget(QtGui.QLabel("Project"))
        asstBox.layout().addWidget(self.projMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Group"))
        asstBox.layout().addWidget(self.grpMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Asset"))
        asstBox.layout().addWidget(self.asstMenu)
        asstBox.layout().addStretch(0)

        passBox = QtGui.QGroupBox("Pass")
        passBox.setLayout(QtGui.QHBoxLayout())

        passBox.layout().addWidget(self.passList)

        elBox = QtGui.QGroupBox("Element")
        elBox.setLayout(QtGui.QHBoxLayout())

        elDesc = QtGui.QWidget()
        elDesc.setLayout(QtGui.QVBoxLayout())

        elDesc.layout().addWidget(QtGui.QLabel("Class"))
        elDesc.layout().addWidget(self.elclassMenu)
        elDesc.layout().addWidget(QtGui.QLabel("Type"))
        elDesc.layout().addWidget(self.eltypeList)
        elDesc.layout().addWidget(QtGui.QLabel("Name"))
        elDesc.layout().addWidget(self.elnameList)

        elVers = QtGui.QWidget()
        elVers.setLayout(QtGui.QVBoxLayout())

        elVers.layout().addWidget(QtGui.QLabel("Version"))
        elVers.layout().addWidget(self.versList)

        elBox.layout().addWidget(elDesc)
        elBox.layout().addWidget(elVers)

        elInfoBox = QtGui.QGroupBox("Element Info")
        elInfoBox.setLayout(QtGui.QGridLayout())

        elInfoBox.layout().addWidget(QtGui.QLabel("Created by"), 0, 0)
        elInfoBox.layout().addWidget(self.elCreatedBy, 0, 1)
        elInfoBox.layout().addWidget(QtGui.QLabel("Created at"), 1, 0)
        elInfoBox.layout().addWidget(self.elCreatedAt, 1, 1)
        elInfoBox.layout().addWidget(QtGui.QLabel("Comment"),2, 0)
        elInfoBox.layout().addWidget(self.elComment, 2, 1)
        elInfoBox.layout().addWidget(self.elThumb, 0, 2, 3, 2)

        verInfoBox = QtGui.QGroupBox("Version Info")
        verInfoBox.setLayout(QtGui.QGridLayout())

        verInfoBox.layout().addWidget(QtGui.QLabel("Created by"), 0, 0)
        verInfoBox.layout().addWidget(self.verCreatedBy, 0, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Created at"), 1, 0)
        verInfoBox.layout().addWidget(self.verCreatedAt, 1, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Comment"),2, 0)
        verInfoBox.layout().addWidget(self.verComment, 2, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Files"), 3, 0, 1, 4)
        verInfoBox.layout().addWidget(self.verFilesList, 4, 0, 1, 4)
        verInfoBox.layout().addWidget(self.verThumb, 0, 2, 3, 2)

        self.layout().addWidget(asstBox)
        self.layout().addWidget(elBox)
        self.layout().addWidget(passBox)
        self.layout().addWidget(elInfoBox)
        self.layout().addWidget(verInfoBox)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
        self.elclassMenu.activated.connect(self.loadTypes)
        self.eltypeList.itemSelectionChanged.connect(self.loadNames)
        self.elnameList.itemSelectionChanged.connect(self.loadVers)
        self.versList.itemSelectionChanged.connect(self.setVers)
        self.passList.itemSelectionChanged.connect(self.setPass)
Beispiel #18
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        global proj, grp, asst
        global elements

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        zero = QtGui.QWidget()
        one = QtGui.QWidget()

        zero.setLayout(QtGui.QHBoxLayout())
        zero.layout().setContentsMargins(2, 2, 2, 2)
        zero.layout().setSpacing(2)
        one.setLayout(QtGui.QHBoxLayout())
        one.layout().setContentsMargins(2, 2, 2, 2)
        one.layout().setSpacing(2)

        zero.layout().addWidget(QtGui.QLabel("project"))
        zero.layout().addWidget(self.projMenu)
        zero.layout().addWidget(QtGui.QLabel("group"))
        zero.layout().addWidget(self.grpMenu)
        zero.layout().addWidget(QtGui.QLabel("asset"))
        zero.layout().addWidget(self.asstMenu)
        zero.layout().addStretch(0)

        tabs = QtGui.QTabWidget()

        elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        self.animationTab = AnimationTab()
        self.backgroundTab = BackgroundTab()
        self.renderTab = RenderTab()

        tabs.addTab(self.animationTab, "Animation")
        tabs.addTab(self.backgroundTab, "Background")
        tabs.addTab(self.renderTab, "Render")

        one.layout().addWidget(tabs)

        self.layout().addWidget(zero)
        self.layout().addWidget(one)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
Beispiel #19
0
Datei: Save.py Projekt: hdd/ue
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        global proj, grp, asst, elclass, eltype, elname
        global comment, thumbnail

        self.elclasses = elclasses

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")
        elclass = None
        eltype = None
        elname = None
        comment = None
        thumbnail = None

        self.setLayout(QtGui.QGridLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()
        self.elclassMenu = QtGui.QComboBox()
        self.eltypeMenu = QtGui.QComboBox()
        self.eltypeBox = QtGui.QLineEdit()
        self.elnameMenu = QtGui.QComboBox()
        self.elnameBox = QtGui.QLineEdit()
        self.commentBox = QtGui.QTextEdit()
        self.thumbnailBox = QtGui.QScrollArea()

        self.thumbnailBox.setFixedHeight(160)

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        for c in sorted(self.elclasses):
            self.elclassMenu.addItem(c)
        elclass = str(self.elclassMenu.currentText())

        self.elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        if elclass in sorted(self.elements):
            for t in self.elements[elclass]:
                self.eltypeMenu.addItem(t)
            eltype = str(self.eltypeMenu.currentText())

            if eltype in self.elements[elclass]:
                for n in sorted(self.elements[elclass][eltype]):
                    self.elnameMenu.addItem(n)
                elname = str(self.elnameMenu.currentText())

        t = QtGui.QWidget()
        t.setLayout(QtGui.QHBoxLayout())

        self.thumbnailButtons = []
        for f in glob.glob(os.path.join(os.getenv("ASST_ROOT"), "tmp", "ueSaveThumbs_*.png")):
            w = QtGui.QWidget()
            w.setLayout(QtGui.QVBoxLayout())

            name = os.path.basename(f).lstrip("ueSaveThumbs_").rstrip(".png")

            label = QtGui.QLabel()
            img = QtGui.QImage(f)
            imgs = img.scaled(250, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
            label.setPixmap(QtGui.QPixmap.fromImage(imgs))
            radio = QtGui.QRadioButton(name)

            self.thumbnailButtons.append(radio)

            radio.toggled.connect(self.loadThumbnail)

            w.layout().addWidget(label)
            w.layout().addWidget(radio)

            t.layout().addWidget(w)

        self.thumbnailBox.setWidget(t)

        asstBox = QtGui.QGroupBox("Asset")
        asstBox.setLayout(QtGui.QHBoxLayout())

        asstBox.layout().addWidget(QtGui.QLabel("Project"))
        asstBox.layout().addWidget(self.projMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Group"))
        asstBox.layout().addWidget(self.grpMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Asset"))
        asstBox.layout().addWidget(self.asstMenu)
        asstBox.layout().addStretch(0)

        elBox = QtGui.QGroupBox("Element")
        elBox.setLayout(QtGui.QGridLayout())

        elBox.layout().addWidget(QtGui.QLabel("Class"), 0, 0)
        elBox.layout().addWidget(self.elclassMenu, 0, 1)
        elBox.layout().addWidget(QtGui.QLabel("Type"), 1, 0)
        elBox.layout().addWidget(self.eltypeMenu, 1, 1)
        elBox.layout().addWidget(self.eltypeBox, 1, 2)
        elBox.layout().addWidget(QtGui.QLabel("Name"), 2, 0)
        elBox.layout().addWidget(self.elnameMenu, 2, 1)
        elBox.layout().addWidget(self.elnameBox, 2, 2)

        miscBox = QtGui.QGroupBox("Optional")
        miscBox.setLayout(QtGui.QVBoxLayout())

        miscBox.layout().addWidget(QtGui.QLabel("Thumbnail"))
        miscBox.layout().addWidget(self.thumbnailBox)
        miscBox.layout().addWidget(QtGui.QLabel("Comment"))
        miscBox.layout().addWidget(self.commentBox)

        self.layout().addWidget(asstBox)
        self.layout().addWidget(elBox)
        self.layout().addWidget(miscBox)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
        self.elclassMenu.activated.connect(self.loadTypes)
        self.eltypeMenu.activated.connect(self.loadNames)
        self.elnameMenu.activated.connect(self.setName)
        self.eltypeBox.textEdited.connect(self.newType)
        self.elnameBox.textEdited.connect(self.newName)
        self.commentBox.textChanged.connect(self.loadComment)
Beispiel #20
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        global proj, grp, asst, elclass, eltype, elname
        global comment, thumbnail

        self.elclasses = elclasses

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")
        elclass = None
        eltype = None
        elname = None
        comment = None
        thumbnail = None

        self.setLayout(QtGui.QGridLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()
        self.elclassMenu = QtGui.QComboBox()
        self.eltypeMenu = QtGui.QComboBox()
        self.eltypeBox = QtGui.QLineEdit()
        self.elnameMenu = QtGui.QComboBox()
        self.elnameBox = QtGui.QLineEdit()
        self.commentBox = QtGui.QTextEdit()
        self.thumbnailBox = QtGui.QScrollArea()

        self.thumbnailBox.setFixedHeight(160)

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        for c in sorted(self.elclasses):
            self.elclassMenu.addItem(c)
        elclass = str(self.elclassMenu.currentText())

        self.elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        if elclass in sorted(self.elements):
            for t in self.elements[elclass]:
                self.eltypeMenu.addItem(t)
            eltype = str(self.eltypeMenu.currentText())

            if eltype in self.elements[elclass]:
                for n in sorted(self.elements[elclass][eltype]):
                    self.elnameMenu.addItem(n)
                elname = str(self.elnameMenu.currentText())

        t = QtGui.QWidget()
        t.setLayout(QtGui.QHBoxLayout())

        self.thumbnailButtons = []
        for f in glob.glob(
                os.path.join(os.getenv("ASST_ROOT"), "tmp",
                             "ueSaveThumbs_*.png")):
            w = QtGui.QWidget()
            w.setLayout(QtGui.QVBoxLayout())

            name = os.path.basename(f).lstrip("ueSaveThumbs_").rstrip(".png")

            label = QtGui.QLabel()
            img = QtGui.QImage(f)
            imgs = img.scaled(250,
                              80,
                              aspectRatioMode=QtCore.Qt.KeepAspectRatio)
            label.setPixmap(QtGui.QPixmap.fromImage(imgs))
            radio = QtGui.QRadioButton(name)

            self.thumbnailButtons.append(radio)

            radio.toggled.connect(self.loadThumbnail)

            w.layout().addWidget(label)
            w.layout().addWidget(radio)

            t.layout().addWidget(w)

        self.thumbnailBox.setWidget(t)

        asstBox = QtGui.QGroupBox("Asset")
        asstBox.setLayout(QtGui.QHBoxLayout())

        asstBox.layout().addWidget(QtGui.QLabel("Project"))
        asstBox.layout().addWidget(self.projMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Group"))
        asstBox.layout().addWidget(self.grpMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Asset"))
        asstBox.layout().addWidget(self.asstMenu)
        asstBox.layout().addStretch(0)

        elBox = QtGui.QGroupBox("Element")
        elBox.setLayout(QtGui.QGridLayout())

        elBox.layout().addWidget(QtGui.QLabel("Class"), 0, 0)
        elBox.layout().addWidget(self.elclassMenu, 0, 1)
        elBox.layout().addWidget(QtGui.QLabel("Type"), 1, 0)
        elBox.layout().addWidget(self.eltypeMenu, 1, 1)
        elBox.layout().addWidget(self.eltypeBox, 1, 2)
        elBox.layout().addWidget(QtGui.QLabel("Name"), 2, 0)
        elBox.layout().addWidget(self.elnameMenu, 2, 1)
        elBox.layout().addWidget(self.elnameBox, 2, 2)

        miscBox = QtGui.QGroupBox("Optional")
        miscBox.setLayout(QtGui.QVBoxLayout())

        miscBox.layout().addWidget(QtGui.QLabel("Thumbnail"))
        miscBox.layout().addWidget(self.thumbnailBox)
        miscBox.layout().addWidget(QtGui.QLabel("Comment"))
        miscBox.layout().addWidget(self.commentBox)

        self.layout().addWidget(asstBox)
        self.layout().addWidget(elBox)
        self.layout().addWidget(miscBox)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
        self.elclassMenu.activated.connect(self.loadTypes)
        self.eltypeMenu.activated.connect(self.loadNames)
        self.elnameMenu.activated.connect(self.setName)
        self.eltypeBox.textEdited.connect(self.newType)
        self.elnameBox.textEdited.connect(self.newName)
        self.commentBox.textChanged.connect(self.loadComment)
Beispiel #21
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        global proj, grp, asst, elclass, eltype, elname, vers, elpass

        self.elclasses = elclasses

        proj = os.getenv("PROJ")
        grp = os.getenv("GRP")
        asst = os.getenv("ASST")
        elclass = None
        eltype = None
        elname = None
        vers = None
        elpass = None

        self.setLayout(QtGui.QGridLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)
        self.layout().setSpacing(2)

        self.projMenu = QtGui.QComboBox()
        self.grpMenu = QtGui.QComboBox()
        self.asstMenu = QtGui.QComboBox()
        self.elclassMenu = QtGui.QComboBox()
        self.eltypeList = QtGui.QListWidget()
        self.elnameList = QtGui.QListWidget()
        self.versList = QtGui.QListWidget()

        self.passList = QtGui.QListWidget()

        self.elCreatedBy = QtGui.QLabel("N/A")
        self.elCreatedAt = QtGui.QLabel("N/A")
        self.elComment = QtGui.QLabel("N/A")
        self.elThumb = QtGui.QLabel()

        self.verCreatedBy = QtGui.QLabel("N/A")
        self.verCreatedAt = QtGui.QLabel("N/A")
        self.verComment = QtGui.QLabel("N/A")
        self.verThumb = QtGui.QLabel()
        self.verFilesList = QtGui.QListWidget()

        img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png"))
        imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio)
        self.elThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))
        self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs))

        pl = sorted(ueAssetUtils.getProjectsList())
        for p in pl:
            self.projMenu.addItem(p)
        self.projMenu.setCurrentIndex(pl.index(proj))

        gl = sorted(ueAssetUtils.getGroupsList(ueSpec.Spec(proj)))
        for g in gl:
            self.grpMenu.addItem(g)
        self.grpMenu.setCurrentIndex(gl.index(grp))

        al = sorted(ueAssetUtils.getAssetsList(ueSpec.Spec(proj, grp)))
        for a in al:
            self.asstMenu.addItem(a)
        self.asstMenu.setCurrentIndex(al.index(asst))

        for c in sorted(self.elclasses):
            self.elclassMenu.addItem(c)
        elclass = str(self.elclassMenu.currentText())

        self.elements = ueAssetUtils.getElements(ueSpec.Spec(proj, grp, asst))

        if elclass in self.elements:
            for t in sorted(self.elements[elclass]):
                self.eltypeList.addItem(QtGui.QListWidgetItem(t))
            self.eltypeList.setCurrentItem(self.eltypeList.item(0))
            eltype = str(self.eltypeList.currentItem().text())

            if eltype in self.elements[elclass]:
                for n in sorted(self.elements[elclass][eltype]):
                    self.elnameList.addItem(QtGui.QListWidgetItem(n))
                self.elnameList.setCurrentItem(self.elnameList.item(0))
                elname = str(self.elnameList.currentItem().text())

                self.updateElInfo()

                self.versions = ueAssetUtils.getVersions(ueSpec.Spec(proj, grp, asst, elclass, eltype, elname))
                if len(self.versions) > 0:
                    for v in sorted(range(len(self.versions)), reverse=True):
                        self.versList.addItem(QtGui.QListWidgetItem("%04d" % int(v + 1)))
                    self.versList.setCurrentItem(self.versList.item(0))
                    vers = int(self.versList.currentItem().text())

                    self.loadPasses()

                    self.updateVersInfo()

        asstBox = QtGui.QGroupBox("Asset")
        asstBox.setLayout(QtGui.QHBoxLayout())

        asstBox.layout().addWidget(QtGui.QLabel("Project"))
        asstBox.layout().addWidget(self.projMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Group"))
        asstBox.layout().addWidget(self.grpMenu)
        asstBox.layout().addWidget(QtGui.QLabel("Asset"))
        asstBox.layout().addWidget(self.asstMenu)
        asstBox.layout().addStretch(0)

        passBox = QtGui.QGroupBox("Pass")
        passBox.setLayout(QtGui.QHBoxLayout())

        passBox.layout().addWidget(self.passList)

        elBox = QtGui.QGroupBox("Element")
        elBox.setLayout(QtGui.QHBoxLayout())

        elDesc = QtGui.QWidget()
        elDesc.setLayout(QtGui.QVBoxLayout())

        elDesc.layout().addWidget(QtGui.QLabel("Class"))
        elDesc.layout().addWidget(self.elclassMenu)
        elDesc.layout().addWidget(QtGui.QLabel("Type"))
        elDesc.layout().addWidget(self.eltypeList)
        elDesc.layout().addWidget(QtGui.QLabel("Name"))
        elDesc.layout().addWidget(self.elnameList)

        elVers = QtGui.QWidget()
        elVers.setLayout(QtGui.QVBoxLayout())

        elVers.layout().addWidget(QtGui.QLabel("Version"))
        elVers.layout().addWidget(self.versList)

        elBox.layout().addWidget(elDesc)
        elBox.layout().addWidget(elVers)

        elInfoBox = QtGui.QGroupBox("Element Info")
        elInfoBox.setLayout(QtGui.QGridLayout())

        elInfoBox.layout().addWidget(QtGui.QLabel("Created by"), 0, 0)
        elInfoBox.layout().addWidget(self.elCreatedBy, 0, 1)
        elInfoBox.layout().addWidget(QtGui.QLabel("Created at"), 1, 0)
        elInfoBox.layout().addWidget(self.elCreatedAt, 1, 1)
        elInfoBox.layout().addWidget(QtGui.QLabel("Comment"), 2, 0)
        elInfoBox.layout().addWidget(self.elComment, 2, 1)
        elInfoBox.layout().addWidget(self.elThumb, 0, 2, 3, 2)

        verInfoBox = QtGui.QGroupBox("Version Info")
        verInfoBox.setLayout(QtGui.QGridLayout())

        verInfoBox.layout().addWidget(QtGui.QLabel("Created by"), 0, 0)
        verInfoBox.layout().addWidget(self.verCreatedBy, 0, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Created at"), 1, 0)
        verInfoBox.layout().addWidget(self.verCreatedAt, 1, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Comment"), 2, 0)
        verInfoBox.layout().addWidget(self.verComment, 2, 1)
        verInfoBox.layout().addWidget(QtGui.QLabel("Files"), 3, 0, 1, 4)
        verInfoBox.layout().addWidget(self.verFilesList, 4, 0, 1, 4)
        verInfoBox.layout().addWidget(self.verThumb, 0, 2, 3, 2)

        self.layout().addWidget(asstBox)
        self.layout().addWidget(elBox)
        self.layout().addWidget(passBox)
        self.layout().addWidget(elInfoBox)
        self.layout().addWidget(verInfoBox)

        self.projMenu.activated.connect(self.loadGroups)
        self.grpMenu.activated.connect(self.loadAssets)
        self.asstMenu.activated.connect(self.loadElements)
        self.elclassMenu.activated.connect(self.loadTypes)
        self.eltypeList.itemSelectionChanged.connect(self.loadNames)
        self.elnameList.itemSelectionChanged.connect(self.loadVers)
        self.versList.itemSelectionChanged.connect(self.setVers)
        self.passList.itemSelectionChanged.connect(self.setPass)