获取maya文档以及安装环境路径

# C:/Users/xx/Documents/maya/2017 

import os
import maya.cmds as cmds

MAYA_VERSION = cmds.about(version=True)[:4]
path = os.environ['HOME']+"/maya/"+MAYA_VERSION
# Result: u'C:/Users/xx/Documents/maya/2017' # 

 

# @File    : 外置获取maya文档以及安装位置.py
# @Date    : 2022-02-20
# @Author  : meng

import winreg
# 获取文档位置
string = r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
handle = winreg.OpenKey(winreg.HKEY_CURRENT_USER, string)
location, _type = winreg.QueryValueEx(handle, 'Personal')
print(location)

# 获取maya安装位置,获取其他版本替换版本号,2019,2028
string = r'SOFTWARE\Autodesk\Maya\2018\Setup\InstallPath'
handle = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, string)
location, __type = winreg.QueryValueEx(handle, 'MAYA_INSTALL_LOCATION')
print(location)

# 获取UE4安装位置,获取其他版本替换版本号,4.23,4.22
string = r'SOFTWARE\EpicGames\Unreal Engine\4.24'
handle = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, string)
location, ___type = winreg.QueryValueEx(handle, 'InstalledDirectory')
print(location)

 

posted @ 2022-02-21 21:28  CGRun  阅读(563)  评论(0编辑  收藏  举报