PDA

View Full Version : Returning the id of an item's parent nodally?



AbstractTech3D
06-28-2012, 12:05 AM
Is there a way to return the item id of an object's parent nodally - without explicitly feeding in the name of the parent?

I need to clone a number of hierarchies with nodal motion control over the children unique to each hierarchy cloned. Can't use instancing, because the hierarchies include lights (which can't be instanced).

Thanks!

RebelHill
06-28-2012, 03:33 AM
Seemingly not...

However TrueArts node library has a "clone index" output on its extended item info node, perhaps that could be used to reference the original parent item, then auto output each clone of that items ID properly. I haven't really used this node to say though... sensei?

AbstractTech3D
06-28-2012, 06:55 AM
Thanks RH. I'll try working with that idea.

RebelHill
06-28-2012, 06:58 AM
If you find a solution, post er up... be interesting to see.

Sensei
06-28-2012, 03:12 PM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_19_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_19_x64.zip

jeric_synergy
06-28-2012, 03:26 PM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_19_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_19_x64.zip
Sensei, did the library get smaller in the past couple iterations?


:thumbsup:

Sensei
06-28-2012, 03:29 PM
No...

Maybe because I started compiling with linked library LWSDK32.lib instead of adding all objects to project manually..

It's just 3 kb smaller executable.. :)

jeric_synergy
06-28-2012, 04:36 PM
I just installed the linked 64 bit one, and it was ~10,000 bytes smaller than the previously installed one.

:stumped:

Sensei
06-28-2012, 04:50 PM
In version v1.0 it'll be 1 byte length ;)

AbstractTech3D
06-28-2012, 05:41 PM
OK, thanks guys, I have found a way through. Although not quite as automated as I had hoped it to be, its not too bad.

See the attached image for the nodal setup for each child in each hierarchy. Cloning the item results in automatic distribution within the hierarchy.

Where I ran into problems was then cloning the hierarchy, since the resulting child clones within each hierarchy are not unique to the given hierarchy. (Instead, of course, they continue in consecutive numbering following on from the last cloned child within the last cloned hierarchy). So for each cloned hierarchy I found I had to delete all but 1 child clone item, rename it - which seems to effectively switch it from being a clone to a new object, then clone that new child object the desired number of times. Thereby creating clones that truly are unique to each cloned hierarchy.

I hope you can follow that!

Thanks again to DP and Sensei for their nodes making this possible.

If I could put in a request (Sensei ? / DP ?) for a node that can return the id of a parent? Would be very useful towards constructing a solution more versatile than what I've come up with.
Perhaps a node that can expose multiple other different item relationship data also, like 'target item' , 'is or is not child' etc... would be useful at times too?

