def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Data generation')
        self.human = gui3d.app.selectedHuman

        box = self.addLeftWidget(gui.GroupBox('Data generation'))
        self.button = box.addWidget(gui.Button('Generate'))
        self.path_label = box.addWidget(gui.TextView('Path'))
        self.path = box.addWidget(gui.TextEdit())
        self.num_label = box.addWidget(gui.TextView('# Meshes'))
        self.num = box.addWidget(gui.TextEdit())

        @self.button.mhEvent
        def onClicked(event):
            num_gen = int(self.num.getText())
            t0 = time.time()

            for i in range(num_gen):
                randomize(self.human, 0.5, True, True, False, True)
                cfg = Mhx2Config()
                cfg.useTPose = False
                cfg.useBinary = True
                cfg.useExpressions = False
                cfg.usePoses = True
                cfg.feetOnGround = True
                cfg.scale, cfg.unit = 0.1, 'meter'
                cfg.setHuman(self.human)
                from . import mh2mhx2
                mh2mhx2.exportMhx2('%s/%s.mhx2' % (self.path.getText(), i),
                                   cfg)

                eta = int(
                    (num_gen - 1 - i) * ((time.time() - t0) / (i + 1)) / 60)
                gui3d.app.statusPersist('ETA: %s minutes' % eta)
Ejemplo n.º 2
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Standardize Models')


        buttonsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        buttonsBox.addWidget(gui.TextView("Options"))
        self.geoBox = buttonsBox.addWidget(gui.CheckBox("Geometries"))
        self.shapeBox = buttonsBox.addWidget(gui.CheckBox("Shapes"))
        # self.AAbox.selected
        
        self.path_out = ""
        self.path_button_out = buttonsBox.addWidget(gui.BrowseButton('dir', "Select an output directory"))
        self.out_path_box = buttonsBox.addWidget(gui.TextEdit(self.path_out))
        
        self.path_in = ""
        self.path_button_in = buttonsBox.addWidget(gui.BrowseButton('dir', "Select an input directory"))
        self.in_path_box = buttonsBox.addWidget(gui.TextEdit(self.path_in))
        
        self.path_exemplar = ""
        self.path_button_exemplar = buttonsBox.addWidget(gui.BrowseButton('open', "Select the standard model"))
        self.exemplar_path_box = buttonsBox.addWidget(gui.TextEdit(self.path_exemplar))
        
        @self.path_button_out.mhEvent
        def onClicked(path):
            self.path_out = path
            self.out_path_box.setText(self.path_out)
        
        @self.path_button_in.mhEvent
        def onClicked(path):
            self.path_in = path
            self.in_path_box.setText(self.path_in)
            
        @self.path_button_exemplar.mhEvent
        def onClicked(path):
            self.path_exemplar = path
            self.exemplar_path_box.setText(self.path_exemplar)
        buttonsBox.addWidget(gui.TextView("Features to standardize (comma+space separated regular expressions)"))
        self.standardShapeFeatures = buttonsBox.addWidget(gui.TextEdit("^head, neck, ear, proportions"))
        
        self.goButton = buttonsBox.addWidget(gui.Button('Go'))
        
        @self.goButton.mhEvent
        def onClicked(event):
            settings = {}
            settings['geometries'] = self.geoBox.selected
            settings['shapes'] = self.shapeBox.selected
            settings['standard_shapes'] = self.standardShapeFeatures.getText().split(", ")
            standard = Standardizer(settings['standard_shapes'])
            specific_model = self.exemplar_path_box.getText()
            if specific_model == "":
                specific_model = None
            standard.load_models(self.in_path_box.getText(), specific_model)
            if settings['geometries'] and settings['standard_shapes']:
                standard.standardize_all(self.out_path_box.getText())
            elif settings['geometries']:
                standard.standardize_geometries(self.out_path_box.getText())  
            elif settings['standard_shapes']:
                standard.standardize_shape(self.out_path_box.getText())  
Ejemplo n.º 3
0
    def __init__(self, category):

        super(SaveTargetsTaskView, self).__init__(category, 'Save Targets')

        self.fileName = 'full_target.target'
        self.dirName = gp.getDataPath('custom')

        self.saveBox = gui.GroupBox('Save Model as Target')
        self.addLeftWidget(self.saveBox)

        label = self.saveBox.addWidget(gui.TextView('Filename:'))

        self.nameEdit = gui.TextEdit(self.fileName)
        self.nameEdit.textChanged.connect(self.onChange)
        self.saveBox.addWidget(self.nameEdit)

        space = self.saveBox.addWidget(gui.TextView(''))

        self.saveButton = gui.Button('Save')
        self.saveBox.addWidget(self.saveButton)

        self.saveAsButton = gui.BrowseButton(label='Save As ...', mode='save')
        self.saveAsButton.path = os.path.join(self.dirName, self.fileName)
        self.saveAsButton.setFilter('MakeHuman Target ( *.target )')
        self.saveBox.addWidget(self.saveAsButton)

        self.createShortCut()

        @self.saveButton.mhEvent
        def onClicked(event):
            self.quickSave()

        @self.saveAsButton.mhEvent
        def onClicked(path):
            if path:
                if not path.lower().endswith('.target'):
                    error_msg = 'Cannot save target to file: {0:s}\n Expected a path to a .target file'.format(
                        path)
                    dialog = gui.Dialog()
                    dialog.prompt(title='Error',
                                  text=error_msg,
                                  button1Label='OK')
                    return
                else:
                    self.saveTargets(path)
                    self.nameEdit.setText(self.fileName)
                    self.saveAsButton.path = path
                    G.app.statusPersist('Saving Directory: ' + self.dirName)
Ejemplo n.º 4
0
    def _setupSelectedBox(self):
        self.log.trace("Enter")
        self.selectBox = mhapi.ui.createGroupBox("Selected")

        self.thumbnail = self.selectBox.addWidget(gui.TextView())
        self.thumbnail.setPixmap(QtGui.QPixmap(os.path.abspath(self.notfound)))
        self.thumbnail.setGeometry(0, 0, 128, 128)
        self.thumbnail.setMaximumHeight(128)
        self.thumbnail.setMaximumWidth(128)
        self.thumbnail.setScaledContents(True)

        self.selectBox.addWidget(mhapi.ui.createLabel(" "))

        self.btnDetails = mhapi.ui.createButton("View details")
        self.selectBox.addWidget(self.btnDetails)

        @self.btnDetails.mhEvent
        def onClicked(event):
            self._onBtnDetailsClick()

        self.btnDownload = mhapi.ui.createButton("Download")
        self.selectBox.addWidget(self.btnDownload)

        @self.btnDownload.mhEvent
        def onClicked(event):
            self._onBtnDownloadClick()

        self.addRightWidget(self.selectBox)
Ejemplo n.º 5
0
    def _setupDetails(self):
        self.log.trace("Enter")

        layout = QVBoxLayout()

        self.detailsName = mhapi.ui.createLabel("<h1>Selected title</h1>")
        layout.addWidget(self.detailsName)

        self.detailsDesc = mhapi.ui.createLabel("<p>Selected description</p>")
        self.detailsDesc.setWordWrap(True)
        layout.addWidget(self.detailsDesc)

        self.detailsExtras = mhapi.ui.createLabel(
            "<tt>License...: Hej<br />Category...: Hopp</tt>")
        layout.addWidget(self.detailsExtras)

        self.detailsRender = gui.TextView()
        self.detailsRender.setPixmap(QPixmap(os.path.abspath(self.notfound)))
        layout.addWidget(self.detailsRender)

        layout.addStretch(1)

        self.detailsPanel = QWidget()
        self.detailsPanel.setLayout(layout)

        self.addTopWidget(self.detailsPanel)
        self.detailsPanel.hide()
