Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
"This code does nothing in windows." You need to call the dialog's Show() method. I'm not sure - is the Render IO/Render Passes script included? wrote it during the late beta phase, but I'm not sure if it made it in the gold master. That one should also give you an idea on how to use the built-in dialogs, and it runs on Windows.
@PoseWorks, as stewer says, you need the dialog's Show() method called. Here's an example (hopefully not too OT) which works in P5 on Mac (expect to be waiting weeks to get my boxed P6 in OZ) and pops up an OS X styled file chooser dialog, rather than an XML styled one: initDir = poser.AppLocation() fileIndex = string.rfind(initDir, separator) initDir = initDir[:fileIndex] + ":Runtime:libraries:Pose" figure = scene.CurrentFigure() initFile = figure.Name() + "_FBM" + pz2ext getSaveFile = poser.DialogFileChooser(type=poser.kDialogFileChooserSave, message="Save Full Body Morph Pose File as:", fileName=initFile, startDir=initDir) if (getSaveFile.Show()): pz2File = getSaveFile.Path() pz2File = pz2File[:string.rfind(pz2File,pz2ext)] + pz2ext # Append extension if missing scene.SaveLibraryPose(pz2File) # Create Icon ... The code above doesn't involve any button callbacks as there is no XML parent dialog displayed prior to the File Save. I discovered the poser.DialogFileChooser (as opposed to DialogDirChooser) by searching the P5 binary for strings and looking at the XML files. Parameters were determined by guesswork and trial & error.
Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Reviewing the new cross-OS dialogs added in P6...
USAGE
Call them from poser.DialogSimple: ie, poser.DialogSimple.AskActor(). AskMenu does not work as documented--the options must be a list of strings, not a series of string arguments.
poser.DialogSimple.AskActor("Pick an actor!")
poser.DialogSimple.AskInt("Type a number.")
poser.DialogSimple.AskFloat("Type a number.")
poser.DialogSimple.AskMenu("Favorites", "What is Jame's favorite food?", ["Cheese","Pudding","Chocolate"])
poser.DialogSimple.MessageBox("Hello Poser!")
poser.DialogSimple.PickImage()
poser.DialogSimple.YesNo("Was this a good upgrade?")
RETURNS
So far, I can't get AskActor to return anything other than None. AskInt/AskFloat will return an integer or a float, respectively or None if the text entered is not evaluate as an integer/floating point. AskMenu returns the selected string or None. Note that AskMenu defaults to None, even if that's not on the list. MessageBox always returns None. PickImage returns the file path of the chosen image. YesNo returns 1 or 0. Canceling any dialog returns None.
BUGS
AskActor loses focus when started, the user must click on the window in the taskbar to regain focus. (Win XP)
self.dlg = poser.Dialog(file="./Runtime/ui/compressFilesDlg.xml", title="compressFiles.py", message = message + "nnnnnn", width=550, height=250)
self.dlg.AddButtonCallback(name="fileBrowser", callback=self.dirBrowserCB)
self.dlg.AddButtonCallback(name="compressGeom", callback=self.compressGeomCB)
self.dlg.AddButtonCallback(name="deleteAfter", callback=self.deleteAfterCB)
self.dlg.SetText(name="fileBrowser", text=initDir)
self.browse = poser.DialogDirChooser(parentDialog=self.dlg, message="Choose folder to begin search", startDir=self.Directory())
This code does nothing in windows. Any Mac users out there who can report/give screens? The ability to create plug-ins with Poser's GUI engine (meaning XML and PSD) seems tantalizing close.
Message edited on: 03/22/2005 13:21