Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 nameszero
,one
andidentity
. (Note perhapsidentity
for a matrix should just be calledone
?).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 toolMaterialXBuildLibrary
is called that loads eachmtlx
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 toOFF
then the data library is installed unmodified, and insteadValue::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.