Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Operators to query shape name

6 REPLIES 6
Reply
Message 1 of 7
juls_
371 Views, 6 Replies

Operators to query shape name

Hi,

Currently I'm trying to solve the following situation:

We have some assets coming from speedtree for an environment. At the moment each of the individual shapes for all of those assets have corresponding textures with the same name. Say we have a poly shape called G_leaves_Shape we have a corresponding texture called leaves.tx.

The way we are assigning those textures currently is through userdata. We set a string userdata by stripping the G_ prefix and _Shape suffix on all shapes (they're always the same) and set the remainder (leaves) as a userdata attribute which we are then referencing in our aiImage nodes. This is however not baked in the source alembics, but rather happens in the render DCC (in this case Katana).

Now, we wanted to make use of the alembic procedural which makes time-to-first-pixel a lot faster and uses less memory. As we however do not have the needed userdata baked on the alembics I was wondering if there's any way to set the basename of a mesh node via regex with operators. name always gives me the full path (eg /root/world/geo/tree1/G_leaves/G_leaves_Shape), but I only need the basename (eg G_leaves_Shape).
From what I can tell I can strip the pre- and suffix from the name of each node with a string_replace operator already. Now I'd only need to set an arbitrary attribute referencing the shape name. Is this possible?

Also as a side question: Is there a straight forward way to bake the effect of operators to inspect the results they have in an ass file for debugging purposes?

Thanks,
Julius

Labels (4)
6 REPLIES 6
Message 2 of 7
Stephen.Blair
in reply to: juls_

Now I'd only need to set an arbitrary attribute referencing the shape name. Is this possible?

Set Parameter can set user data.

Is there a straight forward way to bake the effect of operators to inspect the results they have in an ass file for debugging purposes?

Sorry, no. That would be great, and we do have an enhancement ticket logged for that





// Stephen Blair
// Arnold Renderer Support
Message 3 of 7
juls_
in reply to: juls_

Now I'd only need to set an arbitrary attribute referencing the shape name. Is this possible?

Set Parameter can set user data.

Sorry, I think I should be more specific. I would like to set dynamic userdata with the set_parameter operator. Instead of setting the same value on all shapes in the scene, I would like to set the shape name as a userdata attribute. Is this possible?

Is there a straight forward way to bake the effect of operators to inspect the results they have in an ass file for debugging purposes?

Sorry, no. That would be great, and we do have an enhancement ticket logged for that

That's good to know, thanks for the info!

Message 4 of 7
Stephen.Blair
in reply to: juls_

If you are changing the shape name, then you could assign that parameter value to the user data.

Like in example 2 here: https://answers.arnoldrenderer.com/answers/27210/view.html


 selection "*.(@node=='polymesh')"
 assignment "string tex=name"





// Stephen Blair
// Arnold Renderer Support
Message 5 of 7
juls_
in reply to: juls_

If you are changing the shape name, then you could assign that parameter value to the user data.

Like in example 2 here: https://answers.arnoldrenderer.com/answers/27210/view.html


  1. selection "*.(@node=='polymesh')"
  2.  assignment "string tex=name"


This is great, but I was wondering if there's any way to set the basename of a mesh node via regex with operators. name always gives me the full path (eg /root/world/geo/tree1/G_leaves/G_leaves_Shape), but I only need the basename (eg G_leaves_Shape).

Message 6 of 7
Stephen.Blair
in reply to: juls_

@ To set the name? No, you'd have to use string_replace for that.

You can use regex to selection, but not for assignment.



// Stephen Blair
// Arnold Renderer Support
Message 7 of 7
juls_
in reply to: juls_

@ To set the name? No, you'd have to use string_replace for that. You can use regex to selection, but not for assignment.

That's mainly what I wanted to know, thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report