Sun, Nov 24, 10:39 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 24 8:11 pm)



Subject: Pyton Program to Set Parent


basicwiz ( ) posted Tue, 14 April 2009 at 7:08 PM · edited Wed, 20 November 2024 at 8:54 AM

 I'm working on a project where you basically make a large prop out of several smaller ones. I was wondering if any of the python gurus could post a bit of code to show how to set the parent of one object to another object in the scene. All in all, I've got five pieces that I need to link together, one after the other in a set order. That is obj1 is parent of obj2 is parent of obj3 is parent of obj4 is parent of obj5.

Anyone know how to do this?

And be kind. I don't know crap about pyton. Have looked through the manual, but WOW. What a can of worms.

Doug


geep ( ) posted Tue, 14 April 2009 at 7:24 PM · edited Tue, 14 April 2009 at 7:34 PM

file_428631.png

Python ??? :huh:

Why not just use the Hierarchy Editor? :blink:

Just click and drag to parent one prop to another ...
e.g.,
drag obj5 to obj4
drag obj4 to obj3
drag obj3 to obj2
drag obj2 to obj1

Just a thought. 😄

cheers,
dr geep
;=]

P.S. If you want to make all 5 objects into a single prop object ...
Export objs 1-5 to a Wavefront OBJ... file then Import that file back into Poser and ...
Walla !!! One prop made from the original 5. :biggrin:

Remember ... "With Poser, all things are possible, and poseable!"


cheers,

dr geep ... :o]

edited 10/5/2019



basicwiz ( ) posted Tue, 14 April 2009 at 8:00 PM

 Yes, I know I could do it this way, and so far that's the easiest option I've found.

However, I'm going to be giving copies of this to a number of people, and I just wanted to make things easier for them. If no one can help, this is the route I had planned to go.


lesbentley ( ) posted Wed, 15 April 2009 at 6:26 AM

There are a number of things you could do, but I don't have a clear idea of what you are trying to achieve, and why.

Providing that obj1 does not need to be a smart prop, you could distribute all the props in one pp2 (or ppz) file, already pre-parented. Parent the objects as desired using Geep's method. Next select obj1 (the base of the parenting chain) and proceed to save it to a props pallet. You will be presented with a dialogue box, click the "Select Subset" button. Tick all the items you want to include in the pp2, then proceed to save as normal.

Next time you open the pp2, all the objects you ticked will load, and be still be parented.


lesbentley ( ) posted Wed, 15 April 2009 at 8:34 AM · edited Wed, 15 April 2009 at 8:37 AM

If for some reason my previous suggestion is not suited to your intent, and you do need to apply parenting after the props have been loaded. You can use a text editor to construct a simple cm2 (camera) file to do the parenting. The cm2 would then be saved to a camera folder. The type of parenting will be smart-parenting. Here is an example of a cm2 file to apply parenting:

{

version
        {
        number 3
        }

actor obj1_1
        {
        smartparent UNIVERSE
        }
actor obj2_1
        {
        smartparent obj1_1
        }
actor obj3_1
        {
        smartparent obj2_1
        }
}

In the above example the parent of "obj1_1" is "UNIVERSE", but it could just as easily be some other prop, or a body part, e.g. "hip". Be aware that when a prop is smart-parented, it will inherit the translations and rotations of its parent, in addition to any translations and rotations that may already have.

Also note that Poser appends an underscore and number to a prop when it is loaded. So if you wanted to parent three instances of "obj1", the syntax would be:

{

version
        {
        number 3
        }

actor obj1_<span style="color:rgb(255,0,0);">1</span>
        {
        smartparent UNIVERSE
        }
actor obj1_<span style="color:rgb(0,255,0);">2</span>
        {
        smartparent obj1_<span style="color:rgb(255,0,0);">1</span>
        }
actor obj1_<span style="color:rgb(51,102,255);">3</span>
        {
        smartparent obj1_<span style="color:rgb(0,255,0);">2</span>
        }
}


TrekkieGrrrl ( ) posted Wed, 15 April 2009 at 9:58 AM

 LesBentley.. I'm curious.. Why a .cm2 file?  Can camera files do something other files can't? I guess what I'm asking is why not make it a pose file?

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.



basicwiz ( ) posted Wed, 15 April 2009 at 10:20 AM

 Fascinating idea, Les. I'll give it a try! Many thanks! I'm like TG, though... why a camera file?


markschum ( ) posted Wed, 15 April 2009 at 10:43 AM

Isnt it something about pose files not working on props ? 


basicwiz ( ) posted Wed, 15 April 2009 at 11:48 AM

 I just tried the cm2 file idea and it doesn't work. Could it be that I must reference the internal names of the objects instead of the ones I can set in the properties window?


lesbentley ( ) posted Wed, 15 April 2009 at 11:49 AM

Quote - LesBentley.. I'm curious.. Why a .cm2 file?  Can camera files do something other files can't? I guess what I'm asking is why not make it a pose file?

Markschum is on the right track. You could save the file as a pz2, but then it would only work if there was a figure in the scene. You don't even get the tick (U.S="check") mark in pose pallet until a figure is loaded. With a cm2 (camera) file it can be applied whether or not there is a figure in the scene. Note also that I have addressed the prop as "actor", this is the key factor in making a pose work on a prop that is not parented to a figure.


lesbentley ( ) posted Wed, 15 April 2009 at 11:51 AM

Quote -  I just tried the cm2 file idea and it doesn't work. Could it be that I must reference the internal names of the objects instead of the ones I can set in the properties window?

Yes, you must use the internal names.


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.