I added some exception handling to what I had three days ago and was pretty happy with it until I tried passing materials through Data Output/Input. I already knew that works fine for Custom Preview (Display Material) but found that I couldn’t do it with Render Materials for baking. So I resorted to exporting JSON from mMaterial and adding a json_M component to replicate both Display and Render materials from JSON via Data Input. It’s embarrassing and I’m sorry I couldn’t do it otherwise. Now three outputs from mMaterial instead of one…
Here’s the code in demo models:
demo_mMaterial_2020Jan23a.gh (40.4 KB)
demo_mMaterial_bake_to_layer_2020Jan23a.gh (50.7 KB)
STEP1_mMaterial_bake_to_layer_2020Jan22a.gh (44.1 KB)
STEP2_mMaterial_bake_to_layer_2020Jan22a.gh (18.4 KB)
And for what it’s worth, a video: