コード例 #1
0
    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)
コード例 #2
0
ファイル: __init__.py プロジェクト: ylimerm3/FaReT
    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())  
コード例 #3
0
 def __init__(self):
     super(TagsView, self).__init__('Tags')
     self.editList = []
     for _ in range(int(G.app.getSetting('tagCount'))):
         edit = gui.TextEdit('')
         edit.setMaxLength(25)
         self.editList.append(self.addWidget(edit))
コード例 #4
0
    def __init__(self, category):
        """
        Creates the widget with two text inputs to specify the
        number of instances to generate and the output directory
        :param category: where to display the widget
        """
        gui3d.TaskView.__init__(self, category, 'Generator')

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

        # number of instances to generate
        self.numberInstances = box.addWidget(gui.TextEdit(text="10"))

        # where to store the generated models
        self.outputTextEdit = box.addWidget(
            gui.TextEdit(text=os.path.expanduser("~")))

        # progress bars
        self.genProgressBar = box.addWidget(gui.ProgressBar())
        self.genProgressBar.setProgress(0)

        # button to trigger the generation
        self.genButton = box.addWidget(gui.Button('Generate'))

        # used to avoid any duplicate in the current run
        self.duplicate_tracker = {}

        @self.genButton.mhEvent
        def onClicked(event):
            output_dir = self.outputTextEdit.text

            os.makedirs(output_dir, exist_ok=True)
            N = int(self.numberInstances.text)

            self.duplicate_tracker = {}

            for i in range(N):
                name = f"model_{i}"
                path = os.path.join(output_dir, name)
                os.makedirs(path, exist_ok=True)
                self.generateHuman(path)
                self.genProgressBar.setProgress((i + 1) / N)
コード例 #5
0
ファイル: __init__.py プロジェクト: duststorm/googlecode
    def __init__(self, category):
        guirender.RenderTaskView.__init__(self, category, 'Mitsuba')

        # Buttons
        pathBox = self.addLeftWidget(gui.GroupBox('Mitsuba  bin  path'))
        mitsuba_bin = gui3d.app.settings.get('mitsuba_bin', '')
        self.path= pathBox.addWidget(gui.TextEdit(str(mitsuba_bin)), 0, 0, 1, 2)
        self.browse = pathBox.addWidget(gui.BrowseButton('dir'), 1, 0, 1, 1)
        self.browse.setPath(mitsuba_bin)
        if sys.platform == 'win32':
            self.browse.setFilter('Executable programs (*.exe);;All files (*.*)')
        #
        @self.path.mhEvent
        def onChange(value):
            gui3d.app.settings['mitsuba_bin'] = 'Enter your path' if not value else str(value)

        @self.browse.mhEvent
        def onClicked(path):
            if os.path.isfile(path):
                gui3d.app.settings['mitsuba_bin'] = path
                self.path.setText(path)

        # Type of lighting method
        lightingBox = self.addLeftWidget(gui.GroupBox('Integrators'))
        lighting = []
        self.dlButton = lightingBox.addWidget(gui.RadioButton(lighting, 'DirectLighting', selected = True))
        self.ptButton = lightingBox.addWidget(gui.RadioButton(lighting, 'Path Tracing'))
        self.pmButton = lightingBox.addWidget(gui.RadioButton(lighting, 'Photon Mapping'))

        #
        samplerBox = self.addLeftWidget(gui.GroupBox('Sampler Options'))
        sampler = []
        self.lowdButton = samplerBox.addWidget(gui.RadioButton(sampler, 'Low Discrepancy', selected = True))
        self.indepButton = samplerBox.addWidget(gui.RadioButton(sampler, 'Independent'))
        #
        renderBox = self.addLeftWidget(gui.GroupBox('Render Options'))
        source=[]
        self.consoleButton = renderBox.addWidget(gui.RadioButton(source, 'Render console'))
        self.guiButton = renderBox.addWidget(gui.RadioButton(source, 'Render GUI', selected = True))
        self.xmlButton = renderBox.addWidget(gui.RadioButton(source, 'Write XML'))
        self.renderButton = renderBox.addWidget(gui.Button('Render'))


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

            reload(mh2mitsuba)  # Avoid having to close and reopen MH for every coding change (can be removed once testing is complete)
            mh2mitsuba.MitsubaExport(gui3d.app.selectedHuman.mesh, gui3d.app,
                {'source':'console' if self.consoleButton.selected else 'gui' if self.guiButton.selected else 'xml',
                 'lighting':'dl' if self.dlButton.selected else 'pt' if self.ptButton.selected else 'pm',
                 'sampler':'low' if self.lowdButton.selected else 'ind'})
コード例 #6
0
 def onShow(self, event):
     super(TagsView, self).onShow(event)
     editDiff = int(G.app.getSetting('tagCount')) - len(self.editList)
     if editDiff > 0:
         for _ in range(editDiff):
             edit = gui.TextEdit('')
             edit.setMaxLength(25)
             self.editList.append(self.addWidget(edit))
     elif editDiff < 0:
         for _ in range(abs(editDiff)):
             edit = self.editList.pop()
             edit.hide()
             edit.destroy()
     self.setTags(G.app.selectedHuman.getTags())
コード例 #7
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)
コード例 #8
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
コード例 #9
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)
コード例 #10
0
ファイル: 7_shell.py プロジェクト: huckst3r/makehuman_datagen
    def __init__(self, category):
        super(ShellTaskView, self).__init__(category, 'Shell')
        self.globals = {'G': G}
        self.history = []
        self.histitem = None

        self.main = self.addTopWidget(QtGui.QWidget())
        self.layout = QtGui.QGridLayout(self.main)
        self.layout.setRowStretch(0, 0)
        self.layout.setRowStretch(1, 0)
        self.layout.setColumnStretch(0, 1)
        self.layout.setColumnStretch(1, 0)

        self.text = gui.DocumentEdit()
        self.text.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding)
        self.layout.addWidget(self.text, 0, 0, 1, 2)

        self.line = gui.TextEdit()
        self.line.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.layout.addWidget(self.line, 1, 0, 1, 1)
        self.globals = {'G': G}

        self.clear = gui.Button("Clear")
        self.layout.addWidget(self.clear, 1, 1, 1, 1)

        @self.line.mhEvent
        def onActivate(text):
            self.execute(text)
            self.history.append(text)
            self.histitem = None
            self.line.setText('')

        @self.clear.mhEvent
        def onClicked(event):
            self.clearText()

        @self.line.mhEvent
        def onUpArrow(_dummy):
            self.upArrow()

        @self.line.mhEvent
        def onDownArrow(_dummy):
            self.downArrow()
コード例 #11
0
    def __init__(self, category):
        """ Constructor for the TaskView.  This accepts the category under which
            this feature is enabled.

            The category is registered with the app and passed into this
            constructor on the `load()` API below.
        """
        self.human = gui3d.app.selectedHuman
        gui3d.TaskView.__init__(self, category, "MHServer")

        fr_left = self.addLeftWidget(gui.GroupBox("Settings:"))
        self.txt_port = fr_left.addWidget(gui.TextEdit(text="18830"))
        self.btn_restart = fr_left.addWidget(gui.Button("Restart"))

        @self.btn_restart.mhEvent
        def onClicked(e):
            self.restart_server()

        self.logbox = self.addTopWidget(gui.DocumentEdit())
        self.logbox.setText("")
        self.logbox.setLineWrapMode(gui.DocumentEdit.NoWrap)
