Jump to content

Can't access particle attribute at SOP level?


hopbin9

Recommended Posts

Hi,

I'm using a POP network inside my SOP, and when I use Attribute POP to create a custom attribute named "G". I can't use $G outside the POP network. The Details View clearly shows that the G attribute exists and has data. I can use other particle attributes like $ID or $LIFE.

I'm trying to use it in a Partition SOP set to Points type. So I'm trying to group points like this "group_`$G`" but it says variable not known.

I'm not sure what I'm doing wrong?

Link to comment
Share on other sites

Try creating an attribute that you name G and then set to $G, just after the pop network.

I know...it's weird... why do pops do that...some kind of data conversion thing maybe... don't even get me started on the life attribute...

Edited by Macha
Link to comment
Share on other sites

Try creating an attribute that you name G and then set to $G, just after the pop network.

I know...it's weird... why do pops do that...some kind of data conversion thing maybe... don't even get me started on the life attribute...

That totally worked!

Thanks, that's going into my next tutorial.

Link to comment
Share on other sites

Try creating an attribute that you name G and then set to $G, just after the pop network.

I know...it's weird... why do pops do that...some kind of data conversion thing maybe... don't even get me started on the life attribute...

The reason putting $G does not work is because when you create an attribute, whether your in SOPs, POPs, etc it creates a local variable to that context. But that doesnt get passed to the other contexts. All the variable is, is a way to access the data in your attribute. $G isnt the attribute, its just a pointer to the attribute 'G'.

You may notice there is a detail attribute called 'varmap'. This is the attribute which stores the variables. $ID, $LIFE, etc work because they are just standard in houdini even though, technically, they are local attributes.

instead of putting $G in there, you can also just uncheck 'Write Values' and it will create a local variable which gets stored in 'varmap' detail attribute.

Link to comment
Share on other sites

You can actually go even further.

When you middle click in a node you will see all the variables you have, they are written like this: mass -> MASS

If you put down a attribute create and set it to:

Name - varmap

Class - Detail

Type - String

You can now create any custom attribute variable typing in the String parameter, for example:

mass -> MASS

or

mass -> YOUR_OWN_CLEVER_VARIABLE :lol:

Link to comment
Share on other sites

If you put down a attribute create and set it to:

Name - varmap

Class - Detail

Type - String

You can now create any custom attribute variable typing in the String parameter, for example:

mass -> MASS

or

mass -> YOUR_OWN_CLEVER_VARIABLE :lol:

That's a very neat tip fabiano.

Any ideas on how can we have mapping for multiple attributes of different classes in one go.

Just, so that we don't have to put 10 attrib creates for 10 different attributes ?

Thanks,

Edited by vectorblur
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...