• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mh.getSysDataPath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mh.getSysDataPath函数的典型用法代码示例。如果您正苦于以下问题:Python getSysDataPath函数的具体用法?Python getSysDataPath怎么用?Python getSysDataPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSysDataPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: buildTree

    def buildTree(cls):
        cls._files = {}

        def add_file(dir, path):
            head, tail = path[0], path[1:]
            if not tail:
                dir[head] = None
            else:
                if head not in dir:
                    dir[head] = {}
                add_file(dir[head], tail)

        with zipfile.ZipFile(mh.getSysDataPath('targets.npz'), 'r') as npzfile:
            for file in npzfile.infolist():
                name = file.filename
                if not name.endswith('.index.npy'):
                    continue
                name = name[:-10] + '.target'
                path = name.split('/')
                add_file(cls._files, path)

        with open(mh.getSysDataPath('images.list'), 'r') as imgfile:
            for line in imgfile:
                name = line.rstrip()
                if not name.endswith('.png'):
                    continue
                path = name.split('/')
                add_file(cls._files, path)
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:28,代码来源:targets.py


示例2: getMaterialPaths

    def getMaterialPaths(self, objType, proxy = None):
        if objType == 'skin':
            objType = 'skins'
        elif objType not in [t.lower() for t in SimpleProxyTypes]:
            objType = 'clothes'
        objType = objType.lower()

        if proxy and objType != 'skins':
            subPath = None
        else:
            subPath = objType

        # General paths
        if subPath:
            paths = [mh.getPath(os.path.join('data', subPath)), mh.getSysDataPath(subPath)]
            for p in paths:
                if getpath.isSubPath(p, mh.getPath()) and not os.path.exists(p):
                    os.makedirs(p)
        else:
            paths = []

        # Global material paths
        for p in [mh.getPath(os.path.join('data', objType, 'materials')), mh.getSysDataPath(os.path.join(objType, 'materials'))]:
            if os.path.isdir(p):
                paths.append(p)

        # Path where proxy file is located
        if proxy:
            paths = [os.path.dirname(proxy.file)] + paths

        return paths
开发者ID:kingomyths,项目名称:mhx_os,代码行数:31,代码来源:3_libraries_material_chooser.py


示例3: getThemeResource

 def getThemeResource(self, folder, id):
     if '/' in id:
         return id
     path = os.path.join(mh.getSysDataPath("themes/"), self.theme, folder, id)
     if os.path.exists(path):
         return path
     else:
         return os.path.join(mh.getSysDataPath("themes/default/"), folder, id)
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:8,代码来源:mhmain.py


示例4: targetFileName

def targetFileName(typ, name, gender, age):
    #if typ == "Expressions":
    #    return (mh.getSysDataPath('targets/expression/%s_%s/neutral_%s_%s_%s.target') % (gender, age, gender, age, name) )
    if typ == "ExpressionUnits":
        return (mh.getSysDataPath('targets/expression/units/caucasian/%s_%s/%s.target') %  (gender, age, name) )
    elif typ == "Corrective":
        (part, pose) = name
        return (mh.getSysDataPath("shared/mhx/targets/correctives/%s/caucasian/%s-%s/%s.target") % (part, gender, age, pose))
    else:
        raise NameError("Unknown type %s" % typ)
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:10,代码来源:shapekeys.py


示例5: applyTarget

 def applyTarget(self,targetName,power, assumeThreading = False):
     self.human.setDetail(mh.getSysDataPath("targets/" + targetName + ".target"), power)
     if assumeThreading:
         self._threadSafeApplyAllTargets()
     else:
         self.human.applyAllTargets()
     mh.redraw()
开发者ID:mistajuliax,项目名称:community-plugins,代码行数:7,代码来源:_modifiers.py


示例6: __init__

    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Scene')
        self.scene = scene.Scene()

        leftTopBox = self.addLeftWidget(gui.GroupBox("Current scene"))
        filebox = leftTopBox.addWidget(gui.TextView("Default.mhscene"))
        
        sceneDir = mh.getPath('scenes')
        if not os.path.exists(sceneDir):
            os.makedirs(sceneDir)
        defscene = os.path.join(sceneDir, "Default.mhscene")
        if os.path.exists(defscene):
            self.scene.load(defscene)
        else:
            self.scene.save(defscene)
        if not os.path.exists(os.path.join(sceneDir, "notfound.thumb")):
            shutil.copy(os.path.normpath(mh.getSysDataPath("uvs/notfound.thumb")), sceneDir)
        self.filechooser = self.addRightWidget( \
        fc.IconListFileChooser(sceneDir , 'mhscene', ['thumb', 'png'], 'notfound.thumb', 'Scene'))
        self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            self.scene.load(filename)
            filebox.setText(os.path.basename(filename))
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:25,代码来源:4_rendering_scene.py


