예제 #1
0
        def onFileSelected(filename):

            gui3d.app.do(
                Action(gui3d.app.selectedHuman, filename, self.mhmTaskView,
                       self.include))

            mh.changeCategory('Modelling')
 def onFileSelected(filename):
     gui3d.app.do(Action("Change clothing piece",
         gui3d.app.selectedHuman,
         self,
         filename))
     if gui3d.app.settings.get('jumpToModelling', True):
         mh.changeCategory('Modelling')
예제 #3
0
        def onFileSelected(filename):
            if not filename.lower().endswith('.mhm'):
                filename += '.mhm'

            path = os.path.normpath(os.path.join(modelPath, filename))

            dir, name = os.path.split(path)
            name, ext = os.path.splitext(name)

            if not os.path.exists(dir):
                os.makedirs(dir)

            # Save the thumbnail

            ((x0,y0,z0),(x1,y1,z1)) = self.selection.mesh.calcBBox()
            x0,y0,z0 = gui3d.app.guiCamera.convertToScreen(x0, y0, 0)
            x1,y1,z1 = gui3d.app.guiCamera.convertToScreen(x1, y1, 0)
            log.debug('grab rectangle: %d %d %d %d', x0, y0, x1, y1)
            mh.grabScreen(int(x0+1), int(y1+1), int(x1-x0-1), int(y0-y1-1), os.path.join(dir, name + '.thumb'))

            # Save the model

            human = gui3d.app.selectedHuman
            human.save(path, name)
            gui3d.app.modified = False
            
            gui3d.app.setFilenameCaption(filename)
            gui3d.app.setFileModified(False)

            mh.changeCategory('Modelling')
예제 #4
0
        def onFileSelected(filename):
            path = os.path.normpath(os.path.join(exportPath, filename))
            dir, name = os.path.split(path)
            name, ext = os.path.splitext(name)

            if not os.path.exists(dir):
                os.makedirs(dir)

            def filename(targetExt, different=False):
                if not different and ext != '' and (
                        '.' + targetExt.lower()) != ext.lower():
                    log.warning("expected extension '.%s' but got '%s'",
                                targetExt, ext)
                return os.path.join(dir, name + '.' + targetExt)

            found = False
            for exporter, radio, options in self.formats:
                if radio.selected:
                    exporter.export(gui3d.app.selectedHuman, filename)
                    found = True
                    break

            if not found:
                log.error("Unknown export format selected!")
                return

            gui3d.app.prompt('Info',
                             u'The mesh has been exported to %s.' % dir,
                             'OK',
                             helpId='exportHelp')

            mh.changeCategory('Modelling')
        def onFileSelected(filename):
            
            if os.path.basename(filename) == "clear.mhuv":
                filename = None            
            self.setUv(gui3d.app.selectedHuman, filename)

            mh.changeCategory('Modelling')
예제 #6
0
        def onFileSelected(filename):
            path = os.path.normpath(os.path.join(exportPath, filename))
            dir, name = os.path.split(path)
            name, ext = os.path.splitext(name)

            if not os.path.exists(dir):
                os.makedirs(dir)

            def filename(targetExt, different = False):
                if not different and ext != '' and ('.' + targetExt.lower()) != ext.lower():
                    log.warning("expected extension '.%s' but got '%s'", targetExt, ext)
                return os.path.join(dir, name + '.' + targetExt)

            found = False
            for exporter, radio, options in self.formats:
                if radio.selected:
                    exporter.export(gui3d.app.selectedHuman, filename)
                    found = True
                    break

            if not found:
                log.error("Unknown export format selected!")
                return

            gui3d.app.prompt('Info', u'The mesh has been exported to %s.' % dir, 'OK', helpId='exportHelp')

            mh.changeCategory('Modelling')
        def onFileSelected(filepath):
            if self.lastPose:
                oldFile = self.lastPose
            else:
                oldFile = "clear.mhp"

            gui3d.app.do(PoseAction("Change pose", self, oldFile, filepath))
            mh.changeCategory("Modelling")
        def onFileSelected(filepath):
            if self.lastPose:
                oldFile = self.lastPose
            else:
                oldFile = "clear.mhp"

            gui3d.app.do(PoseAction("Change pose",
                self,
                oldFile,
                filepath))
            mh.changeCategory('Modelling')
예제 #9
0
파일: guiload.py 프로젝트: RuliLG/makehuman
        def onFileSelected(filename):

            human = gui3d.app.selectedHuman

            human.load(filename, True, gui3d.app.progress)

            del gui3d.app.undoStack[:]
            del gui3d.app.redoStack[:]
            gui3d.app.modified = False

            name = os.path.basename(filename).replace('.mhm', '')

            self.parent.tasksByName['Save'].fileentry.text = name
            self.parent.tasksByName['Save'].fileentry.edit.setText(name)
            
            gui3d.app.setFilenameCaption(filename)
            gui3d.app.setFileModified(False)

            mh.changeCategory('Modelling')