Ejemplo n.º 6
0
    def __init__(self, category, name, label=None, saveName=None, cameraView=None):
        super(MeasureTaskView, self).__init__(category, name, label, saveName, cameraView)

        self.ruler = Ruler()
        self._createMeasureMesh()

        self.active_slider = None
        self.lastActive = None

        self.statsBox = self.addRightWidget(gui.GroupBox('Statistics'))
        self.height = self.statsBox.addWidget(gui.TextView('Height: '))
        self.chest = self.statsBox.addWidget(gui.TextView('Chest: '))
        self.waist = self.statsBox.addWidget(gui.TextView('Waist: '))
        self.hips = self.statsBox.addWidget(gui.TextView('Hips: '))

        '''
Ejemplo n.º 7
0
    def __init__(self):

        super(MetadataView, self).__init__()

        layout = gui.QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        self.label = gui.TextView('Metadata')
        self.label.setAlignment(gui.QtCore.Qt.AlignHCenter)
        layout.addWidget(self.label)
        layout.addSpacing(10)

        self.name_view = NameView()
        layout.addWidget(self.name_view)

        self.uuid_view = UuidView()
        layout.addWidget(self.uuid_view)

        self.tags_view = TagsView()
        layout.addWidget(self.tags_view)

        self.reset_button = gui.Button('Reset Metadata')
        layout.addWidget(self.reset_button)

        @self.reset_button.mhEvent
        def onClicked(event):
            self.uuid_view.clearUuid()
            self.tags_view.clearTags()
            self.name_view.clearName()
            G.app.selectedHuman.setName('')
            G.app.selectedHuman.clearTags()
            G.app.selectedHuman.setUuid('')
Ejemplo n.º 8
0
    def createFileChooser(self):
        """
        Overwrite to do custom initialization of filechooser widget.
        """
        #self.filechooser = self.addTopWidget(fc.FileChooser(self.paths, 'mhclo', 'thumb', mh.getSysDataPath(proxyName+'/notfound.thumb')))
        notfoundIcon = self.getNotFoundIcon()
        if not os.path.isfile(notfoundIcon):
            notfoundIcon = getpath.getSysDataPath('notfound.thumb')

        if self.multiProxy:
            clearIcon = None
        else:
            clearIcon = self.getClearIcon()
            if not os.path.isfile(clearIcon):
                clearIcon = getpath.getSysDataPath('clear.thumb')

        self.filechooser = fc.IconListFileChooser(
            self.paths,
            self.getFileExtension(),
            'thumb',
            notfoundIcon,
            clearIcon,
            name=self.label,
            multiSelect=self.multiProxy,
            noneItem=not self.multiProxy,
            stickyTags=gui3d.app.getSetting('makehumanTags'))
        self.addRightWidget(self.filechooser)

        self.filechooser.setIconSize(50, 50)
        self.filechooser.enableAutoRefresh(False)
        if not isinstance(self.getFileExtension(), str) and \
           len(self.getFileExtension()) > 1:
            self.filechooser.mutexExtensions = True
        #self.addLeftWidget(self.filechooser.createSortBox())

        if self.tagFilter:
            self.filechooser.setFileLoadHandler(fc.TaggedFileLoader(self))
            self.addLeftWidget(self.filechooser.createTagFilter())

        if self.descriptionWidget:
            descBox = self.addLeftWidget(gui.GroupBox('Description'))
            self.descrLbl = descBox.addWidget(gui.TextView(''))
            self.descrLbl.setSizePolicy(gui.QtWidgets.QSizePolicy.Ignored,
                                        gui.QtWidgets.QSizePolicy.Preferred)
            self.descrLbl.setWordWrap(True)

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            self.proxyFileSelected(filename)

        if self.multiProxy:

            @self.filechooser.mhEvent
            def onFileDeselected(filename):
                self.proxyFileDeselected(filename)

            @self.filechooser.mhEvent
            def onDeselectAll(value):
                self.deselectAllProxies()
Ejemplo n.º 9
0
    def __init__(self, category, appFacsAnim):
        gui3d.TaskView.__init__(self, category, 'FACSvatar')
        self.facs_human = appFacsAnim.selectedHuman
        self.app = appFacsAnim
        ##########################################################################
        # .json Au's list loading
        ##########################################################################

        self.facs_code_names_path = getpath.getDataPath('FACSHuman')
        self.facs_code_names_file = self.facs_code_names_path + '/au.json'
        self.facs_code_names = json.loads(
            open(self.facs_code_names_file).read())

        box_facsvatar = self.addLeftWidget(gui.GroupBox('FACSvatar listener'))
        #Box Midi
        self.facsvatar_start_stop = box_facsvatar.addWidget(
            gui.CheckBox('Start FACSvatar'))
        self.facsvatar_label = box_facsvatar.addWidget(
            gui.TextView('Listening STOPPED'))
        #self.facsvatar_render = box_facsvatar.addWidget(gui.CheckBox('Render video'))

        self.facs_modifiers = []
        self.facs_modifiers = G.app.selectedHuman.getModifiersByGroup(
            'Upper Face AUs')
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup('Lower Face AUs'))
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup('Head Positions'))
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup('Eye Positions'))
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup(
                'Lip Parting and Jaw Opening'))
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup('Miscellaneous AUs'))
        self.facs_modifiers.extend(
            G.app.selectedHuman.getModifiersByGroup('Emotions Blender'))

        self.modifiers_sliders = {}

        for mod in self.facs_modifiers:
            self.modifiers_sliders[mod.name] = modifierslider.ModifierSlider(
                modifier=mod, label=mod.name)
            #self.aus_list_items.addItem(self.facs_code_names[str(mod.name)], 'black', mod.name,  False)

# Midi Thread creation
        self.facsvatar_listener = FacsvatarThread(self.modifiers_sliders,
                                                  self.renderFacsPicture)

        @self.facsvatar_start_stop.mhEvent
        def onClicked(event):
            if self.facsvatar_start_stop.selected:
                self.facsvatar_label.setText('START')
                #self.facsvatar_listener.slider_assign(self.animation_test)
                #self.facsvatar_listener.text_box_assign(self.midi_msg_received)
                self.facsvatar_listener.start()
            else:
                self.facsvatar_label.setText('STOP')
                self.facsvatar_listener.stopListening()
Ejemplo n.º 10
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'vsScript')

        box = self.addLeftWidget(gui.GroupBox('vsScript'))
        self.category = category
        # We add a button to the current task
        # A button just fires an event when it is clicked, if a selected texture is specified,
        # it is used while the mouse is down on the button
        self.vsWeight_gui = 1.0
        self.modelName_gui = "T1_large_s_mkh"
        self.userDocPath_gui = r"C:\Users\Bekki\Documents"
        self.mkhPath_gui = r"c:\Program Files\makehuman-community"

        self.aTextEdit = box.addWidget(gui.TextEdit(text='add model name'))
        self.aButton = box.addWidget(gui.Button('Load MKH Model'))
        self.bButton = box.addWidget(gui.Button('Export STL Model'))

        self.pushed = 0
        self.aButtonLabel = box.addWidget(gui.TextView('Pushed 0 times'))
        #self.loadRunScript()

        @self.aButton.mhEvent
        def onClicked(event):
            #loadProxy(gui3d.app, 0.88,"T3_s_mkh",r"C:\Users\Bekki\Documents",  r"c:\Program Files\makehuman-community")
            loadProxy(gui3d.app, self.vsWeight_gui, self.modelName_gui,
                      self.userDocPath_gui, self.mkhPath_gui)

        @self.bButton.mhEvent
        def onClicked(event):
            exportProxy(gui3d.app, self.modelName_gui)

        # We want the slider to start from the middle
        self.aSlider = box.addWidget(
            gui.Slider(value=0.5, label=['Change Weight', ' %.2f']))

        self.aSliderLabel = box.addWidget(gui.TextView('Value is 0.5'))

        @self.aSlider.mhEvent
        def onChange(value):
            self.aSliderLabel.setTextFormat('Weight value is %f', value)
            self.aProgressBar.setProgress(value)

        # we also create a progressbar, which is updated as the slider moves

        self.aProgressBar = box.addWidget(gui.ProgressBar())
        self.aProgressBar.setProgress(0.5)
Ejemplo n.º 11
0
    def __init__(self, category):
        super(TargetsTaskView, self).__init__(category, 'Targets')

        self.items = {}

        self.left.child.setSizePolicy(gui.SizePolicy.MinimumExpanding,
                                      gui.SizePolicy.MinimumExpanding)

        self.clear = self.addLeftWidget(gui.Button('Clear'))

        self.targets = self.addLeftWidget(TargetsTree())
        self.targets.setHeaderHidden(True)
        self.targets.resizeColumnToContents(0)
        self.targets.setSizePolicy(gui.SizePolicy.Ignored,
                                   gui.SizePolicy.Expanding)
        self.left.layout.setStretchFactor(self.targets, 1)

        self.itemsBox = gui.GroupBox('Selected Targets:')
        self.itemsList = gui.TextView('')
        self.itemsList.setWordWrap(False)
        self.itemsList.setSizePolicy(gui.SizePolicy.Ignored,
                                     gui.SizePolicy.Preferred)
        self.itemsBox.addWidget(self.itemsList)
        self.addRightWidget(self.itemsBox)

        @self.targets.mhEvent
        def onActivate(item):
            path = self.targets.getItemPath(item)
            log.message('target: %s', path)
            if item.text not in self.items:
                self.items[item.text] = [item, path]
                self.showTarget(path)
            else:
                self.clearColor()
                del self.items[item.text]
                item.setSelected(False)
                for itm in self.items:
                    self.showTarget(self.items[itm][1])
            itemsString = '\n'.join(
                key.split('.')[0] for key in sorted(self.items))
            for key in self.items:
                self.items[key][0].setSelected(True)
            self.itemsList.setText(itemsString)

        @self.targets.mhEvent
        def onExpand(item):
            self.targets.populate(item)
            self.targets.resizeColumnToContents(0)

        @self.clear.mhEvent
        def onClicked(event):
            self.clearColor()
            self.itemsList.setText('')
            for key in self.items:
                self.items[key][0].setSelected(False)
            self.items.clear()
Ejemplo n.º 12
0
    def __init__(self):
        super(UuidView, self).__init__('UUID')
        self.uuidText = gui.TextView()
        self.addWidget(self.uuidText)
        self.genButton = self.addWidget(gui.Button('Generate UUID'))
        self.uuidText.setWordWrap(True)

        @self.genButton.mhEvent
        def onClicked(event):
            self.uuid = '\n'.join(
                self.isplit(G.app.selectedHuman.newUuid(), 24))
            self.uuidText.setText(self.uuid)
Ejemplo n.º 13
0
 def createWidget(self, value, row):
     type = self.uniform.pytype
     if type == int:
         return IntValue(self, value)
     if type == float:
         return FloatValue(self, value)
     if type == str:
         # TODO account for tex idx
         defaultPath = mh.getSysDataPath('litspheres') if self.uniform.name == 'litsphereTexture' else None
         widget = TextureValue(self, value, defaultPath)
         if self.uniform.name == 'litsphereTexture':
             widget.setEnabled(not self.material.autoBlendSkin)
         return widget
     if type == bool:
         return BooleanValue(self, value)
     return gui.TextView('???')
Ejemplo n.º 14
0
    def makeProps(self):
        SceneItem.makeProps(self)

        self.widget.addWidget(gui.TextView("Ambience"))
        self.colbox = self.widget.addWidget(
            gui.TextEdit(", ".join(
                [str(x) for x in self.sceneview.scene.environment.ambience])))

        @self.colbox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.sceneview.scene.environment.ambience = tuple(
                    [float(x) for x in value.split(",")])
            except:
                pass
Ejemplo n.º 15
0
 def createTargetControls(self, box, targetFile, facsTargetFolder, boxName):
     targetFile = os.path.relpath(targetFile, facsTargetFolder)
     facs_modifier = humanmodifier.SimpleModifier(boxName, facsTargetFolder,
                                                  targetFile)
     facs_modifier.setHuman(self.facs_human)
     self.label_create = str(facs_modifier.name)
     self.labelSlider[self.label_create] = box.addWidget(
         gui.TextView("Intensity: 0%"))
     self.slidersValues[self.label_create] = 0
     self.sliders[self.label_create] = box.addWidget(
         modifierslider.ModifierSlider(
             modifier=facs_modifier,
             label=self.facs_code_names[self.label_create]))
     # Create object for mhEvent on sliders to catch values and update labeltxt
     FACSslider(self.sliders[self.label_create],
                self.labelSlider[self.label_create], self.slidersValues,
                self.label_create)
Ejemplo n.º 16
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Animations')

        self.human = gui3d.app.selectedHuman

        self.playbackSlider = self.addLeftWidget(gui.Slider(label='Frame'))
        self.playbackSlider.setMin(0)
        self.frameLbl = self.addLeftWidget(gui.TextView(''))
        self.frameLbl.setTextFormat(u"Frame: %s", 0)

        @self.playbackSlider.mhEvent
        def onChange(value):
            self.updateFrame(int(value))

        @self.playbackSlider.mhEvent
        def onChanging(value):
            self.updateFrame(int(value))
Ejemplo n.º 17
0
    def __init__(self, name, value, defaultPath = None):
        super(FileValue, self).__init__(name)
        self.name = name

        self.fileText = self.addWidget(gui.TextView(''), 0, 0)
        self.browseBtn = self.addWidget(gui.BrowseButton(), 1, 0)

        if value:
            self.browseBtn._path = pathToUnicode(value)
        elif defaultPath:
            self.browseBtn._path = pathToUnicode(defaultPath)

        @self.browseBtn.mhEvent
        def onClicked(path):
            if not path:
                return
            self.setValue(path)
            self.callEvent('onActivate', self.getValue())

        self.setValue(value)
Ejemplo n.º 18
0
    def _setupDetails(self):
        self.log.trace("Enter")

        layout = QVBoxLayout()

        self.detailsName = mhapi.ui.createLabel("<h1>Selected title</h1>")
        layout.addWidget(self.detailsName)

        self.detailsDesc = mhapi.ui.createLabel("<p>Selected description</p>")
        self.detailsDesc.setWordWrap(True)
        layout.addWidget(self.detailsDesc)

        self.detailsExtras = mhapi.ui.createLabel(
            "<tt>License...: Hej<br />Category...: Hopp</tt>")
        layout.addWidget(self.detailsExtras)

        self.detailsRender = gui.TextView()
        self.detailsRender.setPixmap(QPixmap(os.path.abspath(self.notfound)))
        layout.addWidget(self.detailsRender)

        self.btnDownloadScreenshot = mhapi.ui.createButton(
            "Download screenshot")

        @self.btnDownloadScreenshot.mhEvent
        def onClicked(event):
            self._onBtnDownloadScreenshotClick()

        blayout = QHBoxLayout()
        bwidget = QWidget()
        bwidget.setLayout(blayout)
        blayout.addWidget(self.btnDownloadScreenshot)
        blayout.addStretch(1)

        layout.addWidget(bwidget)
        layout.addStretch(1)

        self.detailsPanel = QWidget()
        self.detailsPanel.setLayout(layout)

        self.addTopWidget(self.detailsPanel)
        self.detailsPanel.hide()
Ejemplo n.º 19
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Example')

        box = self.addLeftWidget(gui.GroupBox('Example'))
        
        # We add a button to the current task
        # A button just fires an event when it is clicked, if a selected texture is specified,
        # it is used while the mouse is down on the button

        self.aButton = box.addWidget(gui.Button('Button'))
        
        self.pushed = 0
        self.aButtonLabel = box.addWidget(gui.TextView('Pushed 0 times'))

        @self.aButton.mhEvent
        def onClicked(event):
            self.pushed += 1
            self.aButtonLabel.setTextFormat('Pushed %d times', self.pushed)

        # We add a toggle button to the current task
        # A toggle button fires an event when it is clicked but retains its selected state after the mouse is up,
        # if a selected texture is specified, it is used to show whether the button is toggled

        self.aToggleButton = box.addWidget(gui.CheckBox('ToggleButton'))

        self.aToggleButtonLabel = box.addWidget(gui.TextView('Not selected'))

        @self.aToggleButton.mhEvent
        def onClicked(event):
            if self.aToggleButton.selected:
                self.aToggleButtonLabel.setText('Selected')
            else:
                self.aToggleButtonLabel.setText('Not selected')

        # Next we will add some radio buttons. For this we need a group, since only one in the group can be selected
        # A radio button fires an event when it is clicked but retains its selected state after the mouse is up, and deselects all other buttons in the group
        # If a selected texture is specified, it is used to show whether the button is selected

        self.aRadioButtonGroup = []

         # We make the first one selected
        self.aRadioButton1 = box.addWidget(gui.RadioButton(self.aRadioButtonGroup, 'RadioButton1', selected=True))
        self.aRadioButton2 = box.addWidget(gui.RadioButton(self.aRadioButtonGroup, 'RadioButton2'))

        self.aRadioButtonLabel = box.addWidget(gui.TextView('Button 1 is selected'))

        @self.aRadioButton1.mhEvent
        def onClicked(event):
            self.aRadioButtonLabel.setText('Button 1 is selected')

        @self.aRadioButton2.mhEvent
        def onClicked(event):
            self.aRadioButtonLabel.setText('Button 2 is selected')

        # When the slider is dragged and released, an onChange event is fired
        # By default a slider goes from 0.0 to 1.0, and the initial position will be 0.0 unless specified

        # We want the slider to start from the middle
        self.aSlider = box.addWidget(gui.Slider(value=0.5, label=['Slider',' %.2f']))

        self.aSliderLabel = box.addWidget(gui.TextView('Value is 0.5'))

        @self.aSlider.mhEvent
        def onChange(value):
            self.aSliderLabel.setTextFormat('Value is %f', value)
            self.aProgressBar.setProgress(value)

        # we also create a progressbar, which is updated as the slider moves

        self.aProgressBar = box.addWidget(gui.ProgressBar())
        self.aProgressBar.setProgress(0.5)
        
        # A text edit

        self.aTextEdit = box.addWidget(gui.TextEdit(text='Some text'))
        
        self.meshSlider = box.addWidget(gui.Slider(value=0.5, label=['Mesh distort',' %0.2f']))
        
        self.isMeshStored = False
        @self.meshSlider.mhEvent
        def onChanging(value):
            human = gui3d.app.selectedHuman
            if self.isMeshStored:
                self.restoreMesh(human)
            else:
                self.storeMesh(human)
                self.isMeshStored = True
            human.mesh.coord += human.mesh.vnorm * value
            human.mesh.markCoords(coor=True)
            human.mesh.update()
    
        @self.meshSlider.mhEvent
        def onChange(value):
            human = gui3d.app.selectedHuman
            human.applyAllTargets()
            self.isMeshStored = False
            human.mesh.coord += human.mesh.vnorm * value
            human.mesh.markCoords(coor=True)
            human.mesh.update()
Ejemplo n.º 20
0
    def __init__(self, category):

        info_msg = "Install new plugins by either copying to the user plugins folder or using the built in installer.\n"\
                   "The installer only handles Python script files and plugin packages in plain zip file format."\
                   "\n\nTo activate a plugin it must be checked in the list. Then click the \"Activate\"-Button or " \
                   "restart MakeHuman.\nTo deactivate a plugin uncheck it in the list and restart MakeHuman."

        gui3d.TaskView.__init__(self, category, 'User Plugins')

        self.userPlugins = getUserPlugins()
        activePlugins = gui3d.app.getSetting('activeUserPlugins')

        for plugin in activePlugins:
            if plugin not in [k for k, _ in self.userPlugins]:
                activePlugins.remove(plugin)

        gui3d.app.setSetting('activeUserPlugins', activePlugins)
        gui3d.app.saveSettings()

        self.home = getpath.getHomePath()

        scroll = self.addTopWidget(gui.VScrollArea())
        self.userPluginBox = gui.GroupBox('User Plugins')
        self.userPluginBox.setSizePolicy(gui.SizePolicy.MinimumExpanding,
                                         gui.SizePolicy.Preferred)
        scroll.setWidget(self.userPluginBox)

        self.updatePluginList()

        installWidget = gui.QtWidgets.QWidget()
        installWidgetLayout = gui.QtWidgets.QVBoxLayout()
        installWidget.setLayout(installWidgetLayout)
        self.addLeftWidget(installWidget)

        installBox = gui.GroupBox('')
        self.installPyButton = gui.Button('Install Plugin File')
        installBox.addWidget(self.installPyButton)
        self.installZipButton = gui.Button('Install Zipped Plugin')
        installBox.addWidget(self.installZipButton)
        installWidgetLayout.addWidget(installBox)

        actionsBox = gui.GroupBox('')
        self.reloadButton = gui.Button('Reload Plugins Folder')
        actionsBox.addWidget(self.reloadButton)
        self.activateButton = gui.Button('Activate Plugins')
        actionsBox.addWidget(self.activateButton)
        installWidgetLayout.addWidget(actionsBox)

        infoBox = gui.GroupBox('Info')
        infoText = gui.TextView(info_msg)
        infoText.setWordWrap(True)
        infoText.setSizePolicy(gui.SizePolicy.Ignored,
                               gui.SizePolicy.MinimumExpanding)
        infoBox.addWidget(infoText)
        installWidgetLayout.addWidget(infoBox)
        installWidgetLayout.addStretch(1)

        @self.installZipButton.mhEvent
        def onClicked(event):

            filename = getpath.pathToUnicode(
                gui.QtWidgets.QFileDialog.getOpenFileName(
                    gui3d.app.mainwin,
                    directory=self.home,
                    filter='Zip files ( *.zip );; All files ( *.* )')[0])

            dest_path = getpath.getPath('plugins')
            if os.path.isfile(filename):
                result = decompress(filename, dest_path)
                if result == 0:
                    self.updatePluginList()
                    gui3d.app.prompt(
                        'Info',
                        'The plugin copied successfully. To activate, check '
                        'the plugin in the list and press the "Activate"-Button or restart MakeHuman.',
                        'OK',
                        helpId='installPluginHelp')
                elif result == 3:
                    gui3d.app.prompt(
                        'Warning',
                        'Potentially dangerous zip file, containing files with unsuitable path. '
                        'Inspect/fix the zip file before usage!', 'OK')
                elif result == 4:
                    gui3d.app.prompt(
                        'Error',
                        'Zip file {0:s} contains exiting files.'.format(
                            filename), 'OK')
                elif result == 1:
                    gui3d.app.prompt('Error',
                                     'Not a zip file {0:s}'.format(filename),
                                     'OK')
            self.home = os.path.dirname(filename)

        @self.installPyButton.mhEvent
        def onClicked(event):
            filename = getpath.pathToUnicode(
                gui.QtWidgets.QFileDialog.getOpenFileName(
                    gui3d.app.mainwin,
                    directory=self.home,
                    filter='Python files ( *.py );; All files ( *.* )')[0])
            if os.path.isfile(filename) and os.path.splitext(
                    filename)[1] == '.py':
                try:
                    shutil.copy2(filename, getpath.getPath('plugins'))
                except OSError as e:
                    gui3d.app.prompt(
                        'Error',
                        'Failed to copy {0:s} to user plugins folder'.format(
                            filename), 'OK')
                self.updatePluginList()
                gui3d.app.prompt(
                    'Info',
                    'The plugin copied successfully. To activate, check '
                    'the plugin in the list and press the "Activate"-Button or restart MakeHuman.',
                    'OK',
                    helpId='installPluginHelp')
            self.home = os.path.dirname(filename)

        @self.reloadButton.mhEvent
        def onClicked(event):
            self.updatePluginList()

        @self.activateButton.mhEvent
        def onClicked(event):
            for child in self.userPluginBox.children:
                if child.selected:
                    if not child.module in gui3d.app.modules:
                        if not gui3d.app.loadPlugin(name=child.module,
                                                    location=child.path):
                            gui3d.app.prompt(
                                'Error',
                                'Cannot load module {0:s}\nCheck the log files'
                                .format(child.module), 'OK')
                    else:
                        log.message(
                            'Module %s already exists and will not be imported a second time.',
                            child.module)
Ejemplo n.º 21
0
    def __init__(self, category):

        super(SaveTargetsTaskView, self).__init__(category, 'Save Targets')

        mainPanel = QtWidgets.QWidget()
        layout = QtWidgets.QVBoxLayout()
        mainPanel.setLayout(layout)

        metaFileID = str(uuid4()) + '.target'
        self.metaFilePath = os.path.join(os.path.dirname(__file__),
                                         '__cache__')
        self.metaFile = os.path.join(self.metaFilePath, metaFileID)

        self.fileName = 'full_target.target'
        self.dirName = gp.getDataPath('custom')

        self.diffFileName = 'diff_target.target'
        self.diffDirName = gp.getDataPath('custom')

        self.saveBox = gui.GroupBox('Save Model as Target')
        layout.addWidget(self.saveBox)

        layout.addSpacing(15)

        label = self.saveBox.addWidget(gui.TextView('Filename:'))

        self.nameEdit = gui.TextEdit(self.fileName)
        self.nameEdit.textChanged.connect(self.onChange)
        self.saveBox.addWidget(self.nameEdit)

        self.stripBaseTargets = gui.CheckBox('Strip Base Targets', True)
        self.saveBox.addWidget(self.stripBaseTargets)

        self.saveButton = gui.Button('Save')
        self.saveBox.addWidget(self.saveButton)

        self.saveAsButton = gui.BrowseButton(label='Save As ...', mode='save')
        self.saveAsButton.path = os.path.join(self.dirName, self.fileName)
        self.saveAsButton.setFilter('MakeHuman Target ( *.target )')
        self.saveBox.addWidget(self.saveAsButton)

        self.saveDiffBox = gui.GroupBox('Save Diff Target')
        layout.addWidget(self.saveDiffBox)

        layout.addSpacing(15)

        self.diffNameEdit = gui.TextEdit(self.diffFileName)
        self.diffNameEdit.textChanged.connect(self.onDiffChange)
        self.saveDiffBox.addWidget(self.diffNameEdit)

        self.setBaseButton = gui.Button('Set Base')
        self.saveDiffBox.addWidget(self.setBaseButton)

        self.saveDiffButton = gui.Button('Save')
        self.saveDiffBox.addWidget(self.saveDiffButton)

        self.saveDiffAsButton = gui.BrowseButton(label='Save As ...',
                                                 mode='save')
        self.saveDiffAsButton.path = os.path.join(self.diffDirName,
                                                  self.diffFileName)
        self.saveDiffAsButton.setFilter('MakeHuman Target ( *.target )')
        self.saveDiffBox.addWidget(self.saveDiffAsButton)

        self.clearButton = gui.Button(label='Clear Cache')
        self.saveDiffBox.addWidget((self.clearButton))

        infoBox = gui.GroupBox('Info')
        layout.addWidget(infoBox)
        infoText = gui.TextView(info_message)
        infoText.setWordWrap(True)
        infoBox.setSizePolicy(gui.SizePolicy.Ignored, gui.SizePolicy.Preferred)
        infoBox.addWidget(infoText)

        layout.addStretch()
        self.addLeftWidget(mainPanel)

        self.createShortCut()

        @self.saveAsButton.mhEvent
        def beforeBrowse(event):
            self.saveAsButton.path = os.path.join(self.dirName, self.fileName)

        @self.saveDiffAsButton.mhEvent
        def beforeBrowse(event):
            self.saveDiffAsButton.path = os.path.join(self.dirName,
                                                      self.fileName)

        @self.saveButton.mhEvent
        def onClicked(event):
            self.quickSave()

        @self.saveAsButton.mhEvent
        def onClicked(path):
            if os.path.exists(path):
                if not path.lower().endswith('.target'):
                    error_msg = 'Cannot save target to file: {0:s}\nExpected a path to a .target file'.format(
                        path)
                    dialog = gui.Dialog()
                    dialog.prompt(title='Error',
                                  text=error_msg,
                                  button1Label='OK')
                    log.error('Cannot save targets to %s. Not a .target file.',
                              path)
                    return
                else:
                    self.saveTargets(path, self.stripBaseTargets.selected)
                    self.fileName = os.path.basename(path)
                    self.dirName = os.path.dirname(path)
                    self.nameEdit.setText(self.fileName)
                    self.saveAsButton.path = path
                    G.app.statusPersist('Saving Target Directory: ' +
                                        self.dirName +
                                        '   Saving Diff Targets Directory: ' +
                                        self.diffDirName)

        @self.setBaseButton.mhEvent
        def onClicked(event):
            if not os.path.isdir(self.metaFilePath):
                os.mkdir(self.metaFilePath)
            self.saveTargets(self.metaFile, False)

        @self.saveDiffButton.mhEvent
        def onClicked(event):
            if not os.path.isfile(self.metaFile):
                error_msg = 'No Base Model defined.\nPress "Set Base"'
                dialog = gui.Dialog()
                dialog.prompt(title='Error', text=error_msg, button1Label='OK')
                log.warning(error_msg)
            else:
                path = os.path.join(self.diffDirName, self.diffFileName)
                overwrite = True
                dialog = gui.Dialog()

                if not path.lower().endswith('.target'):
                    error_msg = 'Cannot save target to file: {0:s}\nExpected a path to a .target file'.format(
                        path)
                    dialog.prompt(title='Error',
                                  text=error_msg,
                                  button1Label='OK')
                    log.error('Cannot save targets to %s. Not a .target file.',
                              path)
                    return
                else:
                    if os.path.exists(path):
                        msg = 'File {0:s} already exists. Overwrite?'.format(
                            path)
                        overwrite = dialog.prompt(title='Warning',
                                                  text=msg,
                                                  button1Label='YES',
                                                  button2Label='NO')
                        if overwrite:
                            log.message('Overwriting %s ...', path)
                    if overwrite:
                        human = G.app.selectedHuman
                        target = algos3d.getTarget(human.meshData,
                                                   self.metaFile)
                        target.apply(human.meshData, -1)
                        self.saveTargets(path, False)
                        target.apply(human.meshData, 1)

        @self.saveDiffAsButton.mhEvent
        def onClicked(path):
            if path:
                if not os.path.isfile(self.metaFile):
                    error_msg = 'No Base Model defined.\nPress "Set Base"'
                    dialog = gui.Dialog()
                    dialog.prompt(title='Error',
                                  text=error_msg,
                                  button1Label='OK')
                    log.warning(error_msg)
                else:
                    if not path.lower().endswith('.target'):
                        error_msg = 'Cannot save diff target to file: {0:s}\nExpected a path to a .target file'.format(
                            path)
                        dialog = gui.Dialog()
                        dialog.prompt(title='Error',
                                      text=error_msg,
                                      button1Label='OK')
                        return
                    else:
                        human = G.app.selectedHuman
                        target = algos3d.getTarget(human.meshData,
                                                   self.metaFile)
                        target.apply(human.meshData, -1)
                        self.saveTargets(path, False)
                        target.apply(human.meshData, 1)
                        self.diffFileName = os.path.basename(path)
                        self.diffDirName = os.path.dirname(path)
                        self.diffNameEdit.setText(self.diffFileName)
                        self.saveDiffAsButton.path = path
                        G.app.statusPersist(
                            'Saving Target Directory: ' + self.dirName +
                            '   Saving Diff Targets Directory: ' +
                            self.diffDirName)

        @self.clearButton.mhEvent
        def onClicked(sevent):
            for file in os.listdir(path=self.metaFilePath):
                if file:
                    try:
                        os.remove(os.path.join(self.metaFilePath, file))
                    except os.error as e:
                        pass
Ejemplo n.º 22
0
    def __init__(self, category):
        RenderTaskView.__init__(self, category, 'Interpolation Render')

        # Declare settings
        G.app.addSetting('GL_RENDERER_SSS', False)
        G.app.addSetting('GL_RENDERER_AA', True)

        # Don't change shader for this RenderTaskView.
        self.taskViewShader = G.app.selectedHuman.material.shader

        settingsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        settingsBox.addWidget(gui.TextView("Resolution"))
        self.resBox = settingsBox.addWidget(
            gui.TextEdit("x".join(
                [str(self.renderingWidth),
                 str(self.renderingHeight)])))
        self.AAbox = settingsBox.addWidget(gui.CheckBox("Anti-aliasing"))
        self.AAbox.setSelected(G.app.getSetting('GL_RENDERER_AA'))

        self.path = ""
        self.path_button = settingsBox.addWidget(
            gui.BrowseButton('dir', "Select an output directory"))
        self.pathBox = settingsBox.addWidget(gui.TextEdit(self.path))

        @self.path_button.mhEvent
        def onClicked(path):
            self.path = path
            self.pathBox.setText(self.path)

        self.renderButton = settingsBox.addWidget(gui.Button('Render'))

        self.lightmapSSS = gui.CheckBox("Lightmap SSS")
        self.lightmapSSS.setSelected(G.app.getSetting('GL_RENDERER_SSS'))

        self.optionsBox = self.addLeftWidget(gui.GroupBox('Options'))
        self.optionsWidgets = []

        renderMethodBox = self.addRightWidget(
            gui.GroupBox('Rendering methods'))
        self.renderMethodList = renderMethodBox.addWidget(gui.ListView())
        self.renderMethodList.setSizePolicy(gui.SizePolicy.Ignored,
                                            gui.SizePolicy.Preferred)

        # Rendering methods
        self.renderMethodList.addItem('Quick Render')
        self.renderMethodList.addItem('Advanced Render',
                                      data=[self.lightmapSSS])

        if not mh.hasRenderToRenderbuffer():
            self.firstTimeWarn = True
            # Can only use screen grabbing as fallback,
            # resolution option disabled
            self.resBox.setEnabled(False)
            self.AAbox.setEnabled(False)

        self.listOptions(None)

        # add interpolation settings to the right pane
        interpolateFrameBox = self.addRightWidget(gui.GroupBox('Total Frames'))
        interpolateFrameBox.addWidget(gui.TextView("Frames"))
        self.framesBox = interpolateFrameBox.addWidget(gui.TextEdit("120"))

        interpolatedFramesBox = self.addRightWidget(
            gui.GroupBox('Interpolated Frames'))
        self.interpolatedFramesList = interpolatedFramesBox.addWidget(
            gui.ListView())
        self.interpolatedFramesList.setSizePolicy(gui.SizePolicy.Ignored,
                                                  gui.SizePolicy.Preferred)
        self.interpolatedFramesList.setVerticalScrollingEnabled(True)
        self.addFrame = interpolatedFramesBox.addWidget(
            gui.Button('Add Frame'))
        self.removeFrame = interpolatedFramesBox.addWidget(
            gui.Button('Remove Frame'))
        self.save_button = interpolatedFramesBox.addWidget(
            gui.BrowseButton('save', "Save As.."))
        self.load_button = interpolatedFramesBox.addWidget(
            gui.BrowseButton('open', 'Load JSON'))

        self.key_frames = None

        @self.load_button.mhEvent
        def onClicked(path):
            with open(path, 'r') as f:
                self.key_frames = json.load(f)
                self.GUItize_key_frames()
                self.resort_frames()

        @self.save_button.mhEvent
        def onClicked(path):
            self.generate_key_frames()

            with open(path, 'w') as f:
                json.dump(self.key_frames, f)

        interpolateSettingsBox = self.addRightWidget(
            gui.GroupBox('Interpolation Settings'))
        interpolateSettingsBox.addWidget(
            gui.TextView(
                "Current Frame (integer frame # or float proportion)"))
        self.currentFramesBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("0.0"))
        interpolateSettingsBox.addWidget(
            gui.TextView("Orbit Camera Y (left-right)"))
        self.camY = interpolateSettingsBox.addWidget(gui.TextEdit(""))
        interpolateSettingsBox.addWidget(
            gui.TextView("Oribt Camera X (up-down)"))
        self.camX = interpolateSettingsBox.addWidget(gui.TextEdit(""))
        interpolateSettingsBox.addWidget(gui.TextView("Model File"))

        self.modelBox = interpolateSettingsBox.addWidget(gui.TextEdit(""))
        self.model_button = interpolateSettingsBox.addWidget(
            gui.BrowseButton('open', "Select a model file"))

        @self.model_button.mhEvent
        def onClicked(path):
            self.modelBox.setText(path)

        interpolateSettingsBox.addWidget(
            gui.TextView("Model Extrapolation Percentage"))
        self.modelPercentageBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("100"))

        interpolateSettingsBox.addWidget(
            gui.TextView("Expression file (or specify 'None')"))
        self.expressionBox = interpolateSettingsBox.addWidget(gui.TextEdit(""))
        self.expression_button = interpolateSettingsBox.addWidget(
            gui.BrowseButton('open', "Select an expression file"))
        interpolateSettingsBox.addWidget(
            gui.TextView("Expression Extrapolation Percentage"))
        self.expressionPercentageBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("100"))

        @self.expression_button.mhEvent
        def onClicked(path):
            self.expressionBox.setText(path)

        self.updateFrame = interpolateSettingsBox.addWidget(
            gui.Button('Update Frame'))

        self.keybox = {
            "frame": self.currentFramesBox,
            "rot_Y": self.camY,
            "rot_X": self.camX,
            "model": self.modelBox,
            "expression": self.expressionBox
        }

        @self.framesBox.mhEvent
        def onChange(value):
            try:
                tmp = 1 / int(value)
                self.resort_frames()
            except:
                pass

        # save the values back to the selected frame
        @self.updateFrame.mhEvent
        def onClicked(event):
            selected_frame = self.interpolatedFramesList.selectedItems()
            if len(selected_frame) == 0:
                return
            selected_frame = selected_frame[0]
            selected_frame.setText('Frame {0}'.format(
                self.currentFramesBox.getText()))
            selected_frame.setUserData(
                data={
                    "frame":
                    self.num(self.currentFramesBox.getText()),
                    "rot_Y":
                    self.num(self.camY.getText()),
                    "rot_X":
                    self.num(self.camX.getText()),
                    "model":
                    self.modelBox.getText() + "|" +
                    self.modelPercentageBox.getText(),
                    "expression":
                    self.expressionBox.getText() + "|" +
                    self.expressionPercentageBox.getText()
                })
            self.resort_frames()

        @self.addFrame.mhEvent
        def onClicked(event):
            self.interpolatedFramesList.addItem(
                'Frame {0}'.format(self.currentFramesBox.getText()),
                data={
                    "frame":
                    self.num(self.currentFramesBox.getText()),
                    "rot_Y":
                    self.num(self.camY.getText()),
                    "rot_X":
                    self.num(self.camX.getText()),
                    "model":
                    self.modelBox.getText() + "|" +
                    self.modelPercentageBox.getText(),
                    "expression":
                    self.expressionBox.getText() + "|" +
                    self.expressionPercentageBox.getText()
                })
            self.resort_frames()

        @self.removeFrame.mhEvent
        def onClicked(event):
            selected_frame = self.interpolatedFramesList.selectedItems()
            if len(selected_frame) == 0:
                return
            selected_frame = selected_frame[0]
            new_items = [
                item for item in self.interpolatedFramesList.getItems()
                if item is not selected_frame
            ]
            self.reassign(new_items)

        @self.interpolatedFramesList.mhEvent
        def onClicked(item):
            self.listInterpolationFrameOptions(item.getUserData())

        @self.resBox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                res = [int(x) for x in value.split("x")]
                self.renderingWidth = res[0]
                self.renderingHeight = res[1]
            except:  # The user hasn't typed the value correctly yet.
                pass

        @self.AAbox.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_AA', self.AAbox.selected)

        @self.lightmapSSS.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_SSS', self.lightmapSSS.selected)

        @self.renderMethodList.mhEvent
        def onClicked(item):
            self.listOptions(item.getUserData())

        @self.renderButton.mhEvent
        def onClicked(event):
            settings = dict()
            settings['scene'] = G.app.scene
            settings['AA'] = self.AAbox.selected
            settings['dimensions'] = (self.renderingWidth,
                                      self.renderingHeight)
            settings[
                'lightmapSSS'] = self.lightmapSSS.selected and self.lightmapSSS in self.optionsWidgets
            # change the timing of the render
            # add path output
            self.generate_key_frames()
            interpolate.do_op(self.key_frames,
                              "Front",
                              save_path=self.pathBox.getText(),
                              render_function=(mh2opengl.Render, settings))
Ejemplo n.º 23
0
    def __init__(self, category):
        RenderTaskView.__init__(self, category, 'Classification Images Render')

        # Declare settings
        G.app.addSetting('GL_RENDERER_SSS', False)
        G.app.addSetting('GL_RENDERER_AA', True)

        # Don't change shader for this RenderTaskView.
        self.taskViewShader = G.app.selectedHuman.material.shader

        settingsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        settingsBox.addWidget(gui.TextView("Resolution"))
        self.resBox = settingsBox.addWidget(
            gui.TextEdit("x".join(
                [str(self.renderingWidth),
                 str(self.renderingHeight)])))
        self.AAbox = settingsBox.addWidget(gui.CheckBox("Anti-aliasing"))
        self.AAbox.setSelected(G.app.getSetting('GL_RENDERER_AA'))

        self.path = ""
        self.path_button = settingsBox.addWidget(
            gui.BrowseButton('dir', "Select an output directory"))
        self.pathBox = settingsBox.addWidget(gui.TextEdit(self.path))

        @self.path_button.mhEvent
        def onClicked(path):
            self.path = path
            self.pathBox.setText(self.path)

        self.renderButton = settingsBox.addWidget(gui.Button('Render'))

        self.lightmapSSS = gui.CheckBox("Lightmap SSS")
        self.lightmapSSS.setSelected(G.app.getSetting('GL_RENDERER_SSS'))

        self.optionsBox = self.addLeftWidget(gui.GroupBox('Options'))
        self.optionsWidgets = []

        renderMethodBox = self.addRightWidget(
            gui.GroupBox('Rendering methods'))
        self.renderMethodList = renderMethodBox.addWidget(gui.ListView())
        self.renderMethodList.setSizePolicy(gui.SizePolicy.Ignored,
                                            gui.SizePolicy.Preferred)

        # Rendering methods
        self.renderMethodList.addItem('Quick Render')
        self.renderMethodList.addItem('Advanced Render',
                                      data=[self.lightmapSSS])

        if not mh.hasRenderToRenderbuffer():
            self.firstTimeWarn = True
            # Can only use screen grabbing as fallback,
            # resolution option disabled
            self.resBox.setEnabled(False)
            self.AAbox.setEnabled(False)

        self.listOptions(None)

        classificationImagesSettingsBox = self.addRightWidget(
            gui.GroupBox('Classification Image Settings'))

        classificationImagesSettingsBox.addWidget(
            gui.TextView("The number of trials"))
        self.trialsBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit("10"))

        classificationImagesSettingsBox.addWidget(
            gui.TextView("Orbit Camera Y (left-right)"))
        self.camY = classificationImagesSettingsBox.addWidget(
            gui.TextEdit("0.0"))
        classificationImagesSettingsBox.addWidget(
            gui.TextView("Oribt Camera X (up-down)"))
        self.camX = classificationImagesSettingsBox.addWidget(
            gui.TextEdit("0.0"))

        classificationImagesSettingsBox.addWidget(
            gui.TextView("Fraction of Feature Range SD"))
        self.SDBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit("0.05"))

        classificationImagesSettingsBox.addWidget(
            gui.TextView("Material File"))
        self.materialBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit("young_caucasian_avg"))

        classificationImagesSettingsBox.addWidget(gui.TextView("Model File"))
        self.modelBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit(""))
        self.model_button = classificationImagesSettingsBox.addWidget(
            gui.BrowseButton('open', "Select a model file"))

        @self.model_button.mhEvent
        def onClicked(path):
            self.modelBox.setText(path)

        self.modelFeatureList = classificationImagesSettingsBox.addWidget(
            gui.ListView())
        classificationImagesSettingsBox.addWidget(gui.TextView("Features"))
        self.modelFeatureBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit(".*"))
        # recommended groups
        self.modelGroups = [
            "all", "nose", "head", "forehead", "eyebrow", "eyes", "mouth",
            "ear", "chin", "cheek"
        ]
        self.modelGroupBox = mhapi.ui.createComboBox(self.modelGroups,
                                                     self._onModelGroupChange)
        classificationImagesSettingsBox.addWidget(self.modelGroupBox)
        self.modelAddButton = classificationImagesSettingsBox.addWidget(
            gui.Button("Add"))
        self.modelRemoveButton = classificationImagesSettingsBox.addWidget(
            gui.Button("Remove"))

        self.expressionBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit(""))
        self.expression_button = classificationImagesSettingsBox.addWidget(
            gui.BrowseButton('open', "Select an expression file"))

        @self.expression_button.mhEvent
        def onClicked(path):
            self.expressionBox.setText(path)

        self.expressionFeatureList = classificationImagesSettingsBox.addWidget(
            gui.ListView())
        classificationImagesSettingsBox.addWidget(gui.TextView("Features"))
        self.expressionFeatureBox = classificationImagesSettingsBox.addWidget(
            gui.TextEdit(".*"))
        # recommended groups
        self.expressionGroups = [
            "all", "Nose", "Eyebrow", "Eye", "Mouth", "Chin", "Cheek",
            "Left Eyebrow", "Left Chin", "Left Eye", "Left Mouth",
            "Right Eyebrow", "Right Chin", "Right Eye", "Right Mouth"
        ]
        self.expressionGroupBox = mhapi.ui.createComboBox(
            self.expressionGroups, self._onExpressionGroupChange)
        classificationImagesSettingsBox.addWidget(self.expressionGroupBox)

        self.expressionAddButton = classificationImagesSettingsBox.addWidget(
            gui.Button("Add"))
        self.expressionRemoveButton = classificationImagesSettingsBox.addWidget(
            gui.Button("Remove"))

        @self.modelAddButton.mhEvent
        def onClicked(event):
            features = self.modelFeatureBox.getText()
            self.modelFeatureList.addItem('{0}'.format(features),
                                          data=dict(features=features))

        @self.modelRemoveButton.mhEvent
        def onClicked(event):
            selected_frame = self.modelFeatureList.selectedItems()
            if len(selected_frame) == 0:
                return
            selected_frame = selected_frame[0]
            new_items = [
                item for item in self.modelFeatureList.getItems()
                if item is not selected_frame
            ]
            self.reassign(self.modelFeatureList, new_items)

        @self.expressionAddButton.mhEvent
        def onClicked(event):
            features = self.expressionFeatureBox.getText()
            self.expressionFeatureList.addItem('{0}'.format(features),
                                               data=dict(features=features))

        @self.expressionRemoveButton.mhEvent
        def onClicked(event):
            selected_frame = self.expressionFeatureList.selectedItems()
            if len(selected_frame) == 0:
                return
            selected_frame = selected_frame[0]
            new_items = [
                item for item in self.expressionFeatureList.getItems()
                if item is not selected_frame
            ]
            self.reassign(self.expressionFeatureList, new_items)

        @self.resBox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                res = [int(x) for x in value.split("x")]
                self.renderingWidth = res[0]
                self.renderingHeight = res[1]
            except:  # The user hasn't typed the value correctly yet.
                pass

        @self.AAbox.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_AA', self.AAbox.selected)

        @self.lightmapSSS.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_SSS', self.lightmapSSS.selected)

        @self.renderMethodList.mhEvent
        def onClicked(item):
            self.listOptions(item.getUserData())

        @self.renderButton.mhEvent
        def onClicked(event):
            settings = dict()
            settings['scene'] = G.app.scene
            settings['AA'] = self.AAbox.selected
            settings['dimensions'] = (self.renderingWidth,
                                      self.renderingHeight)
            settings[
                'lightmapSSS'] = self.lightmapSSS.selected and self.lightmapSSS in self.optionsWidgets
            # change the timing of the render
            # add path output
            # base_model, trials, shape_parameters, pose_parameters, SD=.3, rot_X=0, rot_Y=0, material_file="young_caucasian_avg"
            _, shape_parameters = self.get_data_labels(
                self.modelFeatureList.getItems())
            #log.message("Shape parameters "+shape_parameters)
            _, pose_parameters = self.get_data_labels(
                self.expressionFeatureList.getItems())
            CI_settings = dict(base_model=self.modelBox.getText(),
                               base_expression=self.expressionBox.getText(),
                               trials=int(self.trialsBox.getText()),
                               shape_parameters=shape_parameters,
                               pose_parameters=pose_parameters,
                               material_file=self.materialBox.getText(),
                               rot_X=float(self.camX.getText()),
                               rot_Y=float(self.camY.getText()),
                               SD=float(self.SDBox.getText()))
            classification_images.do_op(
                classification_image_settings=CI_settings,
                save_path=self.pathBox.getText(),
                render_function=(mh2opengl.Render, settings))
Ejemplo n.º 24
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Execute')

        box = self.addLeftWidget(gui.GroupBox('Execute'))

        self.execButton = box.addWidget(gui.Button('Execute'))

        @self.execButton.mhEvent
        def onClicked(event):
            #width = G.windowWidth
            #height = G.windowHeight

            global MHScript
            global scriptingView

            MHScript = Scripting()
            executeScript(str(scriptingView.scriptText.toPlainText()))

        box2 = self.addLeftWidget(gui.GroupBox('Fixed canvas size'))

        self.widthLabel = box2.addWidget(gui.TextView('Width'))
        self.widthEdit = box2.addWidget(gui.TextEdit(text='0'))
        self.heightLabel = box2.addWidget(gui.TextView('Height'))
        self.heightEdit = box2.addWidget(gui.TextEdit(text='0'))
        self.getButton = box2.addWidget(gui.Button('Get'))
        self.setButton = box2.addWidget(gui.Button('Set'))

        @self.getButton.mhEvent
        def onClicked(event):
            width = G.windowWidth
            height = G.windowHeight
            self.widthEdit.setText(str(width))
            self.heightEdit.setText(str(height))

        @self.setButton.mhEvent
        def onClicked(event):
            dlg = gui.Dialog()

            desiredWidth = self.widthEdit.getText()
            if (desiredWidth is None or not desiredWidth.isdigit()):
                dlg.prompt("Input error",
                           "Width and height must be valid integers", "OK")
                return

            desiredHeight = self.heightEdit.getText()
            if (desiredHeight is None or not desiredHeight.isdigit()):
                dlg.prompt("Input error",
                           "Width and height must be valid integers", "OK")
                return

            desiredWidth = int(desiredWidth)
            desiredHeight = int(desiredHeight)

            if (desiredHeight < 100 or desiredWidth < 100):
                dlg.prompt(
                    "Input error",
                    "Width and height must be at least 100 pixels each", "OK")
                return

            # This is because we're excluding a passepartout when doing screenshots.
            desiredWidth = desiredWidth + 3
            desiredHeight = desiredHeight + 3

            qmainwin = G.app.mainwin
            central = qmainwin.centralWidget()
            cWidth = central.frameSize().width()
            cHeight = central.frameSize().height()
            width = G.windowWidth
            height = G.windowHeight

            xdiff = desiredWidth - width
            ydiff = desiredHeight - height

            cWidth = cWidth + xdiff
            cHeight = cHeight + ydiff

            central.setFixedSize(cWidth, cHeight)
            qmainwin.adjustSize()
Ejemplo n.º 25
0
    def __init__(self, category):
        guirender.RenderTaskView.__init__(self, category, 'Scene Editor')

        # Declare settings
        G.app.addSetting('Scene_Editor_FileDlgPath', mh.getDataPath('scenes'))

        sceneBox = self.addLeftWidget(gui.GroupBox('Scene'))
        self.fnlbl = sceneBox.addWidget(gui.TextView('<New scene>'))
        self.saveButton = sceneBox.addWidget(gui.Button('Save'), 1, 0)
        self.loadButton = sceneBox.addWidget(gui.Button('Load ...'), 1, 1)
        self.saveAsButton = sceneBox.addWidget(gui.Button('Save As...'), 2, 0)
        self.closeButton = sceneBox.addWidget(gui.Button('Close'), 2, 1)

        itemBox = self.addLeftWidget(gui.GroupBox('Items'))
        self.itemList = itemBox.addWidget(gui.ListView())
        self.itemList.setSizePolicy(
            gui.SizePolicy.Ignored, gui.SizePolicy.Preferred)

        self.propsBox = gui.StackedBox()
        self.addRightWidget(self.propsBox)

        self.addButton = itemBox.addWidget(gui.Button('Add...'))
        self.adder = SceneItemAdder(self)
        self.propsBox.addWidget(self.adder.widget)
        self.activeItem = None

        self._scene = None

        def doLoad():
            filename = mh.getOpenFileName(
                G.app.getSetting('Scene_Editor_FileDlgPath'),
                'MakeHuman scene (*.mhscene);;All files (*.*)')
            if filename:
                G.app.setSetting('Scene_Editor_FileDlgPath', filename)
                self.scene.load(filename)

        def doSave(filename):
            ok = self.scene.save(filename)
            if ok and self._scene.file.path is not None \
                and self._scene.file.path == self.scene.file.path:
                # Refresh MH's current scene if it was modified.
                self._scene.load(self._scene.file.path)

        @self.loadButton.mhEvent
        def onClicked(event):
            if self.scene.file.modified:
                G.app.prompt('Confirmation',
                    'Your scene is unsaved. Are you sure you want to close it?',
                    'Close', 'Cancel', doLoad)
            else:
                doLoad()

        @self.saveButton.mhEvent
        def onClicked(event):
            if self.scene.file.path is None:
                self.saveAsButton.callEvent('onClicked', event)
            else:
                doSave(self.scene.file.path)

        @self.closeButton.mhEvent
        def onClicked(event):
            if self.scene.file.modified:
                G.app.prompt('Confirmation',
                    'Your scene is unsaved. Are you sure you want to close it?',
                    'Close', 'Cancel', self.scene.reset)
            else:
                self.scene.reset()

        @self.saveAsButton.mhEvent
        def onClicked(event):
            filename = mh.getSaveFileName(
                G.app.getSetting('Scene_Editor_FileDlgPath'),
                'MakeHuman scene (*.mhscene);;All files (*.*)')
            if filename:
                G.app.setSetting('Scene_Editor_FileDlgPath', filename)
                doSave(filename)

        @self.itemList.mhEvent
        def onClicked(item):
            item.getUserData().showProps()

        @self.addButton.mhEvent
        def onClicked(event):
            self.adder.showProps()
Ejemplo n.º 26
0
    def __init__(self, category):
        RenderTaskView.__init__(self, category, 'Render')

        # Declare settings
        G.app.addSetting('GL_RENDERER_SSS', False)
        G.app.addSetting('GL_RENDERER_AA', True)

        # Don't change shader for this RenderTaskView.
        self.taskViewShader = G.app.selectedHuman.material.shader

        settingsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        settingsBox.addWidget(gui.TextView("Resolution"))
        self.resBox = settingsBox.addWidget(gui.TextEdit(
            "x".join([str(self.renderingWidth), str(self.renderingHeight)])))
        self.AAbox = settingsBox.addWidget(gui.CheckBox("Anti-aliasing"))
        self.AAbox.setSelected(G.app.getSetting('GL_RENDERER_AA'))
        self.renderButton = settingsBox.addWidget(gui.Button('Render'))

        self.lightmapSSS = gui.CheckBox("Lightmap SSS")
        self.lightmapSSS.setSelected(G.app.getSetting('GL_RENDERER_SSS'))

        self.optionsBox = self.addLeftWidget(gui.GroupBox('Options'))
        self.optionsWidgets = []

        renderMethodBox = self.addRightWidget(gui.GroupBox('Rendering methods'))
        self.renderMethodList = renderMethodBox.addWidget(gui.ListView())
        self.renderMethodList.setSizePolicy(
            gui.SizePolicy.Ignored, gui.SizePolicy.Preferred)

        # Rendering methods
        self.renderMethodList.addItem('Quick Render')
        self.renderMethodList.addItem('Advanced Render',
            data=[self.lightmapSSS])

        if not mh.hasRenderToRenderbuffer():
            self.firstTimeWarn = True
            # Can only use screen grabbing as fallback,
            # resolution option disabled
            self.resBox.setEnabled(False)
            self.AAbox.setEnabled(False)

        self.listOptions(None)

        @self.resBox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                res = [int(x) for x in value.split("x")]
                self.renderingWidth = res[0]
                self.renderingHeight = res[1]
            except:  # The user hasn't typed the value correctly yet.
                pass

        @self.AAbox.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_AA', self.AAbox.selected)

        @self.lightmapSSS.mhEvent
        def onClicked(value):
            G.app.setSetting('GL_RENDERER_SSS', self.lightmapSSS.selected)

        @self.renderMethodList.mhEvent
        def onClicked(item):
            self.listOptions(item.getUserData())

        @self.renderButton.mhEvent
        def onClicked(event):
            settings = dict()
            settings['scene'] = G.app.scene
            settings['AA'] = self.AAbox.selected
            settings['dimensions'] = (self.renderingWidth, self.renderingHeight)
            settings['lightmapSSS'] = self.lightmapSSS.selected and self.lightmapSSS in self.optionsWidgets

            mh2opengl.Render(settings)
Ejemplo n.º 27
0
 def add(widget, name, method):
     widget.addWidget(gui.TextView(name), row[0], 0)
     widget.addWidget(AppMouseActionEdit(method), row[0], 1)
     row[0] += 1
Ejemplo n.º 28
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Skeleton')

        self.systemRigs = os.path.join('data', 'rigs')
        self.userRigs = os.path.join(mh.getPath(''), 'data', 'rigs')
        self.rigPaths = [self.userRigs, self.systemRigs]
        if not os.path.exists(self.userRigs):
            os.makedirs(self.userRigs)
        self.extension = "rig"

        self.human = gui3d.app.selectedHuman
        self.human._skeleton = None
        self.human.animated = None
        # Attach getter to human to access the skeleton, that takes care of deferred
        # updating when the skeleton should change
        import types
        self.human.getSkeleton = types.MethodType(_getSkeleton, self.human,
                                                  self.human.__class__)
        self.human.getVertexWeights = types.MethodType(_getVertexWeights,
                                                       self.human,
                                                       self.human.__class__)

        self.oldSmoothValue = False

        self.humanChanged = False  # Used for determining when joints need to be redrawn

        self.skelMesh = None
        self.skelObj = None

        self.jointsMesh = None
        self.jointsObj = None

        self.selectedBone = None
        self.selectedJoint = None

        self.oldHumanTransp = self.human.meshData.transparentPrimitives

        self.filechooser = self.addRightWidget(
            fc.ListFileChooser(self.rigPaths, self.extension, 'Skeleton rig'))
        self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            if self.human.getSkeleton():
                oldSkelFile = self.human.getSkeleton().file
            else:
                oldSkelFile = None
            gui3d.app.do(
                SkeletonAction("Change skeleton", self, oldSkelFile, filename))

        @self.filechooser.mhEvent
        def onRefresh(fileChooser):
            noSkelPath = os.path.join(self.rigPaths[0], 'clear.rig')
            fileChooser.addItem(noSkelPath, 'No skeleton', None)
            if not self.human.getSkeleton():
                self.filechooser.selectItem(noSkelPath)

        self.filechooser.refresh()

        displayBox = self.addLeftWidget(gui.GroupBox('Display'))
        self.showHumanTggl = displayBox.addWidget(
            gui.ToggleButton("Show human"))

        @self.showHumanTggl.mhEvent
        def onClicked(event):
            if self.showHumanTggl.selected:
                self.human.show()
            else:
                self.human.hide()

        self.showHumanTggl.setSelected(True)

        self.showJointsTggl = displayBox.addWidget(
            gui.ToggleButton("Show joints"))

        @self.showJointsTggl.mhEvent
        def onClicked(event):
            if not self.jointsObj:
                return
            if self.showJointsTggl.selected:
                self.jointsObj.show()
            else:
                self.jointsObj.hide()

        self.showJointsTggl.setSelected(True)

        self.showWeightsTggl = displayBox.addWidget(
            gui.ToggleButton("Show bone weights"))

        @self.showWeightsTggl.mhEvent
        def onClicked(event):
            if self.showWeightsTggl.selected:
                # Highlight bone selected in bone explorer again
                for rdio in self.boneSelector:
                    if rdio.selected:
                        self.highlightBone(str(rdio.text()))
            else:
                self.clearBoneWeights()

        self.showWeightsTggl.setSelected(True)

        self.boneBox = self.addLeftWidget(gui.GroupBox('Bones'))
        self.boneSelector = []

        self.infoBox = self.addRightWidget(gui.GroupBox('Rig info'))
        self.boneCountLbl = self.infoBox.addWidget(gui.TextView('Bones: '))
        self.descrLbl = self.infoBox.addWidget(gui.TextView('Description: '))
        self.descrLbl.setSizePolicy(gui.QtGui.QSizePolicy.Ignored,
                                    gui.QtGui.QSizePolicy.Preferred)
        self.descrLbl.setWordWrap(True)

        self.rigDescriptions = {
            "soft1":
            "Soft skinned rig. Simple version of the MHX reference rig containing only its deforming bones.",
            "xonotic":
            "Rig compatible with the open-source game Xonotic.",
            "second_life":
            "Rig compatible with Second Life.",
            "game":
            "A simple rig with a minimal amount of bones. Has limited expressivity in hands and face.",
            "humanik":
            "Rig compatible with the HumanIK software.",
            "rigid":
            "Same as soft1 a simple version of the MHX reference rig, but with rigid weighting.",
        }
Ejemplo n.º 29
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Scripting')

        self.directory = os.getcwd()
        self.filename = None

        scriptingHome = mh.getPath('scripts')
        if not os.path.exists(scriptingHome):
            try:
                os.mkdir(scriptingHome)
            except OSError:
                scriptingHome = mh.getPath()

        box = self.addLeftWidget(gui.GroupBox('Script'))

        self.scriptText = self.addTopWidget(gui.DocumentEdit())
        self.scriptText.setText('')

        self.scriptText.setLineWrapMode(gui.DocumentEdit.NoWrap)

        self.loadButton = box.addWidget(gui.BrowseButton(mode='open'), 0, 0)
        self.loadButton.setLabel('Load ...')
        self.loadButton.directory = scriptingHome
        self.saveButton = box.addWidget(gui.BrowseButton(mode='save'), 0, 1)
        self.saveButton.setLabel('Save ...')
        self.saveButton.directory = scriptingHome

        @self.loadButton.mhEvent
        def onClicked(filename):
            if not filename:
                return

            if (os.path.exists(filename)):
                contents = io.open(filename, 'r', encoding="utf-8").read()
                self.scriptText.setText(contents)
                dlg = gui.Dialog()
                dlg.prompt("Load script",
                           "File was loaded in an acceptable manner", "OK")
                self.filename = filename
                self.directory = os.path.split(filename)[0]
            else:
                dlg = gui.Dialog()
                dlg.prompt("Load script",
                           "File %s does not exist",
                           "OK",
                           fmtArgs=filename)

        @self.saveButton.mhEvent
        def onClicked(filename):
            if not filename:
                return

            with io.open(filename, "w", encoding="utf-8") as f:
                f.write(self.scriptText.getText())
            dlg = gui.Dialog()
            dlg.prompt("Save script",
                       "File was written in an acceptable manner", "OK")
            self.filename = filename
            self.directory = os.path.split(filename)[0]

        box2 = self.addLeftWidget(gui.GroupBox('Examples'))

        self.insertLabel = box2.addWidget(
            gui.TextView('Append example to script'))
        self.listView = box2.addWidget(gui.ListView())
        self.listView.setSizePolicy(gui.SizePolicy.Ignored,
                                    gui.SizePolicy.Preferred)

        testlist = [
            'applyTarget()', 'incrementingFilename()', 'getHeightCm()',
            'getPositionX()', 'getPositionY()', 'getPositionZ()',
            'getRotationX()', 'getRotationY()', 'getRotationZ()', 'getZoom()',
            'loadModel()', 'modifyPositionX()', 'modifyPositionY()',
            'modifyPositionZ()', 'modifyRotationX()', 'modifyRotationY()',
            'modifyRotationZ()', 'modifyZoom()', 'printCameraInfo()',
            'printDetailStack()', 'printPositionInfo()', 'printRotationInfo()',
            'saveModel()', 'screenShot()', 'setAge()', 'setPositionX()',
            'setPositionY()', 'setPositionZ()', 'setRotationX()',
            'setRotationY()', 'setRotationZ()', 'setZoom()', 'setWeight()',
            'setMaterial()', 'setHeadSquareness()', 'getModelingParameters()',
            'updateModelingParameter()', 'updateModelingParameters()',
            'saveObj()'
        ]

        self.listView.setData(testlist)

        self.insertButton = box2.addWidget(gui.Button('Append'))

        @self.insertButton.mhEvent
        def onClicked(event):
            item = self.listView.getSelectedItem()

            if (item == 'applyTarget()'):
                text = "# applyTarget(<target file name>, <power (from 0.0 to 1.0)>)\n"
                text = text + "#\n"
                text = text + "# This will apply the target on the model. If the target was already applied, the power will be updated\n"
                text = text + "# Note that targets are relative to the data/targets directory, and should not include the .target\n"
                text = text + "# extension, so a valid target name would be, for example, \"breast/breast-dist-max\"\n\n"
                text = text + "MHScript.applyTarget('aTargetName',1.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'loadModel()'):
                text = "# loadModel(<model name>,[path])\n"
                text = text + "#\n"
                text = text + "# This will load a human model from an MHM file. The <model name> part should be a string without spaces\n"
                text = text + "# and without the .MHM extension. The [path] part defaults to the user's makehuman/models directory.\n\n"
                text = text + "MHScript.loadModel('myTestModel')\n\n"
                self.scriptText.addText(text)

            if (item == 'incrementingFilename()'):
                text = "# incrementingFilename(<file name base>, [file extension], [pad length])\n"
                text = text + "#\n"
                text = text + "# This will return a file name containing a numerical component which increases by one for each call.\n"
                text = text + "# The default file extension is \".png\". The default pad length is 4. For example, the following lines:\n"
                text = text + "#\n"
                text = text + "# print incrementingFilename(\"test\",\".target\",3) + \"\\n\"\n"
                text = text + "# print incrementingFilename(\"test\",\".target\",3) + \"\\n\"\n"
                text = text + "#\n"
                text = text + "# Will print:\n"
                text = text + "#\n"
                text = text + "# test001.target\n"
                text = text + "# test002.target\n"
                text = text + "#\n"
                text = text + "# The counter is reset each time the script is executed\n\n"
                text = text + "filename = MHScript.incrementingFilename('test')\n\n"
                self.scriptText.addText(text)

            if (item == 'printCameraInfo()'):
                text = "# printCameraInfo()\n"
                text = text + "#\n"
                text = text + "# This will print info about how the camera is targeted and focused .\n\n"
                text = text + "MHScript.printCameraInfo()\n\n"
                self.scriptText.addText(text)

            if (item == 'printDetailStack()'):
                text = "# printDetailStack()\n"
                text = text + "#\n"
                text = text + "# This will print a list of all applied targets (and their weights) to standard output.\n\n"
                text = text + "MHScript.printDetailStack()\n\n"
                self.scriptText.addText(text)

            if (item == 'printPositionInfo()'):
                text = "# printPositionInfo()\n"
                text = text + "#\n"
                text = text + "# This will print info about where the human object is currently located.\n\n"
                text = text + "MHScript.printPositionInfo()\n\n"
                self.scriptText.addText(text)

            if (item == 'printRotationInfo()'):
                text = "# printRotationInfo()\n"
                text = text + "#\n"
                text = text + "# This will print info about how the human object is currently rotated.\n\n"
                text = text + "MHScript.printRotationInfo()\n\n"
                self.scriptText.addText(text)

            if (item == 'saveModel()'):
                text = "# saveModel(<model name>,[path])\n"
                text = text + "#\n"
                text = text + "# This will save the human model to an MHM file. The <model name> part should be a string without spaces\n"
                text = text + "# and without the .MHM extension. The [path] part defaults to the user's makehuman/models directory.\n"
                text = text + "# Note that this will not save any thumbnail.\n\n"
                text = text + "MHScript.saveModel('myTestModel')\n\n"
                self.scriptText.addText(text)

            if (item == 'saveObj()'):
                text = "# saveObj(<model name>,[path])\n"
                text = text + "#\n"
                text = text + "# This will save the human model to a wavefront .OBJ file. The <model name> part should be a string without spaces\n"
                text = text + "# and without the .obj extension. The [path] part defaults to the user's makehuman/exports directory.\n"
                text = text + "MHScript.saveObj('myOBJExport')\n\n"
                self.scriptText.addText(text)

            if (item == 'screenShot()'):
                text = "# screenShot(<png file name>)\n"
                text = text + "#\n"
                text = text + "# This will save a png file of how the model currently looks.\n\n"
                text = text + "MHScript.screenShot('screenshot.png')\n\n"
                self.scriptText.addText(text)

            if (item == 'setAge()'):
                text = "# setAge(age)\n"
                text = text + "#\n"
                text = text + "# Sets the age of the model. The age parameter is a float between 0 and 1, where 0 is 1 year old, 0.18 is 10 years old, 0.5 is 25 years and 1 equals 90 years old.\n\n"
                text = text + "MHScript.setAge(0.5)\n\n"
                self.scriptText.addText(text)

            if (item == 'setWeight()'):
                text = "# setWeight(weight)\n"
                text = text + "#\n"
                text = text + "# Sets the weight of the model. The weight parameter is a float between 0 and 1, where 0 is starved and\n"
                text = text + "# 1 is severely overweight\n\n"
                text = text + "MHScript.setWeight(0.5)\n\n"
                self.scriptText.addText(text)

            if (item == 'setHeadSquareness()'):
                text = "# setHeadSquareness(squareness)\n"
                text = text + "#\n"
                text = text + "# Sets the squaredness of the model's head. The squareness parameter is a float between 0 and 1, where 0 is not square and\n"
                text = text + "# 1 is very square shaped\n\n"
                text = text + "MHScript.setHeadSquareness(0.5)\n\n"
                self.scriptText.addText(text)

            if (item == 'setMaterial()'):
                text = "# setMaterial(mhmat_filename)\n"
                text = text + "#\n"
                text = text + "# Sets the skin material of the 3D model\n"
                text = text + "# The filename must be realtive to the App Resources directory\n\n"
                text = text + "MHScript.setMaterial('data/skins/young_caucasian_female/young_caucasian_female.mhmat')\n\n"
                self.scriptText.addText(text)

            if (item == 'getHeightCm()'):
                text = "# getHeightCm()\n"
                text = text + "#\n"
                text = text + "# Gets the current height of the model, in cm.\n\n"
                text = text + "height = MHScript.getHeightCm()\n"
                text = text + "print('height='+str(height))\n\n"
                self.scriptText.addText(text)

            if (item == 'getModelingParameters()'):
                text = "# getModelingParameters()\n"
                text = text + "#\n"
                text = text + "# Prints the names of all modeling aspects that can be modified on the human model.\n"
                text = text + "MHScript.getModelingParameters()\n\n"
                self.scriptText.addText(text)

            if (item == 'updateModelingParameter()'):
                text = "# updateModelingParameter(parameterName, value)\n"
                text = text + "#\n"
                text = text + "# Sets the modeling parameter with specified name of the model to the specified value.\n"
                text = text + "# The value is a float between 0 and 1, where 0 means nothing at all or minimal, and 1 is the maximum value.\n\n"
                text = text + "MHScript.updateModelingParameter('macrodetails/Age', 0.7)\n\n"
                self.scriptText.addText(text)

            if (item == 'updateModelingParameters()'):
                text = "# updateModelingParameters(dictOfParameterNameAndValue)\n"
                text = text + "#\n"
                text = text + "# Sets more modeling parameters with specified names of the model to the specified values.\n"
                text = text + "# Faster than setting parameters one by one because the 3D mesh is updated only once.\n"
                text = text + "# The values are a float between 0 and 1, where 0 means nothing at all or minimal, and 1 is the maximum value.\n\n"
                text = text + "MHScript.updateModelingParameters({'macrodetails/Caucasian': 1.000,'macrodetails/Gender': 1.000,'macrodetails/Age': 0.250})\n\n"
                self.scriptText.addText(text)

            if (item == 'setPositionX()'):
                text = "# setPositionX(xpos)\n"
                text = text + "#\n"
                text = text + "# Sets the X position of the model of the model in 3d space, where 0.0 is centered.\n\n"
                text = text + "MHScript.setPositionX(2.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getPositionX()'):
                text = "# getPositionX()\n"
                text = text + "#\n"
                text = text + "# Returns the current X position of the model of the model in 3d space.\n\n"
                text = text + "MHScript.getPositionX()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyPositionX()'):
                text = "# modifyPositionX(xmod)\n"
                text = text + "#\n"
                text = text + "# Modifies X position of the model of the model in 3d space.\n\n"
                text = text + "MHScript.modifyPositionX(-0.1)\n\n"
                self.scriptText.addText(text)

            if (item == 'setPositionZ()'):
                text = "# setPositionZ(zpos)\n"
                text = text + "#\n"
                text = text + "# Sets the Z position of the model of the model in 3d space, where 0.0 is centered.\n\n"
                text = text + "MHScript.setPositionZ(2.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getPositionZ()'):
                text = "# getPositionZ()\n"
                text = text + "#\n"
                text = text + "# Returns the current Z position of the model of the model in 3d space.\n\n"
                text = text + "MHScript.getPositionZ()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyPositionZ()'):
                text = "# modifyPositionZ(zmod)\n"
                text = text + "#\n"
                text = text + "# Modifies Z position of the model of the model in 3d space.\n\n"
                text = text + "MHScript.modifyPositionZ(-0.1)\n\n"
                self.scriptText.addText(text)

            if (item == 'setPositionY()'):
                text = "# setPositionY(ypos)\n"
                text = text + "#\n"
                text = text + "# Sets the Y position of the model of the model in 3d space, where 0.0 is centered.\n"
                text = text + "# Note that the depth of the scene is clipped, so if you move the model too far back\n"
                text = text + "# it will disappear. You will most likely want to use zoom instead of Y position.\n\n"
                text = text + "MHScript.setPositionY(2.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getPositionY()'):
                text = "# getPositionY()\n"
                text = text + "#\n"
                text = text + "# Returns the current Y position of the model of the model in 3d space.\n\n"
                text = text + "MHScript.getPositionY()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyPositionY()'):
                text = "# modifyPositionY(ymod)\n"
                text = text + "#\n"
                text = text + "# Modifies Y position of the model of the model in 3d space.\n"
                text = text + "# Note that the depth of the scene is clipped, so if you move the model too far back\n"
                text = text + "# it will disappear. You will most likely want to use zoom instead of Y position.\n\n"
                text = text + "MHScript.modifyPositionY(-0.1)\n\n"
                self.scriptText.addText(text)

            if (item == 'setRotationX()'):
                text = "# setRotationX(xrot)\n"
                text = text + "#\n"
                text = text + "# Sets the rotation around the X axis for the model, where 0.0 is frontal projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.setRotationX(90.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getRotationX()'):
                text = "# getRotationX()\n"
                text = text + "#\n"
                text = text + "# Returns the current rotatation around the X axis of the model.\n\n"
                text = text + "MHScript.getRotationX()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyRotationX()'):
                text = "# modifyRotationX(xmod)\n"
                text = text + "#\n"
                text = text + "# Modifies the rotation around the X axis for the model, where 0.0 is frontal projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.modifyRotationX(-5.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'setRotationZ()'):
                text = "# setRotationZ(zrot)\n"
                text = text + "#\n"
                text = text + "# Sets the rotation around the Z axis for the model, where 0.0 is frontal projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.setRotationZ(90.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getRotationZ()'):
                text = "# getRotationZ()\n"
                text = text + "#\n"
                text = text + "# Returns the current rotatation around the Z axis of the model.\n\n"
                text = text + "MHScript.getRotationZ()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyRotationZ()'):
                text = "# modifyRotationZ(zmod)\n"
                text = text + "#\n"
                text = text + "# Modifies the rotation around the Z axis for the model, where 0.0 is frontal projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.modifyRotationZ(-5.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'setRotationY()'):
                text = "# setRotationY(yrot)\n"
                text = text + "#\n"
                text = text + "# Sets the rotation around the Y axis for the model, where 0.0 is upright projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.setRotationY(90.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getRotationY()'):
                text = "# getRotationY()\n"
                text = text + "#\n"
                text = text + "# Returns the current rotatation around the Y axis of the model.\n\n"
                text = text + "MHScript.getRotationY()\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyRotationY()'):
                text = "# modifyRotationY(ymod)\n"
                text = text + "#\n"
                text = text + "# Modifies the rotation around the Y axis for the model, where 0.0 is upright projection.\n"
                text = text + "# Rotation is set in degrees from -180.0 to +180.0 (these two extremes are equal)\n\n"
                text = text + "MHScript.modifyRotationY(-5.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'setZoom()'):
                text = "# setZoom(zoom)\n"
                text = text + "#\n"
                text = text + "# Sets current camera zoom. In practise this moves the camera closer or further from the.\n"
                text = text + "# the model. The zoom factor is reversed ans goes from 100.0 which is far away from the\n"
                text = text + "# the model as possible (if you move further away, the model will be clipped and disappear)\n"
                text = text + "# and 0.0 is inside the model. A zoom factor of 10.0 is what is used for the face\n"
                text = text + "# projection, and is in most cases as zoomed in as is functional.\n\n"
                text = text + "MHScript.setZoom(70.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'modifyZoom()'):
                text = "# modifyZoom(zmod)\n"
                text = text + "#\n"
                text = text + "# Modifies current camera zoom. In practise this moves the camera closer or further from the.\n"
                text = text + "# the model. The zoom factor is reversed ans goes from 100.0 which is far away from the\n"
                text = text + "# the model as possible (if you move further away, the model will be clipped and disappear)\n"
                text = text + "# and 0.0 is inside the model. A zoom factor of 10.0 is what is used for the face\n"
                text = text + "# projection, and is in most cases as zoomed in as is functional.\n\n"
                text = text + "MHScript.modifyZoom(1.0)\n\n"
                self.scriptText.addText(text)

            if (item == 'getZoom()'):
                text = "# getZoom()\n"
                text = text + "#\n"
                text = text + "# Returns the current camera zoom factor.\n\n"
                text = text + "MHScript.getZoom()\n\n"
                self.scriptText.addText(text)
Ejemplo n.º 30
0
    def __init__(self, category):
        super(AssetEditorTaskView, self).__init__(category, 'Asset Editor')

        # Preset Variables here:
        self.notfound = mhapi.locations.getSystemDataPath("notfound.thumb")

        assetTypes = [
            "Clothes", "Hair", "Models", "Teeth", "Tongue", "Eyes"
            "Eyebrows", "Eyelashes", "ProxyMeshes", "Materials"
        ]


        saveMsg = "When you click the save button, the asset will be written back to the original file, " \
                  "but a .bak file will be created with the original data."

        tagWarnMsg = 'Your asset has to many tags. The Asset Editor does not support more than 5 tags. ' \
                     'Edit the asset in a Texteditor.'

        self.selectedType = None
        self.asset = None
        self.strip = None
        self.resetAsset = None

        # self.assetFolder = [mhapi.locations.getSystemDataPath('clothes'), mhapi.locations.getUserDataPath('clothes')]
        self.assetFolder = [mhapi.locations.getUserDataPath('clothes')]
        self.extensions = "mhclo"

        self.history_ptr = {
            'current': 0,
            'head': 0,
        }

        self.history = {}

        self.linekeys = ['author', 'name', 'uuid', 'homepage']
        self.textkeys = ['license', 'description']
        self.intkeys = [
            'z_depth',
            'max_pole',
        ]
        self.booleankeys = [
            'shadeless', 'wireframe', 'transparent', 'alphaToCoverage',
            'backfaceCull', 'depthless', 'castShadows', 'receiveShadows'
        ]
        self.texturekeys = [
            'diffuseTexture', 'bumpmapTexture', 'normalmapTexture',
            'displacementmapTexture', 'specularmapTexture',
            'transparencymapTexture', 'aomapTexture'
        ]
        self.floatkeys = [
            'diffuseIntensity', 'bumpMapIntensity', 'normalMapIntensity',
            'displacementMapIntensity', 'specularMapIntensity',
            'transparencyMapIntensity', 'aoMapIntensity', 'shininess',
            'opacity', 'translucency'
        ]
        self.rgbkeys = [
            'diffuseColor', 'specularColor', 'emissiveColor', 'ambientColor'
        ]
        self.num3keys = ['x_scale', 'y_scale', 'z_scale']

        self.baseDict = {k: None for k in mhapi.assets.keyList}

        self.loadedFile = ['', '']

        # Define LeftWidget content here:

        # The SaveBox:

        self.SaveBox = self.addLeftWidget(QGroupBox("Save asset: "))

        self.SaveInfo = gui.TextView(saveMsg)
        self.SaveInfo.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
        self.SaveInfo.setWordWrap(True)

        self.SaveButton = defaultButton('Save')
        self.SaveButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        SaveBoxLayout = QVBoxLayout(self.SaveBox)
        SaveBoxLayout.addWidget(self.SaveInfo)
        SaveBoxLayout.addWidget(self.SaveButton, 0, Qt.AlignHCenter)

        self.SaveBox.setLayout(SaveBoxLayout)

        self.SaveButton.setDisabled(True)

        # The ThumbnailBox:

        self.ThumbnailBox = gui.GroupBox("Thumbnail (if any)")
        self.Thumbnail = self.ThumbnailBox.addWidget(gui.TextView())
        self.Thumbnail.setPixmap(QPixmap(os.path.abspath(self.notfound)))
        self.Thumbnail.setGeometry(0, 0, 128, 128)
        self.addLeftWidget(self.ThumbnailBox)

        # Define RightWidget content here:

        # The ClothesTypeBox:

        self.ClothesTypeBox = self.addRightWidget(
            gui.GroupBox('Select Asset Type'))
        self.typeList = mhapi.ui.createComboBox(assetTypes,
                                                self.onAssetTypeChange)
        self.ClothesTypeBox.addWidget(self.typeList)

        # The TagFielChoose:

        filecache.MetadataCacher.__init__(self, self.getFileExtension(),
                                          'plugin_filecache.mhc')

        self.FileChooser = self.addRightWidget(
            fc.IconListFileChooser(self.assetFolder,
                                   self.extensions,
                                   'thumb',
                                   self.notfound,
                                   None,
                                   name='File Chooser',
                                   noneItem=False))
        self.FileChooser.setIconSize(50, 50)
        self.FileChooser.enableAutoRefresh(True)
        self.FileChooser.setFileLoadHandler(fc.TaggedFileLoader(self))
        self.TagFilter = self.FileChooser.createTagFilter()
        self.addLeftWidget(self.TagFilter)
        fc2Path = mhapi.locations.getUserHomePath("models")
        self.FileChooser2 = self.addRightWidget(
            fc.IconListFileChooser(fc2Path,
                                   'mhm',
                                   'thumb',
                                   self.notfound,
                                   None,
                                   name='File Chooser',
                                   noneItem=False))
        self.FileChooser2.setIconSize(50, 50)
        self.FileChooser2.enableAutoRefresh(True)
        self.FileChooser2.hide()

        # Define MainPanel (TopWidget) content here:

        self.MainPanel = QWidget()
        MainPanelLayout = QVBoxLayout()
        self.addTopWidget(self.MainPanel)
        self.MainPanel.setLayout(MainPanelLayout)
        button = QTabWidget

        # The ButtonGroupBox
        self.ButtonGroupBox = QGroupBox()

        ButtonGroupLayout = QHBoxLayout(self.ButtonGroupBox)
        ButtonGroupLayout.addStretch(1)

        MainPanelLayout.addWidget(self.ButtonGroupBox)

        # The RedoButton
        self.RedoButton = defaultButton('Redo')
        self.RedoButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        ButtonGroupLayout.addWidget(self.RedoButton)
        self.RedoButton.setDisabled(True)

        # The UndoButton
        self.UndoButton = defaultButton('Undo')
        self.UndoButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        ButtonGroupLayout.addWidget(self.UndoButton)
        self.UndoButton.setDisabled(True)

        # The ResetButton
        self.ResetButton = defaultButton('Reset')
        self.ResetButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        ButtonGroupLayout.addWidget(self.ResetButton)
        self.ResetButton.setDisabled(True)

        # The UpdateButton
        self.UpdateButton = defaultButton('Update')
        self.UpdateButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        ButtonGroupLayout.addWidget(self.UpdateButton)
        self.ButtonGroupBox.setLayout(ButtonGroupLayout)

        # The TabWidget:
        self.TabWidget = QTabWidget()
        MainPanelLayout.addWidget(self.TabWidget)

        # The InfoPanel

        # The InfoPanel
        self.InfoPanel = QWidget()
        self.tabInfoIndex = self.TabWidget.addTab(self.InfoPanel,
                                                  'General Info')
        InfoPanelLayout = QVBoxLayout(self.InfoPanel)

        # The AssetInfoBox
        self.AssetInfoBox = QFrame()
        AssetInfoLayout = QVBoxLayout(self.AssetInfoBox)

        # The AssetInfoText
        self.AssetInfoText = gui.TextView('')
        self.BestPracticeText = gui.TextView('')
        self.BestPracticeText.setWordWrap(True)

        AssetInfoLayout.addWidget(self.AssetInfoText)
        AssetInfoLayout.addWidget(self.BestPracticeText)
        AssetInfoLayout.addStretch(1)

        self.AssetInfoBox.setLayout(AssetInfoLayout)

        self.ScrollArea = QScrollArea()
        self.ScrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.ScrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.ScrollArea.setWidgetResizable(True)
        self.ScrollArea.setWidget(self.AssetInfoBox)
        ScrollLayout = QVBoxLayout(self.ScrollArea)
        ScrollLayout.addWidget(self.AssetInfoBox)
        self.ScrollArea.setLayout(ScrollLayout)

        InfoPanelLayout.addWidget(self.ScrollArea)

        self.InfoPanel.setLayout(InfoPanelLayout)

        self.setAssetInfoText(self.asset)

        # Define EditorPanel (TopWidget) content here:

        #The EditPanel
        self.EditPanel = QWidget()
        self.tabEditIndex = self.TabWidget.addTab(self.EditPanel,
                                                  'Edit Common Data')

        EditPanelLayout = QVBoxLayout(self.EditPanel)
        self.EditPanel.setLayout(EditPanelLayout)

        # The CommonDataEditBox
        self.CommonDataEditBox = QGroupBox()
        CommonDataEditLayout = QHBoxLayout()

        EditPanelLayout.addWidget(self.CommonDataEditBox)

        # The LineEditGroupBox with
        self.LineEditGroupBox = QFrame()
        LineEditGroupLayout = QGridLayout()
        self.LineEditGroupBox.sizeHint = lambda: QSize(450, 325)
        self.LineEditGroupBox.setSizePolicy(QSizePolicy.Minimum,
                                            QSizePolicy.Minimum)

        AuthorLabel = LineEditGroupLayout.addWidget(QLabel('Author :'), 0, 0,
                                                    1, 1)
        NameLabel = LineEditGroupLayout.addWidget(QLabel('Name :'), 1, 0, 1, 1)
        TagsLabel = LineEditGroupLayout.addWidget(QLabel('Tags :'), 2, 0, 1, 1)

        self.baseDict['author'] = QLineEdit('')
        LineEditGroupLayout.addWidget(self.baseDict['author'], 0, 1, 1, 1)
        self.baseDict['name'] = QLineEdit('')
        LineEditGroupLayout.addWidget(self.baseDict['name'], 1, 1, 1, 1)

        # The TagGroupBox and ...
        self.TagGroupBox = QGroupBox()
        LineEditGroupLayout.addWidget(self.TagGroupBox, 2, 1, 1, 1)
        TagGroupLayout = QVBoxLayout()

        self.baseDict['tag'] = [QLineEdit('') for i in range(5)]
        for i in self.baseDict['tag']:
            TagGroupLayout.addWidget(i)
        TagGroupLayout.addStretch(1)
        self.TagGroupBox.setLayout(TagGroupLayout)
        self.TagWarn = QLabel(tagWarnMsg)
        self.TagWarn.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.TagWarn.setWordWrap(True)
        self.TagWarn.setGeometry(self.TagGroupBox.geometry())
        self.TagWarn.hide()
        LineEditGroupLayout.addWidget(self.TagWarn, 2, 1, 1, 1)

        self.LineEditGroupBox.setLayout(LineEditGroupLayout)

        HomePageLabel = LineEditGroupLayout.addWidget(QLabel('Homepage :'), 3,
                                                      0, 1, 1)
        self.UUIDButton = gui.Button('UUID')
        LineEditGroupLayout.addWidget(self.UUIDButton, 4, 0, 1, 1)
        self.baseDict['homepage'] = QLineEdit('')
        LineEditGroupLayout.addWidget(self.baseDict['homepage'], 3, 1, 1, 1)
        self.baseDict['uuid'] = QLineEdit()
        LineEditGroupLayout.addWidget(self.baseDict['uuid'], 4, 1, 1, 1)

        # The TextEditGroupBox
        self.TextEditGroupBox = QFrame()
        TextEditGroupLayout = QGridLayout()

        DescriptionLabel = TextEditGroupLayout.addWidget(
            QLabel('Description :'), 0, 0, 1, 1)
        LicenseLabel = TextEditGroupLayout.addWidget(QLabel('License :'), 1, 0,
                                                     1, 1)
        self.baseDict['description'] = QTextEdit()
        TextEditGroupLayout.addWidget(self.baseDict['description'], 0, 1, 1, 1)
        self.baseDict['license'] = QTextEdit()
        TextEditGroupLayout.addWidget(self.baseDict['license'], 1, 1, 1, 1)
        self.baseDict['description'].setLineWrapMode(QTextEdit.NoWrap)
        self.baseDict['license'].setLineWrapMode(QTextEdit.NoWrap)
        self.baseDict['description'].sizeHint = lambda: QSize(450, 125)
        self.baseDict['license'].sizeHint = lambda: QSize(450, 125)
        self.baseDict['description'].setSizePolicy(QSizePolicy.Maximum,
                                                   QSizePolicy.Maximum)
        self.baseDict['license'].setSizePolicy(QSizePolicy.Maximum,
                                               QSizePolicy.Maximum)

        self.TextEditGroupBox.setLayout(TextEditGroupLayout)

        CommonDataEditLayout.addWidget(self.LineEditGroupBox)
        CommonDataEditLayout.addWidget(self.TextEditGroupBox)
        self.CommonDataEditBox.setLayout(CommonDataEditLayout)

        # The asset-type dependent EditPanel:

        self.ClothesPanel = QGroupBox()
        ClothesLayout = QVBoxLayout()
        self.ClothesPanel.setLayout(ClothesLayout)

        self.CNumberPanel = QFrame()
        CNumberPanelLayout = QHBoxLayout()
        self.CNumberPanel.setLayout(CNumberPanelLayout)

        self.scalePanel = QFrame()
        scalePanelLayout = QGridLayout()
        self.scalePanel.setLayout(scalePanelLayout)

        self.objPanel = QFrame()
        objPanelLayout = QHBoxLayout()
        self.objPanel.setLayout(objPanelLayout)

        self.CMaterialPanel = QFrame()
        CMaterialPanelLayout = QHBoxLayout()
        self.CMaterialPanel.setLayout(CMaterialPanelLayout)

        zdepthLabel = QLabel('Z-Depth :')
        self.baseDict['z_depth'] = QLineEdit()
        self.baseDict['z_depth'].sizeHint = lambda: QSize(40, 30)
        self.baseDict['z_depth'].setSizePolicy(QSizePolicy.Maximum,
                                               QSizePolicy.Maximum)
        self.zDepthSelect = mhapi.ui.createComboBox(
            sorted(zDepth, key=zDepth.__getitem__), self.onzDepthSelect)
        self.zDepthSelect.setSizePolicy(QSizePolicy.Maximum,
                                        QSizePolicy.Maximum)
        maxpoleLabel = QLabel('  max pole :')
        self.baseDict['max_pole'] = QLineEdit()
        self.baseDict['max_pole'].sizeHint = lambda: QSize(40, 30)
        self.baseDict['max_pole'].setSizePolicy(QSizePolicy.Maximum,
                                                QSizePolicy.Maximum)
        x_scaleLabel = QLabel('x_scale:')
        self.baseDict['x_scale'] = [QLineEdit(), QLineEdit(), QLineEdit()]
        y_scaleLabel = QLabel('y_scale:')
        self.baseDict['y_scale'] = [QLineEdit(), QLineEdit(), QLineEdit()]
        z_scaleLabel = QLabel('z_scale:')
        self.baseDict['z_scale'] = [QLineEdit(), QLineEdit(), QLineEdit()]
        objLabel = QLabel('Set Object File :')
        self.baseDict['obj_file'] = QLineEdit()
        self.objButton = gui.Button('[ ... ]')
        self.objButton.sizeHint = lambda: QSize(40, 30)
        self.objButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.objRelPathButton = gui.Button('To rel. Path...')
        self.objRelPathButton.sizeHint = lambda: QSize(90, 30)
        self.objRelPathButton.setSizePolicy(QSizePolicy.Fixed,
                                            QSizePolicy.Fixed)
        materialLabel = QLabel('Set Default Material :')
        self.baseDict['material'] = QLineEdit()
        self.MaterialButton = gui.Button('[ ... ]')
        self.MaterialButton.sizeHint = lambda: QSize(40, 30)
        self.MaterialButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.RelPathButton = gui.Button('To rel. Path...')
        self.RelPathButton.sizeHint = lambda: QSize(90, 30)
        self.RelPathButton.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

        CNumberPanelLayout.addWidget(zdepthLabel)
        CNumberPanelLayout.addWidget(self.baseDict['z_depth'])
        CNumberPanelLayout.addWidget(self.zDepthSelect)
        CNumberPanelLayout.addWidget(maxpoleLabel)
        CNumberPanelLayout.addWidget(self.baseDict['max_pole'])
        CNumberPanelLayout.addStretch(1)

        scalePanelLayout.addWidget(x_scaleLabel, 0, 0, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['x_scale'][0], 0, 1, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['x_scale'][1], 0, 2, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['x_scale'][2], 0, 3, 1, 1)
        scalePanelLayout.addWidget(y_scaleLabel, 1, 0, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['y_scale'][0], 1, 1, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['y_scale'][1], 1, 2, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['y_scale'][2], 1, 3, 1, 1)
        scalePanelLayout.addWidget(z_scaleLabel, 2, 0, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['z_scale'][0], 2, 1, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['z_scale'][1], 2, 2, 1, 1)
        scalePanelLayout.addWidget(self.baseDict['z_scale'][2], 2, 3, 1, 1)
        scalePanelLayout.setColumnStretch(4, 75)

        objPanelLayout.addWidget(objLabel)
        objPanelLayout.addWidget(self.baseDict['obj_file'])
        objPanelLayout.addWidget(self.objButton)
        objPanelLayout.addWidget(self.objRelPathButton)

        CMaterialPanelLayout.addWidget(materialLabel)
        CMaterialPanelLayout.addWidget(self.baseDict['material'])
        CMaterialPanelLayout.addWidget(self.MaterialButton)
        CMaterialPanelLayout.addWidget(self.RelPathButton)

        ClothesLayout.addWidget(self.CNumberPanel)
        ClothesLayout.addWidget(self.scalePanel)
        ClothesLayout.addWidget(self.objPanel)
        ClothesLayout.addWidget(self.CMaterialPanel)

        EditPanelLayout.addWidget(self.ClothesPanel)
        EditPanelLayout.addStretch(1)

        # Advanced Panel

        self.AdvancedPanel = QFrame()
        AdvancedPanelLayout = QVBoxLayout()
        self.AdvancedPanel.setLayout(AdvancedPanelLayout)

        self.subFrame1 = QFrame()
        subFrame1Layout = QHBoxLayout()
        self.subFrame1.setLayout(subFrame1Layout)
        AdvancedPanelLayout.addWidget(self.subFrame1)

        self.bkPanel = QGroupBox()
        bkPanelLayout = QGridLayout()
        self.bkPanel.setLayout(bkPanelLayout)
        self.bkPanel.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

        #for i in range(3):
        #    bkPanelLayout.addWidget(QLabel(' Y   |   N  '), 0, i*2 + 1, 1, 1)
        i = 0
        for key in self.booleankeys:
            bkLabel = {i: [QLabel(key.capitalize()), QFrame(), QHBoxLayout()]}
            bkLabel[i][1].setLayout(bkLabel[i][2])
            self.baseDict[key] = [QRadioButton(': Y'), QRadioButton(': N')]
            bkLabel[i][2].addWidget(self.baseDict[key][0])
            bkLabel[i][2].addWidget(self.baseDict[key][1])
            bkLabel[i][2].addStretch(1)
            #bkPanelLayout.addWidget(bkLabel[i][1], (i // 3) + 1, (i % 3) * 2 + 1, 1, 1)
            #bkPanelLayout.addWidget(bkLabel[i][0], (i // 3) + 1, (i % 3) * 2, 1, 1)
            bkPanelLayout.addWidget(bkLabel[i][0], i, 0, 1, 1)
            bkPanelLayout.addWidget(bkLabel[i][1], i, 1, 1, 1)
            i += 1

        self.TexturesPanel = QGroupBox()
        TexturesPanelLayout = QGridLayout()
        self.TexturesPanel.setLayout(TexturesPanelLayout)
        subFrame1Layout.addWidget(self.TexturesPanel)

        subFrame1Layout.addWidget(self.bkPanel)

        i = 0
        for key in self.texturekeys:
            lineEdit = QLineEdit()
            self.baseDict[key] = lineEdit
            texturesPLabel = {
                i: [
                    QLabel(key.capitalize()),
                    QLabel(' : '), lineEdit,
                    defaultButton('[ ... ]', 40, 30),
                    defaultButton('To rel. Path...', 90, 30)
                ]
            }
            texturesPLabel[i][3].setSizePolicy(QSizePolicy.Fixed,
                                               QSizePolicy.Fixed)
            texturesPLabel[i][3].setObjectName(key)
            texturesPLabel[i][3].clicked.connect(self.onLoadTexture)
            texturesPLabel[i][4].setSizePolicy(QSizePolicy.Fixed,
                                               QSizePolicy.Fixed)
            texturesPLabel[i][4].setObjectName(key)
            texturesPLabel[i][4].clicked.connect(self.onRelTexturePathClicked)

            h = 0
            for widget in texturesPLabel[i]:
                # TexturesPanelLayout.addWidget(widget, i // 2, h + (i % 2) * 5, 1, 1)
                TexturesPanelLayout.addWidget(widget, i, h, 1, 1)
                h += 1
            i += 1

        self.subFrame2 = QFrame()
        subFrame2Layout = QHBoxLayout()
        self.subFrame2.setLayout(subFrame2Layout)
        AdvancedPanelLayout.addWidget(self.subFrame2)

        self.floatsPanel = QGroupBox()
        floatsPanelLayout = QGridLayout()
        self.floatsPanel.setLayout(floatsPanelLayout)
        subFrame2Layout.addWidget(self.floatsPanel)

        i = 0
        for key in self.floatkeys:
            self.baseDict[key] = QLineEdit()
            floatsPLabel = {
                i:
                [QLabel(key.capitalize()),
                 QLabel(' : '), self.baseDict[key]]
            }
            h = 0
            for widget in floatsPLabel[i]:
                # floatsPanelLayout.addWidget(widget, i // 2, h + (i % 2) * 3, 1, 1)
                floatsPanelLayout.addWidget(widget, i, h, 1, 1)
                h += 1
            i += 1

        self.rgbPanel = QGroupBox()
        rgbPanelLayout = QGridLayout()
        self.rgbPanel.setLayout(rgbPanelLayout)
        subFrame2Layout.addWidget(self.rgbPanel)

        i = 0
        for key in self.rgbkeys:
            self.baseDict[key] = [QLineEdit(), QLineEdit(), QLineEdit()]
            ed1, ed2, ed3 = self.baseDict[key]
            rgbPLabel = {
                i: [QLabel(key.capitalize()),
                    QLabel(' : '), ed1, ed2, ed3]
            }
            h = 0
            for widget in rgbPLabel[i]:
                # rgbPanelLayout.addWidget(widget, i // 2, h + (i % 2) * 5, 1, 1)
                rgbPanelLayout.addWidget(widget, i, h, 1, 1)
                h += 1
            i += 1

        self.ScrollArea2 = QScrollArea()
        self.ScrollArea2.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        self.ScrollArea2.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.ScrollArea2.setWidgetResizable(True)
        self.ScrollArea2.setWidget(self.AdvancedPanel)
        ScrollLayout2 = QVBoxLayout()
        ScrollLayout2.addWidget(self.AdvancedPanel)
        self.ScrollArea2.setLayout(ScrollLayout2)
        self.tabAdvancedIndex = self.TabWidget.addTab(
            self.ScrollArea2, 'Advanced Materials Data')

        self.TabWidget.setTabEnabled(self.tabEditIndex, False)
        self.TabWidget.setTabEnabled(self.tabAdvancedIndex, False)

        # Define Actions here:

        @self.RedoButton.mhEvent
        def onClicked(event):
            if self.history_ptr['current'] < self.history_ptr['head']:
                self.history[self.history_ptr['current']] = {
                    k: self.asset[k]
                    for k in self.asset.keys()
                }
                self.asset.clear()
                self.history_ptr['current'] += 1
                self.asset = {
                    k: self.history[self.history_ptr['current']][k]
                    for k in self.history[self.history_ptr['current']].keys()
                }
                self.setAssetInfoText(self.asset)
                self.UndoButton.setDisabled(False)
            if self.history_ptr['current'] == self.history_ptr['head']:
                self.RedoButton.setDisabled(True)
            self.setEditData()

        @self.UndoButton.mhEvent
        def onClicked(event):
            if self.history_ptr['current'] > 0:
                self.history[self.history_ptr['current']] = {
                    k: self.asset[k]
                    for k in self.asset.keys()
                }
                self.asset.clear()
                self.history_ptr['current'] -= 1
                self.asset = {
                    k: self.history[self.history_ptr['current']][k]
                    for k in self.history[self.history_ptr['current']].keys()
                }
                self.setAssetInfoText(self.asset)
                self.RedoButton.setDisabled(False)
            if self.history_ptr['current'] == 0:
                self.UndoButton.setDisabled(True)
            self.setEditData()

        @self.UpdateButton.mhEvent
        def onClicked(event):
            self.isUpdate = True
            self.history[self.history_ptr['current']] = {
                key: self.asset[key]
                for key in self.asset.keys()
            }
            self.history_ptr['current'] += 1
            self.history_ptr['head'] = self.history_ptr['current']

            self.UndoButton.setDisabled(False)
            self.SaveButton.setDisabled(False)
            self.ClothesTypeBox.setDisabled(False)
            self.ResetButton.setDisabled(False)

            if not self.tagWarn:
                taglist = []
                for lineEdit in self.baseDict['tag']:
                    if lineEdit.text().strip() != '':
                        taglist.append(lineEdit.text().strip())
                self.asset['tag'] = set(taglist)

            if not self.selectedType in ['Materials', 'Models']:
                self.asset['obj_file'] = self.baseDict['obj_file'].text()
                self.asset['material'] = self.baseDict['material'].text()
                for key in ['x_scale', 'y_scale', 'z_scale']:
                    self.asset[key] = self.getDigitStr(self.baseDict[key][0].text()) + ' ' + \
                                      self.getDigitStr(self.baseDict[key][1].text()) + ' ' + \
                                      self.getFloatStr(self.baseDict[key][2].text())
                    if self.asset[key].strip() == '': self.asset[key] = None

            for key in self.linekeys:
                self.asset[key] = self.baseDict[key].text()
            for key in self.textkeys:
                self.asset[key] = self.baseDict[key].toPlainText()
            if not (self.selectedType == 'Models'
                    or self.selectedType == 'Materials'):
                for key in self.intkeys:
                    self.asset[key] = self.getDigitStr(
                        self.baseDict[key].text())
            if self.selectedType == 'Materials':
                for key in self.booleankeys:
                    self.asset[key] = 'True' if self.baseDict[key][
                        0].isChecked() else 'False'
                for key in self.texturekeys:
                    self.asset[key] = self.baseDict[key].text()
                for key in self.floatkeys:
                    self.asset[key] = self.getFloatStr(
                        self.baseDict[key].text())
                for key in self.rgbkeys:
                    self.asset[key] = self.getDigitStr(self.baseDict[key][0].text()) + ' ' + \
                                      self.getDigitStr(self.baseDict[key][1].text()) + ' ' + \
                                      self.getFloatStr(self.baseDict[key][2].text())
                    if self.asset[key].strip() == '': self.asset[key] = None

            self.setAssetInfoText(self.asset)

        @self.ResetButton.mhEvent
        def onClicked(event):
            self.asset, self.strip = self.splitAssetDict(self.resetAsset)
            self.setAssetInfoText(self.asset)
            self.ResetButton.setDisabled(True)
            self.history.clear()
            self.history_ptr = {'head': 0, 'current': 0}
            self.UndoButton.setDisabled(True)
            self.RedoButton.setDisabled(True)
            self.SaveButton.setDisabled(True)
            self.setEditData()

        @self.SaveButton.mhEvent
        def onClicked(event):
            saveAsset = self.joinDict(self.asset, self.strip)
            if saveAsset:
                mhapi.assets.writeAssetFile(saveAsset, True)
                self.showMessage("Asset was saved as " +
                                 saveAsset["absolute path"] +
                                 "\n\nA backup file was created in " +
                                 saveAsset["absolute path"] + ".bak")

        @self.UUIDButton.mhEvent
        def onClicked(event):
            self.baseDict['uuid'].setText(uuid.uuid4())

        @self.FileChooser.mhEvent
        def onFileSelected(filename):
            self.loadedFile = os.path.split(filename)
            assetInfo = mhapi.assets.openAssetFile(filename)
            if assetInfo["thumb_path"]:
                self.Thumbnail.setPixmap(QPixmap(assetInfo["thumb_path"]))
            else:
                self.Thumbnail.setPixmap(QPixmap(self.notfound))
            self.Thumbnail.setGeometry(0, 0, 128, 128)
            self.resetAsset = assetInfo
            self.asset, self.strip = self.splitAssetDict(self.resetAsset)
            self.setAssetInfoText(self.asset)
            self.tagWarn = False
            self.history.clear()
            self.history_ptr = {'head': 0, 'current': 0}
            self.setEditData()
            self.UndoButton.setDisabled(True)
            self.RedoButton.setDisabled(True)
            self.ResetButton.setDisabled(True)
            self.TabWidget.setTabEnabled(self.tabEditIndex, True)
            self.TabWidget.setTabEnabled(self.tabAdvancedIndex, False)

        @self.FileChooser2.mhEvent
        def onFileSelected(filename):
            self.loadedFile = os.path.split(filename)
            assetInfo = mhapi.assets.openAssetFile(filename)
            if assetInfo["thumb_path"]:
                self.Thumbnail.setPixmap(QPixmap(assetInfo["thumb_path"]))
            else:
                self.Thumbnail.setPixmap(QPixmap(self.notfound))
            self.Thumbnail.setGeometry(0, 0, 128, 128)
            self.resetAsset = assetInfo
            self.asset, self.strip = self.splitAssetDict(self.resetAsset)
            self.setAssetInfoText(self.asset)
            self.isUpdate = False
            self.tagWarn = False
            self.history.clear()
            self.history_ptr = {'head': 0, 'current': 0}
            self.setAssetInfoText(self.asset)
            self.setEditData()
            self.UndoButton.setDisabled(True)
            self.RedoButton.setDisabled(True)
            self.ResetButton.setDisabled(True)
            self.TabWidget.setTabEnabled(self.tabEditIndex, True)
            if self.selectedType == 'Materials':
                self.TabWidget.setTabEnabled(self.tabAdvancedIndex, True)
            else:
                self.TabWidget.setTabEnabled(self.tabAdvancedIndex, False)

        @self.MaterialButton.mhEvent
        def onClicked(event):
            selectedFile = None
            FDialog = QFileDialog(None, '', self.loadedFile[0])
            FDialog.setFileMode(QFileDialog.ExistingFiles)
            FDialog.setFilter(
                'MakeHuman Material ( *.mhmat );; All files ( *.* )')
            if FDialog.exec_():
                selectedFile = FDialog.selectedFiles()[0]
            if selectedFile:
                materialFile = os.path.split(selectedFile)
                if materialFile[0] == self.loadedFile[0]:
                    self.baseDict['material'].setText(materialFile[1])
                else:
                    self.baseDict['material'].setText(selectedFile)

        @self.RelPathButton.mhEvent
        def onClicked(event):
            filepath, filename = os.path.split(
                self.baseDict['material'].text())
            if os.path.isfile(filepath + '/' + filename):
                rel_path = makeRelPath(filepath, self.loadedFile[0])
                if rel_path:
                    self.baseDict['material'].setText(rel_path + filename)
                else:
                    self.baseDict['material'].setText('Failure')
            else:
                self.baseDict['material'].setText('File not found')

        @self.objButton.mhEvent
        def onClicked(event):
            selectedFile = None
            FDialog = QFileDialog(None, '', self.loadedFile[0])
            FDialog.setFileMode(QFileDialog.ExistingFiles)
            FDialog.setFilter('Object Files ( *.obj );; All files ( *.* )')
            if FDialog.exec_():
                selectedFile = FDialog.selectedFiles()[0]
            if selectedFile:
                objFile = os.path.split(selectedFile)
                if objFile[0] == self.loadedFile[0]:
                    self.baseDict['obj_file'].setText(objFile[1])
                else:
                    self.baseDict['obj_file'].setText(selectedFile)

        @self.objRelPathButton.mhEvent
        def onClicked(event):
            filepath, filename = os.path.split(
                self.baseDict['obj_file'].text())
            if os.path.isfile(filepath + '/' + filename):
                rel_path = makeRelPath(filepath, self.loadedFile[0])
                if rel_path:
                    self.baseDict['obj_file'].setText(rel_path + filename)
                else:
                    self.baseDict['obj_file'].setText('Failure')
            else:
                self.baseDict['obj_file'].setText('File not found')