예제 #1
0
def AskDirectory(dir=os.path.dirname(poser.AppLocation()),title="Open...",parent=None):
	askdir = poser.DialogDirChooser(parentDialog=parent, message=title, startDir=dir)
	if askdir.Show():
		folder = askdir.Path()
		os.chdir(os.path.dirname(poser.AppLocation()))
		if not os.path.isdir(folder):
			return None
		else:
			return folder
	else:
		return None
예제 #2
0
    def LegacyPrefsLocation():
        """
		Poser Pro 2014 defines poser.PrefsLocation().
		This function returns the preference path for earlier Poser versions.
		"""
        prefs6Dir = ["Runtime", "prefs"]
        prefs7Dir = ["~", "Library", "Preferences", "Poser 7"]
        prefs8Dir = ["~", "Library", "Preferences", "Poser", "8.0"]
        prefsProDir = ["~", "Library", "Preferences", "Poser Pro"]
        prefsPro2010Dir = ["~", "Library", "Preferences", "Poser Pro", "2.0"]
        prefs9Dir = ["~", "Library", "Preferences", "Poser", "9"]
        prefsPro2012Dir = ["~", "Library", "Preferences", "Poser Pro", "9"]
        # prefsPro2014Dir = [ "~", "Library", "Application Support", "Poser Pro", "10" ]
        # as returned by poser.PrefsLocation()

        poserDir = [os.path.dirname(poser.AppLocation())]
        poserApp = os.path.basename(poser.AppLocation())
        ver = poser.Version()
        if debug:
            print "Poser Directory: ", poserDir
            print "Poser Application: ", poserApp
            print "Poser Version: ", ver
        verIndex = string.rfind(ver, '.')
        proIndex = string.rfind(poserApp, 'Pro')
        if debug:
            print "Pro Index: ", proIndex
        if ver[:verIndex] == "9":
            if proIndex > 0:
                prefsDir = prefsPro2012Dir
            else:
                prefsDir = prefs9Dir
        elif ver[:verIndex] == "8":
            if proIndex > 0:
                prefsDir = prefsPro2010Dir
            else:
                prefsDir = prefs8Dir
        elif ver[:verIndex] == "7":
            if proIndex > 0:
                prefsDir = prefsProDir
            else:
                prefsDir = prefs7Dir
        else:
            prefsDir = poserDir.extend(prefs6Dir)
        return os.path.expanduser(os.path.join(*prefsDir))
예제 #3
0
def AskSaveAs(ext=".fx6",types=[("Firefly Effect","*.fx6")],dir=DIR_FX,title="Save as..."):
	askfile = poser.DialogFileChooser(type=poser.kDialogFileChooserSave,message="Save as...",startDir=dir)
	askfile.Show()
	file = askfile.Path()
	if os.path.isdir(file):
		file = None
	elif not string.lower(file[-4:]) == ext:
		file = file + ext
	os.chdir(os.path.dirname(poser.AppLocation()))
	return file
예제 #4
0
def AskOpen(ext=".fx6",types=[("Firefly Effect","*.fx6")],dir=DIR_FX,title="Load Firefly Effect..."):
	askfile = poser.DialogFileChooser(type=poser.kDialogFileChooserOpen,message=title,startDir=dir)
	askfile.Show()
	file = askfile.Path()
	os.chdir(os.path.dirname(poser.AppLocation()))
	if not os.path.isfile(file):
		return None
	elif not string.lower(file[-4:]) == string.lower(ext):
		ErrorBox("""Bad file type: Must be %s""" % ext)
		return AskOpen(ext=ext, types=types, dir=dir, title=title)
	return file
예제 #5
0
    def UseDefaultLibrary(self, preferenceKey):
        """
		This method for path preferences will determine whether a path lies within the :Runtime:Libraries
		hierarchy and if not, set the path to the defined defaultLibrary for the instance
		"""
        path = self.preferences[preferenceKey]
        if debug:
            print "Testing hierarchy of {} preference: '{}'".format(
                preferenceKey, path)
        if string.find(string.lower(path), "runtime") < 0 or string.find(
                string.lower(path), "libraries") < 0:
            if debug:
                print "{} preference: '{}' is outside Runtime Libraries,".format(
                    preferenceKey, path),
            try:
                pathList = [poser.ContentRootLocation()]
            except:
                pathList = [os.path.dirname(poser.AppLocation())]
            pathList.extend(LIBRARY_PATH)
            pathList.extend([self.library])
            path = os.path.join(*pathList)
            if debug:
                print "using '{}'.".format(path)
            self.preferences[preferenceKey] = path
예제 #6
0
import os, sys, poser

os.chdir(os.path.dirname(poser.AppLocation()))

sys.path.append(
    os.path.join("Runtime", "Python", "PoseWorks", "ShaderSpider", "Data"))

import ss6Node

ss6Node.copyToMatching(
    """(skin)|(nipple)|(nostril)|(lip)|(lid)|(genital)|(body)|(head)""")
예제 #7
0
import poser, os

DIR_POSER = os.path.dirname(poser.AppLocation())
DIR_SCRIPT = os.path.join(DIR_POSER, "Runtime", "Python", "PoseWorks",
                          "ShaderSpider")
DIR_PRESET = os.path.join(DIR_SCRIPT, "Presets")
DIR_DATA = os.path.join(DIR_SCRIPT, "Data")
DIR_TEMP = os.path.join(DIR_SCRIPT, "Temp")
DIR_FX = os.path.join(DIR_SCRIPT, "FX")

for d in [DIR_SCRIPT, DIR_PRESET, DIR_DATA, DIR_TEMP, DIR_FX]:
    if not os.path.exists(d):
        os.makedirs(d)

defaultPaths = {
    'ss6': DIR_PRESET,
    'fx6': DIR_FX,
    'pz2': os.path.join("Runtime", "libraries"),
    'ds': os.path.join("Runtime", "libraries"),
    'mc6': os.path.join("Runtime", "libraries", "materials"),
    "matFileName": "MAT File Name",
    "doPng": 1,
    "doP4": 1,
    "doPP": 1,
    "doP5": 1,
    "doP6": 0,
    "doDS": 0,
    "doClean": 1,
}