Digital assets image path parameter

   3040   4   1
User Avatar
Member
379 posts
Joined: 12月 2006
Online
I have digital asset and inside of it I have several materials with image path, and that path has stamp in it, so I can do some variations. I am having problems with created parameter on DA so I can use their value in these image paths.
When I try to access that DA parameter with ch(“../something”) inside image path of material, on render it says that ch(“../something”) is not valid path, but not content of that parameter.

I hope I am clear enough…
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
Use chs() to reference string parameters. ch() returns floating point values.
There's at least one school like the old school!
User Avatar
Member
379 posts
Joined: 12月 2006
Online
No, that does not work either. I am constantly getting this:

mantra: Unable to load texture ‘chs(“../../books/tex_path”)’

It looks like it does not parse expression that at all …
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
I misread your question. You are trying to build an attribute on the geometry as a material override. I say divide and conquer.

Let's say you have three sequences:

$JOB/pic/sequences/sequence_0.$F4.rat
$JOB/pic/sequences/sequence_1.$F4.rat
$JOB/pic/sequences/sequence_2.$F4.rat

Create four top level parameters:

string root_path “Root Path” >>> set to $JOB/pic/sequences
string sequence_prefix “Sequence Prefix” >>> set to sequence_
string file_extension “File Extension” >>> set to rat
int number_of_sequences “Number of Sequences” >>> set to 3

You also created a variable present on the geometry, let's say $PR for the primitive number and drive this in to a new primitive attribute called “seed” with the attribute mapping $SEED. I'd make sure that seed was set to go from 0-2 driven by the top level number_of_sequences parameter.

Sort SOP to Randomize Primitives if you wish to add a seed to the mix
Attribute Create SOP >
$SEED set to >>> $PR%ch(“../number_of_sequences”)

Now you know why I start sequences from 0 instead of 1.
Makes the final expression a whole lot cleaner as well. I am anticipating that you want to drive the whole thing procedurally.

In the expression, you could do this:

`strcat( chs(“../root_path”) + “/”, chs(“../sequence_prefix”) + $SEED + “.” + $F4 + “.” + chs(“../file_extension”) )`

All this hinges on strcat() to concatenate two strings together and the ability to literally add two strings together with the + operator to build up the final correct string. I like to use strcat() to drive the whole thing.

You “could” do this too but I find it hit and miss:

`chs(“../root_path”) + “/” + chs(“../sequence_prefix”) + $SEED + “.” + $F4 + “.” + chs(“../file_extension”)`

but again hit and miss. The strcat() forces evaluation of the strings nicely.

Final check of the spreadsheet should result in a path that is correct as Mantra needs to find these images using this correct path. For example if $JOB isn't set correctly and Mantra can't expand it properly, you are hosed so best to be explicit in that case.

Hope this helps to give you some ideas as to how to solve this problem.
There's at least one school like the old school!
User Avatar
Member
379 posts
Joined: 12月 2006
Online
Thank you Jeff, this helps a lot!
  • Quick Links