I think that the idea boils down to providing better support for array attributes out of the box in HScript.
Yes, it is currently possible to use Python for that purpose, as @chrisgreb mentioned, and I'm personally fine with that, but this is not a workflow that we can promote to
artists to pass array values around.
The first step would be to make sure that setting a
string parameter with
@myattrib
(or an alternative syntax if backwards compatibility needs to be preserved) will expand all its values like Python's
join()
method does, instead of only outputting the first value as it is currently the case. We do have
@myattrib.0
if we only want to access the first value, so having it also available with
@myattrib
is redundant (in the case of
string parameters).
The second step, for convenience reasons and also to confirm the support for such a workflow out of the box, would be to provide additional methods in the
pdg.Port
class to evaluate such array parameters to what they actually represent. So if we have a
string parameter
myparam set with the value
1 2 3
, then we'd get the choice between these methods:
-
self['myparam'].evaluateStringArray(work_item)
, returning
['1', '2', '3']
.
-
self['myparam'].evaluateIntArray(work_item)
, returning
[1, 2, 3]
.
-
self['myparam'].evaluateFloatArray(work_item)
, returning
[1.0, 2.0, 3.0]
.
Note that I only mentioned string parameters until now. For integer and float parameters, the behaviour of passing @myattrib
would remain the same as it currently is, that is returning the first element only.Ideally, at the node level, we would stop hacking arrays into space-delimited string parameters and would start consistently representing arrays as multiparm blocks. The problem comes when trying to set such a multiparm with a PDG attribute representing an array. It is once again perfectly doable through setting a Python expression for the instance count but it'd be nice for
artists to be able to use something like
argc(@myattrib)
or, even better,
@myattrib.count
instead.
In the case of multiparm blocks, setting the nested parameter values in the Parameters Interface window to something like
@myattrib.#
works well out of the box, so that's great, but here again it could be more artist-friendly to have an easier way to setup such values without having to set their defaults through the Parameters Interface window, because it's not a place we should encourage
artists to interact with. An idea would be to add a right-click context menu item that'd display the list of nested parameters and that'd allow setting their values with an expression in the same way than we can already do with all other parameters.
I hope this makes sense!