On 14/08/2018 at 01:39, xxxxxxxx wrote:
Hi Shallow_Red, first of all, welcome in the plugin cafe community!
As Andreas explain in his previous post you have to useGetState to define your behavior.
Here is a quick plugin example which toggles the icon if there is an object selected or not.
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)
If you have any questions please, let me know 
Cheers,
Maxime!