示例7: loadPreset

    def loadPreset(self, filename, selector, folder=mh.getSysDataPath("rigs/")):
        filepath = os.path.join(folder, filename + ".json")
        struct = io_json.loadJson(filepath)
        self.__init__()
        try:
            self.rigtype = struct["name"]
        except KeyError:
            pass
        try:
            self.description = struct["description"]
        except KeyError:
            pass
        try:
            self.merge = struct["merge"]
        except KeyError:
            pass
        try:
            settings = struct["settings"]
        except KeyError:
            settings = {}
        for key,value in list(settings.items()):
            expr = ("self.%s = %s" % (key, value))
            exec(expr)

        if selector is not None:
            selector.fromOptions(self)
        try:
            bones = struct["bones"]
        except KeyError:
            bones = None
        if bones:
            self.locale = Locale(bones=bones)
        return self.description
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:33,代码来源:options.py


示例8: __init__

    def __init__(self, category):

        gui3d.TaskView.__init__(self, category, 'Proxies')
        self.installDir = mh.getSysDataPath('proxymeshes')
        self.userDir = os.path.join(mh.getPath(''), 'data', 'proxymeshes')
        if not os.path.exists(self.userDir):
            os.makedirs(self.userDir)
        self.paths = [self.userDir , self.installDir]
        #self.filechooser = self.addTopWidget(fc.FileChooser(self.paths, 'proxy', 'thumb', mh.getSysDataPath('proxymeshes/notfound.thumb'), sort=ProxyFileSort()))
        #self.filechooser = self.addRightWidget(fc.ListFileChooser(self.paths, 'proxy', 'Proxy', sort=ProxyFileSort()))
        self.filechooser = self.addRightWidget(fc.IconListFileChooser(self.paths, 'proxy', 'thumb', mh.getSysDataPath('proxymeshes/notfound.thumb'), 'Proxy'))
        self.filechooser.setIconSize(50,50)
        self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            human = gui3d.app.selectedHuman
            if human.proxy:
                oldFile = human.proxy.file
            else:
                oldFile = "clear.proxy"
            gui3d.app.do(ProxyAction("Change proxy",
                human,
                self,
                oldFile,
                filename))
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:26,代码来源:3_libraries_proxy_chooser.py


示例9: onShow

    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.settings.get('cameraAutoZoom', True):
            gui3d.app.setGlobalCamera()

        # Disable smoothing in skeleton library
        self.oldSmoothValue = self.human.isSubdivided()
        self.human.setSubdivided(False)

        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.human.material = xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = xray_mat

        if self.skelObj:
            self.skelObj.show()

        #if not self.jointsObj:
        #    self.drawJointHelpers()

        #self.filechooser.refresh()

        # Make sure skeleton is updated when human has changed
        self.human.getSkeleton()

        # Re-draw joints positions if human has changed
        if self.humanChanged:
            #self.drawJointHelpers()
            self.humanChanged = False
        mh.redraw()
开发者ID:kingomyths,项目名称:mhx_os,代码行数:34,代码来源:skeletonlibrary.py


示例10: getItemPath

 def getItemPath(item):
     path = []
     while item is not None:
         path.append(item.text)
         item = item.parent
     path = mh.getSysDataPath(os.path.join(*reversed(path)))
     return path
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:7,代码来源:7_targets.py


示例11: __init__

    def __init__(self, category):
        gui3d.TaskView.__init__(self, category, 'Material', label='Skin/Material')
        self.human = gui3d.app.selectedHuman

        # Paths, in order, in which relative material filepaths will be searched
        self.searchPaths = [mh.getPath(), mh.getSysDataPath()]
        self.searchPaths = [os.path.abspath(p) for p in self.searchPaths]

        self.materials = None

        self.filechooser = self.addRightWidget(fc.IconListFileChooser(self.materials, 'mhmat', ['thumb', 'png'], mh.getSysDataPath('skins/notfound.thumb'), name='Material'))
        self.filechooser.setIconSize(50,50)
        self.filechooser.enableAutoRefresh(False)
        #self.filechooser.setFileLoadHandler(fc.MhmatFileLoader())
        #self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            mat = material.fromFile(filename)
            human = self.human

            obj = self.humanObjSelector.getSelectedObject()
            if obj:
                gui3d.app.do(MaterialAction(obj, mat))

        self.humanObjSelector = self.addLeftWidget(HumanObjectSelector(self.human))
        @self.humanObjSelector.mhEvent
        def onActivate(value):
            self.reloadMaterialChooser()
