예제 #1
0
 def getMetadataImpl(self, filename):
     tags = set()
     if not os.path.isfile(filename):
         return (tags, )
     name = os.path.splitext(os.path.basename(filename))[0]
     description = ""
     license = mh.getAssetLicense()
     import io
     f = io.open(filename, encoding='utf-8')
     for l in f.read().split('\n'):
         l = l.strip()
         l = l.split()
         if len(l) == 0:
             continue
         if l[0].lower() == 'tag':
             tags.add((' '.join(l[1:])).lower())
         elif l[0].lower() == 'name':
             name = ' '.join(l[1:])
         elif l[0].lower() == 'description':
             description = ' '.join(l[1:])
         elif l[0].lower() == 'author':
             license.author = ' '.join(l[1:])
         elif l[0].lower() == 'license':
             license.license = ' '.join(l[1:])
         elif l[0].lower() == 'copyright':
             license.copyright = ' '.join(l[1:])
         elif l[0].lower() == 'homepage':
             license.homepage = ' '.join(l[1:])
     return (tags, name, description, license)
예제 #2
0
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Expression mixer')

        self.human = gui3d.app.selectedHuman

        self.base_bvh = None
        self.base_anim = None

        self.sliders = []
        self.modifiers = {}

        savebox = self.addRightWidget(gui.GroupBox("Save"))
        loadbox = self.addRightWidget(gui.GroupBox('Load'))
        resetbox = self.addRightWidget(gui.GroupBox('Reset'))

        self.nameField = savebox.addWidget(TextEdit("Name"))
        self.descrField = savebox.addWidget(TextEdit("Description"))
        self.tagsField = savebox.addWidget(TextEdit("Tags (separate with ;)"))
        self.authorField = savebox.addWidget(TextEdit("Author"))
        self.copyrightField = savebox.addWidget(TextEdit("Copyright"))
        self.licenseField = savebox.addWidget(TextEdit("License"))
        self.websiteField = savebox.addWidget(TextEdit("Website"))

        lic = mh.getAssetLicense()
        self.authorField.setValue(lic.author)
        self.copyrightField.setValue(lic.copyright)
        self.licenseField.setValue(lic.license)
        self.websiteField.setValue(lic.homepage)
        self.descrField.setValue("No description set")
        self.tagsField.setValue("")

        self.saveBtn = savebox.addWidget(
            gui.BrowseButton(mode='save', label="Save pose"))
        self.saveBtn.setFilter("MakeHuman blend pose file (*.mhpose)")
        savepath = getpath.getDataPath('expressions')
        if not os.path.exists(savepath):
            os.makedirs(savepath)
        self.saveBtn.setDirectory(getpath.getDataPath('expressions'))

        self.loadBtn = loadbox.addWidget(
            gui.BrowseButton(mode='open', label='Load pose'))
        self.loadBtn.setFilter('MakeHuman Poses (*.mhpose)')

        self.resetBtn = resetbox.addWidget(gui.Button('Reset'))

        @self.saveBtn.mhEvent
        def onClicked(path):
            if path:
                if not os.path.splitext(path)[1]:
                    path = path + ".mhpose"
                self.saveCurrentPose(path)

        @self.loadBtn.mhEvent
        def onClicked(path):
            if os.path.isfile(path):
                self.loadPose(path)

        @self.resetBtn.mhEvent
        def onClicked(event):
            self.resetExpression()
 def getMetadataImpl(self, filename):
     tags = set()
     if not os.path.isfile(filename):
         return (tags, )
     name = os.path.splitext(os.path.basename(filename))[0]
     description = ""
     license = mh.getAssetLicense()
     from codecs import open
     f = open(filename, encoding='utf-8')
     for l in f.read().split('\n'):
         l = l.strip()
         l = l.split()
         if len(l) == 0:
             continue
         if l[0].lower() == 'tag':
             tags.add((' '.join(l[1:])).lower())
         elif l[0].lower() == 'name':
             name = ' '.join(l[1:])
         elif l[0].lower() == 'description':
             description = ' '.join(l[1:])
         elif l[0].lower() == 'author':
             license.author = ' '.join(l[1:])
         elif l[0].lower() == 'license':
             license.license = ' '.join(l[1:])
         elif l[0].lower() == 'copyright':
             license.copyright = ' '.join(l[1:])
         elif l[0].lower() == 'homepage':
             license.homepage = ' '.join(l[1:])
     return (tags, name, description, license)
    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Expression mixer')

        self.human = gui3d.app.selectedHuman

        self.base_bvh = None
        self.base_anim = None

        self.sliders = []
        self.modifiers = {}

        savebox = self.addRightWidget(gui.GroupBox("Save"))

        self.nameField = savebox.addWidget(TextEdit("Name"))
        self.descrField = savebox.addWidget(TextEdit("Description"))
        self.tagsField = savebox.addWidget(TextEdit("Tags (separate with ;)"))
        self.authorField = savebox.addWidget(TextEdit("Author"))
        self.copyrightField = savebox.addWidget(TextEdit("Copyright"))
        self.licenseField = savebox.addWidget(TextEdit("License"))
        self.websiteField = savebox.addWidget(TextEdit("Website"))

        lic = mh.getAssetLicense()
        self.authorField.setValue(lic.author)
        self.copyrightField.setValue(lic.copyright)
        self.licenseField.setValue(lic.license)
        self.websiteField.setValue(lic.homepage)
        self.descrField.setValue("No description set")
        self.tagsField.setValue("no tag;expression")

        self.saveBtn = savebox.addWidget(gui.BrowseButton('save', "Save pose"))
        self.saveBtn.setFilter("MakeHuman blend pose file (*.mhpose)")
        savepath = getpath.getDataPath('expressions')
        if not os.path.exists(savepath):
            os.makedirs(savepath)
        self.saveBtn.setDirectory(getpath.getDataPath('expressions'))

        @self.saveBtn.mhEvent
        def onClicked(path):
            if path:
                if not os.path.splitext(path)[1]:
                    path = path + ".mhpose"
                self.saveCurrentPose(path)