Access values of an RS material in Python?
-
Hello, hoping to write a simple script that grabs all of the values from a selected redshift material and spits them out into a JSON file so I can then import to Houdini. Finding the documentation a bit obtuse and it's not really clear to me where to read up on RS related python. Can someone lend a hand or just point me in the right direction? Thank you!
-
Hello @ryanjp,
Welcome to the Plugin Café forum and the Cinema 4D development community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our Forum and Support Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are:
- Support Procedures: Scope of Support: Lines out the things we will do and what we will not do.
- Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon.
- Forum Structure and Features: Lines out how the forum works.
- Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner.
About your First Question
We were not sure to which RS material type you are referring - Xpresso based RS material or the RS node material.
Here are informations for both:
Node API Python examples, mostly focusing on material nodes: https://github.com/PluginCafe/cinema4d_py_sdk_extended/tree/master/scripts/05_modules/node
Example for a general pattern for writing an "material converter", here at the example of mapping material models in the RS Xpresso system to the standard material model space.
https://developers.maxon.net/forum/topic/14753/script-that-converts-redshift-materials-back-to-c4d-standard-ones/20Note: In 2024 Redshift renamed all attributes in its legacy material type RS C4D Shader, with the result that the
MAPPINGS data defined in the script is incorrect now. While one can easily update the mappings, many ports are just named Color now. You either have to use IDs in the meantime or wait for the update which fixes this port naming issue.Cheers
Jana