コード例 #12
0
    def makeProps(self):
        SceneItem.makeProps(self)

        self.widget.addWidget(gui.TextView("Position"))
        self.posbox = self.widget.addWidget(
            gui.TextEdit(", ".join([str(x) for x in self.light.position])))

        self.widget.addWidget(gui.TextView("Focus"))
        self.focbox = self.widget.addWidget(
            gui.TextEdit(", ".join([str(x) for x in self.light.focus])))

        self.widget.addWidget(gui.TextView("Color"))
        self.colbox = self.widget.addWidget(
            gui.TextEdit(", ".join([str(x) for x in self.light.color])))

        self.widget.addWidget(gui.TextView("Spot angle"))
        self.fov = self.widget.addWidget(gui.TextEdit(str(self.light.fov)))

        self.widget.addWidget(gui.TextView("Attenuation"))
        self.att = self.widget.addWidget(
            gui.TextEdit(str(self.light.attenuation)))

        self.soft = self.widget.addWidget(
            gui.CheckBox("Soft light", self.light.areaLights > 1))
        self.widget.addWidget(gui.TextView("Softness"))
        self.size = self.widget.addWidget(
            gui.TextEdit(str(self.light.areaLightSize)))

        self.widget.addWidget(gui.TextView("Samples"))
        self.samples = self.widget.addWidget(
            gui.TextEdit(str(self.light.areaLights)))

        self.removebtn = self.widget.addWidget(
            gui.Button('Remove light ' + str(self.lightid)))

        @self.posbox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.position = tuple(
                    [float(x) for x in value.split(",")])
            except:  # The user hasn't typed the value correctly yet.
                pass

        @self.focbox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.focus = tuple([float(x) for x in value.split(",")])
            except:
                pass

        @self.colbox.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.color = tuple([float(x) for x in value.split(",")])
            except:
                pass

        @self.fov.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.fov = float(value)
            except:
                pass

        @self.att.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.attenuation = float(value)
            except:
                pass

        @self.soft.mhEvent
        def onClicked(event):
            try:
                if self.soft.checkState() and self.light.areaLights <= 1:
                    self.light.areaLights = 2
                    self.samples.setText(str(2))
                elif self.soft.checkState() == 0 and self.light.areaLights > 1:
                    self.light.areaLights = 1
                    self.samples.setText(str(1))
            except:
                pass

        @self.size.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                self.light.attenuation = float(value)
            except:
                pass

        @self.samples.mhEvent
        def onChange(value):
            try:
                value = value.replace(" ", "")
                alights = int(value)
                self.light.areaLights = alights
                if alights > 1:
                    self.soft.setCheckState(2)
                else:
                    self.soft.setCheckState(0)
            except:
                pass

        @self.removebtn.mhEvent
        def onClicked(event):
            self.sceneview.scene.removeLight(self.light)
            self.sceneview.readScene()
コード例 #13
0
ファイル: 7_example.py プロジェクト: yhl533556/makehuman
    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()
コード例 #14
0
ファイル: __init__.py プロジェクト: fsotoc/FaReT
    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))
コード例 #15
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Average Model')

        settingsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        self.path = ""
        self.path_button = settingsBox.addWidget(
            gui.BrowseButton('dir', "Select an input 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.goButton = settingsBox.addWidget(gui.Button('Start'))

        self.save_button = settingsBox.addWidget(
            gui.Button("Save Average JSON"))
        self.load_button = settingsBox.addWidget(
            gui.BrowseButton('dir', 'Load Average JSONs from Folder'))
        self.generate_button = settingsBox.addWidget(
            gui.Button('Generate Randomly From Average'))

        self.avg_params = None
        self.params_max = None
        self.params_min = None

        @self.goButton.mhEvent
        def onClicked(event):
            self.avg_params, self.sd_params, self.params_min, self.params_max = makehuman_average.make_average(
                self.pathBox.getText())

        @self.load_button.mhEvent
        def onClicked(path):
            jsons = glob(os.path.join(path, "*.json"))
            self.pathBox.setText(self.path)
            for file in jsons:
                with open(file, 'r') as f:
                    if "avg" in file:
                        self.avg_params = json.load(f)
                    elif "sd" in file:
                        self.sd_params = json.load(f)
                    elif "min" in file:
                        self.params_min = json.load(f)
                    elif "max" in file:
                        self.params_max = json.load(f)
            models = glob(os.path.join(path, "*.mhm"))
            # subdirectories
            models += glob(os.path.join(path, "*/*.mhm"))
            gui3d.app.loadHumanMHM(models[0])
            makehuman_average.updateModelingParameters(self.avg_params)

        @self.save_button.mhEvent
        def onClicked(event):
            path = self.pathBox.getText()
            avg_file = os.path.join(path, "avg.json")
            min_file = os.path.join(path, "min.json")
            max_file = os.path.join(path, "max.json")
            sd_file = os.path.join(path, "sd.json")

            with open(avg_file, 'w') as f:
                json.dump(self.avg_params, f)
            with open(sd_file, 'w') as f:
                json.dump(self.sd_params, f)
            with open(min_file, 'w') as f:
                json.dump(self.params_min, f)
            with open(max_file, 'w') as f:
                json.dump(self.params_max, f)

        @self.generate_button.mhEvent
        def onClicked(event):
            params = {}
            for param in self.avg_params:
                params[param] = self.random_between(self.avg_params[param],
                                                    self.params_min[param],
                                                    self.params_max[param],
                                                    self.sd_params[param])
            makehuman_average.updateModelingParameters(params)
            human = gui3d.app.selectedHuman
            mhmain.SymmetryAction(human, 1).do()
コード例 #16
0
ファイル: savetargets.py プロジェクト: recogni/makehuman
    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
コード例 #17
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Povray')

        # for path to PovRay binaries file
        binary = ''

        bintype = []
        pathBox = self.addLeftWidget(gui.GroupBox('Povray  bin  path'))
        # this part load old settings values for next session; str(povray_bin)
        povray_bin = gui3d.app.settings.get('povray_bin', '')
        self.path = pathBox.addWidget(gui.TextEdit(str(povray_bin)), 0, 0, 1,
                                      2)
        self.browse = pathBox.addWidget(gui.BrowseButton('dir'), 1, 0, 1, 1)
        self.browse.setPath(povray_bin)
        if sys.platform == 'win32':
            self.browse.setFilter(
                'Executable programs (*.exe);;All files (*.*)')

        #
        if os.name == 'nt':
            #
            if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
                self.win32sse2Button = pathBox.addWidget(
                    gui.CheckBox('Use SSE2 bin', True))
        #
        @self.path.mhEvent
        def onChange(value):
            gui3d.app.settings[
                'povray_bin'] = 'Enter your path' if not value else str(value)

        @self.browse.mhEvent
        def onClicked(path):
            if os.path.isdir(path):
                gui3d.app.settings['povray_bin'] = path
                self.path.setText(path)

        #------------------------------------------------------------------------------------
        filter = []
        # Options box
        optionsBox = self.addLeftWidget(gui.GroupBox('Options'))
        self.doSubdivide = optionsBox.addWidget(
            gui.CheckBox('Subdivide mesh', True))
        self.useSSS = optionsBox.addWidget(
            gui.CheckBox('Use S.S. Scattering', True))
        self.SSSA = optionsBox.addWidget(
            gui.Slider(value=0.3, label="SSS Amount"))
        self.AA = optionsBox.addWidget(
            gui.Slider(value=0.4, label="AntiAliasing"))

        materialsBox = self.addRightWidget(gui.GroupBox('Materials'))
        self.skinoil = materialsBox.addWidget(
            gui.Slider(value=0.4, label="Skin oil"))
        self.rough = materialsBox.addWidget(
            gui.Slider(value=0.5, label="Skin roughness"))
        self.wrinkles = materialsBox.addWidget(
            gui.Slider(value=0.2, label="Skin wrinkles"))
        self.hairSpec = materialsBox.addWidget(
            gui.CheckBox('Hair shine', False))
        self.hspecA = materialsBox.addWidget(
            gui.Slider(value=0.5, label="Shine strength"))
        self.hairThick = materialsBox.addWidget(
            gui.Slider(value=0.67, label="Hair thickness"))

        # box
        #optionsBox = self.addLeftWidget(gui.GroupBox('Options'))

        #Buttons
        # Simplified the gui a bit for the average user. Uncomment to clutter it up with developer - useful stuff.
        #source=[]
        #self.iniButton = optionsBox.addWidget(gui.RadioButton(source, 'Use ini settings'))
        #self.guiButton = optionsBox.addWidget(gui.RadioButton(source, 'Use gui settings', selected = True))
        #format=[]
        #self.arrayButton = optionsBox.addWidget(gui.RadioButton(format, 'Array  format'))
        #self.mesh2Button = optionsBox.addWidget(gui.RadioButton(format, 'Mesh2 format', selected = True))
        #action=[]
        #self.exportButton = optionsBox.addWidget(gui.RadioButton(action , 'Export only', selected = True))
        #self.exportandrenderButton = optionsBox.addWidget(gui.RadioButton(action , 'Export and render'))
        self.renderButton = optionsBox.addWidget(gui.Button('Render'))

        #
        @self.renderButton.mhEvent
        def onClicked(event):

            reload(
                mh2povray
            )  # Avoid having to close and reopen MH for every coding change (can be removed once testing is complete)
            # it is necessary to put this code here, so that it is executed with the 'renderButton.event'
            if os.name == 'nt':
                #
                if os.environ['PROCESSOR_ARCHITECTURE'] == "x86":
                    binary = 'win32'
                    #
                    if self.win32sse2Button.selected:
                        binary = 'win32sse2'
                #
                else:
                    binary = 'win64'
            # for Ubuntu.. atm
            if sys.platform == 'linux2':
                binary = 'linux'
            #
            mh2povray.povrayExport(
                gui3d.app.selectedHuman.mesh,
                gui3d.app,
                {
                    'source':
                    'gui',  # 'ini' if self.iniButton.selected else 'gui',
                    'format':
                    'mesh2',  # 'array' if self.arrayButton.selected else 'mesh2',
                    'action':
                    'render',  # 'export' if self.exportButton.selected else 'render',
                    'subdivide': True if self.doSubdivide.selected else False,
                    'AA': 0.5 - 0.49 * self.AA.getValue(),
                    'bintype': binary,
                    'SSS': True if self.useSSS.selected else False,
                    'SSSA': 6 * self.SSSA.getValue(),  # power of 2
                    'skinoil': 0.001 *
                    (10**(4 * self.skinoil.getValue())),  # exponential slider
                    'rough': 0.001 *
                    (10**(2 * self.rough.getValue())),  # exponential slider
                    'wrinkles': 0.5 * self.wrinkles.getValue(),
                    'hairSpec': True if self.hairSpec.selected else False,
                    'hspecA': 0.1 *
                    (10**(2 * self.hspecA.getValue())),  # exponential slider
                    'hairThin': 5**(2 * (1 - self.hairThick.getValue()))
                })  # exponential slider
コード例 #18
0
 def __init__(self, name, value=""):
     super(TextEdit, self).__init__(name)
     self.edit = self.addWidget(gui.TextEdit(value))
コード例 #19
0
    def __init__(self, category, appFacs):
        gui3d.TaskView.__init__(self, category, 'Pain Face Generator')
        self.facs_human = appFacs.selectedHuman
        camera = G.app.modelCamera
        self.app = appFacs

        # self.targets_path_emotions_blender = getpath.getPath('data/FACSHuman/00 Emotions')
        self.targets_path_upper_face = getpath.getPath(
            'data/FACSHuman/01 Upper Face AUs')
        self.targets_path_lower_face = getpath.getPath(
            'data/FACSHuman/02 Lower Face AUs')
        self.targets_path_lip_jaw = getpath.getPath(
            'data/FACSHuman/03 Lip Parting and Jaw Opening')
        # self.targets_path_eye = getpath.getPath('data/FACSHuman/04 Eye Positions')
        # self.targets_path_head = getpath.getPath('data/FACSHuman/05 Head Positions')
        # self.targets_path_misc = getpath.getPath('data/FACSHuman/06 Miscellaneous AUs')

        self.last_directory_rendering = ''
        self.images_to_convert = ''
        self.video_destination = ''
        #self.video_background = 'black.jpg'
        self.renderingWidth = '500'
        self.renderingHeight = '500'
        self.images_set_dir_destination = ''

        # box_emotions_blender = self.addLeftWidget(gui.GroupBox('Emotions blender'))
        box_upper = self.addLeftWidget(gui.GroupBox('Upper Face AUs'))
        box_lower = self.addLeftWidget(gui.GroupBox('Lower Face AUs'))
        # box_head = self.addLeftWidget(gui.GroupBox('Head Positions'))
        # box_eye = self.addLeftWidget(gui.GroupBox('Eye Positions'))
        box_lip = self.addLeftWidget(
            gui.GroupBox('Lip Parting and Jaw Opening'))
        # box_misc = self.addLeftWidget(gui.GroupBox('Miscellaneous AUs'))
        box_weight = self.addRightWidget(gui.GroupBox('AU Matrix Weights'))
        box_gen = self.addRightWidget(gui.GroupBox('View and Generate Images'))
        box_tools = self.addRightWidget(gui.GroupBox('Tools'))
        # box_aus_code = self.addRightWidget(gui.GroupBox('Action Units coding'))

        # self.general_intensity = box_aus_code.addWidget(gui.Slider(value=100, min=0, max=100, label=['General Intensity : ','%d%%']), columnSpan = 2)
        # #self.general_intensity_progress_bar = box_tools.addWidget(gui.ProgressBar())
        # #self.general_intensity_progress_bar.setProgress(1)
        # self.txt_file_loaded = box_aus_code.addWidget(gui.TextView('- New facial code -'), columnSpan = 2)
        # self.load_facs_button = box_aus_code.addWidget(gui.BrowseButton('open', "Load FACS Code"), 3, 0)
        # self.save_facs_button = box_aus_code.addWidget(gui.BrowseButton('save', "Save FACS Code"), 3, 1)
        # # self.save_target_button = box_aus_code.addWidget(gui.BrowseButton('save', "Save target"))
        # self.generate_au_coding_button = box_aus_code.addWidget(gui.Button('Get AU\'s Code'), columnSpan = 2)
        # self.txt_coding = box_aus_code.addWidget(gui.TextView('AU\'s code generated :'), columnSpan = 2)
        # self.au_coding = box_aus_code.addWidget(gui.DocumentEdit(text='Neutral'), columnSpan = 2)
        # self.one_shot_button = box_tools.addWidget(gui.Button('Take one shot'), 1, 0)

        self.survey_img_button = box_weight.addWidget(
            gui.Button('Generate Survey Images'), columnSpan=2)
        self.au4_lab = box_weight.addWidget(gui.TextView('AU4 Weight'))
        self.au4_val = box_weight.addWidget(gui.TextEdit(text='0.8865'))
        self.au7_lab = box_weight.addWidget(gui.TextView('AU7 Weight'))
        self.au7_val = box_weight.addWidget(gui.TextEdit(text='0.7758'))
        self.au9_lab = box_weight.addWidget(gui.TextView('AU9 Weight'))
        self.au9_val = box_weight.addWidget(gui.TextEdit(text='2.6129'))
        self.au10_lab = box_weight.addWidget(gui.TextView('AU10 Weight'))
        self.au10_val = box_weight.addWidget(gui.TextEdit(text='3.6517'))

        self.reset_camera_button = box_gen.addWidget(
            gui.Button('Full face camera view'), columnSpan=2)
        self.master_slider = box_gen.addWidget(gui.Slider(
            value=0, min=0, max=100, label=['General Intensity : ', '%d%%']),
                                               columnSpan=2)
        self.one_shot_button = box_gen.addWidget(gui.Button('Take one shot'),
                                                 columnSpan=2)
        self.generate_set_button = box_gen.addWidget(
            gui.Button('generate pain image set'), columnSpan=2)

        self.one_shot_stereo_button = box_tools.addWidget(
            gui.Button('Stereoscopic shot'), columnSpan=2)
        self.au_set_gen_button = box_tools.addWidget(
            gui.BrowseButton('open', "Dir to img"), 2, 0)
        self.material_gen_button = box_tools.addWidget(
            gui.BrowseButton('open', "Images set"), 2, 1)
        self.material_gen_dir_button = box_tools.addWidget(gui.FileEntryView(
            'Browse', mode='dir'),
                                                           columnSpan=2)
        self.camera_slider_x = box_tools.addWidget(gui.Slider(
            value=0, min=-1, max=1, label=['camera x: ', '%2f']),
                                                   columnSpan=2)
        self.camera_slider_y = box_tools.addWidget(gui.Slider(
            value=0, min=-1, max=1, label=['camera y: ', '%2f']),
                                                   columnSpan=2)
        self.camera_slider_zoom = box_tools.addWidget(gui.Slider(
            value=0, min=4, max=9, label=['Zoom: ', '%2f']),
                                                      columnSpan=2)
        self.rotation_slider_z = box_tools.addWidget(gui.Slider(
            value=0, min=-90, max=90, label=['rotation z: ', '%2f']),
                                                     columnSpan=2)
        self.reset_button = box_tools.addWidget(
            gui.Button('Reset Facial Code'), columnSpan=2)
        self.full_set_button = box_tools.addWidget(
            gui.Button('Full set generation'), columnSpan=2)
        self.facsvatar_set_button = box_tools.addWidget(gui.BrowseButton(
            'open', 'FACAvatar rendering'),
                                                        columnSpan=2)

        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())

        self.slidersValues = {
        }  #Keep a trace of values in the General intensity sliders function
        self.sliders = {}
        self.sliders_order = []
        self.labelSlider = {}
        #self.modifiers = {}
        self.au_timeline_values = {}  # For the animation functionality
        self.au_facs_loaded_file_values = {}  # For the animation functionality

        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())

        # self.searchTargets(self.targets_path_emotions_blender, box_emotions_blender, 'Emotions Blender')
        self.searchTargets(self.targets_path_upper_face, box_upper,
                           'Upper Face AUs')
        self.searchTargets(self.targets_path_lower_face, box_lower,
                           'Lower Face AUs')
        self.searchTargets(self.targets_path_lip_jaw, box_lip,
                           'Lip Parting and Jaw Opening')
        # self.searchTargets(self.targets_path_eye, box_eye, 'Eye Positions')
        # self.searchTargets(self.targets_path_head, box_head, 'Head Positions')
        # self.searchTargets(self.targets_path_misc, box_misc, 'Miscellaneous AUs')

        @self.camera_slider_x.mhEvent
        def onChanging(value):
            pos = self.facs_human.getPosition()
            pos[0] = value
            self.facs_human.setPosition(pos)
            mh.redraw()

        @self.camera_slider_y.mhEvent
        def onChanging(value):
            pos = self.facs_human.getPosition()
            pos[1] = value
            self.facs_human.setPosition(pos)
            mh.redraw()

        @self.camera_slider_zoom.mhEvent
        def onChanging(value):
            camera.setZoomFactor(value)

        @self.rotation_slider_z.mhEvent
        def onChanging(value):
            pos = self.facs_human.getRotation()
            pos[1] = value
            self.facs_human.setRotation(pos)
            mh.redraw()

