Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 am)
Dude, you beat me to it. That was the next script I was going to write. I am just putting the finishing touches on my morph transfer script, then I planned on tackling this issue. Bravo!
I just started using the P6 Dialogs myself. A much better solution that tkInter, at the cost of incompatibility with older Poser versions. But at least Mac P6 users can use them! (Though it would be so much eaiser if everyone just used Windows ;-)
Anyway, here is the way to do text entry:
sMsg = poser.DialogTextEntry(message="Enter a new name for something.")
sMsg.Show()
print sMsg.Text()
I don't really have time right at the moment, but I will check out your script, and throw you some feedback ASAP.
I'm Psyced you've posted your progress with this script SVDL, thank you very much for your gener'osity!
You posted this script to a thread I wrote a month or so ago about deleting morphs with values of zero, but the URL is'nt available, right now, for some reason.
Anyhow, we got to speaking of Wymaster...Have you found a way to incorporate the consolidation of his remotes into the INJ, is that on the chaulkboard anywhere?
I think it's just dynamite that your new script makes an INJ! This was the only way I could get the old script to work. I needed to run it, then apply INJs I had for my figure.
Thanks again, I'll Beta test this just as soon as I get home!
= )
Message edited on: 03/28/2006 17:43
Two similar scripts are on the chalkboard: one that will consolidate Wyrmmaster's magnets to a figure morph (and it'll make morphs in the conformed clothing and hair too while it's at it), and one that will create a morph set from an imported object (especially useful for ZBrushers). These scripts will also generate an INJ/REM pose pair. I'm playing with an idea to make the scripts more intelligent: if they can find a PBMCC_xx injection channel they'll use it, if not, they'll create a new channel and generate scripts to create that new channel in the figure before applying the pose (which will work on all figures, human or otherwise). I also have some ideas on how to get the progress bar to work from Python. Needs a couple of tests, though. If I can make it work, I'll update my scripts. I tested the link, it works for me. And it's published in freestuff too. destro75: I knew the DialogTextEntry trick (I even found out how to have it "remember" the last entry, see the script). What I am aiming for is a dialog that contains multiple textboxes (like the Movie Settings dialog, for example).
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Attached Link: http://poseworks.com/serendipity/index.php?/categories/4-PzrXml
For more complicated dialogs you can use poseworks PzrXML library. The one downside, is the people have to download the library to use a script that makes use of it (i.e. it's not redistributable). However, I think you can take a copy of the temporary XML file it generates and use it with the poser.Dialog class (you'll need to look at RenderPasses.py for clues on how to use it).I learned quite a few tricks from PzrXml, most of them have been applied in my script. Poseworks has done an impressive job. Sir Isaac Newton once said something about standing on the shoulders of giants. Not that I am a second Newton, but the same idea applies.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Hi svdl I gave your SpawnCharacterP6 script a try. Unfortunately, it freezes during the "Writing Inj for actor Hip" Error message: Hip Traceback (most recent call last): File "", line 291, in btnGenerateClick NameError: global name 'math' is not define Tested on V3 and M3, same thing. Using P6SR2 Any suggestion ? Thanks
Going to try that one out. I might have to replace the math.sqrt function by something else.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Problem found and fixed (just forgot an "import math" statement). Please redownload the script, it should work now.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
If the injection channels are named PBMCC_xx (xx is a number), it'll work. The injector will not affect any trans or rot values, nor will it affect any other morph channel than the injected channel itself. Same goes for the REM pose.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Oh Yeah, you mentioned putting Wyrmmaster's remotes/magnets right straight through clothing too, Wow! Do you think it'll work on any clothing, like maybe As Shanim's Yu dress? How is your ETA looking there?
I'm glad you've addressed the Hip INJ issue, I had trouble also, I'll ca'nt wait to test again.
The GUI is fantastic, you've outdone yourself, I thought the last version of this script was the best I'd seen!
You might try rewriting the Save INJ/REM line as a checkbox, where it will always be nice to have that INJ/REM set around, but becasue the user should'nt need to do any injecting once the script has run. That would be something thats right up the scripts alley really, I think it'd be much nicer if the script did the injecting automatically once the INJ is written, be it from a temp file or perminant directory.
About the Morph Channels line, I'm not sure the average Poser user understands what the point of picking a morph channel is, I sure do'nt? Why is'nt this something you'd prefer the script pick up from the first available, at random, or some kind of exclution. I think it'd be great if you'd a line to the ReadMe explaining this.
Angelouscuitry, no offence but, Quote I think it'd be much nicer if the script did the injecting automatically once the INJ is written Unquote No, because the idea is not to add an extra morph to the figure you are using to create custom morphs, but to save an injector and load it in a much lighter figure (basic cr2+Expression morphs) Quote Why is'nt this something you'd prefer the script pick up from the first available, at random, or some kind of exclution Unquote No, it's definitively better to be given the choice. The first available will always be the same. If 2 morphs are using the same channel, the first to be loaded is removed when the second is loaded. One may want to use a combination of 2 morphs or more.
You've got some points there, Angelouscuitry. Actually, it's my mistake. The SpawnCharacter utility will be aimed at end users who want to keep their system responsive, even if working with many characters and many morphs. Selecting a morph channel is something that might baffle an end user, you're right. The other two scripts on the chalkboard are aimed at character creators, and the objective is to have those scripts create INJ/REM pose sets that can be redistributed/sold. Character makers will have to know about morph channels, it's part of the job. As soon as I have finished the MorphFromObject and MorphFromMagnets scripts I'll do an overhaul of SpawnCharacterP6.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
"Remembering" will be tough.
On the other hand, it's fairly easy to scan the morph channels in the figure and exclude the occupied ones. Same goes for names, it's easy to scan the figure for the morph name and warn the user if it's already there. Remembering file locations: as long as the dialog is not dismissed, it's fairly easy. And it's not too difficult to create some sort of .ini file that stores the folder preferences.
Message edited on: 03/30/2006 04:04
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
The SpawnCharacterP6 script has the XML that defines the dialog widgets incorporated in the script. It will recreate the XML file when run. The MorphFromOBJ script I'm working on is just a little smarter: if the XML file doesn't exist, it will create the file, but if it's already there, it'll skip the file creation. So the first time the script is started will be somewhat slow, after that the script will start up a lot faster.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
x, y, z trans values: it's on my TODO list. Can be done, not too difficult. Remembering the last name/folder entered: calls for an INI file. Again, can be done, it's on my TODO list.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Good idea. I'll include it in the next version.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
SVDL - I was really hoping this script will be geared much more for use with .PZ3, than on .CR2. I do'nt think characters should be cut out of .PZ3 they were developed in, for sale or transfer. This would insure you are getting more of where promo pics were made from.
The first time I was intorduced to this script it was named spawncharacter2; in a post I wrote, in here, about deleting morphs with values of 0 in order to get a lighter .pz3(/.cr2). It was there, also, that we first got to speaking of Wyrmmasters sets. I've been under the impression that this script , like the second version of it, will do the stripping of most all my morphs, and then prep an INJ to replace them. And that this is all expected to happen right within .CR2 that's presently loaded within the .PZ3, without needing to then remove that .cr2, load a blank, and do any injecting. Especially if the .cr2 in the scene has Wyrmmaster's magnets all over it, because then replacing it with a blank .cr2 would be difficult, as I've tried transfering altered sets of Wyrmmaster's remotes, from one .pz3 to another, but this was not easy at, in fact I still have'nt done that %100.
I still have the second version of this script to do my stripping, and I know from experience that the one thing it was missing could be fixed with INJ, so both your scripts will prove handy to have around for how I'm approaching this, but when you do your overhaul of SpawncharacterP6, for Wyrmaster's magnets, will you plan on stripping morphs, magnets, and remotes, from within the .pz3, like the second version of this script did?.
I think this would be the neat and tidier way of doing things, just open a huge .PZ3, and save away a small one, who could ask for anything more? Granted the user has to expect alot of changes within the .pz3, before runnng the script, but that is'nt anything having a backup is'nt good for, and it would be so much easyer than ever changing the .cr2. I'm sure this is something most End User's will agree with, most avidly.
Adavyss - I'll have to look more into Channels, it's never been asked of me before this, I'll just have to roll with it untill I find some other need for them.
"No, it's definitively better to be given the choice. The first available will always be the same. If 2 morphs are using the same channel, the first to be loaded is removed when the second is loaded. One may want to use a combination of 2 morphs or more."
But where we're planning to only have one morph per part then always just picking the channel at the top of the list should should never cause a problem with 2 morphs using the same channel, right?
Angelouscuitry: you're correct about the SpawnCharacter script being geared towards .PZ3s. Slimming down an existing .pz3 is one of the main reasons I made the spawncharacter2 script, and that functionality will return. My personal use of Poser is illustrating a story, so the same characters return again and again. That's why saving the character as a .CR2 or .pz2 is useful for me, and that's why this functionality will stay in the script. But the in-place slimming down is the important part. The same will go for Wyrmmastered sets. Spawn the morphs, in both character and clothes, then strip away the magnets and remotes. The channel choice is geared towards character creators use. The new version of the SpawnCharacter script (I'm working on it right now) will automatically select a free channel, if there is one, or create a new one, without user intervention.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Working on a more user-friendly version. The current script should work on non-Millenium 3 figures too - including non-human figures. I've been offline this weekend, but I managed to squeeze ot some time to work on an ini settings system. The next version of SpawnCharacterP6 (I'll be renaming it to ConsolidateMorphs, since that's what it actually does) will be able to do it all. In-place trimming down, head-only, body-only and full body, saving head-only INJ/REM poses, body-only INJ/REM poses, and full INJ/REM poses, optionally including trans and scale parameters, the whole kaboodle. And it'll still be free.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
And should I also make a ProPack/P5/Tkinter version? Some functionality must be stripped then, P5 and ProPack don't support creating full body morphs from Python.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Head Only would generate a "partial body morph", affecting head, neck and eyes. Should I change the dial option text to "Set Full/Partial morph to 1" ?
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Actually, I use PzrXML to make the base XML file. Then I apply some tricks I learned by experimenting. One trick that's pretty useful: the isStringID attribute defines whether the widgetText attribute specifies a string resource (like "0:2") or just plain text. If you change isStringID from 1 to 0, you can enter your plain text in the widgetText attribute. If you want to have a text label to have a callback, you must add the attribute useRectClick="1" to the widget entry in the XML, and of course a command=... attribute. Next, I used the "dir" Python function on a Poser Dialog object. That told me that a Poser Dialog has only four methods: AddButtonCallback, SetText, SetButtonValue and Show. PzrXML explains very well what those functions do. So now I create the base XML using PzrXml until it looks like I want it to look. Then I edit the XML to change IsStringID where appropriate (labels, button texts and so on), and play with useRectClick. And then I write a class around a Poser Dialog object. The init method sets the callbacks. Lots of other methods use SetText and SetButtonValue to toggle checkboxes and labels and set the dynamic texts. That's it. Not all that complicated, actually.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Wow, I consider myself a pretty savvy coder, but that is like a whole different language to me. (I program SQL code day to day. I'm also very good with VBScript, JavaScript, and C variants. I have had a bit of a tough time with Python, but I am pretty comfortable with it now. Strangely, I have always had a problem with XML. You would think that something as simple as XML would be easy, but it has been my own personal bane.)
I'll have to see what I can figure out from PzrXML. I haven't touched it at all, except to look over the documentation. Thanks for the info!
The link in post #1 will download the new version - I replaced the zip file on my server. Working on an improved version, but the scaling is troublesome. Translations incorporate fine.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Another thought has come up, but it'll take quite a lot of work (and some serious user interface design headaches). The user should be able to select what morphs should be included in the consolidated morphs, what morphs should be completely left out, and what morphs should be included in the consolidated one, but NOT stripped out of the figure. JCM morphs should be left alone, that's pretty clear. Expression morphs? The user will probably want to keep them, but maybe a basic expression should be included in the consolidation. Most other morphs should be included in the consolidated morphs and then stripped out. Back to the drawing board... Angelouscuitry: "I can't wait to beta test the strip functions" LOL! That got my dirty mind working.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Latest update: working on a completely object-oriented approach. This will resuilt in a ConsolidateMorphs script, a MorphFromOBJ script and a MorphFromMagnets script, all in a P6 dialog version, a Tkinter version and a GUI-less version (just using print statements for feedback and a config file for input). The scripts will not use the CreateFullBodymorph method of P6 SR2, so they'll work in P5 and PP too. A nice side effect: this fixed the scaling problem. Another thing: settings can be saved to an .INI file. Each figure geometry will have its own INI file. Making all the correct selections can be quite a chore when there are hundreds of morphs to deal with (Eternal Judy, V3 SAE), so INI files that will remember your selections seemed like a good idea. I've finished the IniFile, InjRemOptions and PZ2Writer objects. They work. I'll keep you posted.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Well a super big thank you for this one! Even with all the expressions morphs already in the characters, I'm shaving off at least 10 MB. Doesn't seem like much for one, but if you like to save complete figures the savings add up. Figures load faster too!
Can't read the graphic so can't see what it says. I know there's a way to save to the last folder opened. Is it possible with this?
I just love these things made by talented people that make life easier. And so generous! Thanks!
Working on it.
This script is BIG. So I have to do a lot of testing. I want the script to be as robust as humanly possible. It'll take time.
The idea of the ini file is that most people organise their poses and figures by character type. So the ini file for V3 based figures will have different settings (different morphs, different default folders for poses and figures) than the inifile for Aiko based figures.
How does the script know what ini file to use? By looking at the geometry file name of the loaded figure. If a figure is based on a blMilWom_v3.obj file, it's a V3 character, and the script will load the settings from blMilWom_v3.ini.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
SVDL - IMHO, It's really great to see you are taking this script to the next level for us, but I really thought your fourth post back would actually start stripping. This stripper function is just what so many of us are so eager to see you comprise, this is where most of your size displacement is coming from. Magnet stripping would then be my next goal, but I think between the two(Morph and Magnet stripping) you've already got your work cut out. I'd really like to see you put much of the other functions on hold until just those two work. I'd hate to see anything get in your way, especially fluffier things that like you say are just make the script bigger and/or buggier. And where it would really be nice to have the Morph and Magnet strippers in one script I'm wondering if your trying to incorporate too many scripts into one...Don’t let me stop you though, all the power to you, Sir! I'm just taking a look at the difference in contrast between some of the things going on at the developmental stages of this script, that I am sure will take off like a rocket?
For your first post I had prepared a whole page of my Beta findings, including computer speeds, boot and run times, size change, etc., but never got to post when I realized from which direction the script was coming. Then I became very eager to repeat this process when I read you'd updated the .zip on your server, but then realized we were still coming form that direction. In waiting a few days, to come back here to my library, in order to give you time to work, but I see from your past few posts we're planning to cover even more at once.
Still eager to Beta...
The three scripts have a lot of common functionality. I'm busy writing the common functionality objects - those for writing the pz2 files (also needed for the morph stripper), reading ini files and so on.
Only when I'm completely satisfied with the functionality and robustness of the common objects I'll turn to writing the script-specific objects and the user interfaces. I want this set of scripts to be a good example of solid programming.
It's Easter weekend. I have time. I'm coding like hell. Please be patient!
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
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.
Attached Link: http://svdlinden.xs4all.nl/poserstuff/downloads/spawncharacterp6.zip
Hello all, I've been busy writing a little script that may assist in character creation.When you use a Millenium 3 figure (Michael 3, Victoria 3, David, Steph Petite) with a lot of injected morphs, the figure will claim a lot of memory since all the morph deltas of all the injected morphs are loaded. This script will consolidate all those morphs into a single morph and write an INJ/REM pose combo to disk.
The new INJ/REM pose will use only one morph channel, reducing memory usage drastically. For example, the Kaleigh character by TamelaJ will occupy over 20 MB when saved to disk as a CR2. When this script is applied to a "Kaleigh" figure, and the resulting INJ pose is applied to an unmorphed V3, the resulting CR2 will be less than 6 MB.
The script uses P6 dialogs, no Tkinter. So it should work on Macs too.
I'd love to get some feedback on how to improve the script.
And if somebody has found out how to create textboxes in P6, I'd love to know!
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
My gallery My freestuff