(I'd write one myself if I had half an idea how to begin!)

Thanks everyone who helped!

Sensei
06-28-2012, 05:43 PM
If I could put in a request (Sensei ? / DP ?) for a node that can return the id of a parent?

What I posted 3h ago?

jeric_synergy
06-28-2012, 05:59 PM
What I posted 3h ago?
Just to save everyone some scrambling.... (see pic)

THANK YOU Sensei, 'cuz I really couldn't unscramble AbstractTech3D's explanation above, and it looked like a headache anyway. :beerchug:

(Now I'll be horrible: how about # of child items?)

(A clear demonstration of "Baker's Dilemma" as defined in my sig.)

AbstractTech3D
06-28-2012, 06:06 PM
Ah, yes, sorry Sensei.

Got it, that's really great, thanks!

Very quick work!

AbstractTech3D
06-28-2012, 06:09 PM
(Now I'll be horrible: how about # of child items?)

Actually - yes - that would also be useful!:thumbsup:

Sensei
06-28-2012, 06:11 PM
(Now I'll be horrible: how about # of child items?)


Child items can be unlimited (in theory) so Extended Item Info is not place for them.. I guess so..


Very quick work!

After 350 ml of vodka and 2 beers.. :p
Too slow.. :p

RebelHill
06-28-2012, 06:21 PM
sweet!

goal and target items!

hows about pole? sai (pos/rot/scale items)?

lol... the list could be stupidly long.

Sensei
06-28-2012, 06:25 PM
Sai?

jeric_synergy
06-28-2012, 06:34 PM
Sai?
Yeah, I never got an explanation for that either. :grumpy: :)

++
Sensei, what I was thinking was just a ordinal AMOUNT of children, not all of their i.d.s. I.E., "this item has N children".

Then, that number could be stashed somewhere useful.


BTW, god knows if I'll ever need what you've done here, but THANK YOU for doing it!

AbstractTech3D
06-28-2012, 06:35 PM
This (parent exposed) is really very useful!

Sensei
06-28-2012, 06:56 PM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_20_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_20_x64.zip
Pole item added.

RebelHill
06-29-2012, 04:47 AM
Yeah, I never got an explanation for that either.

Yes u have, I (for my part at least at least) have answered on 2 occasions in the past when you've asked after I used the term...

Sensei... its same as item, pos/rot/scale items selection. Tbh, im not usre if that'll be available in the sdk, there's no hook for it in LS... you can check goal, pole, etc there, but not sai.

thanks for the pole though.

Sensei
06-29-2012, 04:58 AM
You mean this?

LWItemInfo
[...]
LWItemID (*sameItem) (LWItemID, LWItemParam);
double (*sameItemBlend) (LWItemID, LWItemParam, LWTime);
unsigned int (*sameItemBlendMethod) (LWItemID, LWItemParam);
unsigned int (*sameItemFlags) (LWItemID, LWItemParam);


id = sameItem( item, param_type )
Returns the item's "Same As Item" item for the given parameter, or LWITEM_NULL if none set. The parameter is one of:

LWIP_POSITION
LWIP_ROTATION
LWIP_SCALING


blend = sameItemBlend( item, param_type, time )
Returns the item's "Same As Item" blending factor at a given time. The parameter is one of:

LWIP_POSITION
LWIP_ROTATION
LWIP_SCALING


method = sameItemBlendMethod( item, param_type )
Returns the item's "Same As Item" blending methoditem for the given parameter. The parameter is one of:

LWIP_POSITION
LWIP_ROTATION
LWIP_SCALING

The returned method is one of:

LWMOTCTL_SAMEITEM_INTERPOLATE
LWMOTCTL_SAMEITEM_COMPENSATE


flags = sameItemFlags( item, param_type )
Returns any flags for the item's "Same As Item" setting. The parameter is one of:

LWIP_POSITION
LWIP_ROTATION
LWIP_SCALING


The returned value is zero or more of the following bitflags:

LWMOTCTL_SAMEITEM_WORLD

jeric_synergy
06-29-2012, 08:18 AM
Yes u have, I (for my part at least at least) have answered on 2 occasions in the past when you've asked after I used the term...

Sensei... its same as item, pos/rot/scale items selection. Tbh, im not usre if that'll be available in the sdk, there's no hook for it in LS... you can check goal, pole, etc there, but not sai.

thanks for the pole though.
Well, I apologize for missing it twice.

Perhaps the derivation of the term would cement it in memory: SAI, hmm, "scale/angle/???", is it an English acronym? Or French perhaps? Seems kinda arbitrary. If it's made-up, I suggest "pros" (pronounced PROSS) as an alternative.

Sensei
06-29-2012, 08:20 AM
Same As Item (first letters) = SAI.. But where to hell is LW using it, and what for.. ? ;)

jeric_synergy
06-29-2012, 08:44 AM
Same As Item (first letters) = SAI.. But where to hell is LW using it, and what for.. ? ;)
LOL, I don't think I ever realized that was the explanation, and not just part of a sentence.

RebelHill
06-29-2012, 08:52 AM
*facepalm

Sensei - Yep... that'll be the puppy. Nice one.

Sensei
06-29-2012, 10:11 AM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_21_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_21_x64.zip

Same As Item node added.

nomad108
06-29-2012, 07:31 PM
I've got to keep following this thread just to see what Sensei comes up with! Thanks much for the plug!

jeric_synergy
06-30-2012, 09:38 AM
No love for "Number of Children" output idea?

(It just seems like it might be useful.....) :question: ;D

Sensei
06-30-2012, 09:58 AM
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_22_x32.zip
http://www.trueart.pl/Products/Plug-Ins/TrueArt%20Node%20Library/Files/TrueArt_NodeLibrary_0_22_x64.zip

jeric_synergy
06-30-2012, 01:53 PM
DUDE!!!! You are on a ROLL!

And not just "Childs" :), but w/o reading the dox, I'm guessing that "Total Childs" is the recursive count of immediate children plus all their descendents.

Many thanks, Sensei, for being so helpful to all LightWavers!

AbstractTech3D
07-01-2012, 03:45 AM
That's very cool, and very useful!

Thanks indeed Sensei!

With these tools one can easily create clone-able hierarchies over which one has independent control over each set of children based on the ID of the parent. It's really quite powerful for motion graphics work.

at least that would be my immediate use for my current project.

But I'm sure there are many more uses for these new tools!