3dcheapskate opened this issue on Apr 23, 2020 ยท 38 posts
3dcheapskate posted Fri, 24 April 2020 at 9:09 AM
My original code for writing a temporary pose file in the wrong place was this...
sTmp = os.path.join('Runtime','Libraries','Pose','3DCheapskate','SmartPlus','TempPose.pz2')
poserpath=os.path.split(poser.AppLocation())
fileaddr = os.path.join(poserpath[0],sTmp)
pose=open(fileaddr,"w")
...which as I've said is easy to fix using poser.TempLocation() instead of poser.AppLocation()...
sTmp = poser.TempLocation() # Returns something of the form C:UsersAppDataLocalTempPoser Pro10
fileaddr = os.path.join(sTmp,'TempPose.pz2')
pose=open(fileaddr,"w")
...and that should work fine on both Windows and MacOS.
Regarding the datafiles, which is what I'm now looking at. Ploughing through my code I've realized that my datafiles weren't necessarily in the main Poser runtime, i.e. the one under poser.AppLocation() - although they might be.
They can be in any mapped Poser runtime. So I originally used script like this to find them (not forgetting to check for failure to find the file and finding multiple files)...
try:
aLibs = poser.Libraries()
for lib in aLibs:
filetocheck = os.path.join(lib,'Runtime','Python','poserScripts','3DCheapskate','SmartPlus','SmartPlusData.txt')
if os.path.exists(filetocheck):
...
...which I could fix for PP2014 Windows like this...
sTmp = os.environ['APPDATA']
fileaddr = os.path.join(sTmp,'Roaming','Poser Pro','10','SmartPlusData.txt')
if os.path.exists(fileaddr):
...
...but like I said,that would be specific to PP2014 (or Poser 10) on Windows.
Suggestions ?
The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident. And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU or something else.
*soon only to be available in two flavours - DAZ and Renderosity