Sun, Jan 5, 7:41 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: Looking for script - morphed .obj exporter


Spanki ( ) posted Sat, 22 October 2005 at 1:41 PM · edited Thu, 26 December 2024 at 1:19 AM

Here's what I want to do... - load a .obj or prop - morph it using Poser Magnets - export an .obj file with those morphs applied. ...in other words, I want to be able to export the model as it is currently being displayed in Poser. I think the best approach might be to use the default model vertex info, then add any deltas from any currently dialed morphs (I can manually create morphs from the magnets before running the script). Does anything like this exist already? Thanks, - Keith

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


PhilC ( ) posted Sun, 23 October 2005 at 11:31 AM

I may not be understanding you correctly. Why not just use the export options currently available?

philc_agatha_white_on_black.jpg


Spanki ( ) posted Sun, 23 October 2005 at 12:01 PM

Well, I've had a little more time to play with it and here's a little more detail on my problem... Basically, when you export a .obj file from Poser, you have 2 options: 1. export the mesh as it exists already on your drive (no morphs, no joint-induced changes) or... 2. export the mesh with morph changes, but also with joint-induced changes. ...which one you get, depends on the 'As Morph Target' option being checked or not. So, now suppose you want to export StephyP, with some morphs applied - let's say the Muscular full-body morph, for example - so that you can load that into a modeller to create Muscular morphs in some clothing you've created for her. So, you load up Sp3, zero the joint rotations, dial up the Muscular morph and export the .obj and you're good to go, right? Wrong :). And this is where my problem is. First off, through some mechanism/values I have yet to find, her legs will be skewed to her right because she's "rigged". This is a tiny displacement and different amounts can be found when comparing the thighs, shins, feet, etc. but causes troubles if the clothing item is meant to be a very tight-fitting item (like stockings or a catsuit). Secondly, Sp3's .cr2 file is bugged to begin with - it has some non-zero X center (or center of rotation) values in it, causing skewing in the upper body parts as well (the hip comes out exactly centered, the abdomen is off, the chest is off, the neck is off, the head is off... all by different amounts). You can see some of these errors by loading Sp3 in as above, then importing her mesh - they won't occupy the same space. So, what I really want is NOT exactly what you see in Poser (a morphed, but 'rig-errored' model), what I want is the file-based .obj file vertices (no rig-induced errors, no posing rotations or translations), but with whatever morphs I have dialed in applied to it. - Keith

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


Spanki ( ) posted Sun, 23 October 2005 at 12:07 PM

Oh and BTW, part of the confusion (bug?) is, to get a 'morphed' output model, you have to have "As Morph Target" UNCHECKED. If you check it, you just get the model with no morphs (or transformations of any type) applied. I think this is a bug.. I'll have to go do more testing in P5 and P4, but it seems like it used to work correctly.

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


Netherworks ( ) posted Mon, 24 October 2005 at 1:04 AM

I could see where there might be problems if there is a default rotation being applied when exporting - there very well could be something locked in the cr2 - I don't know. I've always worked on the .obj rather than the cr2 because problems can creep in. Often I'll load the whole mesh and then on export select options 4 and 6: preserve groups and as morph target. Guess this doesn't help at all. BTW Spanki, STOMP is brilliant. Thats for that. I've been using it to mirror morphs from one limb to another, when MTmirror doesn't work right.

.


EnglishBob ( ) posted Mon, 31 October 2005 at 6:34 AM

A Python method for doing this would be great. Meanwhile, I would use John Wind's Compose utility which can do just this, although it's a bit long winded and you'd soon tire of it if you had a lot of morphs to do. Sorry not to contribute much, but this is partially a bookmark so I'll be notified if anyone comes up with the goods (ebots permitting).


Spanki ( ) posted Mon, 31 October 2005 at 6:43 PM

Good tip, but I never found my way around Compose and I think it might have trouble reading P6 files (?). At any rate, since there didn't seem to be an existing Python solution to this issue, I decided to get my Python feet wet and managed to come up with something that works... mostly. The current script just bakes the currently dialed in morphs to the figure's geometry, so when you export the mesh (as morph target), it includes the morphs, but none of the rig-induced errors (yay!). There are a few ways I could refine this process, but having never programmed Python, I'm not quite sure how to do some (very simple) things I need to do in order to implement the changes I have in mind. In particular, I want to create a (boolean type) array of a runtime-determined size -> 'numVerts', initialize the values to zero and be able set and later check values in that array. If someone could fill me in with a quickie example of that, that would be great. For example: . . . numVerts = geom.NumVertices() myboolarray = ?? # <-- how do I allocate a simple array of 'numVert' size and set all the values to zero? ...I assume once that's done, I can later just: myboolarray[i] = 1 ...to set values and... if( not myboolarray[i] ) do_something_here() ...to test for values, but I'm just unclear on allocating the array to start with. - Keith

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


Spanki ( ) posted Tue, 01 November 2005 at 12:09 AM

Nevermind... I found some info on the Numeric Python library and managed to figure it out... working on refining the script now.

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


Spanki ( ) posted Tue, 01 November 2005 at 1:03 AM

file_299475.jpg

Ok, it turned out to be fairly straight-forward (barring any Python newbieness on my part). Save the attatched file as "UniMorph.py" (I put mine in the :Runtime:Python:poserScripts:GeomMods folder). Have a look in the comments inside the file for details. Have fun! - Keith

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.


TrekkieGrrrl ( ) posted Tue, 01 November 2005 at 4:23 AM

Interesting. Thanks, Spanki!

FREEBIES! | My Gallery | My Store | My FB | Tumblr |
You just can't put the words "Poserites" and "happy" in the same sentence - didn't you know that? LaurieA
  Using Poser since 2002. Currently at Version 11.1 - Win 10.



EnglishBob ( ) posted Tue, 01 November 2005 at 4:38 AM

This is officially A Good Thing. Thanks for your efforts. I admit I haven't tried Compose on a node laden Poser 6 figure, I generally use it for hacking OBJs about; and, yes, the interface does have certain eccentricities. :)


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.