This mMaterial component implements parameters that are not found in the standard GH Material component and is designed to work with a companion Bake Geometry component. It can easily be extended to support more properties defined for the Material class. Nine parameters are currently supported:
Encapsulating the open source Python code inside a cluster allows two significant advantages:
The 'M' output of mMaterial is for the 'M' input of the standard Custom Preview component. It can be passed via the Data Output and Data Input components in Rhino 6. If that's all you need, you can ignore the other two.
Baking geometry, however, requires a different data type. Instead of 'Display Material' from the 'M' output, baking needs a 'Render Material' data type, which is supplied by the 'rM' output.
Unlike 'M' (Display Material), Rhino 6 Data Output and Data Input components fail to handle 'rM' (Render Material). To circumvent this obstacle, a third output was added, 'JSON', to convert mMaterial input values to text for transmission via Data Output. Subsequent Grasshopper models use these JSON values from Data Input as input to a json_M component that replicates both 'M' and 'rM', so passing it alone enables both Custom Preview and baking geometry.
See example on the Bake To Layer page.
Grasshopper: mMaterial_2020Jan30a.gh (29.4 KB)