Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/05/2011 at 09:21, xxxxxxxx wrote:
Is it possible to create controls in the Attribute manager with Python? I have a Python Tag that I would like to show four buttons in the Attribute manager when it is selected. But I only seem to find information about creating a GeDialog. Is there anything on creating stuff on the Attribute manager?
On 24/05/2011 at 10:22, xxxxxxxx wrote:
You need to write Ressource files. Instead of dialog, it's called a description. There are examples in the doc. Py-RoundedTube or Py-SpherifyModifier for example.
Cheers, nux
On 24/05/2011 at 10:47, xxxxxxxx wrote:
"Description resource" in the C++ SDK is probably the best source of information about this.
Here's a very simple tag with a button and some other things on it that might help:https:////sites.google.com/site/scottayersmedia/MyPythonTag.zip?attredirects=0&d=1
-ScottA
On 24/05/2011 at 13:14, xxxxxxxx wrote:
Scott, by the way: You can already use those Parameter-Ids in your Plugin*. Like: rot.x = tag[c4d.rotx] Do also always write those IDs Upparcase, as this is the standart of C4D.
*: You may sometimes have to delete the coffeesymbolscache-file.
On 24/05/2011 at 13:24, xxxxxxxx wrote:
Thank you very much. I will dissect them all
Rui Batista
On 24/05/2011 at 14:01, xxxxxxxx wrote:
Nux. The reason that file uses numeric ID's is because I use it to remind myself of both ways we can create gizmos. Using Both the .res names method, and the numeric ID method. It was just something really simple I could slap a button on to show Rui an example.
But you're right about the Case. If I give it out. I should probably not use lower case names. So I changed that. I don't want to promote bad habits.
On 25/05/2011 at 01:15, xxxxxxxx wrote:
Everything was going fine until the time I needed to check what was the button it was pressed. I assume it is done inside the Message procedure. The message procedure has the following parameters: Message(self, tag, type, data) : I placed in there:
print type print data
and only the data part seems to return something useful in the form:
{id: (1001, 8, 100000011)}
The problem is that it appears in the middle of a whole lot more data that I don't need. So, how can I extract the information of what button in being pressed? Thank you very much in advance for any reply.
On 25/05/2011 at 03:26, xxxxxxxx wrote:
Lol, same question one topic down of this one here.
I'm not at home, so i cant test it right now. It was something like _ if not data: return True id = data[0]["id"][0]_ or so.
Cheers, Niklas
On 25/05/2011 at 04:33, xxxxxxxx wrote:
I tried this:
def Message(self, tag, type, data) : if not data: return True but=data[0]['id'][0] print but return True
But I still get errors in the console:
Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message TypeError: 'NoneType' object is unsubscriptable Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message KeyError: 0 Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message KeyError: 0 Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message KeyError: 0 Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message KeyError: 0 Traceback (most recent call last) : File "'Origins.pyp'", line 26, in Message KeyError: 0
Line 26 is: but=data[0]['id'][0]
On 25/05/2011 at 06:38, xxxxxxxx wrote:
Did you also tried to change the Keys ? I'm no able to try it today.
try this to check out what returns what.
if not data: return True print data print data[0] print data[0]["id"] print data[0][0] print data[0]["id"][0] print data[0][0]["id"]
You can then just delete what raises an error.
Cheers
On 25/05/2011 at 07:22, xxxxxxxx wrote:
None of those worked out. But I'm getting somewhere by trial&error; So, what I have now is:
def Message(self, tag, type, data) :
if not type: return True if type<>18: return True print data.values()[0]
return True
And, what I get it something like:
(1001, 8, 100000011)
So, now I just need a way to extract the first number (the 1001, in this case). Any help?
On 25/05/2011 at 07:35, xxxxxxxx wrote:
I can't even determine the type of the "but" variable If it is in the format (1001, 8, 100000011), it is not an array, right? It is not a dict either, I believe. So, how can I extract the numbers from it?
On 25/05/2011 at 07:38, xxxxxxxx wrote:
Ok, it seems to be a tuple but when I print the first element with print but[0], instead of a number, I get:
<c4d.DescLevel object at 0x12902c4b0>
What I want is a number, as in... 1001 How?!?
On 25/05/2011 at 08:24, xxxxxxxx wrote:
Hi Rui, you can access this by calling but[0].id Cheers, Sebastian
On 25/05/2011 at 08:36, xxxxxxxx wrote:
YES!!! Thank you soooooo much
On 25/05/2011 at 08:54, xxxxxxxx wrote:
Did you get the button to actually work Rui? I can get other things to work like check boxes..But not Buttons:
def Message(self, tag, type, bc) : bc = tag.GetDataInstance(); if bc.GetLong(c4d.XRAY)== True: #This works print "CheckBox Enabled" if bc.GetLong(c4d.CLICK_ME)== True: #<-----This does not work!! print "Button Pushed"
Maybe I need to get and check the state of the button?
On 25/05/2011 at 09:34, xxxxxxxx wrote:
Hm I could now look it up and i used this:
def GetMessageID(data) : try: return data["id"][0].id except: return None
cheers
On 25/05/2011 at 14:09, xxxxxxxx wrote:
What I have now (and fully working) is something like this:
if not type: return True if type<>18: return True
but=data.values()[0]
if but[0].id==1001: # stuff
if but[0].id==1002: # stuff
Would this be what you need, Scott? Thank you all for the help
On 25/05/2011 at 15:14, xxxxxxxx wrote:
Yeah.. That helps a lot Rui. But it doesn't seem to work with ID names
if but[0].id==1006: print "button enabled" #<---Works if but[0].id==CLICK_ME: print "button enabled" #<---Does Not Work!
I'm sure there's a good reason for why the ID names don't work. But it's not the end of the world to have to use the ID numbers.
Where did you find this?:type<>18 I've never seen that before. And I'm wondering what it means. Is that a C4D SDK thing. Or is that something that is built into the Python language?
On 25/05/2011 at 15:43, xxxxxxxx wrote:
Actually I found out by trial&error.; I just placed a print type inside the Message procedure. I noted the values. Then I placed a:
if type==(numbers the I noted, one by one) : print data
And when I compared the type with 18, it printed out:
Not a very elegant way to find out, but it did the trick. However, I don't know what the 18 means