autodesk-forks / MaterialX

MaterialX C++ and Python libraries
http://www.materialx.org/
Apache License 2.0
107 stars 23 forks source link

LOOKDEVX-470 : Look and LookGroup management #1152

Closed bernardkwok closed 3 years ago

bernardkwok commented 3 years ago

Updates

Add in look / lookgroup management utilities

Testing

  1. Starting configuration
    <?xml version="1.0"?>
    <materialx version="1.38">
    <lookgroup name="lookgroup1" looks="look1,look2,look3,look4,look5" active="look1" />
    <look name="look1">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look2">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look3">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look4">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look5">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <!-- Copy test -->
    <lookgroup name="lookgroup1_copy" looks="look1,look2,look3,look4,look5" active="look1" />
    </materialx>
  2. Results after merging looks in "lookgroup" to produce new look "look6"
    <?xml version="1.0"?>
    <materialx version="1.38">
    <lookgroup name="lookgroup1" looks="look6" active="look6" />
    <look name="look1">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look2">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look3">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look4">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look5">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <lookgroup name="lookgroup1_copy" looks="look1,look2,look3,look4,look5" active="look1" />
    <look name="look6">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    <materialassign name="look2_matA" material="materialA" />
    <materialassign name="look2_matB" material="materialB" />
    <materialassign name="look2_matC" material="materialC" />
    <materialassign name="look3_matA" material="materialA" />
    <materialassign name="look3_matB" material="materialB" />
    <materialassign name="look3_matC" material="materialC" />
    <materialassign name="look4_matA" material="materialA" />
    <materialassign name="look4_matB" material="materialB" />
    <materialassign name="look4_matC" material="materialC" />
    <materialassign name="look5_matA" material="materialA" />
    <materialassign name="look5_matB" material="materialB" />
    <materialassign name="look5_matC" material="materialC" />
    </look>
    </materialx>
  3. Results after merging new lookgroup ("lookgroup2") with ("lookgroup1_copy").
    <?xml version="1.0"?>
    <materialx version="1.38">
    <look name="look1">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look2">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look3">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look4">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look5">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <lookgroup name="lookgroup1_copy" looks="look1,look2,look3,look4,look5" active="look1" />
    <lookgroup name="lookgroup2" looks="lookA,look1,lookC,look3,lookE" active="lookA,look3,lookE" />
    <look name="lookA">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="lookC">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="lookE">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <lookgroup name="lookgroup1_copy_merged" looks="look1, look2, look3, look4, look5, lookA, lookC, lookE" active="look1, lookA, look3, lookE" />
    </materialx>
  4. Results after trying to insert after "look2" and to look which is not found (lookgroup1_copy_merged2, and lookgroup1_copy_merged3 respectively)
    <?xml version="1.0"?>
    <materialx version="1.38">
    <look name="look1">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look2">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look3">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look4">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="look5">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <lookgroup name="lookgroup1_copy" looks="look1,look2,look3,look4,look5" active="look1" />
    <lookgroup name="lookgroup2" looks="lookA,look1,lookC,look3,lookE" active="lookA,look3,lookE" />
    <look name="lookA">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="lookC">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <look name="lookE">
    <materialassign name="matA" material="materialA" />
    <materialassign name="matB" material="materialB" />
    <materialassign name="matC" material="materialC" />
    </look>
    <lookgroup name="lookgroup1_copy_merged" looks="look1, look2, look3, look4, look5, lookA, lookC, lookE" active="look1, lookA, look3, lookE" />
    <lookgroup name="lookgroup1_copy_merged2" looks="look1, look2, lookA, lookC, lookE, look3, look4, look5" active="look1, lookA, look3, lookE" />
    <lookgroup name="lookgroup1_copy_merged3" looks="look1, look2, look3, look4, look5, lookA, lookC, lookE" active="look1, lookA, look3, lookE" />
    </materialx>