PDA

View Full Version : Nodes: Native Item ID# retrieval? -- 2 questions



jeric_synergy
06-14-2012, 01:41 PM
TrueArts' Node Pack has the Extended Item Info node which allows users to specify/extract/retrieve the Item ID#, manually.

Two questions:

1) Is there a Newtek native node that allows one to access the Item ID#? (I was surprised the native "Item Info" does not allow this.)

2) Is there an automatic method to extract a CLONE'S ID#, to allow the user to specify different Surface attributes depending on the Clone's object id? So, even though all the clones are sharing the same Surface, each gets colored (for example) differently?

Thanks.
+++
++++
The pictured network did NOT work... :grumpy:

RebelHill
06-14-2012, 03:01 PM
If those are clones and not instances, why would u think to use the instance info node? So far as I know, there's no node that delivers each objects layout ID/number, and this colouring trick you're trying is only good with instances, not clones.

jeric_synergy
06-14-2012, 03:51 PM
Well, y'know, cuz I'm an idiot. At the time, I was just thinking "clones=instances". Now, I've learned better.

In fact, I got it working. But, that raised some other questions about TrueArt's Extended Item Info Node's outputs.

Regardez ley zjhaypeque. In fact, it would appear that DPKit's (?) Item Info node will output a clone's proper ID#. Hurrah! But the 3 circled outputs on TruArt's Extended Item Info, when swapped into the same input that DPKit's Item Info node is feeding, does not work, it would seem because it has no "SELF" option.