##########################################################################
# Generate all AUs images
##########################################################################

        @self.facsvatar_set_button.mhEvent
        def onClicked(path):
            self.generateFacsvatarDirSet(path)

##########################################################################
# Generate all AUs images
##########################################################################

        @self.au_set_gen_button.mhEvent
        def onClicked(path):
            self.generateDirSet(path)

##########################################################################
# Generate material images
##########################################################################

        @self.material_gen_button.mhEvent
        def onClicked(path):
            self.generateCompleteImagesSetFromDir(path)
##########################################################################
# Generate material images
##########################################################################

        @self.material_gen_dir_button.mhEvent
        def onFileSelected(event):
            # self.images_set_dir_destination = os.path.dirname(path)
            self.images_set_dir_destination = event.path
            # self.images_set_dir_destination = os.path.dirname(path)
            gui3d.app.statusPersist('Images destination : ' +
                                    str(self.images_set_dir_destination))

##########################################################################
# Reset button for camera's orientation to have full face view
# in order to have constant point of view for experiments
##########################################################################

        @self.reset_camera_button.mhEvent
        def onClicked(event):
            gui3d.app.setTargetCamera(131, 9, False)
            gui3d.app.axisView([0.0, 0.0, 0.0])
            pos = [0, 0.2, 0]
            self.facs_human.setPosition(pos)
            self.camera_slider_x.setValue(0)
            self.camera_slider_y.setValue(0.2)
            self.camera_slider_zoom.setValue(9)
            self.rotation_slider_z.setValue(0)
            self.rotation_slider_z.onChanging(0)
            self.rotation_slider_z.update()
            mh.redraw()
            gui3d.app.statusPersist('Camera updated')

        @self.one_shot_button.mhEvent
        def onClicked(event):
            self.renderFacsPicture()

##########################################################################
# Reset facial code and AUs button
##########################################################################

        @self.reset_button.mhEvent
        def onClicked(event):
            G.app.prompt('Confirmation',
                         'Do you really want to reset your Facial code ?',
                         'Yes', 'Cancel', self.resetFacialCodes)

##########################################################################
# Generate 81 images for the survey website
##########################################################################

        @self.survey_img_button.mhEvent
        def onClicked(event):
            weight = [0, 0.5, 1]
            for i4 in range(3):
                for i7 in range(3):
                    for i9 in range(3):
                        for i10 in range(3):
                            self.survey_img_gen(weight[i4], weight[i7],
                                                weight[i9], weight[i10])
                            time.sleep(0.5)
                            self.renderSurveyImg(i4, i7, i9, i10)

##########################################################################
# Generate and save 101 images for overall intensity = 0% to 100%
##########################################################################

        @self.generate_set_button.mhEvent
        def onClicked(event):
            for val in range(0, 101):
                self.generate_face_set(val)
                time.sleep(0.5)
                self.renderFacsPicture()


##########################################################################
# View pain expression change at various general intensities
##########################################################################

        @self.master_slider.mhEvent
        def onChange(value):
            self.masterslider_render(value, True)