开发者ID:kingomyths,项目名称:mhx_os,代码行数:29,代码来源:3_libraries_material_chooser.py


示例12: onHumanChanged

 def onHumanChanged(self, event):
     super(EyesTaskView, self).onHumanChanged(event)
     if event.change == 'reset':
         # Load initial eyes
         self.selectProxy(mh.getSysDataPath("eyes/high-poly/high-poly.mhclo"))
         # Reset default material on eyes (in case it was changed)
         self.getObjects()[0].material = self.getSelection()[0].material
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:7,代码来源:3_libraries_eye_chooser.py


示例13: buildShader

 def buildShader(self, shader):
     
     srcPath = os.path.join(mh.getSysDataPath('shaders/aqsis'), shader + '.sl')
     dstPath = os.path.join(self.sceneToRender.usrShaderPath, shader + '.slx')
     
     if not os.path.exists(dstPath) or os.stat(srcPath).st_mtime > os.stat(dstPath).st_mtime:
         subprocess.Popen('aqsl %s -o "%s"' % (srcPath, dstPath), shell=True)
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:7,代码来源:4_rendering_aqsis.py


示例14: __init__

    def __init__(self, category, proxyName, tabLabel = None, multiProxy = False, tagFilter = False):
        if not tabLabel:
            tabLabel = proxyName.capitalize()
        proxyName = proxyName.lower().replace(" ", "_")
        gui3d.TaskView.__init__(self, category, tabLabel)

        self.proxyName = proxyName
        self.label = tabLabel
        self.multiProxy = multiProxy
        self.tagFilter = tagFilter

        self.homeProxyDir = getpath.getPath(os.path.join('data', proxyName))
        self.sysProxyDir = mh.getSysDataPath(proxyName)

        if not os.path.exists(self.homeProxyDir):
            os.makedirs(self.homeProxyDir)

        self.paths = [self.homeProxyDir , self.sysProxyDir]

        self.human = gui3d.app.selectedHuman

        self._proxyCache = dict()
        self._proxyFileCache = None
        self._proxyFilePerUuid = None

        self.selectedProxies = []

        self.createFileChooser()
开发者ID:kingomyths,项目名称:mhx_os,代码行数:28,代码来源:proxychooser.py


示例15: __init__

    def __init__(self, category, proxyName, tabLabel = None, multiProxy = False, tagFilter = False, descriptionWidget = False):
        if not tabLabel:
            tabLabel = proxyName.capitalize()
        proxyName = proxyName.lower().replace(" ", "_")
        self.proxyName = proxyName
        gui3d.TaskView.__init__(self, category, tabLabel)
        filecache.MetadataCacher.__init__(self, self.getFileExtension(), self.proxyName + '_filecache.mhc')

        self.label = tabLabel
        self.multiProxy = multiProxy
        self.tagFilter = tagFilter
        self.descriptionWidget = descriptionWidget

        self.homeProxyDir = getpath.getPath(os.path.join('data', proxyName))
        self.sysProxyDir = mh.getSysDataPath(proxyName)

        if not os.path.exists(self.homeProxyDir):
            os.makedirs(self.homeProxyDir)

        self.paths = [self.homeProxyDir , self.sysProxyDir]

        self.human = gui3d.app.selectedHuman

        self._proxyFilePerUuid = None

        self.selectedProxies = []

        self.createFileChooser()
开发者ID:severin-lemaignan,项目名称:makehuman-commandline,代码行数:28,代码来源:proxychooser.py


示例16: readTarget

def readTarget(filepath):

    words = filepath.split("-")
    if (words[0] == mh.getSysDataPath("targets/macrodetails/universal") and
        words[-2] == "averagemuscle" and
        words[-1] == "averageweight.target"):
        return {}

    try:
        fp = open(filepath, "r")
    except:
        fp = None

    if fp is None:
        filepath1 = filepath.replace("-averagemuscle", "").replace("-averageweight", "")
        try:
            fp = open(filepath1, "r")
        except:
            fp = None

    if fp:
        target = {}
        for line in fp:
            words = line.split()
            if len(words) >= 4 and words[0][0] != '#':
                n = int(words[0])
                if n < meshstat.numberOfVertices:
                    target[n] = np.array([float(words[1]), float(words[2]), float(words[3])])
        fp.close()
        return target
    else:
        log.message("Found neither %s nor %s" % (filepath, filepath1))
        halt
        return None
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:34,代码来源:warpmodifier.py


