コード例 #1
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self,
                                category,
                                'Detail modelling',
                                label='Micro')
        self.tool = None

        self.sliders = []

        self.modifiersBox = self.addLeftWidget(gui.GroupBox('Modifiers'))

        self.detailButtonGroup = []

        self.tool = Detail3dTool(gui3d.app, True, 'translation')

        self.translationButton = self.modifiersBox.addWidget(
            gui.RadioButton(self.detailButtonGroup, 'Move', True))
        self.scaleButton = self.modifiersBox.addWidget(
            gui.RadioButton(self.detailButtonGroup, label='Scale'))

        @self.translationButton.mhEvent
        def onClicked(event):
            self.tool = Detail3dTool(gui3d.app, True, 'translation')
            gui3d.app.tool = self.tool

        @self.scaleButton.mhEvent
        def onClicked(event):
            self.tool = Detail3dTool(gui3d.app, True, 'scale')
            gui3d.app.tool = self.tool

        #self.microButton = self.modifiersBox.addWidget(gui.ToggleButton('Micro'))
        """    
コード例 #2
0
    def build(self, options):
        #self.version24 = options.addWidget(gui.CheckBox("Version 2.4", False))
        #self.version25 = options.addWidget(gui.CheckBox("Version 2.5", True))
        self.mhxSeparateFolder = options.addWidget(
            gui.CheckBox("Separate folder", False))
        self.mhxFeetOnGround = options.addWidget(
            gui.CheckBox("Feet on ground", True))
        self.mhxExpressionUnits = options.addWidget(
            gui.CheckBox("Expressions", False))
        #self.mhxFaceShapes = options.addWidget(gui.CheckBox("Face shapes", True))
        self.mhxBodyShapes = options.addWidget(
            gui.CheckBox("Body shapes", True))
        self.mhxCustomShapes = options.addWidget(
            gui.CheckBox("Custom shapes", False))
        #self.mhxFacePanel = options.addWidget(gui.CheckBox("Face panel", True))
        self.mhxClothes = options.addWidget(gui.CheckBox("Clothes", True))
        self.mhxMasks = options.addWidget(gui.CheckBox("Clothes masks", False))
        self.mhxHidden = options.addWidget(
            gui.CheckBox("Keep hidden faces", True))
        self.mhxClothesRig = options.addWidget(
            gui.CheckBox("Clothes rig", True))
        self.mhxCage = options.addWidget(gui.CheckBox("Cage", False))
        self.mhxAdvancedSpine = options.addWidget(
            gui.CheckBox("Advanced spine", False))
        self.mhxMaleRig = options.addWidget(gui.CheckBox("Male rig", False))
        #self.mhxSkirtRig = options.addWidget(gui.CheckBox("Skirt rig", False))

        rigs = []
        self.mhxMhx = options.addWidget(
            gui.RadioButton(rigs, "Use mhx rig", True))
        self.rigifyMhx = options.addWidget(
            gui.RadioButton(rigs, "Use rigify rig", False))
        addedRigs = self.addRigs(options, rigs)
        self.mhxRigs = [(self.mhxMhx, "mhx"),
                        (self.rigifyMhx, "rigify")] + addedRigs
コード例 #3
0
    def build(self, options, taskview):
        #Exporter.build(self, options, taskview)
        self.taskview = taskview
        self.useTexFolder = options.addWidget(
            gui.CheckBox("Separate folder", True))

        self.feetOnGround = options.addWidget(
            gui.CheckBox("Feet on ground", True))
        self.expressions = options.addWidget(gui.CheckBox(
            "Expressions", False))
        self.facepanel = options.addWidget(gui.CheckBox("Face rig", False))
        self.bodyShapes = options.addWidget(gui.CheckBox("Body shapes", False))
        self.useCustomShapes = options.addWidget(
            gui.CheckBox("Custom shapes", False))
        self.masks = options.addWidget(gui.CheckBox("Clothes masks", False))
        self.clothesRig = options.addWidget(gui.CheckBox("Clothes rig", False))
        self.cage = options.addWidget(gui.CheckBox("Cage", False))
        self.advancedSpine = options.addWidget(
            gui.CheckBox("Advanced spine", False))
        self.maleRig = options.addWidget(gui.CheckBox("Male rig", False))

        rigtypes = []
        self.libraryRig = options.addWidget(
            gui.RadioButton(rigtypes, "Use rig from library", True))
        self.mhx = options.addWidget(
            gui.RadioButton(rigtypes, "Use mhx rig", True))
        self.rigify = options.addWidget(
            gui.RadioButton(rigtypes, "Use rigify rig", False))
        self.rigtypes = [(self.mhx, "mhx"), (self.rigify, "rigify"),
                         (self.libraryRig, None)]
コード例 #4
0
 def build(self, options):
     stlOptions = []
     self.stlAscii = options.addWidget(
         gui.RadioButton(stlOptions, "Ascii", selected=True))
     self.stlBinary = options.addWidget(
         gui.RadioButton(stlOptions, "Binary"))
     self.stlSmooth = options.addWidget(gui.CheckBox("Subdivide", False))
コード例 #5
0
ファイル: __init__.py プロジェクト: hackerlank/testzatfits
 def build(self, options, taskview):
     Exporter.build(self, options, taskview)
     stlOptions = []
     self.stlAscii = options.addWidget(
         gui.RadioButton(stlOptions, "Ascii", selected=True))
     self.stlBinary = options.addWidget(
         gui.RadioButton(stlOptions, "Binary"))
コード例 #6
0
ファイル: __init__.py プロジェクト: hackerlank/testzatfits
    def build(self, options, taskview):
        Exporter.build(self, options, taskview)
        #self.expressions     = options.addWidget(gui.CheckBox("Expressions", False))
        #self.useCustomTargets = options.addWidget(gui.CheckBox("Custom targets", False))
        #self.useTPose = options.addWidget(gui.CheckBox("T-pose", False))

        orients = []
        self.yUpFaceZ = options.addWidget(gui.RadioButton(orients, "Y up, face Z", True))
        self.yUpFaceX = options.addWidget(gui.RadioButton(orients, "Y up, face X", False))
        self.zUpFaceNegY = options.addWidget(gui.RadioButton(orients, "Z up, face -Y", False))
        self.zUpFaceX = options.addWidget(gui.RadioButton(orients, "Z up, face X", False))
コード例 #7
0
ファイル: __init__.py プロジェクト: solsane/unnaturalcode
    def build(self, options, taskview):
        import gui
        Exporter.build(self, options, taskview)

        orients = []
        self.yUpFaceZ = options.addWidget(
            gui.RadioButton(orients, "Y up, face Z", True))
        self.yUpFaceX = options.addWidget(
            gui.RadioButton(orients, "Y up, face X", False))
        self.zUpFaceNegY = options.addWidget(
            gui.RadioButton(orients, "Z up, face -Y", False))
        self.zUpFaceX = options.addWidget(
            gui.RadioButton(orients, "Z up, face X", False))
コード例 #8
0
    def reloadBoneExplorer(self):
        # Remove old radio buttons
        for radioBtn in self.boneSelector:
            radioBtn.hide()
            radioBtn.destroy()
        self.boneSelector = []

        #skel = self.human.getSkeleton()
        skel = self.human.skeleton  # We do this because we do not need updated joint positions
        if not skel:
            return

        bones = [(bone.name, bone) for bone in skel.getBones()]
        bones.sort()  # Sort by name
        for _, bone in bones:
            # TODO using a tree widget here, as in Utilities > Data would be good
            radioBtn = self.boneBox.addWidget(
                gui.RadioButton(self.boneSelector, bone.name))

            @radioBtn.mhEvent
            def onClicked(event):
                for rdio in self.boneSelector:
                    if rdio.selected:
                        self.removeBoneHighlights()
                        self.highlightBone(str(rdio.text()))
コード例 #9
0
    def populateClothesSelector(self):
        """
        Builds a list of all available clothes.
        """
        human = gui3d.app.selectedHuman
        # Only keep first 3 radio btns (human body parts)
        for radioBtn in self.objectSelector[3:]:
            radioBtn.hide()
            radioBtn.destroy()
        del self.objectSelector[3:]

        self.clothesSelections = []
        theClothesList = human.clothesObjs.keys()
        self.activeClothing = None
        for i, uuid in enumerate(theClothesList):
            if i == 0:
                self.activeClothing = uuid
            radioBtn = self.clothesBox.addWidget(gui.RadioButton(self.objectSelector, human.clothesProxies[uuid].name, selected=False))
            self.clothesSelections.append( (radioBtn, uuid) )

            @radioBtn.mhEvent
            def onClicked(event):
                for radio, uuid in self.clothesSelections:
                    if radio.selected:
                        self.activeClothing = uuid
                        log.debug( 'Selected clothing "%s" (%s)' % (radio.text(), uuid) )
                        self.reloadTextureChooser()
                        return
コード例 #10
0
ファイル: __init__.py プロジェクト: yhl533556/makehuman
    def build(self, options, taskview):
        import gui
        Exporter.build(self, options, taskview)

        self.hiddenGeom = options.addWidget(
            gui.CheckBox("Helper geometry", False))
        self.facePoseUnits = options.addWidget(
            gui.CheckBox("Facial pose-units", False))

        orients = []
        box = options.addWidget(gui.GroupBox("Orientation"))
        self.yUpFaceZ = box.addWidget(
            gui.RadioButton(orients, "Y up, face Z", True))
        self.yUpFaceX = box.addWidget(
            gui.RadioButton(orients, "Y up, face X", False))
        self.zUpFaceNegY = box.addWidget(
            gui.RadioButton(orients, "Z up, face -Y", False))
        self.zUpFaceX = box.addWidget(
            gui.RadioButton(orients, "Z up, face X", False))

        csyses = []
        box = options.addWidget(gui.GroupBox("Bone orientation"))
        self.localY = box.addWidget(
            gui.RadioButton(csyses, "Along local Y", True))
        self.localX = box.addWidget(
            gui.RadioButton(csyses, "Along local X", False))
        self.localG = box.addWidget(
            gui.RadioButton(csyses, "Local = Global", False))
コード例 #11
0
 def addScales(self, scaleBox):
     check = True
     buttons = []
     scales = []
     for name in ["decimeter", "meter", "inch", "centimeter"]:
         button = scaleBox.addWidget(gui.RadioButton(scales, name, check))
         check = False
         buttons.append((button, name))
     return buttons
コード例 #12
0
 def addEncodings(self, encodingBox):
     buttons = []
     encodings = []
     for name, check in [("ascii", False), ("latin-1", False),
                         ("utf-8", True)]:
         button = encodingBox.addWidget(
             gui.RadioButton(encodings, name, check))
         buttons.append((button, name))
     return buttons
コード例 #13
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'})
コード例 #14
0
    def addExporter(self, exporter):
        radio = self.boxes[exporter.group].addWidget(
            gui.RadioButton(self.exportBodyGroup, exporter.name, self.empty))
        options = self.optionsBox.addWidget(gui.GroupBox('Options'))
        exporter.build(options)
        self.empty = False
        self.formats.append((exporter, radio, options))

        @radio.mhEvent
        def onClicked(event):
            self.updateGui()
            self.fileentry.setFilter(exporter.filter)
コード例 #15
0
ファイル: guiexport.py プロジェクト: threos/makehuman-macos
    def addExporter(self, exporter):
        radio = gui.RadioButton(self.exportBodyGroup, exporter.name)
        radio.exporter = exporter
        options = self.optionsBox.addWidget(gui.GroupBox('Options'))
        exporter.build(options, self)
        self.formats.append((exporter, radio, options))

        @radio.mhEvent
        def onClicked(event):
            self.updateGui()

        self._requiresUpdate = True
コード例 #16
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Proportional editing', label='Edit')

        self.radius = 1.0
        self.start = None
        self.center = None
        self.axis = None
        self.depth = None
        self.original = None
        self.normals = None
        self.weights = None
        self.verts = None
        self.faces = None
        self.smoothed = None

        self.converter = ValueConverter()
        value = self.converter.displayToData(self.radius)
        self.radiusSlider = self.addLeftWidget(gui.Slider(value, min=-5.0, max=3.0, label="Radius",
                                                          valueConverter=self.converter))
        self.clear = self.addLeftWidget(gui.Button("Clear"))
        self.modeBox = self.addLeftWidget(gui.GroupBox("Mode"))
        modes = []
        self.grab = self.modeBox.addWidget(gui.RadioButton(modes, "Grab", selected=True))
        self.norm = self.modeBox.addWidget(gui.RadioButton(modes, "Normal"))
        self.scalex = self.modeBox.addWidget(gui.RadioButton(modes, "Scale X"))
        self.scaley = self.modeBox.addWidget(gui.RadioButton(modes, "Scale Y"))
        self.scalez = self.modeBox.addWidget(gui.RadioButton(modes, "Scale Z"))
        self.rotate = self.modeBox.addWidget(gui.RadioButton(modes, "Rotate"))
        self.smooth = self.modeBox.addWidget(gui.RadioButton(modes, "Smooth"))

        self.buildCircle()
        self.updateRadius()

        self.circle = self.addObject(gui3d.Object(self.circleMesh))

        @self.clear.mhEvent
        def onClicked(dummy):
            human = gui3d.app.selectedHuman
            targets = []
            for name in human.targetsDetailStack.keys():
                if isinstance(algos3d.getTarget(human, name), EditTarget):
                    targets.append(name)
            gui3d.app.do(EditAction(human, targets, 0.0))

        @self.radiusSlider.mhEvent
        def onChanging(value):
            self.radius = self.converter.dataToDisplay(value)
            self.updateRadius()

        @self.radiusSlider.mhEvent
        def onChange(value):
            self.radius = self.converter.dataToDisplay(value)
            self.updateRadius()
コード例 #17
0
    def addRigs(self, options, rigs=None):
        path = "data/rigs"
        if not os.path.exists(path):
            log.message("Did not find directory %s", path)
            return []

        check = rigs is None
        buttons = []
        rigs = rigs if rigs is not None else []
        for fname in os.listdir(path):
            (name, ext) = os.path.splitext(fname)
            if ext == ".rig":
                button = options.addWidget(
                    gui.RadioButton(rigs, "Use %s rig" % name, check))
                check = False
                buttons.append((button, name))
        return buttons
コード例 #18
0
    def reloadBoneExplorer(self):
        # Remove old radio buttons
        for radioBtn in self.boneSelector:
            radioBtn.hide()
            radioBtn.destroy()
        self.boneSelector = []

        human = self.mainLib.human
        skel = human.getSkeleton()
        if not skel:
            return

        for bone in skel.getBones():
            radioBtn = self.boneBox.addWidget(gui.RadioButton(self.boneSelector, bone.name))
            @radioBtn.mhEvent
            def onClicked(event):
                for rdio in self.boneSelector:
                    if rdio.selected:
                        self.mainLib.removeBoneHighlights()
                        self.mainLib.highlightBone(str(rdio.text()))
コード例 #19
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.unitsBox = 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'))

        startupBox = self.addLeftWidget(gui.GroupBox('Startup'))
        self.preload = startupBox.addWidget(
            SettingCheckbox("Preload macro targets", 'preloadTargets'))

        self.saveScreenSize = startupBox.addWidget(
            SettingCheckbox("Restore window size", 'restoreWindowSize'))

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

        self.checkboxes.extend([
            self.realtimeUpdates, self.realtimeNormalUpdates,
            self.realtimeFitting, self.cameraAutoZoom, self.sliderImages,
            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:
            self.languageBox.addWidget(LanguageRadioButton(
                languages, language))

        @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.updateGui()
コード例 #20
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Background')

        self.human = gui3d.app.selectedHuman

        self.backgroundsFolder = mh.getPath('backgrounds')
        if not os.path.exists(self.backgroundsFolder):
            os.makedirs(self.backgroundsFolder)

        self.backgroundsFolders = [ mh.getSysDataPath('backgrounds'),
                                    self.backgroundsFolder ]
        self.extensions = ['bmp', 'png', 'tif', 'tiff', 'jpg', 'jpeg']

        self.texture = mh.Texture()

        self.sides = { 'front': [0,0,0],
                       'back': [0,180,0],
                       'left': [0,-90,0],
                       'right': [0,90,0],
                       'top': [90,0,0],
                       'bottom': [-90,0,0],
                       'other': None }

        self.filenames = {}    # Stores (filename, aspect)
        self.transformations = {} # Stores ((posX,posY), scaleY)
        for side in self.sides.keys():
            self.filenames[side] = None
            self.transformations[side] = [(0.0, 0.0), 1.0]

        self.planeMeshes = dict()

        self.opacity = 40

        for viewName, rot in self.sides.items():
            if rot is not None:
                rv = [0, 0, 0]
                angle = 0.0
                for r_idx, r in enumerate(rot):
                    if r != 0:
                        rv[r_idx] = 1
                        angle = math.radians(r)
                if angle == 0:
                    m = None
                else:
                    m = tm.rotation_matrix(-angle, rv)
            else:
                m = None

            mesh = geometry3d.RectangleMesh(20, 20, centered=True, rotation=m)
            mesh.name = "Background_%s" % viewName
            obj = gui3d.app.addObject(gui3d.Object(mesh, [0, 0, 0], visible=False))
            obj.setShadeless(True)
            obj.setDepthless(True)
            #obj.placeAtFeet = True
            mesh.setCameraProjection(0)
            mesh.setColor([255, 255, 255, self.opacity*2.55])
            mesh.setPickable(False)
            mesh.priority = -90
            self.planeMeshes[viewName] = obj

            if viewName == 'other':
                obj.lockRotation = True

            @obj.mhEvent
            def onMouseDragged(event):
                if event.button in [mh.Buttons.LEFT_MASK, mh.Buttons.MIDDLE_MASK]:
                    if mh.getKeyModifiers() & (mh.Modifiers.SHIFT):
                        delta = 150.0
                    else:
                        delta = 30.0

                    dx = float(event.dx)/delta
                    dy = float(-event.dy)/delta
                    self.moveBackground(dx, dy)
                elif event.button == mh.Buttons.RIGHT_MASK:
                    if mh.getKeyModifiers() & (mh.Modifiers.SHIFT):
                        delta = 500.0
                    else:
                        delta = 100.0
                    scale = self.getBackgroundScale()
                    scale += float(event.dy)/delta

                    self.setBackgroundScale(scale)

        # Add icon to action toolbar
        self.backgroundImageToggle = gui.Action('background', 'Background', self.toggleBackground, toggle=True)
        gui3d.app.view_toolbar.addAction(self.backgroundImageToggle)
        gui3d.app.actions.background = self.backgroundImageToggle

        #self.filechooser = self.addTopWidget(fc.FileChooser(self.backgroundsFolders, self.extensions, None))
        #self.addLeftWidget(self.filechooser.sortBox)
        self.filechooser = self.addRightWidget(fc.IconListFileChooser(self.backgroundsFolders, self.extensions, None, None, 'Background', noneItem=True))
        self.filechooser.setIconSize(50,50)
        self.filechooser.enableAutoRefresh(False)
        #self.addLeftWidget(self.filechooser.createSortBox())

        self.backgroundBox = self.addLeftWidget(gui.GroupBox('Side'))
        self.bgSettingsBox = self.addLeftWidget(gui.GroupBox('Background settings'))

        self.radioButtonGroup = []
        for side in ['front', 'back', 'left', 'right', 'top', 'bottom', 'other']:
            radioBtn = self.backgroundBox.addWidget(gui.RadioButton(self.radioButtonGroup, label=side.capitalize(), selected=len(self.radioButtonGroup)==0))
            radioBtn.side = side
            @radioBtn.mhEvent
            def onClicked(value):
                side = self.sides[self.getSelectedSideCheckbox()]
                if side:
                    gui3d.app.axisView(side)
                self.refreshFileChooser()

        self.opacitySlider = self.bgSettingsBox.addWidget(gui.Slider(value=self.opacity, min=0,max=100, label = ["Opacity",": %d%%"]))
        self.dragButton = self.bgSettingsBox.addWidget(gui.CheckBox('Move && Resize'))
        self.foregroundTggl = self.bgSettingsBox.addWidget(gui.CheckBox("Show in foreground"))

        @self.opacitySlider.mhEvent
        def onChanging(value):
            for obj in self.planeMeshes.values():
                obj.mesh.setColor([255, 255, 255, 2.55*value])
        @self.opacitySlider.mhEvent
        def onChange(value):
            self.opacity = value
            for obj in self.planeMeshes.values():
                obj.mesh.setColor([255, 255, 255, 2.55*value])
        @self.foregroundTggl.mhEvent
        def onClicked(value):
            self.setShowBgInFront(self.foregroundTggl.selected)

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            side = self.getSelectedSideCheckbox()

            if self.filenames[side]:
                oldBg = self.filenames[side][0]
            else:
                oldBg = None
            gui3d.app.do(BackgroundAction("Change background",
                self,
                side,
                oldBg,
                filename))

            mh.redraw()


        @self.dragButton.mhEvent
        def onClicked(event):
            for obj in self.planeMeshes.values():
                obj.mesh.setPickable(self.dragButton.selected)
            gui3d.app.selectedHuman.mesh.setPickable(not self.dragButton.selected)
            mh.redraw()
コード例 #21
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Texture', label='Skin/Material')

        self.systemSkins = os.path.join('data', 'skins')
        self.systemTextures = os.path.join('data', 'clothes', 'textures')

        self.userSkins = os.path.join(mh.getPath(''), 'data', 'skins')
        self.userTextures = os.path.join(mh.getPath(''), 'data', 'clothes', 'textures')
        if not os.path.exists(self.userSkins):
            os.makedirs(self.userSkins)
        if not os.path.exists(self.userTextures):
            os.makedirs(self.userTextures)

        self.defaultTextures = [self.systemTextures, self.userTextures]  
        self.textures = self.defaultTextures
        self.activeClothing = None
        self.eyeTexture = None

        #self.filechooser = self.addTopWidget(fc.FileChooser(self.userSkins, 'png', ['thumb', 'png'], 'data/skins/notfound.thumb'))
        self.filechooser = self.addRightWidget(fc.IconListFileChooser(self.userSkins, 'png', ['thumb', 'png'], 'data/skins/notfound.thumb', 'Texture'))
        self.filechooser.setIconSize(50,50)
        self.addLeftWidget(self.filechooser.createSortBox())

        self.update = self.filechooser.sortBox.addWidget(gui.Button('Check for updates'))
        self.mediaSync = None
        self.mediaSync2 = None

        @self.filechooser.mhEvent
        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))

        @self.update.mhEvent
        def onClicked(event):
            self.syncMedia()

        self.objectSelector = []
        self.humanBox = self.addLeftWidget(gui.GroupBox('Human'))
        self.skinRadio = self.humanBox.addWidget(gui.RadioButton(self.objectSelector, "Skin", selected=True))
        self.hairRadio = self.humanBox.addWidget(gui.RadioButton(self.objectSelector, "Hair", selected=False))
        self.eyesRadio = self.humanBox.addWidget(gui.RadioButton(self.objectSelector, "Eyes", selected=False))

        @self.skinRadio.mhEvent
        def onClicked(event):
            if self.skinRadio.selected:
                self.reloadTextureChooser()

        @self.hairRadio.mhEvent
        def onClicked(event):
            if self.hairRadio.selected:
                self.reloadTextureChooser()

        @self.eyesRadio.mhEvent
        def onClicked(event):
            if self.eyesRadio.selected:
                self.reloadTextureChooser()

        self.clothesBox = self.addLeftWidget(gui.GroupBox('Clothes'))
        self.clothesSelections = []
コード例 #22
0
    width='66',
    font={
        'style': 'bold',
        'size': 20,
        'family': 'sans serif',
        'face': u'David'
    },
    parent='mywin',
    text=u':??? ????',
    visible=False,
)
gui.RadioButton(
    name='baradplada',
    label=u'??? ????',
    left='50px',
    top='200px',
    parent='mywin',
    visible=False,
    transparent=True,
)
gui.RadioButton(
    name='barad had',
    label=u'??? ??',
    left='50px',
    top='220px',
    parent='mywin',
    visible=False,
    transparent=True,
)
gui.RadioButton(
    name='barad kaved',
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Perspective')

        self.human = gui3d.app.selectedHuman
        self.humanPos = [0.0, 0.0, 0.0]
        self.currentframe = 0
        self.framesloaded = 0

        animbox = self.addLeftWidget(gui.GroupBox('Frames'))

        self.avFramesText = animbox.addWidget(
            gui.TextView('Available frames: 0'))

        self.playbackSlider = animbox.addWidget(
            gui.Slider(label=['Current frame', ': %d']))
        self.playbackSlider.setMin(0)

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

        self.nextframeButton = animbox.addWidget(gui.Button('Next frame'))

        @self.nextframeButton.mhEvent
        def onClicked(event):
            anim = self.human.getActiveAnimation()
            if anim:
                if self.currentframe >= anim.nFrames - 1:
                    self.currentframe = 0
                else:
                    self.currentframe += 1

                self.updateFrame()
                self.playbackSlider.setValue(self.currentframe)

        self.prevframeButton = animbox.addWidget(gui.Button('Previous frame'))

        @self.prevframeButton.mhEvent
        def onClicked(event):
            anim = self.human.getActiveAnimation()
            if anim:
                if self.currentframe <= 0:
                    self.currentframe = anim.nFrames - 1
                else:
                    self.currentframe -= 1

                self.updateFrame()
                self.playbackSlider.setValue(self.currentframe)

        projbox = self.addLeftWidget(gui.GroupBox('Projection'))

        self.projRadioButtonGroup = []

        self.persButton = projbox.addWidget(
            gui.RadioButton(self.projRadioButtonGroup,
                            'Perspective',
                            selected=G.app.modelCamera.projection))

        @self.persButton.mhEvent
        def onClicked(event):
            G.app.guiCamera.projection = True
            G.app.guiCamera.fixedRadius = True
            G.app.modelCamera.projection = True
            G.app.modelCamera.fixedRadius = True
            if G.app.backgroundGradient:
                G.app.removeObject(G.app.backgroundGradient)
            G.app.backgroundGradient = None
            # G.app.modelCamera.updateCamera()

        self.orthButton = projbox.addWidget(
            gui.RadioButton(self.projRadioButtonGroup,
                            'Orthogonal',
                            selected=not G.app.modelCamera.projection))

        @self.orthButton.mhEvent
        def onClicked(event):
            G.app.guiCamera.projection = False
            G.app.guiCamera.fixedRadius = False
            G.app.modelCamera.projection = False
            G.app.modelCamera.fixedRadius = False
            G.app.loadBackgroundGradient()
            # G.app.modelCamera.updateCamera()

        self.fovslider = projbox.addWidget(
            gui.Slider(label=['Camera focus', '= %.2f'],
                       min=25.0,
                       max=130.0,
                       value=90.0))

        @self.fovslider.mhEvent
        def onChange(value):
            G.app.modelCamera.setFovAngle(value)
            G.app.guiCamera.setFovAngle(value)
            #G.app.modelCamera.updateCamera()
            G.app.redraw()

        posbox = self.addLeftWidget(gui.GroupBox('Position'))

        self.xposslider = posbox.addWidget(
            gui.Slider(label=['X-position', '= %.2f'],
                       min=-10.0,
                       max=10.0,
                       value=0.0))

        @self.xposslider.mhEvent
        def onChange(value):
            self.humanPos[0] = value
            G.app.selectedHuman.setPosition(self.humanPos)
            self.updateFrame()

        self.yposslider = posbox.addWidget(
            gui.Slider(label=['Y-position', '= %.2f'],
                       min=-10.0,
                       max=10.0,
                       value=0.0))

        @self.yposslider.mhEvent
        def onChange(value):
            self.humanPos[1] = value
            G.app.selectedHuman.setPosition(self.humanPos)
            self.updateFrame()

        self.zposslider = posbox.addWidget(
            gui.Slider(label=['Z-position', '= %.2f'],
                       min=-10.0,
                       max=10.0,
                       value=0.0))

        @self.zposslider.mhEvent
        def onChange(value):
            self.humanPos[2] = value
            G.app.selectedHuman.setPosition(self.humanPos)
            self.updateFrame()

        self.resetButton = posbox.addWidget(gui.Button('Reset position'))

        @self.resetButton.mhEvent
        def onClicked(event):
            self.humanPos = [0.0, 0.0, 0.0]
            self.xposslider.setValue(0.0)
            self.yposslider.setValue(0.0)
            self.zposslider.setValue(0.0)
            G.app.selectedHuman.setPosition(self.humanPos)
            self.updateFrame()
コード例 #24
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()
コード例 #25
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Pose tuning')

        self.zone = ""
        self.rigtype = None
        self.armature = None
        self.armatureObject = None
        self.objects = []
        self.activeBone = None
        self.poseModifier = None

        cubeLayer = CLayerObject("Cube", 'CUBE')
        cubeLayer.buildCube((-8, 8, 0), 1.0)
        cubeLayer.finishBuild((0, 0, 0))
        self.cube = cubeLayer.object
        self.cube.hide()

        # Main box
        self.mainBox = self.addLeftWidget(gui.GroupBox('Rotation'))
        self.eulerBox = self.addLeftWidget(gui.GroupBox('Euler'))
        self.quatBox = self.addLeftWidget(gui.GroupBox('Quaternion'))

        self.QWslider = self.quatBox.addWidget(
            gui.Slider(value=1000.0, min=-1000.0, max=1000.0, label="W: %d"))
        self.QXslider = self.quatBox.addWidget(
            gui.Slider(value=0.0, min=-1000.0, max=1000.0, label="X: %d"))
        self.QYslider = self.quatBox.addWidget(
            gui.Slider(value=0.0, min=-1000.0, max=1000.0, label="Y: %d"))
        self.QZslider = self.quatBox.addWidget(
            gui.Slider(value=0.0, min=-1000.0, max=1000.0, label="Z: %d"))

        self.EXslider = self.eulerBox.addWidget(
            gui.Slider(value=0.0, min=-180, max=180, label="X: %d"))
        self.EYslider = self.eulerBox.addWidget(
            gui.Slider(value=0.0, min=-180, max=180, label="Y: %d"))
        self.EZslider = self.eulerBox.addWidget(
            gui.Slider(value=0.0, min=-180, max=180, label="Z: %d"))

        self.rotSlider = self.mainBox.addWidget(
            gui.Slider(value=0.0, min=-180, max=180, label="Rotation: %d"))
        self.rotWorld = self.mainBox.addWidget(
            gui.CheckBox("World Rotation", False))
        rots = []
        self.rotX = self.mainBox.addWidget(gui.RadioButton(rots, "X", True))
        self.rotY = self.mainBox.addWidget(gui.RadioButton(rots, "Y", False))
        self.rotZ = self.mainBox.addWidget(gui.RadioButton(rots, "Z", False))

        self.showMesh = self.mainBox.addWidget(gui.CheckBox("Show Mesh", True))
        self.showRig = self.mainBox.addWidget(gui.CheckBox("Show Rig", False))
        self.restPosition = self.mainBox.addWidget(
            gui.CheckBox("Rest Position", False))

        #self.updateButton = self.mainBox.addWidget(gui.Button("Update"))
        self.reloadCharacterButton = self.mainBox.addWidget(
            gui.Button("Reload Character"))
        self.zeroBoneButton = self.mainBox.addWidget(gui.Button("Zero Bone"))
        self.zeroAllButton = self.mainBox.addWidget(gui.Button("Zero All"))
        self.poseButton = self.mainBox.addWidget(gui.Button("Pose"))
        self.testButton = self.mainBox.addWidget(gui.Button("Test bones"))
        # self.mainBox.hide()
        # self.quatBox.hide()
        # self.eulerBox.hide()

        # Rig select box
        self.rigBox = self.addLeftWidget(gui.GroupBox('Rig'))

        prisms = []
        self.prismButtons = {}
        first = True
        for type in ['Prism', 'Box', 'Line']:
            self.prismButtons[type] = self.rigBox.addWidget(
                gui.RadioButton(prisms, type, first))
            first = False

        self.selectRigButton = self.rigBox.addWidget(gui.Button("SelectRig"))

        rigs = []
        self.rigButtons = {}
        self.rigButtons["mhx"] = self.rigBox.addWidget(
            gui.RadioButton(rigs, "Mhx", False))
        path = "data/rigs"
        if not os.path.exists(path):
            log.notice("Did not find directory %s", path)
        else:
            buttons = []
            for name in ["game", "simple", "rigid"]:
                #for fname in os.listdir(path):
                #    (name, ext) = os.path.splitext(fname)
                #    if ext == ".rig":
                self.rigButtons[name] = self.rigBox.addWidget(
                    gui.RadioButton(rigs, name.capitalize(), False))
        self.rigBox.show()

        # Bone select box
        self.boneBox = self.addRightWidget(gui.GroupBox('Bone'))
        self.boneButtons = {}
        self.boneBox.hide()

        # Pose select box
        self.poseBox = self.addRightWidget(gui.GroupBox('Pose'))
        self.poseButtons = {}
        self.poseBox.hide()

        # Layer select box
        self.layerBox = self.addRightWidget(gui.GroupBox('Layers'))
        self.layerButtons = {}
        self.layerBox.hide()

        @self.selectRigButton.mhEvent
        def onClicked(event):
            for name, button in self.prismButtons.items():
                if button.selected:
                    prismType = name
            for name, button in self.rigButtons.items():
                if button.selected:
                    rigtype = name
            if rigtype:
                self.selectRig(prismType, rigtype)

        @self.testButton.mhEvent
        def onClicked(event):
            listBones = doTest1(self.armature.bones)
            self.updateAll()
            doTest2(listBones)

        @self.poseButton.mhEvent
        def onClicked(event):
            if not self.poseButtons:
                radio = []
                self.poseButtons = {}
                path = os.path.join(mh.getPath(''), "data", "poses")
                if not os.path.exists(path):
                    os.makedirs(path)
                for file in os.listdir(path):
                    (pose, ext) = os.path.splitext(file)
                    if ext.lower() == ".bvh":
                        button = PoseRadioButton(radio, pose, False, self)
                        self.poseButtons[pose] = self.poseBox.addWidget(button)
            self.poseBox.show()

        @self.showMesh.mhEvent
        def onClicked(event):
            self.updateAll()

        @self.showMesh.mhEvent
        def onClicked(event):
            self.updateAll()

        @self.showRig.mhEvent
        def onClicked(event):
            self.updateAll()

        @self.restPosition.mhEvent
        def onClicked(event):
            self.updateAll()

        @self.zeroBoneButton.mhEvent
        def onClicked(event):
            bone = self.getSelectedBone()
            bone.zeroTransformation()
            self.zeroSliders()
            self.updateAll()

        @self.zeroAllButton.mhEvent
        def onClicked(event):
            self.zeroSliders()
            for bone in self.armature.controls:
                bone.zeroTransformation()
            self.updateAll()

        @self.reloadCharacterButton.mhEvent
        def onClicked(event):
            self.zeroSliders()
            human = gui3d.app.selectedHuman
            amt = self.getArmature()
            self.armatureObject = None
            if amt:
                #amt.hide()
                gui3d.app.removeObject(amt)
            if self.armature:
                self.armature.rebuild()
            else:
                self.armature = amtpkg.rigdefs.createPoseRig(
                    human, self.armature.rigtype)
            self.updateAll()

        @self.rotSlider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            if self.rotX.selected:
                axis = 0
            elif self.rotY.selected:
                axis = 1
            elif self.rotZ.selected:
                axis = 2
            bone.rotate(value, axis, self.rotWorld.selected)
            self.updateSliders(bone)

        @self.QXslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(1, value, True)
            self.updateSliders(bone)

        @self.QYslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(2, value, True)
            self.updateSliders(bone)

        @self.QZslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(3, value, True)
            self.updateSliders(bone)

        @self.EXslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(1, value, False)
            self.updateSliders(bone)

        @self.EYslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(2, value, False)
            self.updateSliders(bone)

        @self.EZslider.mhEvent
        def onChange(value):
            bone = self.getSelectedBone()
            bone.setRotationIndex(3, value, False)
            self.updateSliders(bone)

        @self.cube.mhEvent
        def onMouseEntered(event):
            gui3d.TaskView.onMouseEntered(self, event)
            mh.redraw()

        @self.cube.mhEvent
        def onMouseDragged(event):
            gui3d.app.selectedHuman.show()
            self.getArmature().hide()

            gui3d.TaskView.onMouseDragged(self, event)

            if not self.showMesh.selected:
                gui3d.app.selectedHuman.hide()
            if self.showRig.selected:
                self.getArmature().show()

        @self.cube.mhEvent
        def onMouseWheel(event):
            gui3d.app.selectedHuman.show()
            self.getArmature().hide()

            gui3d.TaskView.onMouseWheel(self, event)

            if not self.showMesh.selected:
                gui3d.app.selectedHuman.hide()
            if self.showRig.selected:
                self.getArmature().show()
コード例 #26
0
ファイル: gui_example.py プロジェクト: hosysy/python-sdk
gui.TextBox(name='api_key', left='80', top='50', width='150', parent='mywin.notebook.tab_setup', value='NCS52A57F48C3D32')

# api_secret
gui.Label(name='label_secret', left='10', top='84', parent='mywin.notebook.tab_setup', text='API Secret')
gui.TextBox(name='api_secret', left='80', top='84', width='280', parent='mywin.notebook.tab_setup', value='5AC44E03CE8E7212D9D1AD9091FA9966')

# test mode
gui.CheckBox(label='Test Mode', name='test_mode', left='80', top='115', parent='mywin.notebook.tab_setup', onclick=ui.test_mode)

# balance info.
gui.Button(label='Balanece', name='balance', left='80', top='138', width='85', default=True, parent='mywin.notebook.tab_setup', onclick=ui.get_balance)

#### message #####
# type
gui.Label(name='label_type', left='10', top='22', parent='mywin.notebook.tab_message', text='Type')
gui.RadioButton(label='SMS', name='sms', left='80', top='22', parent='mywin.notebook.tab_message', value=True, onclick=ui.choose_type)
gui.RadioButton(label='LMS', name='lms', left='130', top='22', parent='mywin.notebook.tab_message', onclick=ui.choose_type)
gui.RadioButton(label='MMS', name='mms', left='180', top='22', parent='mywin.notebook.tab_message', onclick=ui.choose_type)

# to
gui.Label(name='label_to', left='10', top='50', parent='mywin.notebook.tab_message', text='To')
gui.TextBox(label='To ', name='to', left='80', top='50', width='150', parent='mywin.notebook.tab_message', value='01000000000')

# from
gui.Label(name='label_from', left='10', top='84', parent='mywin.notebook.tab_message', text='From')
gui.TextBox(name='from', left='80', top='84', width='150', parent='mywin.notebook.tab_message', value='01000000000')

# subject
gui.Label(name='label_subject', left='10', top='116', parent='mywin.notebook.tab_message', text='Subject')
gui.TextBox(name='subject', left='80', top='116', width='150', parent='mywin.notebook.tab_message', value='LMS MMS Subject')
コード例 #27
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Background')

        self.backgroundsFolder = os.path.join(mh.getPath(''), 'backgrounds')
        if not os.path.exists(self.backgroundsFolder):
            os.makedirs(self.backgroundsFolder)

        self.backgroundsFolders = [
            os.path.join('data', 'backgrounds'), self.backgroundsFolder
        ]
        self.extensions = ['bmp', 'png', 'tif', 'tiff', 'jpg', 'jpeg', 'clear']

        self.texture = mh.Texture()

        self.sides = {
            'front': [0, 0, 0],
            'back': [0, 180, 0],
            'left': [0, 90, 0],
            'right': [0, -90, 0],
            'top': [90, 0, 0],
            'bottom': [-90, 0, 0],
            'other': None
        }

        self.filenames = {}  # Stores (filename, aspect)
        self.transformations = {}  # Stores ((posX,posY), scaleY)
        for side in self.sides.keys():
            self.filenames[side] = None
            self.transformations[side] = [(0.0, 0.0), 1.0]

        mesh = geometry3d.RectangleMesh(20, 20, centered=True)
        self.backgroundImage = gui3d.app.addObject(
            gui3d.Object([0, 0, 1], mesh, visible=False))
        self.backgroundImage.mesh.setCameraProjection(0)  # Set to model camera
        self.opacity = 100
        mesh.setColor([255, 255, 255, self.opacity])
        mesh.setPickable(False)
        mesh.setShadeless(True)
        mesh.setDepthless(True)
        mesh.priority = -90

        self.backgroundImageToggle = gui.Action('background',
                                                'Background',
                                                self.toggleBackground,
                                                toggle=True)
        gui3d.app.main_toolbar.addAction(self.backgroundImageToggle)
        gui3d.app.actions.background = self.backgroundImageToggle

        #self.filechooser = self.addTopWidget(fc.FileChooser(self.backgroundsFolders, self.extensions, None))
        #self.addLeftWidget(self.filechooser.sortBox)
        self.filechooser = self.addRightWidget(
            fc.IconListFileChooser(self.backgroundsFolders, self.extensions,
                                   None, None, 'Background'))
        self.filechooser.setIconSize(50, 50)
        self.addLeftWidget(self.filechooser.createSortBox())

        self.backgroundBox = self.addLeftWidget(gui.GroupBox('Side'))
        self.bgSettingsBox = self.addLeftWidget(
            gui.GroupBox('Background settings'))

        self.radioButtonGroup = []
        for side in [
                'front', 'back', 'left', 'right', 'top', 'bottom', 'other'
        ]:
            radioBtn = self.backgroundBox.addWidget(
                gui.RadioButton(self.radioButtonGroup,
                                label=side.capitalize(),
                                selected=len(self.radioButtonGroup) == 0))
            radioBtn.side = side

        self.opacitySlider = self.bgSettingsBox.addWidget(
            gui.Slider(value=self.opacity, min=0, max=255,
                       label="Opacity: %d"))
        self.foregroundTggl = self.bgSettingsBox.addWidget(
            gui.ToggleButton("Show in foreground"))

        @self.opacitySlider.mhEvent
        def onChanging(value):
            self.backgroundImage.mesh.setColor([255, 255, 255, value])

        @self.opacitySlider.mhEvent
        def onChange(value):
            self.opacity = value
            self.backgroundImage.mesh.setColor([255, 255, 255, value])

        @self.foregroundTggl.mhEvent
        def onClicked(value):
            self.setShowBgInFront(self.foregroundTggl.selected)

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            side = self.getSelectedSideCheckbox()

            if os.path.splitext(filename)[1] == ".clear":
                filename = None

            if self.filenames[side]:
                oldBg = self.filenames[side][0]
            else:
                oldBg = None
            gui3d.app.do(
                BackgroundAction("Change background", self, side, oldBg,
                                 filename))

            if self.sides[side]:
                gui3d.app.selectedHuman.setRotation(self.sides[side])
            mh.redraw()
コード例 #28
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Perspective')
        self.isOrthoView = True
        self.createShortCut()

        self.human = gui3d.app.selectedHuman
        self.currentframe = 0
        self.framesloaded = 0
        self.fov = self.fovangle_loaded = G.app.modelCamera.getFovAngle()

        projbox = self.addLeftWidget(gui.GroupBox('BVH Viewer'))

        self.avFramesText = projbox.addWidget(gui.TextView('Available frames: 0'))

        self.playbackSlider = projbox.addWidget(gui.Slider(label=['Current frame', ': %d']))
        self.playbackSlider.setMin(0)
        self.invMouseWheel = G.app.getSetting('invertMouseWheel')

        @self.playbackSlider.mhEvent
        def onChange(value):
            self.currentframe = int(value)
            self.updateFrame()
        
        self.nextframeButton = projbox.addWidget(gui.Button('Next frame'))

        @self.nextframeButton.mhEvent
        def onClicked(event):
            anim = self.human.getActiveAnimation()
            if anim:
                if self.currentframe >= anim.nFrames-1:
                    self.currentframe = 0
                else:
                    self.currentframe += 1

                self.updateFrame()
                self.playbackSlider.setValue(self.currentframe)

        self.prevframeButton = projbox.addWidget(gui.Button('Previous frame'))

        @self.prevframeButton.mhEvent
        def onClicked(event):
            anim = self.human.getActiveAnimation()
            if anim:
                if self.currentframe <= 0:
                    self.currentframe = anim.nFrames-1
                else:
                    self.currentframe -= 1

                self.updateFrame()
                self.playbackSlider.setValue(self.currentframe)

        projbox = self.addLeftWidget(gui.GroupBox('Projection'))

        self.projRadioButtonGroup = []

        self.persButton = projbox.addWidget(gui.RadioButton(self.projRadioButtonGroup, 'Perspective',selected=G.app.modelCamera.projection))

        @self.persButton.mhEvent
        def onClicked(event):
            self.toggleView()

        self.orthButton = projbox.addWidget(gui.RadioButton(self.projRadioButtonGroup, 'Orthogonal',selected=not G.app.modelCamera.projection))

        @self.orthButton.mhEvent
        def onClicked(event):
            self.toggleView()

        self.focalDistanceLbl = projbox.addWidget(gui.TextView('Focal distance= '))
        self.updateFocalDistance(self.fov)
        self.fovslider = projbox.addWidget(gui.Slider(label=['Focus angle', '= %.2f'], min=1.0, max=90.0, value=self.fov))

        @self.fovslider.mhEvent
        def onChange(value):
            for cam in G.cameras:
                cam.setFovAngle(value)
                cam.changed()
            self.updateFocalDistance(value)

        self.trans= G.cameras[0].getPosition()
        posbox = self.addLeftWidget(gui.GroupBox('Camera Translation'))

        self.xposslider = posbox.addWidget(gui.Slider(label=['X-translation', '= %.2f'], min=-1.0, max=1.0, value=self.trans[0]))

        @self.xposslider.mhEvent
        def onChange(value):
            for cam in G.cameras:
                self.trans[0] = value
                cam.setPosition (self.trans)
                cam.changed()
      
        self.yposslider = posbox.addWidget(gui.Slider(label=['Y-translation', '= %.2f'], min=-1.0, max=1.0, value=self.trans[1]))

        @self.yposslider.mhEvent
        def onChange(value):
            for cam in G.cameras:
                cam.translation[1] = value
                cam.setPosition (self.trans)
                cam.changed()

        self.resetButton = posbox.addWidget(gui.Button('Reset translation'))

        @self.resetButton.mhEvent
        def onClicked(event):
            for cam in G.cameras:
                cam.translation = [0.0, 0.0, 0.0]
                cam.pickedPos = cam.translation
                cam.changed()
            self.xposslider.setValue (0.0)
            self.yposslider.setValue (0.0)
            self.updateFrame()

        @self.mhEvent
        def onMouseWheel(event):
            if self.isOrthoView == True:
                G.app.onMouseWheel(event)
            else:
                zoomOut = event.wheelDelta > 0
                if self.invMouseWheel:
                    zoomOut = not zoomOut
                
                if zoomOut:
                    if self.fov <= 1:
                        return
                    self.fov -= 1
                else:
                    if self.fov >=90:
                        return
                    self.fov += 1
                for cam in G.cameras:
                    cam.setFovAngle(self.fov)
                    cam.changed()
                self.updateFocalDistance(self.fov)
                self.fovslider.setValue (self.fov)

        @self.mhEvent
        def onMouseDragged(event):
            G.app.onMouseDragged(event)
            self.updateCoords()
コード例 #29
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()
コード例 #30
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'General')

        sliderBox = self.addLeftWidget(gui.GroupBox('Slider behavior'))
        self.realtimeUpdates = sliderBox.addWidget(
            gui.CheckBox("Update real-time",
                         gui3d.app.settings.get('realtimeUpdates', True)))
        self.realtimeNormalUpdates = sliderBox.addWidget(
            gui.CheckBox("Update normals real-time",
                         gui3d.app.settings.get('realtimeNormalUpdates',
                                                True)))
        self.realtimeFitting = sliderBox.addWidget(
            gui.CheckBox("Fit objects real-time",
                         gui3d.app.settings.get('realtimeFitting', False)))
        self.cameraAutoZoom = sliderBox.addWidget(
            gui.CheckBox("Auto-zoom camera",
                         gui3d.app.settings.get('cameraAutoZoom', False)))
        self.sliderImages = sliderBox.addWidget(
            gui.CheckBox("Slider images",
                         gui3d.app.settings.get('sliderImages', True)))

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

        startupBox = self.addLeftWidget(gui.GroupBox('Startup'))
        self.preload = startupBox.addWidget(
            gui.CheckBox("Preload macro targets",
                         gui3d.app.settings.get('preloadTargets', False)))
        self.saveScreenSize = startupBox.addWidget(
            gui.CheckBox("Restore window size",
                         gui3d.app.settings.get('restoreWindowSize', False)))

        themes = []
        themesBox = self.themesBox = self.addRightWidget(gui.GroupBox('Theme'))
        self.themeNative = themesBox.addWidget(
            ThemeRadioButton(themes, "Native look", "default"))
        self.themeMH = 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 = []
        languageBox = self.languageBox = self.addRightWidget(
            gui.GroupBox('Language'))
        languageBox.addWidget(LanguageRadioButton(languages, 'english'))

        languageFiles = [
            os.path.basename(filename).replace('.ini', '')
            for filename in os.listdir(mh.getSysDataPath('languages'))
            if filename.split(os.extsep)[-1] == "ini"
        ]
        for language in languageFiles:
            languageBox.addWidget(LanguageRadioButton(languages, language))

        @self.realtimeUpdates.mhEvent
        def onClicked(event):
            gui3d.app.settings[
                'realtimeUpdates'] = self.realtimeUpdates.selected

        @self.realtimeNormalUpdates.mhEvent
        def onClicked(event):
            gui3d.app.settings[
                'realtimeNormalUpdates'] = self.realtimeNormalUpdates.selected

        @self.realtimeFitting.mhEvent
        def onClicked(event):
            gui3d.app.settings[
                'realtimeFitting'] = self.realtimeFitting.selected

        @self.cameraAutoZoom.mhEvent
        def onClicked(event):
            gui3d.app.settings['cameraAutoZoom'] = self.cameraAutoZoom.selected

        @self.sliderImages.mhEvent
        def onClicked(event):
            gui3d.app.settings['sliderImages'] = self.sliderImages.selected
            gui.Slider.showImages(self.sliderImages.selected)
            mh.refreshLayout()

        @metric.mhEvent
        def onClicked(event):
            gui3d.app.settings['units'] = 'metric'
            gui3d.app.loadGrid()

        @imperial.mhEvent
        def onClicked(event):
            gui3d.app.settings['units'] = 'imperial'
            gui3d.app.loadGrid()

        @self.preload.mhEvent
        def onClicked(event):
            gui3d.app.settings['preloadTargets'] = self.preload.selected

        @self.saveScreenSize.mhEvent
        def onClicked(event):
            gui3d.app.settings[
                'restoreWindowSize'] = self.saveScreenSize.selected