<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Controlling Shader with Userdata]]></title><description><![CDATA[<p dir="auto">Hey,</p>
<p dir="auto">I'm trying to control a shader from some userdata but I keep getting this error:</p>
<p dir="auto">Traceback (most recent call last):<br />
File "'Python'", line 6, in main<br />
AttributeError: parameter access failed</p>
<p dir="auto">I'm not sure what I'm missing here.</p>
<p dir="auto"><a href="https://www.dropbox.com/s/0pvpjbiiofqdwg5/LinkShader_Py.c4d?dl=0" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.dropbox.com/s/0pvpjbiiofqdwg5/LinkShader_Py.c4d?dl=0</a></p>
<pre><code>import c4d


def main():
    ShaderOb = op[c4d.ID_USERDATA,3]
    ShaderOp = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_SHADER]
    ChannOp = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_CHANNELSELECT]
    
    
    ShaderOb[c4d.ID_MG_SHADER_SHADER] = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_SHADER]
    ShaderOb[c4d.ID_MG_SHADER_CHANNELSELECT] = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_CHANNELSELECT]
</code></pre>
]]></description><link>http://developers.maxon.net/forum//topic/11008/controlling-shader-with-userdata</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 10:20:30 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum//topic/11008.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Sep 2018 17:26:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Controlling Shader with Userdata on Sat, 22 Sep 2018 01:34:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a> I've run into the copy/paste UserData bug a few times. Glad it's been reported!</p>
]]></description><link>http://developers.maxon.net/forum//post/55783</link><guid isPermaLink="true">http://developers.maxon.net/forum//post/55783</guid><dc:creator><![CDATA[dskeithbuck]]></dc:creator><pubDate>Sat, 22 Sep 2018 01:34:16 GMT</pubDate></item><item><title><![CDATA[Reply to Controlling Shader with Userdata on Fri, 21 Sep 2018 10:19:15 GMT]]></title><description><![CDATA[<p dir="auto">Yes, the issue comes from the fact you have created user data by Copying User Data interface from the shader interface (nothing wrong here).<br />
But when you copy and paste user data Interface due to a bug, the previous ID is kept and used when drag and dropping this parameter.</p>
]]></description><link>http://developers.maxon.net/forum//post/55778</link><guid isPermaLink="true">http://developers.maxon.net/forum//post/55778</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Fri, 21 Sep 2018 10:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to Controlling Shader with Userdata on Fri, 21 Sep 2018 00:29:14 GMT]]></title><description><![CDATA[<p dir="auto">Thank you m_adam that works perfectly now. Is that bug in all versions of cinema?</p>
]]></description><link>http://developers.maxon.net/forum//post/55776</link><guid isPermaLink="true">http://developers.maxon.net/forum//post/55776</guid><dc:creator><![CDATA[bencaires]]></dc:creator><pubDate>Fri, 21 Sep 2018 00:29:14 GMT</pubDate></item><item><title><![CDATA[Reply to Controlling Shader with Userdata on Wed, 19 Sep 2018 09:45:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi Bencaires,</p>
<p dir="auto">I can confirm there is a bug in C4D when you drag and drop a user data parameter into the console from your scene, the wrong ID is written.<br />
With that's said if you open the User Data Manager (In the description of an object, in the top menu, User Data =&gt; Manage User Data ...). Select your User Data parameter then below the name/short name you get the actual ID of this parameter.</p>
<p dir="auto">So in your case, if you write the correct ID, your script is working nicely.</p>
<pre><code>import c4d

def main():
	ShaderOb = op[c4d.ID_USERDATA, 3]
	ShaderOp = op[c4d.ID_USERDATA, 10]
	ChannOp = op[c4d.ID_USERDATA, 2]
	
	ShaderOb[c4d.ID_MG_SHADER_SHADER] = op[c4d.ID_USERDATA, 10]
	ShaderOb[c4d.ID_MG_SHADER_CHANNELSELECT] = op[c4d.ID_USERDATA, 2]
</code></pre>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum//post/55755</link><guid isPermaLink="true">http://developers.maxon.net/forum//post/55755</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Wed, 19 Sep 2018 09:45:24 GMT</pubDate></item></channel></rss>