Thu, Feb 20, 3:00 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 am)

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: MorphFromOBJ script


svdl ( ) posted Thu, 30 March 2006 at 10:29 AM · edited Thu, 20 February 2025 at 3:00 PM

Attached Link: http://svdlinden.xs4all.nl/poserstuff/downloads/morphfromobjp6.zip

A new script. Especially useful for ZBrushers.

If you ZBrush a geometry and want to turn it into a morph, there's a lot of manual work - importing the ZBrushed object, spawning props, saving out the individual props, loading morph targets onto all figure parts, setting an FBM, and let's not forget the hassle of creating a nice INJ/REM pose pair.

This script will eliminate almost all manual work. It's fully functional, but still in beta.

Give it a try, and give me some feedback on how to improve it.

By the way, the script will detect the presence of PBM_CC injection channels in the figure. If they're present, the user will be asked to select one. If not, the user will be asked to define a new morph channel name.
I might change the script to automatically construct the morph channel name from the morph name (stripping whitespace).

Forgot to add: P6 SR2 required. Will not work on earlier editions of Poser.

Message edited on: 03/30/2006 10:31

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


destro75 ( ) posted Thu, 30 March 2006 at 10:41 AM

You're a busy little beaver lately huh?


svdl ( ) posted Thu, 30 March 2006 at 11:54 AM

Well, I usually work on several scripts at the same time. And now some of them are nearing completion. So the appearance of several scripts is not surprising. Another one in the making, which will make morphs out of magnets (and optionally save the figure, create INJ/REM poses, the whole kaboodle). The magnet-to-morph code is functional, it just needs a GUI plus cleanup code.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


destro75 ( ) posted Thu, 30 March 2006 at 1:45 PM

Cool. Nothing wrong with a bit of hard work!

That's a great script idea. I was thinking of doing that one myself after the one I am working on now.

I may as well just wait to see if you are working on something before I even try anymore ;-)

I just finished a script to transfer morph values from one figure to another. I needed it for something I am currently working on. I haven't decided whether to release it, or even if anyone would find it useful.

Right now, I am working on a script to copy morph values from one side of a figure to the other, so that only one side has to be morphed, then the other side can be made symmetric automatically. This is part of the current project I am working on too.

These may have been done already, I don't know, but sometimes it's easier for me to just write my own code, my own way.

So what else do you have in your bag of tricks?


svdl ( ) posted Thu, 30 March 2006 at 2:36 PM

Hmm, nothing much at the moment. There's an old script using Tkinter that'll clean up the walking motion of a figure after applying the Walk Designer, it's called WalkThisWayV2. Will drop the figure onto the selected surface(s) and reduce/eliminate foot slippage when walking. It's not perfect, the hip motion tends to get jerky. And I have added some functionality to two of ockhams scripts: DeleteProps and DeleteFigs. I'm planning to write a script that easily hides/unhides multiple figures. I'm also working on a very precise DropToSurface script. Lots of mathematics to make it work right, and lots of headaches to let it have adequate performance. Bounding boxes, intersection algorithms, you name it. Tough, but if I can get it to work, very useful. Ah well. Something to keep me out of trouble, I guess.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


Adavyss ( ) posted Thu, 30 March 2006 at 2:37 PM
Online Now!

file_287600.jpg

Sorry but I'm facing some problems

Test with M3
Here is the end of the message
........................
Creating morph target on lFoot
Creating morph target on lToe
Creating Full Body morph
Restoring IK for Figure 2
Done
Saving INJ Yvon to library
Writing INJ for actor Hip
Writing INJ for actor Abdomen
Writing INJ for actor Chest
Writing INJ for actor Neck
Writing INJ for actor Head
Head
Traceback (most recent call last):
File "", line 662, in ?
File "", line 578, in SaveINJREM
AttributeError: 'NoneType' object has no attribute 'MorphTargetDelta

and the end of the message using M2
............................
Writing INJ for actor Left Collar
Writing INJ for actor Left Shoulder
Writing INJ for actor Left Forearm
Writing INJ for actor Left Hand
Writing INJ for actor Left Thumb 1
Writing INJ for actor lThumb2
lThumb2
Traceback (most recent call last):
File "", line 662, in ?
File "", line 578, in SaveINJREM
AttributeError: 'NoneType' object has no attribute 'MorphTargetDelta

