question

Julius Ihle avatar image
Julius Ihle asked ·

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

asskatanaoperatoroperators
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Julius Ihle avatar image
Julius Ihle answered ·
@ 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!

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Julius Ihle avatar image
Julius Ihle answered ·

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).

1 comment
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

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

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

0 Likes 0 ·
Stephen Blair avatar image
Stephen Blair answered ·

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"



10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Julius Ihle avatar image
Julius Ihle answered ·

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!

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

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



10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.