<?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[Icon Button State]]></title><description><![CDATA[<p dir="auto"><em>On 03/08/2018 at 09:25, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Is there a way to modify the state of an icon to keep the button "pressed" while at an on state?</p>
<p dir="auto">I've made a script that hides and reveals things. But I want the icon state to remain highlighted when it's either on or off. Just like how the Selection Tools and most icons do already in the UI. Is that possible with a script icon?</p>
<p dir="auto">Thanks!</p>
]]></description><link>http://developers.maxon.net/forum/topic/10898/14347_icon-button-state</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 09:41:46 GMT</lastBuildDate><atom:link href="http://developers.maxon.net/forum/topic/10898.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 Sep 2018 10:53:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Icon Button State on Sat, 01 Sep 2018 10:53:56 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 16/08/2018 at 09:00, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Maxime,</p>
<p dir="auto">Thanks for you reply, it helped a lot!</p>
<p dir="auto">What I was looking for was to return either c4d.CMD_ENABLED|c4d.CMD_VALUE when the plugin is on and c4d.CMD_ENABLED when off, and I found a way thanks to your link.</p>
<p dir="auto">Thanks again, I will try to search deeper before asking next time, but this really makes me want to crave into Python deeper.</p>
<p dir="auto">Cheers</p>
]]></description><link>http://developers.maxon.net/forum/post/55383</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55383</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:56 GMT</pubDate></item><item><title><![CDATA[Reply to Icon Button State on Sat, 01 Sep 2018 10:53:53 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 14/08/2018 at 01:39, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi Shallow_Red, first of all, welcome in the plugin cafe community!</p>
<p dir="auto">As Andreas explain in his previous post you have to use<a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.plugins/BaseData/CommandData/index.html?highlight=commanddata#CommandData.GetState" target="_blank" rel="noopener noreferrer nofollow ugc">GetState</a> to define your behavior.<br />
Here is a quick plugin example which toggles the icon if there is an object selected or not.</p>
<pre><code>import c4d
  
# Be sure to use a unique ID obtained from www.plugincafe.com
PLUGIN_ID = 1000001
  
class MyCommandDataPlugin(c4d.plugins.CommandData) :
  
    def Execute(self, doc) :
        print 'Execute'
        return True
  
    def GetState(self, doc) :
        # If we get an object selected we can click on the Icon
        if doc.GetActiveObject() :
            return c4d.CMD_ENABLED
        else:
            return False
  
  
if __name__ == "__main__":
    plugins.RegisterCommandPlugin(id=PLUGIN_ID, str="MyCommandDataPlugin",
                                  help="PMyCommandDataPlugin", info=0,
                                  dat=MyCommandDataPlugin(), icon=None)
</code></pre>
<p dir="auto">If you have any questions please, let me know <img src="http://developers.maxon.net/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=0b8ddba251d" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /><br />
Cheers,<br />
Maxime!</p>
]]></description><link>http://developers.maxon.net/forum/post/55382</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55382</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:53 GMT</pubDate></item><item><title><![CDATA[Reply to Icon Button State on Sat, 01 Sep 2018 10:53:50 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 13/08/2018 at 11:33, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hey Motion4D did you succeed?</p>
<p dir="auto">I am also trying to set a highlight toggle for a python script icon based on it's state... I managed to convert it into a plugin but can't go any further... I found a few similar topics through the web but no real solution...</p>
<p dir="auto">If you have found a way I'd be glad to know it</p>
<p dir="auto">Cheers</p>
]]></description><link>http://developers.maxon.net/forum/post/55381</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55381</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:50 GMT</pubDate></item><item><title><![CDATA[Reply to Icon Button State on Sat, 01 Sep 2018 10:53:47 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 06/08/2018 at 07:07, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Perfect! Thanks for the help Andreas</p>
]]></description><link>http://developers.maxon.net/forum/post/55380</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55380</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:47 GMT</pubDate></item><item><title><![CDATA[Reply to Icon Button State on Sat, 01 Sep 2018 10:53:44 GMT]]></title><description><![CDATA[<p dir="auto"><em>On 06/08/2018 at 02:02, <strong>xxxxxxxx</strong> wrote:</em></p>
<p dir="auto">Hi,</p>
<p dir="auto">no, currently there's no way to accomplish this for a script. But you can quite easily convert your script into a <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.plugins/BaseData/CommandData/index.html?highlight=commanddata" target="_blank" rel="noopener noreferrer nofollow ugc">CommandData</a> plugin, where you can then use the <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.plugins/BaseData/CommandData/index.html?highlight=commanddata#CommandData.GetState" target="_blank" rel="noopener noreferrer nofollow ugc">GetState()</a> function. While the conversion from a script to a CommandData is actually simple (basically the script code just goes into <a href="https://developers.maxon.net/docs/py/2023_2/modules/c4d.plugins/BaseData/CommandData/index.html?highlight=commanddata#CommandData.Execute" target="_blank" rel="noopener noreferrer nofollow ugc">Execute()</a>), you may also consider using the Script Converter from Niklas Rosenstein's quick prototyping toolset, featured on our <code>blog</code>[URL-REMOVED] a while ago.</p>
<p dir="auto">And now, that Cinema 4D R20 got announced, I can also say, that with R20 Python scripts in Script Manager will also get the ability to set the menu state.</p>
<hr />
<p dir="auto">[URL-REMOVED] <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/maxon">@<bdi>maxon</bdi></a>: This section contained a non-resolving link which has been removed.</p>
]]></description><link>http://developers.maxon.net/forum/post/55379</link><guid isPermaLink="true">http://developers.maxon.net/forum/post/55379</guid><dc:creator><![CDATA[Helper]]></dc:creator><pubDate>Sat, 01 Sep 2018 10:53:44 GMT</pubDate></item></channel></rss>