I am left with left hand fingers as props
The new figure is saved & seems to work properly
Only Inj injector is created and only the upper part of the body is morphed
Thumbnail is not created

Any suggestion ?


destro75 ( ) posted Thu, 30 March 2006 at 2:45 PM

Interesting. The hide/unhide shouldn't be too hard. Just flip the SetOnOff switch for each figure. What are you going to do, put checkboxes in for who the user wants to hide? The DropToSurface sounds very intriguing. I think you would make a lot of people happy with that script. I'm planning on working on a Render Passes script next. I haven't tried out the one that comes with Poser, but I quickly glanced over the code, and I think it only deals with lights, rendering a pass for each one. I'm thinking more along the lines of turning off figures in a scene, rendering with only one figure, then cycling through each one, then rendering the shadows without any figures in the scene. I figure then all of them can be composited and make a nice postworked image. I figured I would take a look at the wishlist and see if there was anything anyone wanted as well.


svdl ( ) posted Thu, 30 March 2006 at 2:53 PM

@Adavyss: I think I figured out what happened. The obj file you imported may have had a different number of vertices in the head than the original head geometry. That will cause the SpawnTargetFromGeometry method to fail silently. No morph will be created. Or maybe you haven't morphed his head at all. In that case, the SpawnTargetFromGeometry method might also refuse to create a morph target. I've updated the script, it now will pass over bodyparts that don't have the new morph channel. You can redownload the updated script from the link in post #1.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


Adavyss ( ) posted Thu, 30 March 2006 at 3:59 PM
Online Now!

I've tested the updated version with M2 & M3 and it works perfectely well appart from the 4 fingers & thumb of the left hand which are left behind at the end of the process.
Very nice script.

I noticed that the object and CR2 are in the same folder. Would it be possible to send the object in the geometry folder as it offers more flexibility to move or rename the CR2 folder ?
Would it be possible to include the INJ/REM after the morph name instead of before in order to have the 2 related injectors next to each other in the folder ?
Would it be possible to include the thumb creation process into SpawnCharacterP6.py ?


svdl ( ) posted Thu, 30 March 2006 at 4:08 PM

That business with fingers and thumb is strange. They SHOULD have been deleted after running the script. I'll see what I can find out. As for the .OBJ question, I can do better than that. Since morph data only exist in the CR2, it's better to make the CR2 point back to the original OBJ. Which is not too hard to do (asking the geomFileName from the original figure, and replacing the correct lines in the CR2 is fairly easy - as long as you're not working with compressed files, that is!) I might have to figure out how to handle compressed files. As it is now, the script can only deal with uncompressed files.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


Adavyss ( ) posted Thu, 30 March 2006 at 4:45 PM
Online Now!

"They SHOULD have been deleted"
That's what I suspected, but whatever Character I use they are still there
"it's better to make the CR2 point back to the original OBJ"
That's true, I'm pretty slow sometimes.

"the script can only deal with uncompressed files"
I don't know about the others but it's perfect for me. Once decompressed, I never bother to compress them again.

Bedtime here
Thanks for your time


destro75 ( ) posted Thu, 30 March 2006 at 7:13 PM

SVDL, couldn't you just use the gzip module to uncompress the file, save it to a directory of your choosing, then use the uncompressed copy? Hope you don't feel like I am stepping on your toes, just trying to be helpful. =)


svdl ( ) posted Thu, 30 March 2006 at 11:52 PM

No toes hurt. I just never have used the gzip module yet, I'll need to learn it.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


destro75 ( ) posted Fri, 31 March 2006 at 5:09 AM

I admit I haven't used it myself, but it doesn't look too complicated. Take a look at the uncompressPoserFiles.py file in the Utility folder. Lines 77 to 118 specifically.


Adavyss ( ) posted Sat, 01 April 2006 at 2:03 PM
Online Now!

Hi svdl, Would it be possible for the script to reset the Render Dimensions to their original state after the thumb creation ?


svdl ( ) posted Sun, 02 April 2006 at 3:22 PM

Of course. The script remembers most of the render settings, including dimensions. I'll just have to add a few more settings to the data structure.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


Adavyss ( ) posted Fri, 19 May 2006 at 9:38 AM
Online Now!

file_342457.jpg

Hi **svdl ** I tried to use the script to convert a morph for V3 CatSuit created in the ClothRoom. It did not work and I've got this error message.

Any suggestion, please


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.