Thu, Dec 26, 1:22 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Moving individual verticies with Python Script..can it be done?


Josiah ( ) posted Mon, 28 October 2002 at 4:00 PM · edited Thu, 26 December 2024 at 1:13 AM

Is there a way I can use a script to select an individual vertex with my mouse? If so, couldn't I then position it with "vert.setX(),vert.setY() and vert.setZ()" which could be linked to dials on a dialog?

Any help or advice would be GREATLY appreciated!
Thanks!
josiah


ockham ( ) posted Mon, 28 October 2002 at 10:21 PM

Interesting question. The methods for selecting and moving one vertex, referenced by some index if not directly by X and Y, are in fact present in the Poser Python. The hard part, I think, is in using the mouse, because Python doesn't have good communication with mouse moves in the document window. I've been looking at this set of actions for a different purpose. One trick that might work is to use a little prop, created by the Python script, as a kind of 3D cursor. The position of this object in X,Y and Z would be available to Python. You would drag the little cursor thing to the desired location, using regular Poser editing tools; Python could then locate the vertex and apply a parameter dial to its location.

My python page
My ShareCG freebies


stewer ( ) posted Tue, 29 October 2002 at 10:48 AM

You can move vertices with Python scripts (see the examples that come with Poser in the Geom Mods folder). However, I am not aware of any methods to determine the mouse position inside the Pose window from Pyhton.


Josiah ( ) posted Tue, 29 October 2002 at 4:39 PM

Hmm.. Good idea Ockham, working on an idea... Any method to return the current camera depth (Z)? Heres a new idea; A small cube with a wireframe texture so it could be seen. this cubes z (depth) is "camera Z + 10". This will keep the cube the same size at any zoom. It should also have a X and Y boundries that are determined by the camera cone so if the camera rotates to where the cube would fall out of view, the cube will be "dragged" along the viewport edge. Zoom in to where you can see the verts you want to manipulate, activate the script and the cube appears. Drag the cube over the vert you want to select using the mouse. Press "Pick", and the script will look along the z axis until it hits a vertex, the it returns the vertex index number. The x,y, and z -/+ buttons become active and the vertex can then be moved with the "set" functions. What do you think?


Josiah ( ) posted Tue, 29 October 2002 at 5:14 PM

Arrg! Poser doesn't seem to supply enough python functions to create this! Maybe if I start simply and refine? Ok, after looking around the python methods, It looks like this COULD be done; A dialog in which YOU SELECT: 1. the bodypart you are working with. 2. the vertex number you wish to move. Below this would be X,Y and Z, plus and minus buttons to move the vert along each axis in either direction. The problem would be "what is a easy way to determine the vertex number I want to move?",there are ~1000 to choose from! josiah


ockham ( ) posted Wed, 30 October 2002 at 12:33 AM

Creating a prop is actually the easy part, though it's not quite obvious. Look at the LoadLibraryProp function. Assuming the end user hasn't messed up the primitives, you can just call LoadLibrary("Runtime:Libraries:Props:Prop Types:Box.pp2") to bring in a box, then give it your wireframe properties. This would be one Python script.... Then move the box around so that its Origin coincides with the vertex you want. At this point the box will still be the CurrentActor, so you can use something like MyOrigin = scene.CurrentActor().Origin() which will give you a 3-member vector. I've done the part above for a different purpose, and I know it works. After this, I'm purely guessing. The Vertices() function should give you an array (list) of all vertices on some object; then run through that array and stop when the x,y,z of one vertex is closest to the x,y,z of the Origin. I suspect that figuring out how to define "closest" in a mathematical way is the hardest part of all.

My python page
My ShareCG freebies


Josiah ( ) posted Wed, 30 October 2002 at 10:28 AM

Ockham, thanks for your help on this, I appreciate it! You certainly know your stuff! Yes I think that would work, but it would be a lot of trouble for a lazy person like me to line up a very small box with a single vertex in 3D space. Also, when you would zoom in or out with the camera, the size of the box would appear to change size because you are closer or further away from it. Thats why I was hoping to keep the box a fixed depth away from the camera, then you could zoom in and align it with a vertex in 2D space and it could then look along the Z axis until it returns a vertex position. However I couldn't find a way to keep a prop a certain distance away from the front of the current camera. Your idea is great, the best yet, I just wish there where a little easier or faster way to select a vertex. I wonder why CL didn't incorperate vertex movement with "soft selection"? Magnets are hard to work with big time! As far as searching for the nearest vertex closet to the origin, couldn't we take and add or subtract one from each coordinate? This would be 26 positions to sort. However the number to look at would grow exponentially as the positions away increased, but I don't think thats a problem. I think you would have to have an array of the verts of the current body part, and the the box origin could be compared with each and return the closest vert index. The only way I can think to indicate to the user which vertex is selected, would be the vert number displayed on the dialog somewhere. The softselection idea is not that far fetched either, but thats off in the future maybe.


Privacy Notice

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.