AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX

Getting the value of a node def's input of type vector2array returns a string

Open
#673 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
451
Avg merge
6d 6h
Merged PRs (30d)
5

Description

Hello,

I'm not sure if I'm doing something wrong, but I think there's a small "bug" in the way the stdlib is defined.
In `stdlib_defs.mtlx`, the input values of some node defs (for instance `ND_arrayappend_vector2array_vector2array`, input `in1` are typed as `vector2array`, but if you try to to get the node def via the API, and extract the value, its type is `string`:
```cpp
// assuming node_def is the def for ND_arrayappend_vector2array_vector2array
auto in1 = node_def->getInput("in1");
auto in1_type = int1->getTypeDef()->getName(); // < this returns "vector2array"
bool is_string = in1->getValue()->isA(); // < this is true
```

I'd expect the value to be a `vector` or something else, but not a `string` (on a sidenode, in `MaterialXCore\Value.h`, I see specialization for arrays of int, bool, float and string, but not vector2, etc. so I'm not sure how I should go about to get the value of a `vector2array` input)

Is this a bug? A missing `[]` in the value in the .mtlx file? (I noticed that the outputs of type `vector2array` had the value `"[]"` while the inputs had `""`)

Regards,
Damien.

Contributor guide

Open the contributing guide

Research direction

Start with stdlib_defs.mtlx and MaterialXCore/Value.h, then reproduce the node_def->getInput("in1") and getValue() calls described in the issue. Compare the declared vector2array type with the returned value representation, and consider the issue resolved when the API behavior for vector2array inputs is consistent with their declared type and the corresponding output values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.