Autodesk / sitoa

Arnold plugin for Softimage
Apache License 2.0
33 stars 16 forks source link

[Question] declare AtArray with Operator #62

Closed hollov closed 5 years ago

hollov commented 5 years ago

I have a question about operators (#19 ). @JenusL, @caron I saw you guys are actively developing this right now so I thought you might know the answer.

Is it possible to declare an AtArray parameter with operators? Yeah the MtoA docs lists the types that are available but I've found that unlisted types like 'point' and 'array' are recognized as well. My guess is that 'array' would declare an AtArray param but I can't figure out what is the proper syntax for that. It gives me the following error: missing array type! constant

Since it is not documented nor I have access to the arnold source code to figure out how 'set_parmater.assignment' is parsed I am stucked.

Btw how you guys are developing sitoa? I mean do you have access to Arnold source?

JenusL commented 5 years ago

Hi @hollov We don't have access to the Arnold source code. We only have access to the SDK like everybody else and this information is not in there. But looking at the help in MtoA docs you link to, it looks like defining arrays is possible as it's several examples of it there. Are you writing your own Arnold plugin or do you just want to know what to write in the assignment field in MtoA? If it's the later, what type of array are you trying to set? Could you share the string you are setting in set_parameter.assignment?

hollov commented 5 years ago

Hey @JenusL, Thank you for helping me.

Yep, based on the docs it is possible to declare arrays. For example vector arrays would look like this: vector[] = [[1 2 3] [4 5 6] [7 8 9]] But my guess is it won't generate an AtArray for me. AtArrays also have an nkey parameter: number of motion keys.

What I'm trying to achieve? I'd like to set texture reference object for polymeshes in an alembic procedural. I try to declare the Pref attribute on polymeshes using operators. I checked in a test .ass file that it looks like this: declare Pref varying VECTOR Pref 42 1 VECTOR 1.13375068 2.29986978 -0.797210693 0.99171114 2.29986978 -1.07597911...

So I tried to declare this as a vector[] but it didn't work (no errors messages during render but no effect in the resulting image) vector[] Pref=[[1.13375068 2.29986978 -0.797210693] [0.99171114 2.29986978 -1.07597911] ... ]

I assume that it is not working because the above is just a vector[] but I need an AtArray. As I did some experiment I've found that the keyword 'array' is also accepted in set_parameter.assignment as type declaration. My hunch says that array Pref=[...] would work but can't get through missing array type! constant error msg. I may just need to give one of the following: 'constant', 'varying', 'uniform', 'indexed' as array type. But I can't figure out the correct syntax. (varying array Pref =, array varying Pref =, array<varying> Pref =, ...)

But maybe it's not supported. I don't know since I have no info: no detailed docs, no source. I just thought you guys digged deeper than me since you are implementing this right now...

JenusL commented 5 years ago

Since Pref is already defined / built-in you should only use it's name without the type first. So this should be enough: Pref = [[1.13375068 2.29986978 -0.797210693] [0.99171114 2.29986978 -1.07597911] ... ] That is stated very clearly in the MtoA docs link you sent.

JenusL commented 5 years ago

@hollov Did you see my response above? Not sure if you got the notification when I didn't tagged your name.

JenusL commented 5 years ago

@sjannuz Could you close this please? :)

hollov commented 5 years ago

@JenusL Sorry for disappearing...

Yep, I've also tried it without type declaration. Then I get Pref is not an array error message.

Anyway we solved our problem with a workaround: we saved the Pref data in the .abc cache as a custom attribute. And MtoA's alembic procedural handles it.

But still I'm curious if it can be set with operators. But this topic not belongs here, so yeah...let's just close this. Thanks for your time ;) Cheers