Forum: Poser Python Scripting


Subject: Modify "hidden" attribute with Python ?

compiler opened this issue on Jan 26, 2004 ยท 13 posts


compiler posted Mon, 26 January 2004 at 12:23 PM

I liked Ockham's "make part and its children invisible" script a lot. Now I would like to modify it to make the children (and not the selected part) "hidden" and not "invisible". I did not find a method to access this parameter in the PoserPython manual. Does anyone know if a method exists to access the "hidden" parameter of a body part ? Thanks in advance.


ockham posted Mon, 26 January 2004 at 9:28 PM

It's there. parm.SetHidden(1) hides the dial; parm.SetHidden(0) shows the dial. Look at my UnhideXYZ script for an example. ockhamsbungalow.com/python/UnhideXYZ.ZIP

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 10:40 AM

The parm.SetHidden seems to be for hiding a dial, am I right ? What I'd need to do is to hide a body part. What would be the syntax ? (basically, I'd just change your script by changing SetOnOff(0,1) to SetHidden or somehting like this). Thanks for your help.


ockham posted Tue, 27 January 2004 at 11:00 AM

Oh! Hiding body parts on the menu! I never considered that before, and I don't see any way to do it internally. Your new PZ2 approach is probably the best way. Python could write and load a PZ2 to fit a specific need, but that seems a bit wasteful when the user can just load a PZ2!

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 11:17 AM

Yes, but the PZ2 are coded with the body part names. So I have to make a PZ2 for every figure type. For characters, it's quite easy : they all have fingers. But for some other figures, say EasyPose tentacles (no, no connections to nakked vickies intended...), it might be useful to select a body part and hide its children. Well, if you thinks it cannot be done, it cannot be done. Another question : I have made a procedure to convert V3 clothes to V2. It involves applying a preset pose, then another pose (to change the centers), then a set of magnets. Could this all be made into one python script ? And still another, related question : when all these magnets are applied, I have to select each body part whose geometry is modified, spawn a new morph, then delete the magnets, and make all these new morphs into a Full Body Morph. Could this procedure be automated ? Thanks in advance for your help (I'm absolutely not experienced enough in Python to try and do these procedures by myself...).


ockham posted Tue, 27 January 2004 at 11:37 AM

1st question: ".....it might be useful to select a body part and hide its children......." Yes, that would be a useful general trick. And it could be done by the indirect method; Python writes the PZ2 then loads it. I'll work on this. (I already have PZ2-writing actions in Python, so it shouldn't be hard to specialize.) 2nd question: If the magnets are contained in a PZ2, this would be easy. Just combine three steps into one. If the magnets need to be set "visually", then difficult or impossible. 3rd question: I don't see any way to do FBM in Python directly. There must be some way to get the same effect; I think it will require storing the state of the entire OBJ first, and then computing deltas after deformation.

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 12:01 PM

OK, I'll try to include the magnets in a single pose, but haow can the pose know that it must first set the centers and apply a pse, and only after this apply the magnets ?


ockham posted Tue, 27 January 2004 at 12:10 PM

Can the mags be described numerically? Do you know in advance that Mag 1 goes on the left shoulder, with scale .3, yrot 40, etc? If the mags are "constant" in that sense, Python could do the three things in order. (set centers, apply pose, apply mags.) Obviously I'm not seeing the big picture here.....

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 12:22 PM

Yes, the mags are "constant". I apply a pose so that I align the dress with the figure, Then I apply the centers Then I apply the magnets, as a full set in a cr2. I think it would be better to make a python script just to call the 3 files (2 pz2 and one cr2 or pp2) rather than having Python create magnets : I have made magnets for every possible bodypart, but there might be some body part that is missing in th dress. So can Python call, in a predefined sequence, 2 poses and a cr2 to be applied to a dress already selected in the scene ?


ockham posted Tue, 27 January 2004 at 12:33 PM

Yes, that part is easy! Assume the poses are P1.PZ2 and P2.PZ2 in the folder CompilerPose, and the figure is C1.CR2 in the folder CompilerFig. ------------------------------ import poser import os scene=poser.Scene() BasePathUncut=poser.AppLocation() BP=BasePathUncut[:(-len('poser.exe'))] Pose1=os.path.normpath(BP+'/Runtime/Libraries/pose/CompilerPose/P1.PZ2') Pose2=os.path.normpath(BP+'/Runtime/Libraries/pose/CompilerPose/P2.PZ2') Fig1=os.path.normpath(BP+'/Runtime/Libraries/character/CompilerFig/C1.CR2') scene.LoadLibraryPose(Pose1) scene.LoadLibraryPose(Pose2) scene.LoadLibraryFigure(Fig1)

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 4:23 PM

Thank you so very much for this script. I would never have thought to check for the os !!! I'd have a final request, if it's possible : Is there a way to 1-check each part of the dress I just modified with the magnets 2-set the morphs to 0 (and also the dials related to already existing magnets in the dress before the one I added) 3-spawn for each a new morph target, called "conversion" for instance 4-delete all the magnets (save those that were already present) 5-set all the "conversion" morphs to 1 (and also all the dials related to already existing magnets in the dress before the one I added) I know that the parts between the () would be quite tricky to make (I have no idea how I would do this), but even without these parts, it would be great to have the rest. Thanks again for your help. sylvain


ockham posted Tue, 27 January 2004 at 4:31 PM

I think this is possible. Will have to digest it for a while!

My python page
My ShareCG freebies


compiler posted Tue, 27 January 2004 at 5:07 PM

Thanks for considering it. It would be great if I could put this set in the freestuff. The succession of poses and magnets converts reasonably well V3 clothes to V2, but the whole process is still quite long...