On 02/05/2017 at 06:16, xxxxxxxx wrote:
sometimes I use the Script log to see what a command syntax looks like, and usually fail to create a Python script out of it.
For example, using:
turns the "Create New object at View Center" on and off.
How would I create a script that toggles between states, with the icon being Active (blue) when it's on and grey when it's off?
just pasting the code in a script gives me an error:
Traceback (most recent call last) :
File "'scriptmanager'", line 11, in <module>
File "'scriptmanager'", line 7, in main
NameError: global name 'prefs' is not defined
On 02/05/2017 at 07:00, xxxxxxxx wrote:
def main() :
interface = c4d.plugins.FindPlugin(465001620, c4d.PLUGINTYPE_PREFS)
interface[c4d.PREF_INTERFACE_CENTEROBJECT] = not bool(interface[c4d.PREF_INTERFACE_CENTEROBJECT]) #toogle
For the state take a look at my video here (in french) https://vimeo.com/190940660.
Or look at this post where you have everything you need for doing it https://plugincafe.maxon.net/topic/423/13564_plugins-in-plugin-or-icons&PID=53811#53811
Btw I wanted to say a big thank you!
You are one of the guy who inspire me about doing pythonic stuff. So thanks for your love of c4d and all your share !
On 02/05/2017 at 10:09, xxxxxxxx wrote:
Thank you so much for your help.
I was trying to help out a user on CG Society.
I'm going to post your script alongside another solution.
Also, I'm glad I could inspire you to push the limits of C4D... keep up the great work!