def __init__(self, category, mhmTaskView, mhmLabel, folder): gui3d.TaskView.__init__(self, category, mhmLabel, label=mhmLabel) self.mhmTaskView = mhmTaskView self.include = "All" self.globalMhmPath = os.path.join('data', folder) self.mhmPath = os.path.join(mh.getPath(''), 'data', folder) if not os.path.exists(self.mhmPath): os.makedirs(self.mhmPath) self.filechooser = self.addTopWidget( fc.FileChooser([self.globalMhmPath, self.mhmPath], 'mhm', 'thumb')) self.addLeftWidget(self.filechooser.sortBox) @self.filechooser.mhEvent def onFileSelected(filename): gui3d.app.do( Action(gui3d.app.selectedHuman, filename, self.mhmTaskView, self.include)) mh.changeCategory('Modelling')
def __init__(self, category): self.systemClothes = os.path.join('data', 'clothes') self.userClothes = os.path.join(mh.getPath(''), 'data', 'clothes') self.taggedClothes = {} self.clothesList = [] gui3d.TaskView.__init__(self, category, 'Clothes') if not os.path.exists(self.userClothes): os.makedirs(self.userClothes) self.filechooser = self.addTopWidget(fc.FileChooser([self.systemClothes, self.userClothes], 'mhclo', 'thumb', 'data/clothes/notfound.thumb')) self.addLeftWidget(self.filechooser.sortBox) self.update = self.filechooser.sortBox.addWidget(gui.Button('Check for updates')) self.mediaSync = None @self.filechooser.mhEvent def onFileSelected(filename): gui3d.app.do(Action("Change clothing piece", gui3d.app.selectedHuman, self, filename)) if gui3d.app.settings.get('jumpToModelling', True): mh.changeCategory('Modelling') @self.update.mhEvent def onClicked(event): self.syncMedia()
def __init__(self, category): modelPath = mh.getPath('models') gui3d.TaskView.__init__(self, category, 'Load', ) self.filechooser = self.addTopWidget(fc.FileChooser(modelPath, 'mhm', 'thumb', 'data/notfound.thumb', sort=HumanFileSort())) self.addLeftWidget(self.filechooser.sortBox) @self.filechooser.mhEvent def onFileSelected(filename): human = gui3d.app.selectedHuman human.load(filename, True, gui3d.app.progress) del gui3d.app.undoStack[:] del gui3d.app.redoStack[:] gui3d.app.modified = False gui3d.app.clearUndoRedo() name = os.path.basename(filename).replace('.mhm', '') self.parent.tasksByName['Save'].fileentry.text = name self.parent.tasksByName['Save'].fileentry.edit.setText(name) gui3d.app.setFilenameCaption(filename) gui3d.app.setFileModified(False) mh.changeCategory('Modelling')
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Proxies') self.filechooser = self.addTopWidget( fc.FileChooser('data/proxymeshes', 'proxy', 'thumb', 'data/proxymeshes/notfound.thumb', sort=ProxyFileSort())) self.addLeftWidget(self.filechooser.sortBox) @self.filechooser.mhEvent def onFileSelected(filename): self.setProxy(gui3d.app.selectedHuman, filename) mh.changeCategory('Modelling')
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'UV') uvDir = os.path.join(mh.getPath(''), 'data', 'uvs') if not os.path.exists(uvDir): os.makedirs(uvDir) self.filechooser = self.addTopWidget(fc.FileChooser([uvDir , 'data/uvs'], 'mhuv', 'png', 'data/uvs/notfound.thumb')) self.addLeftWidget(self.filechooser.sortBox) @self.filechooser.mhEvent def onFileSelected(filename): if os.path.basename(filename) == "clear.mhuv": filename = None self.setUv(gui3d.app.selectedHuman, filename) mh.changeCategory('Modelling')
def __init__(self): # Glade setup self.builder = Gtk.Builder() self.builder.add_from_file("ui/standalone_3.glade") self.window = Gtk.Window() box = self.builder.get_object('box') self.window.add(box) header = self.builder.get_object('header') self.window.set_titlebar(header) self.window.connect('delete_event', self.on_delete_event) # Filechooser setup self.filechooser = filechooser.FileChooser() box = self.builder.get_object("box") box.add(self.filechooser) # Initialize keyboard self.keyboard = Keyboard # Connect signals emited by filechooser self.filechooser.connect('file-activated', self.on_file_activated) self.filechooser.connect('selection-changed', self.on_file_selection_changed) self.filechooser.connect('filename-editing-started', self.on_file_name_editing_started) self.filechooser.connect('error', self.on_error) # Set up file ext filters self.filechooser.add_filter('gcode', ['.ngc', '.TAP', '.txt']) self.filechooser.add_filter('all', ['*']) self.filechooser.set_filter('all') # Set show hidden (defaults to False if not set) self.filechooser.set_show_hidden(False) #print self.filechooser.get_filter() #print self.filechooser.get_filters() # Show the whole shebang self.window.show()
def __init__(self, category): self.systemPoses = os.path.join('data', 'poses') self.userPoses = os.path.join(mh.getPath(''), 'data', 'poses') self.dirty = False gui3d.TaskView.__init__(self, category, 'Poses') if not os.path.exists(self.userPoses): os.makedirs(self.userPoses) self.filechooser = self.addTopWidget(fc.FileChooser([self.systemPoses, self.userPoses], 'mhp', 'thumb', 'data/clothes/notfound.thumb')) self.addLeftWidget(self.filechooser.sortBox) self.update = self.filechooser.sortBox.addWidget(gui.Button('Check for updates')) self.mediaSync = None @self.filechooser.mhEvent def onFileSelected(filepath): self.loadMhpFile(filepath) mh.changeCategory('Modelling') @self.update.mhEvent def onClicked(event): self.syncMedia()
def __init__(self, category): gui3d.TaskView.__init__(self, category, 'Texture', label='Textures') 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.addTopWidget(fc.FileChooser([self.systemSkins, self.userSkins], 'png', 'thumb', 'data/skins/notfound.thumb')) self.addLeftWidget(self.filechooser.sortBox) 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)) if gui3d.app.settings.get('jumpToModelling', True): mh.changeCategory('Modelling') @self.update.mhEvent def onClicked(event): self.syncMedia() self.objectSelector = [] self.humanBox = self.addRightWidget(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.addRightWidget(gui.GroupBox('Clothes')) self.clothesSelections = []