コード例 #20
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Povray')

        # for path to PovRay binaries file
        binary = ''

        bintype = []
        pathBox = self.addLeftWidget(gui.GroupBox('Povray  bin  path'))
        # this part load old settings values for next session; str(povray_bin)
        povray_bin = gui3d.app.settings.get('povray_bin', '')
        self.path = pathBox.addWidget(gui.TextEdit(str(povray_bin)), 0, 0, 1,
                                      2)
        self.browse = pathBox.addWidget(gui.BrowseButton('dir'), 1, 0, 1, 1)
        self.browse.setPath(povray_bin)
        if sys.platform == 'win32':
            self.browse.setFilter(
                'Executable programs (*.exe);;All files (*.*)')

        #
        if os.name == 'nt':
            #
            if os.environ['PROCESSOR_ARCHITECTURE'] == 'x86':
                self.win32sse2Button = pathBox.addWidget(
                    gui.CheckBox('Use SSE2 bin', True))
        #
        @self.path.mhEvent
        def onChange(value):
            gui3d.app.settings[
                'povray_bin'] = 'Enter your path' if not value else str(value)

        @self.browse.mhEvent
        def onClicked(path):
            if os.path.isdir(path):
                gui3d.app.settings['povray_bin'] = path
                self.path.setText(path)

        #------------------------------------------------------------------------------------
        filter = []
        # Options box
        optionsBox = self.addLeftWidget(gui.GroupBox('Options'))
        self.doSubdivide = optionsBox.addWidget(
            gui.CheckBox('Subdivide mesh', True))
        self.usebump = optionsBox.addWidget(gui.CheckBox(
            'Use bump maps', True))
        self.useSSS = optionsBox.addWidget(
            gui.CheckBox('Use S.S. Scattering', True))
        self.SSSA = optionsBox.addWidget(
            gui.Slider(value=0.5, label="SSS Amount"))

        settingsBox = self.addLeftWidget(gui.GroupBox('Settings'))
        settingsBox.addWidget(gui.TextView("Resolution"))
        self.resBox = settingsBox.addWidget(
            gui.TextEdit("x".join([str(self.resWidth),
                                   str(self.resHeight)])))
        self.AA = settingsBox.addWidget(
            gui.Slider(value=0.5, label="AntiAliasing"))

        materialsBox = self.addRightWidget(gui.GroupBox('Materials'))
        self.skinoil = materialsBox.addWidget(
            gui.Slider(value=0.5, label="Skin oil"))
        self.moist = materialsBox.addWidget(
            gui.Slider(value=0.7, label="Moisturization"))
        self.tension = materialsBox.addWidget(
            gui.Slider(value=0.7, label="Skin tension"))
        self.grain = materialsBox.addWidget(
            gui.Slider(value=0.5, label="Skin graininess"))
        self.hairShine = materialsBox.addWidget(
            gui.CheckBox('Hair shine', False))
        self.hairSpec = materialsBox.addWidget(
            gui.Slider(value=0.45, label="Shine strength"))
        self.hairRough = materialsBox.addWidget(
            gui.Slider(value=0.4, label="Shine coverage"))
        self.hairHard = materialsBox.addWidget(
            gui.Slider(value=0.5, label="Hair hardness"))

        # box
        #optionsBox = self.addLeftWidget(gui.GroupBox('Options'))

        #Buttons
        # Simplified the gui a bit for the average user. Uncomment to clutter it up with developer - useful stuff.
        #source=[]
        #self.iniButton = optionsBox.addWidget(gui.RadioButton(source, 'Use ini settings'))
        #self.guiButton = optionsBox.addWidget(gui.RadioButton(source, 'Use gui settings', selected = True))
        #format=[]
        #self.arrayButton = optionsBox.addWidget(gui.RadioButton(format, 'Array  format'))
        #self.mesh2Button = optionsBox.addWidget(gui.RadioButton(format, 'Mesh2 format', selected = True))
        #action=[]
        #self.exportButton = optionsBox.addWidget(gui.RadioButton(action , 'Export only', selected = True))
        #self.exportandrenderButton = optionsBox.addWidget(gui.RadioButton(action , 'Export and render'))
        self.renderButton = optionsBox.addWidget(gui.Button('Render'))

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

        #
        @self.renderButton.mhEvent
        def onClicked(event):
            reload(
                mh2povray
            )  # Avoid having to close and reopen MH for every coding change (can be removed once testing is complete)
            # it is necessary to put this code here, so that it is executed with the 'renderButton.event'
            if os.name == 'nt':
                #
                if os.environ['PROCESSOR_ARCHITECTURE'] == "x86":
                    binary = 'win32'
                    if self.win32sse2Button.selected:
                        binary = 'win32sse2'
                else:
                    binary = 'win64'
            # for Ubuntu.. atm
            if sys.platform == 'linux2':
                binary = 'linux'
            #
            mh2povray.povrayExport({
                'source':
                'gui',  # 'ini' if self.iniButton.selected else 'gui',
                'format':
                'mesh2',  # 'array' if self.arrayButton.selected else 'mesh2',
                'action':
                'render',  # 'export' if self.exportButton.selected else 'render',
                'scene':
                gui3d.app.getCategory('Rendering').getTaskByName(
                    'Scene').scene,
                'subdivide':
                True if self.doSubdivide.selected else False,
                'AA':
                0.5 - 0.49 * self.AA.getValue(),
                'bintype':
                binary,
                'SSS':
                True if self.useSSS.selected else False,
                'SSSA':
                self.SSSA.getValue() + 0.01,  # blur strength. Prevent zero
                'skinoil':
                0.001 *
                (10**(4 * self.skinoil.getValue())),  # exponential slider
                'moist':
                self.moist.getValue(),  # percentage
                'rough':
                0.001 *
                (10**(2 *
                      (1 - self.tension.getValue()))),  # exponential slider
                'wrinkles':
                0.5 * self.grain.getValue(),
                'usebump':
                True if self.usebump.selected else False,
                'hairShine':
                True if self.hairShine.selected else False,
                'hairSpec':
                self.hairSpec.getValue(),
                'hairRough': (0.7 * self.hairRough.getValue())**2,
                'hairHard':
                0.01 * 10**(4 * self.hairHard.getValue())
            })  # exponential slider
コード例 #21
0
    def __init__(self, category, socketConfig=None):

        self.human = gui3d.app.selectedHuman
        gui3d.TaskView.__init__(self, category, 'Socket')

        self.socketConfig = {'acceptConnections': False,
                             'advanced': False,
                             'host': '127.0.0.1',
                             'port': 12345 }

        if socketConfig and isinstance(socketConfig, dict):
            self.socketConfig['acceptConnections'] = socketConfig.get('acceptConnections', False)
            self.socketConfig['advanced'] = socketConfig.get('advanced', False)
            self.socketConfig['host'] = socketConfig.get('host', '127.0.0.1')
            self.socketConfig['port'] = socketConfig.get('port', 12345)

        self.workerthread = None

        self.log = mhapi.utility.getLogChannel("socket")

        box = self.addLeftWidget(gui.GroupBox('Server'))
        
        self.accToggleButton = box.addWidget(gui.CheckBox('Accept connections'))
        box.addWidget(gui.QtWidgets.QLabel(''))
        self.advToggleButton = box.addWidget(gui.CheckBox('Advanced Setings'))
        self.hostLabel = box.addWidget(gui.QtWidgets.QLabel('\nHost [Default=127.0.0.1] :'))
        self.hostEdit = box.addWidget(gui.TextEdit(str(self.socketConfig.get('host'))))
        self.portLabel = box.addWidget(gui.QtWidgets.QLabel('\nPort [Default=12345] :'))
        self.portEdit = box.addWidget(gui.TextEdit(str(self.socketConfig.get('port'))))
        self.spacer = box.addWidget(gui.QtWidgets.QLabel(''))
        self.changeAddrButton = box.addWidget(gui.Button('Change Host + Port'))

        self.hostEdit.textChanged.connect(self.onHostChanged)
        self.portEdit.textChanged.connect(self.onPortChanged)

        @self.accToggleButton.mhEvent
        def onClicked(event):
            if isPy3:
                if self.accToggleButton.selected:
                    self.socketConfig['acceptConnections'] = True
                    self.openSocket()
                else:
                    self.socketConfig['acceptConnections'] = False
                    self.closeSocket()

        @self.advToggleButton.mhEvent
        def onClicked(event):
            self.enableAdvanced(self.advToggleButton.selected)
            self.socketConfig['advanced'] = self.advToggleButton.selected

        @self.changeAddrButton.mhEvent
        def onClicked(event):
            if isPy3:
                gui3d.app.prompt('Attention', 'The host and port must be changed in Blender, too', 'OK',
                                 helpId='socketInfo')
                self.accToggleButton.setChecked(True)
                self.closeSocket()
                self.openSocket()


        self.scriptText = self.addTopWidget(gui.DocumentEdit())
        if isPy3:
            self.scriptText.setText('')
        else:
            self.scriptText.setText('This version of the socket plugin requires the py3 version of MH from github.')
        self.scriptText.setLineWrapMode(gui.DocumentEdit.NoWrap)

        if isPy3:
            self.dirops = SocketDirOps(self)
            self.meshops = SocketMeshOps(self)
            self.modops = SocketModifierOps(self)
            if self.socketConfig.get('acceptConnections'):
                self.accToggleButton.setChecked(True)
                self.openSocket()
            self.enableAdvanced(self.socketConfig.get('advanced', False))
            self.advToggleButton.setChecked(self.socketConfig.get('advanced', False))
コード例 #22
0
 def createTextEdit(self, text='', validator=None):
     return gui.TextEdit(text, validator)
コード例 #23
0
ファイル: __init__.py プロジェクト: xiaohong23/MakeHuman_IC
    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)
コード例 #24
0
ファイル: __init__.py プロジェクト: ylimerm3/FaReT
    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))
コード例 #25
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'BVH')

        self.BVH = bvh.BVH()

        #self.systemAnims = os.path.join('data', 'animations')
        #self.userAnims = os.path.join(mh.getPath(''), 'data', 'animations')
        #self.animPaths = [self.userAnims, self.systemAnims]
        #if not os.path.exists(self.userAnims):
        #    os.makedirs(self.userAnims)
        #self.extension = "mhanim"

        self.skelObj = None  # indicates skeleton object attached
        self.lastSkeleton = None

        self.human = gui3d.app.selectedHuman
        self.oldHumanTransp = self.human.meshData.transparentPrimitives

        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.showSkeletonTggl = displayBox.addWidget(
            gui.ToggleButton("Show skeleton"))

        @self.showSkeletonTggl.mhEvent
        def onClicked(event):
            if not self.skelObj:
                return
            if self.showSkeletonTggl.selected:
                self.skelObj.show()
                self.setHumanTransparency(True)
            else:
                self.skelObj.hide()
                self.setHumanTransparency(False)

        self.showSkeletonTggl.setSelected(True)

        self.skinProxiesTggl = displayBox.addWidget(
            gui.ToggleButton("Skin clothes and hair"))

        @self.skinProxiesTggl.mhEvent
        def onClicked(event):
            self.setupProxySkinning()

        self.skinProxiesTggl.setSelected(False)

        pathBox = self.addLeftWidget(gui.GroupBox('BVH  path'))
        self.path = pathBox.addWidget(gui.TextEdit('/'), 0, 0, 1, 2)
        self.file = pathBox.addWidget(gui.BrowseButton('open'), 1, 0, 1, 1)
        self.file.setLabel("Select BVH")

        @self.path.mhEvent
        def onChange(value):
            print '[BVHAnimLibrary: onChange] Path value changed:' + value

        @self.file.mhEvent
        def onClicked(file):
            #if os.path.isdir(path):
            print '[BVHAnimLibrary: onClicked] File value changed:' + file
            self.path.setText(file)
            if os.path.isfile(file):
                self.BVH = bvh.load(file)
                #self.BVH.fromFile(file)
                print '[BVHAnimLibrary: onClicked] Loaded BVH file'