예제 #10
0
        def onFileSelected(filename):
            human = gui3d.app.selectedHuman
            if self.skinRadio.selected:
                gui3d.app.do(SkinAction(human, human.getTexture(), filename))
            elif self.hairRadio.selected:
                gui3d.app.do(
                    HairAction(human, human.hairObj.getTexture(), filename))
            elif self.eyesRadio.selected:
                # TODO make undoable action
                self.setEyes(gui3d.app.selectedHuman, filename)
            else:  # Clothes
                if self.activeClothing:
                    uuid = self.activeClothing
                    gui3d.app.do(
                        ClothesAction(human, self, uuid,
                                      self.getClothesTexture(uuid), filename))

            if gui3d.app.settings.get('jumpToModelling', True):
                mh.changeCategory('Modelling')
예제 #11
0
        def onFileSelected(filename):

            human = gui3d.app.selectedHuman

            human.load(filename, True, gui3d.app.progress)

            del gui3d.app.undoStack[:]
            del gui3d.app.redoStack[:]
            gui3d.app.modified = False

            name = os.path.basename(filename).replace('.mhm', '')

            self.parent.tasksByName['Save'].fileentry.text = name
            self.parent.tasksByName['Save'].fileentry.edit.setText(name)

            gui3d.app.setFilenameCaption(filename)
            gui3d.app.setFileModified(False)

            mh.changeCategory('Modelling')
예제 #12
0
    def saveMHM(self, filename):
        if not filename.lower().endswith('.mhm'):
            filename += '.mhm'

        modelPath = mh.getPath('models')
        path = os.path.normpath(os.path.join(modelPath, filename))

        dir, name = os.path.split(path)
        name, ext = os.path.splitext(name)

        if not os.path.exists(dir):
            os.makedirs(dir)

        # Save square sized thumbnail
        size = min(G.windowWidth, G.windowHeight)
        img = mh.grabScreen((G.windowWidth - size) / 2,
                            (G.windowHeight - size) / 2, size, size)

        # Resize thumbnail to max 128x128
        if size > 128:
            img.resize(128, 128)
        img.save(os.path.join(dir, name + '.thumb'))

        # Save the model
        human = gui3d.app.selectedHuman
        human.save(path, name)
        gui3d.app.modified = False
        #gui3d.app.clearUndoRedo()

        gui3d.app.setFilenameCaption(filename)
        gui3d.app.setFileModified(False)

        self.parent.tasksByName['Load'].fileentry.text = dir
        self.parent.tasksByName['Load'].fileentry.edit.setText(dir)
        self.parent.tasksByName['Load'].fileentry.setDirectory(dir)

        mh.changeCategory('Modelling')
        def onFileSelected(filename):
            human = gui3d.app.selectedHuman
            if self.skinRadio.selected:
                gui3d.app.do(SkinAction(human,
                    human.getTexture(),
                    filename))
            elif self.hairRadio.selected:
                gui3d.app.do(HairAction(human,
                    human.hairObj.getTexture(),
                    filename))
            elif self.eyesRadio.selected:
                # TODO make undoable action 
                self.setEyes(gui3d.app.selectedHuman, filename)
            else: # Clothes
                if self.activeClothing:
                    uuid = self.activeClothing
                    gui3d.app.do(ClothesAction(human,
                        self,
                        uuid,
                        self.getClothesTexture(uuid),
                        filename))

            if gui3d.app.settings.get('jumpToModelling', True):
                mh.changeCategory('Modelling')
예제 #14
0
        def onFileSelected(filename):

            gui3d.app.do(Action(gui3d.app.selectedHuman, filename, self.mhmTaskView, self.include))
            
            mh.changeCategory('Modelling')
예제 #15
0
 def goToHelp(self):
     mh.changeCategory("Help")
예제 #16
0
        def onFileSelected(filepath):

            self.loadMhpFile(filepath)
            mh.changeCategory('Modelling')
예제 #17
0
        def onFileSelected(filename):
            
            self.setProxy(gui3d.app.selectedHuman, filename)

            mh.changeCategory('Modelling')
예제 #18
0
 def onActivate(item):
     path = self.targets.getItemPath(item)
     log.message('target: %s', path)
     self.showTarget(path)
     mh.changeCategory('Modelling')
예제 #19
0
 def onClicked(event):
     self.clearColor()
     mh.changeCategory('Modelling')
예제 #20
0
 def goToRendering(self):
     mh.changeCategory("Rendering")
     self.redraw()
예제 #21
0
 def goToHelp(self):
     mh.changeCategory("Help")
예제 #22
0
 def onClicked(event):
     self.clearColor()
     mh.changeCategory('Modelling')
예제 #23
0
 def goToModelling(self):
     mh.changeCategory("Modelling")
     self.redraw()
예제 #24
0
 def onActivate(item):
     path = self.targets.getItemPath(item)
     log.message('target: %s', path)
     self.showTarget(path)
     mh.changeCategory('Modelling')
        def onFileSelected(filename):

            self.setProxy(gui3d.app.selectedHuman, filename)

            mh.changeCategory('Modelling')
예제 #26
0
 def goToModelling(self):
     mh.changeCategory("Modelling")
     self.redraw()
 def onFileSelected(filename):
     
     mhclo = filename.replace('.obj', '.mhclo')
     self.setHair(gui3d.app.selectedHuman, filename, mhclo)
     if gui3d.app.settings.get('jumpToModelling', True):
         mh.changeCategory('Modelling')
예제 #28
0
 def goToRendering(self):
     mh.changeCategory("Rendering")
     self.redraw()