Multi-Buttons with Python
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 14:32, xxxxxxxx wrote:
First, if you want to fo this, you must *not* return if no "id" is given, because the id is only available if a button is pressed. Just leave the line with "if not id: return" out.
To check if Option 2 is enabled:
if op[c4d.MULTIBUTTON] == c4d.MULTI_TWO: print "Option Two is enabled"
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 15:02, xxxxxxxx wrote:
Did you try to use that on my example?
That doesn't seem to work for me.
Neither does using the numeric id's and the tag as the owner:if tag[1008] == 1010: print "Option Two is enabled"
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 15:05, xxxxxxxx wrote:
Yes, it worked for me.
Did you delete
if not id: return
?
PS: in your example, the tag is "op" and not "tag" ^^
/edit:
mom, I'll upload the corrected Message method/edit:
Here it is.def Message(self, op, type, data) : doc = op.GetDocument() id = GetMessageID(data) # calls to the custom GetMessage() method # #### if not id: return True # Error handling if id == c4d.CLICK_ONE: # If this Gizmo is activated #Do Something print "Button1 was Clicked" if id == c4d.CLICK_TWO: # If this Gizmo is activated #Do Something print "Button2 was Clicked" if op[c4d.MULTIBUTTON] == c4d.MULTI_TWO: print "Option 2 is selected." return True
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 15:26, xxxxxxxx wrote:
Weird.
It doesn't work for me.Not only that. I cannot use the long id names without getting definition errors.
I have to use the numerical ones to get it to run.We both have the same code so I can't imagine why we're getting such different results.
I must be doing something really stupid.
-ScottA -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 15:32, xxxxxxxx wrote:
DOH!
DOH!
DOH!
DOH!I forgot to delete my coffeesymbolcache file!!!!
DOH!
DOH!
DOH!Thanks for the help
-ScottA -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 16:14, xxxxxxxx wrote:
My favorite .pyp
from os import remove path = r"C:\Users\niklas\AppData\Roaming\MAXON\Cinema 4D R 12 Studio_6463D359\prefs\coffeesymbolcache" remove(path)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 17:26, xxxxxxxx wrote:
It's too bad that there's no way to run scripts automatically when C4D launches and/or closes (or is there?).
I've got a book on Windows OS programming that I keep meaning to read. But haven't had the time.
Maybe I can write my own launcher program that kills that file first..Then opens the c4d .exe file.
It seems like something that shouldn't be that hard to do.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 20:04, xxxxxxxx wrote:
I figured out how to create a .bat file that will do two things
1- Delete the coffeesysmbolschache file
2- Launch Cinema4DThis batch file can be used to launch C4D without worrying about that pesky cache file.
No more cache file headaches.I'm willing to share how to do this. But this is potentially DANGEROUS!!!!
Deleted files with a .bat file DO NOT COME BACK!!! So be VERY careful with this!!!Create this code in a plain text file with no formatting:
@echo off del "The path to your coffeesymbolscache file goes here" /Q/S >nul start "\" "The path to your cinema 4d.exe file goes here" "\"
When you're done setting your paths. Save the file as "whatever name you like.bat"
When you double click on it. It will delete the cache file and launch Cinema 4D.Please be careful with this one.
Make sure your paths are right when using the del option.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2011 at 23:36, xxxxxxxx wrote:
Originally posted by xxxxxxxx
It's too bad that there's no way to run scripts automatically when C4D launches and/or closes (or is there?).
Didn't you recognize my previous post ?
Originally posted by xxxxxxxx
My favorite .pyp
from os import remove path = r"C:\Users\niklas\AppData\Roaming\MAXON\Cinema 4D R 12 Studio_6463D359\prefs\coffeesymbolcache" remove(path)
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 07:17, xxxxxxxx wrote:
You never said that it runs automatically at start up.
That's good to know.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 07:19, xxxxxxxx wrote:
I thought you will recognize it. ^^
If you think a bit about it, you will notice that a .pyp file *must* be executed at startup. Or when do you want your plugin to be registered if not at startup ?Cheers
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 07:59, xxxxxxxx wrote:
I was hoping that this might possibly be a way to change some of the C4D interface options when C4D starts up.
I just started looking into this:
from os import remove import os import time import c4d from c4d import gui, utils start = time.time() if start > 1300000000: gui.MessageDialog("Welcome") path = r"C:\Users\user\AppData\Roaming\MAXON\CINEMA 4D R12 Demo_0E6F67AE\prefs\coffeesymbolcache" remove(path)
The timer function isn't working properly in this example.
But hopefully you should get the idea what I'm trying to do with it.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 08:35, xxxxxxxx wrote:
From the docs:
Can I execute code on startup of CINEMA 4D?
In some cases it might be necessary that you need to execute Python code on startup of CINEMA 4D before any other Python stuff is loaded. In this case, go to the user folder of CINEMA 4D and create a file in the python prefs {USER_FOLDER}/prefs/python/.
_
_
> > python_init.py Autostart Python Code. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 08:59, xxxxxxxx wrote:
Thanks for the heads up.
I'll give it a try.-ScottA
Edit:
The problem I'm running into is that this python file runs before C4D has finished loading. So it doesn't accept the code in it.For example:
If I wanted the UI to load with the scale tool active. And I put c4d.CallCommand(200000089) in the file. It doesn't work because the python file is trying to execute that command before C4D has finished loading.I was wondering if this kind of thing was possible to do?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 09:39, xxxxxxxx wrote:
No, this is not possible. Btw, opening GUI is blocked on startup.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 09:49, xxxxxxxx wrote:
Sorry to hear that.
But thanks for the help.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 10:27, xxxxxxxx wrote:
Haha, I already found a workaround some time ago.
I wanted to insert an object into the document on c4d start up. But it didn't work. I found out that the active document on startup isnt the same as when c4d has finished loading.So what to do ? Start a Thread on C4D startup that compares the current document with the document you got when the thread actually started within a while-loop.
If the document is not the same, C4D did finish loading.
Cheers,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 10:37, xxxxxxxx wrote:
Do you have an example of this?
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 10:50, xxxxxxxx wrote:
Of course, you should now me now ;-D
Cheers,
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/06/2011 at 10:52, xxxxxxxx wrote:
Why don't you use the template.c4d? This file is loaded on startup