コード例 #26
0
ファイル: __init__.py プロジェクト: fsotoc/FaReT
    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.save_models = gui.CheckBox("Save a Model per Frame")
        settingsBox.addWidget(self.save_models)

        @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("Zoom Factor (8.7 for default face cam)"))
        self.camZ = 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"))
        # allow alpha beta parameters
        self.modelAlphaBetaList = interpolateSettingsBox.addWidget(
            gui.ListView())
        interpolateSettingsBox.addWidget(gui.TextView("Features"))
        self.modelFeatureBox = interpolateSettingsBox.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)
        interpolateSettingsBox.addWidget(self.modelGroupBox)

        interpolateSettingsBox.addWidget(gui.TextView("Alpha"))
        self.modelAlphaBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("1.0"))
        interpolateSettingsBox.addWidget(gui.TextView("Beta"))
        self.modelBetaBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("1.0"))
        self.modelAddButton = interpolateSettingsBox.addWidget(
            gui.Button("Add"))
        self.modelRemoveButton = interpolateSettingsBox.addWidget(
            gui.Button("Remove"))

        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"))
        # alphas and betas for expressions
        self.expressionAlphaBetaList = interpolateSettingsBox.addWidget(
            gui.ListView())
        interpolateSettingsBox.addWidget(gui.TextView("Features"))
        self.expressionFeatureBox = interpolateSettingsBox.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)
        interpolateSettingsBox.addWidget(self.expressionGroupBox)

        interpolateSettingsBox.addWidget(gui.TextView("Alpha"))
        self.expressionAlphaBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("1.0"))
        interpolateSettingsBox.addWidget(gui.TextView("Beta"))
        self.expressionBetaBox = interpolateSettingsBox.addWidget(
            gui.TextEdit("1.0"))
        self.expressionAddButton = interpolateSettingsBox.addWidget(
            gui.Button("Add"))
        self.expressionRemoveButton = interpolateSettingsBox.addWidget(
            gui.Button("Remove"))

        @self.modelAddButton.mhEvent
        def onClicked(event):
            features = self.modelFeatureBox.getText()
            alpha = float(self.modelAlphaBox.getText())
            beta = float(self.modelBetaBox.getText())
            self.modelAlphaBetaList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(
                features, alpha, beta),
                                            data=dict(features=features,
                                                      alpha=alpha,
                                                      beta=beta))

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

        @self.expressionAddButton.mhEvent
        def onClicked(event):
            features = self.expressionFeatureBox.getText()
            alpha = float(self.expressionAlphaBox.getText())
            beta = float(self.expressionBetaBox.getText())
            self.expressionAlphaBetaList.addItem(
                '{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta),
                data=dict(features=features, alpha=alpha, beta=beta))

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

        @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,
            "cam_Z": self.camZ,
            "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()))

            # each item has a Regular expression and the alpha beta values
            model_extra = {}
            for item in self.modelAlphaBetaList.getItems():
                d = item.getUserData()
                model_extra[d['features']] = (d['alpha'], d['beta'])

            expression_extra = {}
            for item in self.expressionAlphaBetaList.getItems():
                d = item.getUserData()
                expression_extra[d['features']] = (d['alpha'], d['beta'])

            selected_frame.setUserData(
                data={
                    "frame":
                    self.num(self.currentFramesBox.getText()),
                    "rot_Y":
                    self.num(self.camY.getText()),
                    "rot_X":
                    self.num(self.camX.getText()),
                    "cam_Z":
                    self.num(self.camZ.getText()),
                    "model": (self.modelBox.getText(),
                              self.num(self.modelPercentageBox.getText()),
                              model_extra),
                    "expression": (
                        self.expressionBox.getText(),
                        self.num(self.expressionPercentageBox.getText()),
                        expression_extra)
                })
            self.resort_frames()
            self.generate_key_frames()

        @self.addFrame.mhEvent
        def onClicked(event):
            # each item has a Regular expression and the alpha beta values
            model_extra = {}
            for item in self.modelAlphaBetaList.getItems():
                d = item.getUserData()
                model_extra[d['features']] = (d['alpha'], d['beta'])

            expression_extra = {}
            for item in self.expressionAlphaBetaList.getItems():
                d = item.getUserData()
                expression_extra[d['features']] = (d['alpha'], d['beta'])

            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()),
                    "cam_Z":
                    self.num(self.camZ.getText()),
                    "model":
                    (self.modelBox.getText(),
                     self.num(self.modelPercentageBox.getText()), model_extra),
                    "expression":
                    (self.expressionBox.getText(),
                     self.num(self.expressionPercentageBox.getText()),
                     expression_extra)
                })
            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(self.interpolatedFramesList, 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
            settings['saveModels'] = self.save_models.selected
            # 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))
コード例 #27
0
 def __init__(self):
     super(NameView, self).__init__('Human Name')
     self.nameEdit = self.addWidget(gui.TextEdit())
コード例 #28
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'General')
        self.checkboxes = []

        sliderBox = self.addLeftWidget(gui.GroupBox('Slider behavior'))
        self.realtimeUpdates = sliderBox.addWidget(
            SettingCheckbox("Update real-time", 'realtimeUpdates'))

        self.realtimeNormalUpdates = sliderBox.addWidget(
            SettingCheckbox("Update normals real-time",
                            'realtimeNormalUpdates'))

        self.realtimeFitting = sliderBox.addWidget(
            SettingCheckbox("Fit objects real-time", 'realtimeFitting'))

        self.cameraAutoZoom = sliderBox.addWidget(
            SettingCheckbox("Auto-zoom camera", 'cameraAutoZoom'))

        def updateSliderImages(selected):
            gui.Slider.showImages(selected)
            mh.refreshLayout()

        self.sliderImages = sliderBox.addWidget(
            SettingCheckbox("Slider images", 'sliderImages',
                            updateSliderImages))

        modes = []
        unitBox = self.addLeftWidget(gui.GroupBox('Units'))
        self.metric = unitBox.addWidget(
            gui.RadioButton(modes, 'Metric',
                            gui3d.app.getSetting('units') == 'metric'))
        self.imperial = unitBox.addWidget(
            gui.RadioButton(modes, 'Imperial',
                            gui3d.app.getSetting('units') == 'imperial'))

        weights = []
        weightBox = self.addLeftWidget(gui.GroupBox('Weight'))
        self.rel_weight = weightBox.addWidget(
            gui.RadioButton(weights, 'Relative Weight',
                            not gui3d.app.getSetting('real_weight')))
        self.real_weight = weightBox.addWidget(
            gui.RadioButton(weights, 'Real Weight',
                            gui3d.app.getSetting('real_weight')))

        tagFilter = []
        self.tagFilterBox = self.addLeftWidget(gui.GroupBox('Tag Filter Mode'))
        self.or_mode = self.tagFilterBox.addWidget(
            gui.RadioButton(tagFilter, 'OR',
                            gui3d.app.getSetting('tagFilterMode') == 'OR'), 0,
            0)
        self.and_mode = self.tagFilterBox.addWidget(
            gui.RadioButton(tagFilter, 'AND',
                            gui3d.app.getSetting('tagFilterMode') == 'AND'), 0,
            1)
        self.nor_mode = self.tagFilterBox.addWidget(
            gui.RadioButton(tagFilter, 'NOT OR',
                            gui3d.app.getSetting('tagFilterMode') == 'NOR'), 1,
            0)
        self.nand_mode = self.tagFilterBox.addWidget(
            gui.RadioButton(tagFilter, 'NOT AND',
                            gui3d.app.getSetting('tagFilterMode') == 'NAND'),
            1, 1)

        tagsBox = self.addLeftWidget(gui.GroupBox('Tags Count'))
        self.countEdit = tagsBox.addWidget(gui.TextEdit(
            str(gui3d.app.getSetting('tagCount'))),
                                           0,
                                           0,
                                           columnSpan=0)
        tagsBox.addWidget(gui.TextView(' Tags '), 0, 1)
        self.countEdit.textChanged.connect(self.onTextChanged)

        nameBox = self.addLeftWidget(gui.GroupBox('Name Tags:'))
        self.useNameTags = nameBox.addWidget(
            SettingCheckbox('Use Name Tags', 'useNameTags'))

        self.createFilterModeSwitch()

        startupBox = self.addLeftWidget(gui.GroupBox('Startup'))

        def hdpiPostAction(action):
            if action:
                gui3d.app.prompt(
                    'Info',
                    'You need to restart for HDPI changes to be applied.',
                    'OK',
                    helpId='useHDPI')

        self.preload = startupBox.addWidget(
            SettingCheckbox("Preload macro targets", 'preloadTargets'))
        self.saveScreenSize = startupBox.addWidget(
            SettingCheckbox("Restore window size", 'restoreWindowSize'))
        self.useHDPI = startupBox.addWidget(
            SettingCheckbox("Use HDPI", 'useHDPI', hdpiPostAction))

        resetBox = self.addLeftWidget(gui.GroupBox('Restore settings'))
        self.resetButton = resetBox.addWidget(
            gui.Button("Restore to defaults"))

        @self.resetButton.mhEvent
        def onClicked(event):
            gui3d.app.resetSettings()
            self.updateGui()

        homeBox = gui.GroupBox('Configure Home Folder')
        self.addLeftWidget(homeBox)
        self.homeButton = homeBox.addWidget(gui.Button(''))
        if hasConfigFile():
            self.homeButton.setLabel('Delete Config File')
        else:
            self.homeButton.setLabel('Create Config File')

        @self.homeButton.mhEvent
        def onClicked(event):
            if hasConfigFile():
                os.remove(getConfigPath('makehuman.conf'))
                self.homeButton.setLabel('Create Config File')
                gui3d.app.statusPersist('Home Folder Location: Default')
            else:
                filePath = getConfigPath('makehuman.conf')
                homePath = formatPath(getExistingDirectory(getHomePath()))
                if homePath != '.':
                    if sys.platform.startswith(
                            'darwin') or sys.platform.startswith(
                                'linux') and not os.path.isdir(
                                    getConfigPath('')):
                        os.makedirs(getConfigPath(''))
                    if os.path.isdir(homePath) and os.path.isdir(
                            getConfigPath('')):
                        with io.open(filePath, 'w', encoding='utf-8') as f:
                            f.writelines(homePath + '\n')
                    self.homeButton.setLabel('Delete Config File')
                    gui3d.app.statusPersist('Home Folder Location: ' +
                                            homePath)

        self.checkboxes.extend([
            self.realtimeUpdates, self.realtimeNormalUpdates,
            self.realtimeFitting, self.cameraAutoZoom, self.sliderImages,
            self.useNameTags, self.preload, self.saveScreenSize
        ])

        themes = []
        self.themesBox = self.addRightWidget(gui.GroupBox('Theme'))
        self.themeNative = self.themesBox.addWidget(
            ThemeRadioButton(themes, "Native look", "default"))
        self.themeMH = self.themesBox.addWidget(
            ThemeRadioButton(themes, "MakeHuman", "makehuman"))

        # For debugging themes on multiple platforms
        '''
        platforms = []
        platformsBox = self.platformsBox = self.addRightWidget(gui.GroupBox('Look and feel'))
        for platform in gui3d.app.getLookAndFeelStyles():
            platformsBox.addWidget(PlatformRadioButton(platforms, platform))
        '''

        languages = []
        self.languageBox = self.addRightWidget(gui.GroupBox('Language'))

        languageFiles = gui3d.app.getLanguages()
        for language in languageFiles:
            if not language.lower() == "master":
                self.languageBox.addWidget(
                    LanguageRadioButton(languages, language))
        if not mh.isRelease():
            self.languageBox.addWidget(LanguageRadioButton(
                languages, "master"))

        @self.metric.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('units', 'metric')
            gui3d.app.loadGrid()

        @self.imperial.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('units', 'imperial')
            gui3d.app.loadGrid()

        @self.rel_weight.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('real_weight', False)

        @self.real_weight.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('real_weight', True)

        @self.and_mode.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('tagFilterMode', 'AND')

        @self.or_mode.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('tagFilterMode', 'OR')

        @self.nor_mode.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('tagFilterMode', 'NOR')

        @self.nand_mode.mhEvent
        def onClicked(event):
            gui3d.app.setSetting('tagFilterMode', 'NAND')

        self.updateGui()
