本文整理汇总了Python中mh.getSysDataPath函数的典型用法代码示例。如果您正苦于以下问题:Python getSysDataPath函数的具体用法?Python getSysDataPath怎么用?Python getSysDataPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSysDataPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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)
示例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)
示例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()
示例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))
示例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
示例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))
示例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()
示例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
示例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()
示例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
示例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)
示例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()
示例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()