If you feed DPKit's Item ID output to TrueArt's EII "Item" input, you get the "rainbow objects" effect pictured, but each of the 3 outputs results in coloring the clones with a different colors, starting at a different point in the gradient cycle. That is, "Item", "Item Index", and "Clone Index" are all outputting different values. "Item" just replicates the "Item" input --no surprise there. (Clone Index doesn't seem to be covered in the online dox I found.) I'm not sure why ITEM and ITEM INDEX differ.

If TA's EII node had a "Self" setting, it'd probably work.

This all may be self-evident to you, but not so much to me.

Since I think this "Gradient Rainbow" node would be handy, I include it here (attached). It's purty.

EDIT: uploaded wrong jpg before. Fixed now.

jeric_synergy
06-14-2012, 08:35 PM
see this thread for solution:

http://forums.newtek.com/showthread.php?p=1250529#post1250529

Sensei
06-15-2012, 08:43 AM
TrueArt's Node Library is using perfect LWItemID the one that's in LWSDK without any modifications..

DPont's is probably removing item type from it (just guessing), it's in the most important bits, and informs whether it's object, light or camera. Or maybe LightWolf was doing so, one of them or both..

So you should not mix them without carefully debugging. Connecting incorrect such important parameter to function which won't check true existence of item might result in crash.

Anyway you can see LWItemID in text editor after loading lws file. Search for LoadObjectLayer, AddLight, AddCamera etc. rows..

Sensei
06-15-2012, 09:00 AM
In fact, I got it working. But, that raised some other questions about TrueArt's Extended Item Info Node's outputs.

Regardez ley zjhaypeque. In fact, it would appear that DPKit's (?) Item Info node will output a clone's proper ID#. Hurrah! But the 3 circled outputs on TruArt's Extended Item Info, when swapped into the same input that DPKit's Item Info node is feeding, does not work, it would seem because it has no "SELF" option.

If you feed DPKit's Item ID output to TrueArt's EII "Item" input, you get the "rainbow objects" effect pictured, but each of the 3 outputs results in coloring the clones with a different colors, starting at a different point in the gradient cycle. That is, "Item", "Item Index", and "Clone Index" are all outputting different values. "Item" just replicates the "Item" input --no surprise there. (Clone Index doesn't seem to be covered in the online dox I found.) I'm not sure why ITEM and ITEM INDEX differ.

If TA's EII node had a "Self" setting, it'd probably work.


It works too, but you have to give something for Extended Item Info to work with ;)

http://forums.newtek.com/attachment.php?attachmentid=105107&stc=1&d=1339772268

jeric_synergy
06-15-2012, 10:29 AM
Thanks Sensei.

Something you said: Do you mean that Item ID has some bits embedded in it that convey the Item (type), that some nodes may forward and others may not (while using the "Item ID" label)??

Sorry if this is a bit incoherent-- a little under the weather today.
++

BTW, the dox on your website for Extended Item Info seem to be using an image from a previous version of EII, in that the image doesn't have the the Clone Index output.

Sensei
06-15-2012, 10:52 AM
Something you said: Do you mean that Item ID has some bits embedded in it that convey the Item (type), that some nodes may forward and others may not (while using the "Item ID" label)??

YES.

4 the most important bits- 28..31

The first object in scene has id 0x10000000
so in decimal it is 268435456 (2 to power 28)

See how Gradient would have to be set up to take it into account:
http://forums.newtek.com/attachment.php?attachmentid=105109&stc=1&d=1339778819

So, Dpont or LightWolf or both, decided to cut off item type bits..
But I didn't because I planned to use LWItemID in other nodes as input.



BTW, the dox on your website for Extended Item Info seem to be using an image from a previous version of EII, in that the image doesn't have the the Clone Index output.

Older version of Node Library. It's 5 years old after all..

evolross
11-01-2012, 06:09 PM
Well, y'know, cuz I'm an idiot. At the time, I was just thinking "clones=instances". Now, I've learned better.

In fact, I got it working. But, that raised some other questions about TrueArt's Extended Item Info Node's outputs.

Regardez ley zjhaypeque. In fact, it would appear that DPKit's (?) Item Info node will output a clone's proper ID#. Hurrah! But the 3 circled outputs on TruArt's Extended Item Info, when swapped into the same input that DPKit's Item Info node is feeding, does not work, it would seem because it has no "SELF" option.

If you feed DPKit's Item ID output to TrueArt's EII "Item" input, you get the "rainbow objects" effect pictured, but each of the 3 outputs results in coloring the clones with a different colors, starting at a different point in the gradient cycle. That is, "Item", "Item Index", and "Clone Index" are all outputting different values. "Item" just replicates the "Item" input --no surprise there. (Clone Index doesn't seem to be covered in the online dox I found.) I'm not sure why ITEM and ITEM INDEX differ.

If TA's EII node had a "Self" setting, it'd probably work.

This all may be self-evident to you, but not so much to me.

Since I think this "Gradient Rainbow" node would be handy, I include it here (attached). It's purty.

EDIT: uploaded wrong jpg before. Fixed now.
This works, but is there a way to filter out the nulls and other objects in the scene? It seems like kind of a guessing game in order to set each clone with the intended color.

jeric_synergy
11-01-2012, 06:20 PM
This works, but is there a way to filter out the nulls and other objects in the scene? It seems like kind of a guessing game in order to set each clone with the intended color.
Beats me, I don't even remember this thread. (Yikes! Five months and my memory is blank.)
I think the best thing is randomly assign super obnoxious colors, note 'em down, and then adjust the desired objects by referencing your notes. If I understand your question, all the ID's have to be in there for the UI to make sense.

Are you wanting just cloned items to show up?? That'd be convenient, fer sure, save a lot of confusion for this case.

evolross
11-01-2012, 06:59 PM
I mean if you have like twenty objects (including nulls) in your scene and five of those are the same cloned object that you want to color differently using the above method. The problem is the other fifteen items get mixed in LW's internal Item ID count, especially if you have nulls for parenting/controlling. So you end up having to set up a gradient with twenty different keys in it in order to figure out EXACTLY what the IDs are of just the five clones so that you can color them. There isn't some way in LW to determine an object's ID number is there?

Sensei
11-01-2012, 07:01 PM
Clone Index in Extended Item Info is analyzing digits in item name, so I don't know what you are saying.. Don't use ItemID if you want clone index, it won't work. Like you noticed.

Sensei
11-01-2012, 07:04 PM
How to color clones video tutorial is here
https://www.youtube.com/watch?v=QJHSPseh8hU

jeric_synergy
11-01-2012, 07:14 PM
There isn't some way in LW to determine an object's ID number is there?
How about Item Info>>Input Spy? (Yes, should be easier....)

But Sensei is correct: if it's a Clone, the Clone index should be straightforward.

jeric_synergy
11-01-2012, 07:21 PM
I mean if you have like twenty objects (including nulls) in your scene and five of those are the same cloned object that you want to color differently using the above method. The problem is the other fifteen items get mixed in LW's internal Item ID count, especially if you have nulls for parenting/controlling.
Here ya go, with a big push from Sensei....

http://forums.newtek.com/showthread.php?128792-TrueArt-Extended-Item-Info-clone-index&p=1250529#post1250529

evolross
11-01-2012, 07:22 PM
How to color clones video tutorial is here
https://www.youtube.com/watch?v=QJHSPseh8hU
Ah yes... this is much easier. Thanks Sensei. I wish I would have known about this in the past... would have saved a lot of duplicated objects and long scene load times! :)

Sensei
11-01-2012, 07:27 PM
You would know if you would be subscribed to mine YouTube channel.. :p

jameswillmott
11-01-2012, 07:54 PM
TrueArts' Node Pack has the Extended Item Info node which allows users to specify/extract/retrieve the Item ID#, manually.

Two questions:

1) Is there a Newtek native node that allows one to access the Item ID#? (I was surprised the native "Item Info" does not allow this.)