コード例 #29
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()
コード例 #30
0
    def __init__(self, category):
        RenderTaskView.__init__(self, category, 'Classification Images Motion 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("1"))

        classificationImagesSettingsBox.addWidget(gui.TextView("The number of frames per trial"))
        self.framesBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("30"))

        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("Oribt Camera Z (out-int)"))
        self.camZ = classificationImagesSettingsBox.addWidget(gui.TextEdit("8.7"))

        classificationImagesSettingsBox.addWidget(gui.TextView("Frame Rate"))
        self.frameRateBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("30"))

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

        classificationImagesSettingsBox.addWidget(gui.TextView("Start 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)

        classificationImagesSettingsBox.addWidget(gui.TextView("End Model File"))
        self.modelBox2 = classificationImagesSettingsBox.addWidget(gui.TextEdit("None"))
        self.model_button2 = classificationImagesSettingsBox.addWidget(gui.BrowseButton('open', "Select a model file"))
        
        @self.model_button2.mhEvent
        def onClicked(path):
            self.modelBox2.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)
        classificationImagesSettingsBox.addWidget(gui.TextView("Mode and SD"))
        self.modelAlphaBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("0.5"))
        self.modelAlphaSDBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("0.1667"))
        classificationImagesSettingsBox.addWidget(gui.TextView("Concentration and SD"))
        self.modelBetaBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("25.0"))
        self.modelBetaSDBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("7.6667"))
        self.modelAddButton = classificationImagesSettingsBox.addWidget(gui.Button("Add"))
        self.modelRemoveButton = classificationImagesSettingsBox.addWidget(gui.Button("Remove"))
        
        classificationImagesSettingsBox.addWidget(gui.TextView("Start Expression File"))
        self.expressionBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("None"))
        self.expression_button = classificationImagesSettingsBox.addWidget(gui.BrowseButton('open', "Select an expression"))
        @self.expression_button.mhEvent
        def onClicked(path):
            self.expressionBox.setText(path)

        classificationImagesSettingsBox.addWidget(gui.TextView("End Expression File"))
        self.expressionBox2 = classificationImagesSettingsBox.addWidget(gui.TextEdit(""))
        self.expression_button2 = classificationImagesSettingsBox.addWidget(gui.BrowseButton('open', "Select an expression"))
        @self.expression_button2.mhEvent
        def onClicked(path):
            self.expressionBox2.setText(path)


        self.expressionFeatureList = classificationImagesSettingsBox.addWidget(gui.ListView())

        # add the default CCNLab NSF groups
        alpha = 0.5
        alpha_sd = .5/3
        beta = 25.0
        beta_sd = 7 + 1/3.
        
        # between the brows
        features = "NoseWrinkler"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))
        
        # the nose
        features = "Nose,Naso"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))
        
        # left brow
        features = "Left.*Brow"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # left eyelid
        features = "Left.*Eye,Left.*Lid"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # right brow
        features = "Right.*Brow"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # right eyelid
        features = "Right.*Eye,Right.*Lid"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))
        
        # chin and jaw
        features = "Chin,Jaw"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # left mouth and cheek
        features = "Mouth.*Left,TongueLeft,Left.*Cheek"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # right mouth and cheek
        features = "Mouth.*Right,TongueRight,Right.*Cheek"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        # center mouth
        features = "Tongue,Lip"
        self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        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)
        
        classificationImagesSettingsBox.addWidget(gui.TextView("Mode and SD"))
        self.expressionAlphaBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("0.5"))
        self.expressionAlphaSDBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("0.1667"))
        classificationImagesSettingsBox.addWidget(gui.TextView("Concentration and SD"))
        self.expressionBetaBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("25.0"))
        self.expressionBetaSDBox = classificationImagesSettingsBox.addWidget(gui.TextEdit("7.6667"))

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

        @self.modelAddButton.mhEvent
        def onClicked(event):
            features = self.modelFeatureBox.getText()
            alpha = float(self.modelAlphaBox.getText())
            alpha_sd = float(self.modelAlphaSDBox.getText())
            beta = float(self.modelBetaBox.getText())
            beta_sd = float(self.modelBetaSDBox.getText())
            self.modelFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        @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()
            alpha = float(self.expressionAlphaBox.getText())
            alpha_sd = float(self.expressionAlphaSDBox.getText())
            beta = float(self.expressionBetaBox.getText())
            beta_sd = float(self.expressionBetaSDBox.getText())
            self.expressionFeatureList.addItem('{0}: ({1:0.2f}, {2:0.2f})'.format(features, alpha, beta), data=dict(features=features, alpha=alpha, alpha_sd=alpha_sd, beta=beta, beta_sd=beta_sd))

        @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_data,shape_parameters = self.get_data_labels(self.modelFeatureList.getItems())
            #log.message("Shape parameters "+shape_parameters)
            pose_data,pose_parameters = self.get_data_labels(self.expressionFeatureList.getItems())
            frame_rate = float(self.frameRateBox.getText())
            CI_settings = dict(base_model = self.modelBox.getText(),
                                end_model = self.modelBox2.getText(),
                                base_expression = self.expressionBox.getText(),
                                end_expression = self.expressionBox2.getText(),
                                trials = int(self.trialsBox.getText()),
                                frames = int(self.framesBox.getText()),
                                shape_parameters = shape_parameters,
                                pose_parameters=pose_parameters,
                                shape_data=shape_data,
                                pose_data=pose_data,
                                material_file = self.materialBox.getText(),
                                rot_X = float(self.camX.getText()),
                                rot_Y = float(self.camY.getText()),
                                cam_Z = float(self.camZ.getText()))
            classification_images_motion.do_op(classification_image_settings=CI_settings, 
            save_path = self.pathBox.getText(), 
            frame_rate = frame_rate, render_function = (mh2opengl.Render, settings))