Enable / disable / hide User Controls
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 12:29, xxxxxxxx wrote:
@tca, ingvar, Yannick:
I can't get the parent-call to work. (I've never needed it, so I didn't know it doesn't work until now) I guess it's just a bug in the Py4D API. Yannick or Sebastian should be able to give us more information.
If the official support does not have a solution for the parent-call, I'd suggest just to ignore the advice in the SDK and return False instead of the return-value of the parent-call.def GetDEnabling(self, node, id, t_data, flags, itemdesc) : rid = id[0].id if rid == c4d.MYTAG_VALUE: # ... return False elif rid == ...: # ... return True return False
-Nik
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 12:29, xxxxxxxx wrote:
@Lennart
_> Ingvar you will soon learn that coding for Cinema is not a walk in the park.
_ Which is illustrated by this:
"Maxon for heavens sake, give a -working- example."When Maxon cannot do it right themselves, I somehow accept that I myself have problems.. I am asking myself to what extent it is my way of thinking, to what extent the documentation is written in an unusal way and so forth. But I am starting to realize that the way the docs are laid out is unusal to me, and that this is part of the source of my problems. I spend waaaaaaaaay too much time carrying out even the simplest tasks. So it is partly bad or even wrong documentation, and partly me that is not familiar with the way it is documented.
And I have written plugins before. I wrote several for Sony Vegas, the video NLE. What a breeze! The SDK has a full list of Classes, their properties, their methods and mostly everything works on the first or second attempt. Ok, sleeves up, I must get used to the docs. But I often feel like blind folded, tapping around in the dakrness..
And if you want C4D to crash - I mean really crash, you can do this:
def GetDEnabling(self, node, id, t_data, flags, itemdesc) :
if(id == 1003) :
Return False
:)))
-Ingvar -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 12:38, xxxxxxxx wrote:
Nik,
how do you do this:
c4d.MYTAG_VALUE:I have never gotten this to work.
I must redefine MYTAG_VALUE in the pyp file.
I often see the c4d.XXXX. What does it mean, and how do you do it?
Another question:
Is it possible to disable a whole group using Python? (With several user controls)
I see that C4D can do it, with the built in controls.
-Ingvar -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 12:38, xxxxxxxx wrote:
@ingvar:
I totally agree with you. Once I started with Py4D, I had experience with COFFEE so it wasn't that hard, because I did already understand the principles of c4d. I've never written any code before COFFEE, but I think it is even harder for people that are already used to something else, especially something better else.To your "crashy" code: Why should this crash Cinema 4D? ^^ IMHO the easiest way to crash it, is this:
op.InsertUnder(op)
or even
import types types.FunctionType(types.CodeType(0, 0, 0, 0, "KABOOM", (), (), (), "", "", 0, ""), {})()
That even works for every Python Interpreter
edit :
This only works for descriptions, not for dialogs. When C4D detects a new plugin, it recomputes the "symbolcache". But if you later add new symbols to your description, it might happen that C4D does not add them to the "symbolcache". [citation needed, information out of experience]
You can delete the file under %appdata%/MAXON/Cinema 4D RXX/prefs/symbolcachce to fix this. Note that it's called coffeesymbolcache under R12.Hm, I don't know actually. Only when Cinema 4D asks you about the group in GetDEnabling. Otherwise, you'd have to figure out what ID's are in the group you'd like to disable.
The whole GetDEnabling thingy is a little overcomplicate, imho. Why not just make something like SetDEnabling(id, status)?! Just like Enable() of the GeDialog class..-Nik
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 13:07, xxxxxxxx wrote:
Nik,
_> You can delete the file under _
Worked! Thank you!
> Only when Cinema 4D asks you about the group in GetDEnabling
Unfortunately it does not. Groups are not iterated, only user controls.
> The whole GetDEnabling thingy is a little overcomplicate
Probably prepared for a more complicate future..
Lots of things seem overcomplicated to me..
-Ingvar -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/07/2012 at 13:37, xxxxxxxx wrote:
Thanks Niklas for checking.
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/07/2012 at 01:29, xxxxxxxx wrote:
Originally posted by xxxxxxxx
The whole GetDEnabling thingy is a little overcomplicate, imho. Why not just make something like SetDEnabling(id, status)?! Just like Enable() of the GeDialog class..-Nik
My guess is that a lot of the SDK is ancient and comes from early versions of Cinema. To rewrite it now would be a gigantic task because this goes right to the core of Cinema's GUI.
If you think GetDEnabling is bad, wait until you have to use GetDDescription (C++ only ATM). This one requires you to use undocumented function calls that aren't even in the C++ docs.
-
On 04/09/2017 at 00:45, xxxxxxxx wrote:
ahhm... this thread and others about GetDEnabling() are a bit confusing!
ie. the sdk example does not use the (above discussed) return c4d.plugins.NodeData.GetDEnabling() call
https://github.com/PluginCafe/cinema4d_py_sdk/blob/master/plugins/Py-DoubleCircle/Py-DoubleCircle.pypso, is there a way to ghost an userdata entry (in python tag space)?
for example i have a simple op[c4d.USERDATA_ID,5] = "whatever"
now i want to ghost (or unghost) this field... (maybe just to disallow user interactions)i guess you need to hook GetDEnabling() in like message() ? but then, if i add
def GetDEnabling(self, node, id, t_data, flags, itemdesc) : print "hi there!"
to my pyhton tag, it doesnt get called at all. i do not get any console output....is GetDEnabling even possible in python tags?
-
On 06/09/2017 at 05:40, xxxxxxxx wrote:
Hi,
neither GetDEnabling() nor GetDDescription() can be overridden in a Python Tag (talking about the scripting tag here, not a TagData plugin implemented in Python). So, no, it's unfortunately not possible to disable parameters in a Python tag. But it should be fairly easy to translate a Python tag into a TagData plugin written in Python (script code goes into Execute()).
-
On 06/09/2017 at 23:12, xxxxxxxx wrote:
ok, thanks for clarifying this, andreas!