From e229cf159750eab030d8ea2f9a41e578e089a77d Mon Sep 17 00:00:00 2001 From: Chris Rydalch Date: Tue, 29 Oct 2024 17:00:20 -0500 Subject: [PATCH] Initial work on geompropvalueuniform --- libraries/bxdf/usd_preview_surface.mtlx | 18 +++++++++++++--- .../stdlib/genglsl/stdlib_genglsl_impl.mtlx | 5 ++++- .../stdlib/genmdl/stdlib_genmdl_impl.mtlx | 5 ++++- .../stdlib/genmsl/stdlib_genmsl_impl.mtlx | 5 ++++- .../mx_geompropvalueuniform_filename.osl | 5 +++++ .../genosl/mx_geompropvalueuniform_string.osl | 5 +++++ .../stdlib/genosl/stdlib_genosl_impl.mtlx | 5 ++++- libraries/stdlib/stdlib_defs.mtlx | 21 ++++++++++++++----- 8 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 libraries/stdlib/genosl/mx_geompropvalueuniform_filename.osl create mode 100644 libraries/stdlib/genosl/mx_geompropvalueuniform_string.osl diff --git a/libraries/bxdf/usd_preview_surface.mtlx b/libraries/bxdf/usd_preview_surface.mtlx index a521c756bc..f3879a4617 100644 --- a/libraries/bxdf/usd_preview_surface.mtlx +++ b/libraries/bxdf/usd_preview_surface.mtlx @@ -62,8 +62,13 @@ - - + + + + + + + @@ -363,7 +368,14 @@ - + + + + + + + + diff --git a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx index 69f8f9a7f8..34000f3933 100644 --- a/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx +++ b/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx @@ -163,7 +163,6 @@ - @@ -171,6 +170,10 @@ + + + + diff --git a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx index 51566463aa..6fc5f3dfb8 100644 --- a/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx +++ b/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx @@ -166,7 +166,6 @@ - @@ -174,6 +173,10 @@ + + + + diff --git a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx index afdfb2cfbb..c8141e066d 100644 --- a/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx +++ b/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx @@ -77,7 +77,6 @@ - @@ -85,6 +84,10 @@ + + + + diff --git a/libraries/stdlib/genosl/mx_geompropvalueuniform_filename.osl b/libraries/stdlib/genosl/mx_geompropvalueuniform_filename.osl new file mode 100644 index 0000000000..ac5e72b4c4 --- /dev/null +++ b/libraries/stdlib/genosl/mx_geompropvalueuniform_filename.osl @@ -0,0 +1,5 @@ +void mx_geompropvalueuniform_filename(string geomprop, string defaultVal, output string out) +{ + if (getattribute(geomprop, out) == 0) + out = defaultVal; +} diff --git a/libraries/stdlib/genosl/mx_geompropvalueuniform_string.osl b/libraries/stdlib/genosl/mx_geompropvalueuniform_string.osl new file mode 100644 index 0000000000..e30d9e8175 --- /dev/null +++ b/libraries/stdlib/genosl/mx_geompropvalueuniform_string.osl @@ -0,0 +1,5 @@ +void mx_geompropvalueuniform_string(string geomprop, string defaultVal, output string out) +{ + if (getattribute(geomprop, out) == 0) + out = defaultVal; +} diff --git a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx index 716e1072d7..8c06ab6668 100644 --- a/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx +++ b/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx @@ -166,7 +166,6 @@ - @@ -174,6 +173,10 @@ + + + + diff --git a/libraries/stdlib/stdlib_defs.mtlx b/libraries/stdlib/stdlib_defs.mtlx index 943e36ec88..4fdcf36b2e 100644 --- a/libraries/stdlib/stdlib_defs.mtlx +++ b/libraries/stdlib/stdlib_defs.mtlx @@ -1306,11 +1306,6 @@ - - - - - @@ -1342,6 +1337,22 @@ + + + + + + + + + + + + +