SOLVED Attribute Error when accessing Redshift parameters

Hi there,

I am trying to read out parameteres from a redshift material. I can drag parameters from the graph view attribute window to the python console which shows me the desciption ids and after hitting enter on the keyboard their values. (Getting the desc IDs by code is no problem as well, this is not the point)

For example I can drag the diffuse color if a "RS Material" node into the console which shows

>>> RSMaterial[c4d.REDSHIFT_SHADER_MATERIAL_DIFFUSE_COLOR]

and the vector value of the color after hitting enter.

So basic so good.

But I noticed his does not work for every parameter. If I take a "RS Color Abs" node and drag the color of that, I get the Desc Id as well. But after hitting enter an

AttributeError: Parameter value not accessible (object unknown in Python)

which seems odd as this should just be a Vector as well.

Does anyone have an idea how to get this exact parameter value?

Cheers,
David

Damn. After poking around and trying stuff for some time I found the answer right after posting this.

You can right click on the parameter, choose "Userinterface" > "Show Subchannels". This will show that the paramter has some subparameters. Don't know what this is about. But dragging this into the attribute manager does work.

Damn. After poking around and trying stuff for some time I found the answer right after posting this.

You can right click on the parameter, choose "Userinterface" > "Show Subchannels". This will show that the paramter has some subparameters. Don't know what this is about. But dragging this into the attribute manager does work.

Hello @davidweidemann,

Thank you for reaching out to us and solving your own question :). To give a bit of background information, parameters can be composed in Cinema 4D. The simplest example is a parameter of type c4d.Vector. You can access the relative position of an object like this:

>>> Cube[c4d.ID_BASEOBJECT_REL_POSITION]
Vector(0, 0, 0)

But as users might want to access and animate the components of that vector individually, the vector is dealt with and represented as a parameter actually as a set of sub-channels, one for each of its components.

>>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X]
0.0
>>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]
0.0
>>> Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Z]
0.0
>>> 

This is why DescId are composed out of up to three DescLevel. To access the component of a vector you need two DescLevel, e.g., c4d.ID_BASEOBJECT_REL_POSITION and c4d.VECTOR_X.

And while you might not be able to deal with the enclosing parameter, you might be able to deal with its subchannels. The input and output ports of an RSColorAbs Redshift node are of type RsColorAlpha, a parameter type that is composed of a Vector and a float, so it is effectively a four-component vector. This parameter type is not exposed to the Python API, so the API has no clue what to do with it. But it can deal with the subchannels.

# Python has no clue about that parameter type at REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT.
>>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT]
Traceback (most recent call last):
  File "console", line 1, in <module>
AttributeError: Parameter value not accessible (object unknown in Python)

# But we can access the subchannels which are standard types. This is a two DescLevel access
>>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT,c4d.REDSHIFT_COLORALPHA_COLOR]
Vector(0, 0, 0)

# We can even reach into the subchannels of a subchannel, here for example to access the red
# component of the RGBA vector tuple that is represented by the type RsColorAlpha.
>>> RSColorAbs[c4d.REDSHIFT_SHADER_RSMATHABSCOLOR_INPUT,c4d.REDSHIFT_COLORALPHA_COLOR, c4d.VECTOR_X]
0.0

Cheers,
Ferdinand