2) Is there an automatic method to extract a CLONE'S ID#, to allow the user to specify different Surface attributes depending on the Clone's object id? So, even though all the clones are sharing the same Surface, each gets colored (for example) differently?

Thanks.
+++
++++
The pictured network did NOT work... :grumpy:

The node network DOES work, your gradient has to be set to repeat.

The output you've used uses the actual ObjectID, which for objects starts at 0x010000000. ( 268435456 )

jameswillmott
11-01-2012, 07:59 PM
If those are clones and not instances, why would u think to use the instance info node? So far as I know, there's no node that delivers each objects layout ID/number, and this colouring trick you're trying is only good with instances, not clones.

The InstanceID outputs the ObjectID if it's being evaluated as part of an object, or the actual instance id if being evaluated as part of an instance. So it works just fine for clones, you just have to take into account that LW objects IDs start at 268435456 for the first object added to the scene.

Sensei
11-01-2012, 08:15 PM
One info that has not been said ever-

When you're using ItemID that's direct LWSDK ID (with 28-31 bits used - for item type) you can plug it to Math > Scalar > Mod (modulo - the rest of dividing) and enter second value f.e. 256 (it must be power of 2 f.e. 2,4,8,16,32 etc. etc.) it will act like bit wise AND operator clearing all higher bits, leaving just straight lower bits - so Mod 256 will return bits 0-7, and 8-31 will be 0. And item type bits will be gone. And it can be directly plugged to Gradient.

jeric_synergy
11-01-2012, 09:42 PM
One info that has not been said ever-

When you're using ItemID that's direct LWSDK ID (with 28-31 bits used - for item type) you can plug it to Math > Scalar > Mod (modulo - the rest of dividing) and enter second value f.e. 256 (it must be power of 2 f.e. 2,4,8,16,32 etc. etc.) it will act like bit wise AND operator clearing all higher bits, leaving just straight lower bits - so Mod 256 will return bits 0-7, and 8-31 will be 0. And item type bits will be gone. And it can be directly plugged to Gradient.
That was worth repeating. Slick.

So, I've kinda lost track (hey, it's been five months....) : you'd want to do this ....when? :stumped: {{REREAD}} Ahhhh, so like you'd use this to clear out the upper order bits to use the ID# in a (reasonable) Gradient, right?


+

The InstanceID outputs the ObjectID if it's being evaluated as part of an object, or the actual instance id if being evaluated as part of an instance. So it works just fine for clones, you just have to take into account that LW objects IDs start at 268435456 for the first object added to the scene.
Dang, that's quite a stumbling block. Is that well known?

jameswillmott
11-01-2012, 10:01 PM
Dang, that's quite a stumbling block. Is that well known?

I don't think so.

The question should be asked, should the output be 'normalized' to something reasonable ( essentially automating Sensei's bitmasking trick ) or should it be left as the raw ID?

If it remains the raw ID it could be used to drive other nodes in a similar way Sensei's nodes do ( but that we don't actually have inputs for yet ) But if it's a sensible index it would make gradients simpler to set up ( although using the Fixed Random output instead of the raw ID is better for driving gradients )...

jeric_synergy
11-01-2012, 11:05 PM
I don't think so.

The question should be asked, should the output be 'normalized' to something reasonable ( essentially automating Sensei's bitmasking trick ) or should it be left as the raw ID?

Another option is to add more outputs: or maybe put a switch in the.... what are we calling the panel that opens when one double-clicks? That thing. So, there could be radio buttons for



[_] Raw ID#
[X] Normalized ID#

like that. Any other logical options?

dwburman
11-04-2012, 02:33 PM
I think I'd rather see a "Normalize" checkbox, although perhaps just an additional output would be quicker and lees confusing. This would be like the 'normal' and 'smoothed normal' outputs on the spot info node.



Another option is 0to add more outputs: or maybe put a switch in the.... what are we calling the panel that opens when one double-clicks? That thing. So, there could be radio buttons for



[_] Raw ID#
[X] Normalized ID#

like that. Any other logical options?

jeric_synergy
11-04-2012, 04:26 PM
One thing, in the side panel, the actual Raw ID# and the Normalized ID# could both be displayed, simultaneously, to lessen confusion and aid in debugging.

Less hidden info.