Khai-J-Bach opened this issue on Aug 27, 2010 · 1684 posts
Netherworks posted Fri, 27 August 2010 at 5:49 PM
Better yet, and only a suggestion, allow the user to define the folder for LuxPose Export.
import poser,os
try:
luxSvPath = os.path.join(poser.PrefsLocation(), "LuxPose")
except:
luxSvPath = os.path.join(os.path.dirname(poser.AppLocation()), "LuxPose")
if not os.path.exists(luxSvPath):
os.makedirs(luxSvPath)
luxSvFile = os.path.join(luxSvPath,"LuxPose_SceneFolder.ini")
filePath = os.path.join(os.path.dirname(poser.AppLocation()),"Runtime")
msg = "Please Select a Folder For Lux Scenes"
dlg = poser.DialogDirChooser(message=msg, startDir=filePath)
if dlg.Show():
dir = dlg.Path()
fp = open(luxSvFile, "wt")
fp.write(dir)
fp.close()
outFolder = os.path.join(myFolder, 'toLux')
if not os.path.isdir(outFolder):
try: os.mkdir(outFolder)
except:
raise Exception, "Folder 'toLux' can't be created in path %s." % myFolder +
"Check if a file named 'toLux' exists already."
try:
luxSvFile = os.path.join(poser.PrefsLocation(), "LuxPose","LuxPose_SceneFolder.ini")
except:
luxSvFile = os.path.join(os.path.dirname(poser.AppLocation()), "LuxPose","LuxPose_SceneFolder.ini")
if os.path.exists(luxSvFile):
fp = open(luxSvFile, "rt")
outFolder = fp.readline()
fp.close()
else:
outFolder = os.path.join(myFolder, 'toLux')
if not os.path.isdir(outFolder):
try: os.mkdir(outFolder)
except:
raise Exception, "Folder 'toLux' can't be created in path %s." % myFolder +
"Check if a file named 'toLux' exists already."
Of course, it could all be integrated in and additional code could also allow users to name the export file. I don't know what kind of GUI you have going in the future, so if you already will have it covered, that's cool :)
.