<?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[Struggling on SetParameter for OLight]]></title><description><![CDATA[<p dir="auto">Hello there!</p>
<p dir="auto">I'm starting a new TAG plugin development and I would like to affect <code>OLight</code> parameter, i.e. <code>c4d.LIGHT_COLOR</code>, but my <code>DescId</code> does not reach its target.</p>
<p dir="auto">All this is happening in <code>dataTag.Execute</code>.</p>
<p dir="auto">Here the code, and the <code>GetParameter</code> returns only <code>None</code>, which means there is something wrong...</p>
<pre><code> # TAG Execute() method
def Execute(self, tag, doc, op, bt, priority, flags):
    self.tagData = tag.GetDataInstance()
    sim_color = c4d.Vector(0) # For debug purpose, set a black color value

    if op.GetType() == c4d.Olight:
        # For debug purpose  
        print( op.GetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_COLOR, 0)), c4d.DESCFLAGS_GET_PARAM_GET ) )

        op.SetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_COLOR, 0)), sim_color, c4d.DESCFLAGS_SET_USERINTERACTION )
    
        return c4d.EXECUTIONRESULT_OK
</code></pre>
<p dir="auto">I tried different flags for <code>SetParameter</code>, but based on <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/ferdinand">@<bdi>ferdinand</bdi></a> explanation on CTrack, it seems that <code>c4d.DESCFLAGS_SET_USERINTERACTION</code> is the good one.</p>
<p dir="auto">If someone can light me up on this, that would be awesome.</p>
<p dir="auto">Cheers,<br />
Christophe</p>
]]></description><link>http://developers.maxon.net/forum/topic/14373/struggling-on-setparameter-for-olight</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 17:25:04 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/14373.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Feb 2023 17:21:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Struggling on SetParameter for OLight on Thu, 02 Feb 2023 11:22:39 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/m_adam">@<bdi>m_adam</bdi></a>,</p>
<p dir="auto">Thanks a lot for the flags, it does work as expected now.<br />
Are <code>c4d.DESCFLAGS_GET_NONE</code> and <code>c4d.DESCFLAGS_GET_0</code> similars?</p>
<p dir="auto">Cheers,<br />
Christophe.</p>
]]></description><link>http://developers.maxon.net/forum/post/70697</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/70697</guid><dc:creator><![CDATA[mocoloco]]></dc:creator><pubDate>Thu, 02 Feb 2023 11:22:39 GMT</pubDate></item><item><title><![CDATA[Reply to Struggling on SetParameter for OLight on Thu, 02 Feb 2023 09:24:35 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/mocoloco">@<bdi>mocoloco</bdi></a> for such a parameter, using the bracket operator will be more easy.<br />
Find bellow the code within a Python Scripting tag, this work as expected.</p>
<pre><code>from typing import Optional
import c4d

doc: c4d.documents.BaseDocument # The document evaluating this tag
op: c4d.BaseTag # The Python scripting tag
flags: int # c4d.EXECUTIONFLAGS
priority: int # c4d.EXECUTIONPRIORITY
tp: Optional[c4d.modules.thinkingparticles.TP_MasterSystem] # Particle system
thread: Optional[c4d.threading.BaseThread] # The thread executing this tag

def main() -&gt; None:
    obj = op.GetObject()
    previousLightColor = obj[c4d.LIGHT_COLOR]
    print(previousLightColor)
    newLightColor = c4d.Vector(0.0, 1.0, 1.9)
    obj[c4d.LIGHT_COLOR] = newLightColor
</code></pre>
<p dir="auto">But if you really want to use G/SetParameter you can do it with the code bellow. The issue with your code is that <code>DESCFLAGS_GET_PARAM_GET</code> mean to be used within the implementation to notify the system that this parameter have been already retrieved so no need to retrieve it again. So if you pass this flag as an input therefor you will have nothing in return.</p>
<pre><code>    obj = op.GetObject()
    previousLightColor = obj.GetParameter(c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), c4d.DESCFLAGS_GET_NONE)
    print(previousLightColor)
    newLightColor = c4d.Vector(0.0, 0.0, 1.9)
    obj.SetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), newLightColor, c4d.DESCFLAGS_SET_NONE )
</code></pre>
<p dir="auto">Cheers,<br />
Maxime.</p>
]]></description><link>http://developers.maxon.net/forum/post/70689</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/70689</guid><dc:creator><![CDATA[m_adam]]></dc:creator><pubDate>Thu, 02 Feb 2023 09:24:35 GMT</pubDate></item><item><title><![CDATA[Reply to Struggling on SetParameter for OLight on Wed, 01 Feb 2023 20:05:49 GMT]]></title><description><![CDATA[<p dir="auto">Little addition after looking for a solution and reading more on <code>OLight</code>, it seems that the correct data type is <code>c4d.DTYPE_VECTOR</code> instead of <code>c4d.DTYPE.COLOR</code>. But even with this I can't reach the value.</p>
<pre><code> # TAG Execute() method
def Execute(self, tag, doc, op, bt, priority, flags):
    self.tagData = tag.GetDataInstance()
    sim_color = c4d.Vector(0) # For debug purpose, set a black color value

    if op.GetType() == c4d.Olight:
        # For debug purpose  
        print( op.GetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), c4d.DESCFLAGS_GET_PARAM_GET ) )

        op.SetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), sim_color, c4d.DESCFLAGS_SET_USERINTERACTION )
    
        return c4d.EXECUTIONRESULT_OK
</code></pre>
]]></description><link>http://developers.maxon.net/forum/post/70686</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/70686</guid><dc:creator><![CDATA[mocoloco]]></dc:creator><pubDate>Wed, 01 Feb 2023 20:05:49 GMT</pubDate></item></channel></rss>