示例17: __init__

    def __init__(self, category):

        gui3d.TaskView.__init__(self, category, 'Eyes')
        eyesDir = os.path.join(mh.getPath(''), 'data', 'eyes')
        if not os.path.exists(eyesDir):
            os.makedirs(eyesDir)
        self.paths = [eyesDir , mh.getSysDataPath('eyes')]
        #self.filechooser = self.addTopWidget(fc.FileChooser(self.paths, 'mhclo', 'thumb', mh.getSysDataPath('eyes/notfound.thumb')))
        self.filechooser = self.addRightWidget(fc.IconListFileChooser(self.paths, 'mhclo', 'thumb', mh.getSysDataPath('clothes/notfound.thumb'), 'Eyes'))
        self.filechooser.setIconSize(50,50)
        self.filechooser.enableAutoRefresh(False)
        self.addLeftWidget(self.filechooser.createSortBox())

        self.oHeadCentroid = [0.0, 7.436, 0.03 + 0.577]
        self.oHeadBBox = [[-0.84,6.409,-0.9862],[0.84,8.463,1.046]]

        self.human = gui3d.app.selectedHuman

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            if self.human.eyesProxy:
                oldFile = self.human.eyesProxy.file
            else:
                oldFile = 'clear.mhclo'
            gui3d.app.do(EyesAction("Change eyes",
                self.human,
                self,
                oldFile,
                filename))
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:29,代码来源:3_libraries_eye_chooser.py


示例18: setValue

 def setValue(self, value):
     self._path = pathToUnicode(value)
     if value:
         self.imageView.setImage(value)
         if isinstance(value, basestring):
             self.browseBtn._path = pathToUnicode(value)
     else:
         self.imageView.setImage(mh.getSysDataPath('notfound.thumb'))
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:8,代码来源:7_material_editor.py


示例19: onSkinUpdateEvent

    def onSkinUpdateEvent(self, event):
        if "litsphereTexture" not in self.human.meshData.shaderParameters:
            return

        current = self.human.meshData.shaderParameters["litsphereTexture"]
        if current and (isinstance(current, image.Image) or \
           os.path.abspath(current) == os.path.abspath(mh.getSysDataPath("litspheres/adaptive_skin_tone.png"))):
            if event.change == "caucasian" or event.change == "african" or \
              event.change == "asian" or event.change == "material":
                self.updateAdaptiveSkin()
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:10,代码来源:3_libraries_material_chooser.py


示例20: setTheme

    def setTheme(self, theme):

        if self.theme == theme:
            return

        f = open(os.path.join(mh.getSysDataPath("themes/"), theme + ".mht"), 'r')

        for data in f.readlines():
            lineData = data.split()

            if len(lineData) > 0:
                if lineData[0] == "version":
                    log.message('Version %s', lineData[1])
                elif lineData[0] == "color":
                    if lineData[1] == "clear":
                        self.clearColor[:] = [float(val) for val in lineData[2:5]]
                        mh.setClearColor(float(lineData[2]), float(lineData[3]), float(lineData[4]), 1.0)
        log.debug("Loaded theme %s", mh.getSysDataPath('themes/'+theme+'.mht'))

        try:
            f = open(mh.getSysDataPath('themes/%s.qss' % theme), 'r')
            qStyle = "\n".join(f.readlines())
            self.setStyleSheet(qStyle)
            # Also set stylesheet on custom slider style
            for widget in self.allWidgets():
                if isinstance(widget, gui.Slider):
                    widget.setStyleSheet(qStyle)
            log.debug("Loaded Qt style %s", mh.getSysDataPath('themes/'+theme+'.qss'))
        except:
            self.setStyleSheet("")
            # Also set stylesheet on custom slider style
            for widget in self.allWidgets():
                if isinstance(widget, gui.Slider):
                    widget.setStyleSheet("")
            '''
            if theme != "default":
                log.warning('Could not open Qt style file %s.', mh.getSysDataPath('themes/'+theme+'.qss'))
            '''

        self.theme = theme
        self.reloadIcons()
        self.redraw()
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:42,代码来源:mhmain.py



注:本文中的mh.getSysDataPath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mh.redraw函数代码示例发布时间:2022-05-27
下一篇:
Python mh.getPath函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap