Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft : Named value experiment #2152

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ld-kerley
Copy link
Contributor

This PR not currently in a mergable state, but is posted to help promote conversation around the recent proposals posted #2148 #2149 related to generic types and named values.

Here we see one possible implementation of the named values proposal, that offers both build time and run-time options.

Named values are added to the <typedef> elements, with the names zero, one and identity. (Note perhaps identity for a matrix should just be called one?).

There are then a number of example uses of Value:zero, Value:one etc. in place of the respective concrete values.

The cmake argument MATERIALX_BUILD_BAKE_NAMED_VALUES is used to control if the named values are baked out concretely at build time. If they are then a new tool MaterialXBuildLibrary is called that loads each mtlx file in the library and mutates the value to the concrete one, and writes the file out.

If MATERIALX_BUILD_BAKE_NAMED_VALUES is set to OFF then the data library is installed unmodified, and instead Value::getValueString() has been updated to apply the corresponding logic. This logic is only included in the library if the cmake flag is disabled.

This is only one possible route this proposal could take, but I wanted to post it as having a concrete example can make discussion easier.

…#2149).

Add 'zero' and 'one' named values to some basic types, and use those named values in some of the basic arithmetic nodes as an example.  Add build time tool to process and write out resolved values, and add support for run-time evaluation - switchable by setting MATERIALX_BUILD_BAKE_NAMED_VALUES cmake flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant