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()
def createCheckBox(self, label=None, selected=False): return gui.CheckBox(label,selected)
def build(self, options, taskview): import gui Exporter.build(self, options, taskview) self.binary = options.addWidget(gui.CheckBox("Binary FBX", True)) self.hiddenGeom = options.addWidget( gui.CheckBox("Helper geometry", False))
myGui = gui.GUI(myDisplay, (10, height * scale + 10, width * scale - 20, 180)) myGui.objects["heurs"] = gui.List((0.4, 0.1, 0.5, 0.8), (250, 250, 250), heurs.keys(), selectHeurs, ["all"]) myGui.objects["exportWalls"] = gui.Button( (0.0, 0.0, 0.2, 0.18), (150, 150, 150), "Export Walls", exportWalls, ["all"]) myGui.objects["clrWalls"] = gui.Button((0.0, 0.2, 0.2, 0.18), (150, 150, 150), "Clear Walls", clrWalls, ["all"]) myGui.objects["addRandWalls"] = gui.Button( (0.0, 0.4, 0.2, 0.18), (150, 150, 150), "Add Rand Walls", addRandWalls, ["all"]) myGui.objects["Maze"] = gui.Button((0.0, 0.6, 0.2, 0.18), (150, 150, 150), "Make Maze", maze, ["all"]) myGui.objects["diagonal"] = gui.CheckBox( (0.0, 0.8, 0.2, 0.18), (150, 150, 150), "Diagonal Moves", True, toggleDiagonals, ["all"]) myGui.objects["speedLabel"] = gui.Button((0.22, 0.0, 0.1, 0.2), (20, 20, 20), "Delay", None, ["all"]) myGui.objects["speed"] = gui.ValueBox((0.22, 0.2, 0.1, 0.18), (150, 150, 150), (0, 10), 0, setSpeed, ["all"]) myGui.resize((10, height * scale + 10, width * scale - 20, 180)) #============================================================================== # Main loop # #------------------------------------------------------------------------------ myBoard = a_star.Board(width, height, scale)
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
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()
value=datetime.date(2014, 5, 27), ) gui.TextBox(id=2361, mask='########', name=u'nro_cbte_hasta', alignment='right', height='27', left='654', top='59', width='92', bgcolor=u'#FFFFFF', fgcolor=u'#000000', value=12345678, ) gui.TextBox(mask='########', name=u'nro_cbte_desde', alignment='right', height='27', left='481', top='59', width='92', bgcolor=u'#FFFFFF', fgcolor=u'#000000', value=12345678, ) gui.Label(name='label_26_372_2499_2861', height='17', left='439', top='98', width='39', text=u'CAE:', ) gui.TextBox(name='cae', left='480', top='93', width='153', text=u'123456789012345', tooltip=u'CAE o c\xf3digo de barras', value=u'123456789012345', ) gui.CheckBox(label=u'Aprobado', name=u'aceptado', height='24', left='655', top='94', width='114', value=True, ) gui.Label(id=1243, name='label_356_21_178_2591_1243', height='17', left='423', top='63', width='47', text=u'Desde:', ) gui.Label(id=1343, name='label_356_21_178_1343', height='17', left='593', top='64', width='44', text=u'Hasta:', ) gui.Button(label=u'Cargar', name=u'cargar', left='379', top='542', width='73', fgcolor=u'#4C4C4C', ) gui.Button(label=u'Exportar', name=u'exportar', left='458', top='542', width='75', fgcolor=u'#4C4C4C', onclick=exportar) gui.Button(id=188, label=u'Reporte', name=u'reporte', left='542', top='542', width='75', fgcolor=u'#4C4C4C', onclick=reporte) # --- gui2py designer generated code ends --- # obtener referencia a la ventana principal: mywin = gui.get("consultas")
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Skeleton Debug') self.human = gui3d.app.selectedHuman self.displayBox = self.addRightWidget(gui.GroupBox('Display')) self.selectedBone = None self.boneBox = self.addRightWidget(gui.GroupBox('Bones')) self.boneSelector = [] self.xray_mat = None self.skelMesh = None self.skelObj = None self.axisMesh = None self.axisObj = None self.planesObj = None self.planesMesh = None self.showWeightsTggl = self.displayBox.addWidget( gui.CheckBox("Show bone weights")) @self.showWeightsTggl.mhEvent def onClicked(event): if self.showWeightsTggl.selected: # Highlight bone selected in bone explorer again for rdio in self.boneSelector: if rdio.selected: self.highlightBone(str(rdio.text())) else: self.clearBoneWeights() self.showWeightsTggl.setSelected(True) self.showAxisTggl = self.displayBox.addWidget( gui.CheckBox("Show bone axis")) @self.showAxisTggl.mhEvent def onClicked(event): if self.axisObj: self.axisObj.setVisibility(self.showAxisTggl.selected) self.showAxisTggl.setSelected(True) self.showBonesTggl = self.displayBox.addWidget( gui.CheckBox("Show bones")) @self.showBonesTggl.mhEvent def onClicked(event): if self.skelObj: self.skelObj.setVisibility(self.showBonesTggl.selected) self.showBonesTggl.setSelected(True) self.showPlanesTggl = self.displayBox.addWidget( gui.CheckBox("Show bone planes")) @self.showPlanesTggl.mhEvent def onClicked(event): if self.planesObj: self.planesObj.setVisibility(self.showPlanesTggl.selected) self.showPlanesTggl.setSelected(False)
def build(self, options, taskview): import gui Exporter.build(self, options, taskview) self.stlBinary = options.addWidget(gui.CheckBox("Binary STL", False))
left='100') gui.Label(name='lblMono', height='25', width='50', left='270', text=u'Monotributo:', top=nTop) gui.ComboBox(name='monotributo', width='50', items=MONOTRIBUTO, top=nTop, left='350') gui.CheckBox( label=u'Empleador', name='empleador', left='420', top=nTop, width='80', value=False, ) gui.CheckBox( label=u'Int. Sociedad', name='intsociedad', left='500', top=nTop, width='110', value=False, ) nTop = str(int(nTop) + 30) gui.Label(name='lblEmail', height='25',
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(mhapi.ui.createLabel('')) self.advToggleButton = box.addWidget(gui.CheckBox('Advanced Setings')) self.hostLabel = box.addWidget( mhapi.ui.createLabel('\nHost [Default=127.0.0.1] :')) self.hostEdit = box.addWidget( gui.TextEdit(str(self.socketConfig.get('host')))) self.portLabel = box.addWidget( mhapi.ui.createLabel('\nPort [Default=12345] :')) self.portEdit = box.addWidget( gui.TextEdit(str(self.socketConfig.get('port')))) self.spacer = box.addWidget(mhapi.ui.createLabel('')) 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))
def build(self, options, taskview): Exporter.build(self, options, taskview) self.expressions = options.addWidget(gui.CheckBox("Expressions", False)) self.useCustomShapes = options.addWidget(gui.CheckBox("Custom shapes", False))
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("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 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))
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)
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()
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', True))) 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')) languageFiles = gui3d.app.getLanguages() 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
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Random') toolbox = self.addLeftWidget(gui.SliderBox('Tools')) self.macro = toolbox.addWidget(gui.CheckBox("Macro", True)) self.height = toolbox.addWidget(gui.CheckBox("Height")) self.face = toolbox.addWidget(gui.CheckBox("Face")) self.symmetry = toolbox.addWidget( gui.Slider(value=-1.0, min=-1.0, max=1.0, label="Symmetry")) self.amount = toolbox.addWidget(gui.Slider(value=0.5, label="Amount")) self.create = toolbox.addWidget(gui.Button("Replace current")) self.modify = toolbox.addWidget(gui.Button("Adjust current")) self.lastRandoms = {} @self.create.mhEvent def onClicked(event): #human = gui3d.app.selectedHuman # human.resetMeshValues() self.lastRandoms = {} if self.macro.selected: self.storeLastRandom('gender', 0.5, random.random() - 0.5) self.storeLastRandom('age', 0.5, random.random() - 0.5) self.storeLastRandom('muscle', 0.5, random.random() - 0.5) self.storeLastRandom('weight', 0.5, random.random() - 0.5) if self.height.selected: self.storeLastRandom('height', 0, random.random() * 2 - 1) if self.face.selected: category = gui3d.app.getCategory('Modelling') taskview = category.getTaskByName('Face') modifiers = taskview.getModifiers() symmetricModifiers = taskview.getSymmetricModifierPairNames() for pair in symmetricModifiers: #print "symmetric: "+pair['left']+' and '+pair['right'] leftValue = random.gauss(0, 0.5) rightValue = random.gauss(0, 0.5) # store randoms for later self.storeLastRandom(pair['left'], 0, leftValue) self.storeLastRandom(pair['right'], 0, rightValue) singularModifiers = taskview.getSingularModifierNames() for modName in singularModifiers: #print "singular: "+modName # get random gaussian value = random.gauss(0, 0.5) # non-asymmetric modifiers should only go 0..1 m = modifiers[modName] if m.clampValue(-1.0) >= 0: value = abs(value) # store for later self.storeLastRandom(modName, 0, value) self.setModifiers() @self.modify.mhEvent def onClicked(event): human = gui3d.app.selectedHuman if self.macro.selected: self.storeLastRandom('gender', human.getGender(), random.random() - 0.5) self.storeLastRandom('age', human.getAge(), random.random() - 0.5) self.storeLastRandom('weight', human.getWeight(), random.random() - 0.5) self.storeLastRandom('muscle', human.getMuscle(), random.random() - 0.5) if self.height.selected: self.storeLastRandom('height', human.getHeight(), random.random() - 0.5) if self.face.selected: category = gui3d.app.getCategory('Modelling') taskview = category.getTaskByName('Face') modifiers = taskview.getModifiers() symmetricModifiers = taskview.getSymmetricModifierPairNames() for pair in symmetricModifiers: #print "symmetric: "+pair['left']+' and '+pair['right'] leftValue = random.gauss(0, 0.5) rightValue = random.gauss(0, 0.5) # store randoms for later self.storeLastRandom( pair['left'], modifiers[pair['left']].getValue(human), leftValue) self.storeLastRandom( pair['right'], modifiers[pair['right']].getValue(human), rightValue) singularModifiers = taskview.getSingularModifierNames() for modName in singularModifiers: #print "singular: "+modName # get random gaussian value = random.gauss(0, 0.5) # non-asymmetric modifiers should only go 0..1 m = modifiers[modName] if m.clampValue(-1.0) >= 0: value = abs(value) # store for later self.storeLastRandom(modName, modifiers[modName].getValue(human), value) self.setModifiers() @self.amount.mhEvent def onChange(value): self.setModifiers() @self.symmetry.mhEvent def onChange(value): self.setModifiers()
def build(self, options, taskview): import gui self.taskview = taskview self.feetOnGround = options.addWidget(gui.CheckBox("Feet on ground", True))
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
def build(self, options, taskview): import gui Exporter.build(self, options, taskview) self.useNormals = options.addWidget(gui.CheckBox("Normals", False)) self.hiddenGeom = options.addWidget( gui.CheckBox("Helper geometry", False))
def build(self, options, taskview): Exporter.build(self, options, taskview) self.useNormals = options.addWidget(gui.CheckBox("Normals", False))
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Settings') self.shaderGroup = [] shaderBox = self.addLeftWidget(gui.GroupBox('Shader')) self.shaderNo = shaderBox.addWidget( gui.RadioButton(self.shaderGroup, "No shader", True)) self.shaderPhong = shaderBox.addWidget( gui.RadioButton(self.shaderGroup, "Phong shader")) self.shaderToon = shaderBox.addWidget( gui.RadioButton(self.shaderGroup, "Toon shader")) #self.shaderSkin = shaderBox.addWidget(gui.RadioButton(self.shaderGroup, "Skin shader")) 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.cameraAutoZoom = sliderBox.addWidget( gui.CheckBox("Auto-zoom camera", gui3d.app.settings.get('cameraAutoZoom', True))) self.sliderImages = sliderBox.addWidget( gui.CheckBox("Slider images", gui3d.app.settings.get('sliderImages', True))) mouseBox = self.addLeftWidget(gui.SliderBox('Mouse behavior')) self.normal = mouseBox.addWidget( gui.Slider(gui3d.app.settings.get('lowspeed', 1), 1, 10, "Normal: %d")) self.shift = mouseBox.addWidget( gui.Slider(gui3d.app.settings.get('highspeed', 5), 1, 10, "Shift: %d")) 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')) libraryBox = self.addLeftWidget(gui.GroupBox('Library behavior')) self.jumpToModelling = libraryBox.addWidget( gui.CheckBox("To Modelling after choice", gui3d.app.settings.get('jumpToModelling', True))) 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)) ''' # We might allow overriding the font from the style, but for now loaded fonts can be used from a style ''' fonts = [] fontsBox = self.fontsBox = self.addRightWidget(gui.GroupBox('Font')) fontsBox.addWidget(FontRadioButton(fonts, "Default")) for font in gui3d.app.getCustomFonts(): fontsBox.addWidget(FontRadioButton(fonts, font)) ''' 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('data/languages') if filename.split(os.extsep)[-1] == "ini" ] for language in languageFiles: languageBox.addWidget(LanguageRadioButton(languages, language)) @self.shaderNo.mhEvent def onClicked(event): human = gui3d.app.selectedHuman human.mesh.setShader(None) @self.shaderPhong.mhEvent def onClicked(event): self.setShader("data/shaders/glsl/phong") @self.shaderToon.mhEvent def onClicked(event): self.setShader("data/shaders/glsl/toon") #@self.shaderSkin.mhEvent #def onClicked(event): #self.setShader("data/shaders/glsl/skin") #gui3d.app.selectedHuman.mesh.setShaderParameter("gradientMap", "data/textures/color_temperature.png") #gui3d.app.selectedHuman.mesh.setShaderParameter("ambientOcclusionMap", "data/textures/female_young.tif") @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.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() @self.normal.mhEvent def onChange(value): gui3d.app.settings['lowspeed'] = value @self.shift.mhEvent def onChange(value): gui3d.app.settings['highspeed'] = value @metric.mhEvent def onClicked(event): gui3d.app.settings['units'] = 'metric' @imperial.mhEvent def onClicked(event): gui3d.app.settings['units'] = 'imperial' @self.jumpToModelling.mhEvent def onClicked(event): gui3d.app.settings[ 'jumpToModelling'] = self.jumpToModelling.selected
def build(self, options): self.uvmapDisplay = options.addWidget(gui.CheckBox("Display on human", False))
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Material Editor') self.human = gui3d.app.selectedHuman self.humanObjSelector = self.addLeftWidget( HumanObjectSelector(self.human)) @self.humanObjSelector.mhEvent def onActivate(value): self.reloadMaterial() shaderBox = self.addLeftWidget(gui.GroupBox('Shader')) self.shaderList = shaderBox.addWidget(gui.ListView()) self.shaderList.setSizePolicy(gui.SizePolicy.Ignored, gui.SizePolicy.Preferred) self.shaderConfBox = self.addLeftWidget(gui.GroupBox('Shader config')) shaderConfig = self.human.material.shaderConfig for name in shaderConfig: chkBox = gui.CheckBox(name, shaderConfig[name]) chkBox.shaderOption = name self.shaderConfBox.addWidget(chkBox) @chkBox.mhEvent def onClicked(event): shaderConfig = dict() for child in self.shaderConfBox.children: shaderConfig[child.shaderOption] = child.isChecked() self.getSelectedObject().material.configureShading( **shaderConfig) self.shaderDefBox = self.addLeftWidget( gui.GroupBox('Custom shader defines')) self.paramBox = self.addRightWidget(gui.GroupBox('Shader parameters')) self.materialBox = self.addRightWidget( gui.GroupBox('Material settings')) if not shader.Shader.supported(): log.notice('Shaders not supported') self.shaderList.setEnabled(False) self.shaderList.hide() self.paramBox.hide() @self.shaderList.mhEvent def onClicked(item): self.setShader(str(item.getUserData())) self.loadSaveBox = self.addRightWidget(gui.GroupBox("Material file")) self.loadMaterialBtn = self.loadSaveBox.addWidget( gui.BrowseButton(), 0, 0) self.loadMaterialBtn.setFilter("MakeHuman Material (*.mhmat)") self.loadMaterialBtn.setText('Load') @self.loadMaterialBtn.mhEvent def onClicked(path): if path: self.loadMaterial(path) self.saveMaterialBtn = self.loadSaveBox.addWidget( gui.BrowseButton('save'), 0, 1) self.saveMaterialBtn.setFilter("MakeHuman Material (*.mhmat)") self.saveMaterialBtn.setText('Save') @self.saveMaterialBtn.mhEvent def onClicked(path): if path: if not os.path.splitext(path)[1]: path = path + ".mhmat" self.saveMaterial(path)
def build(self, options, taskview): import gui self.taskview = taskview self.exportAnimations = options.addWidget( gui.CheckBox("Animations", True))