modal dialog to panel

On 30/05/2018 at 01:51, xxxxxxxx wrote:

Hi folks,

I've been a forum reader for a while now, so first I like to say Thanks for all the solutions I have found here :-)

Our renderings are quite extensive, so we do couple of checks before submitting. So far we've been using a modal GeDialog in a single script - buttons, input fields, labels, nothing special. It sets frame rate, range, image size, camera plugins etc.

Now I'd like to improve UI integration. The script is not depending on a particular scene item, I image something like a menu entry to open a non-modal panel. Just need some links or keywords to get started.

Thanks once more!

On 31/05/2018 at 09:35, xxxxxxxx wrote:

Hi Bastian,

non-modal dialogs can not be achieved with scripts (i.e. Python written in Script Manager).

Instead you will need to implement a CommandData plugin.

No worries, this may sound harder and more complicated than it actually is. In a very first iteration you could simply move your existing script code into the Execute() function of a CommandData plugin (you may have to care for the predefined global variables (like doc or op) in Script Manager by getting the active document or object, though).

Then you can continue to change the code to open your GeDialog asynchronously/non-modal (DLG_TYPE_ASYNC). I recommend to take a look at one of our examples to get a better idea: Py-CVRssPy-TextureBaker or Py-MemoryViewer (examples ordered by complexity low to high).

I hope this helps. Don't hesitate to get back to us, if any questions remain.

On 11/06/2018 at 08:59, xxxxxxxx wrote:

Thanks Andreas
that's just the hint I needed. I have refactored the code and it works great.
Only one more question: How can I wrap the panel content so it will show scrollbars instead of expanding to its full height?

On 12/06/2018 at 06:14, xxxxxxxx wrote:

I'm not sure, what you mean with panel? The entire GeDialog content? Then that's probably not directly possible. Cinema 4D leaves it to the user to resize dialogs as needed and tries to use the given space as much as possible. You might be able to fake something by introducing dummy groups with invisble dummy elements, but I don't think that's very C4D style nor very convenient (neither for you nor the user).

If it's only about parts of your dialog, it's definitely worth taking a look at ScrollGroups.

May I suggest to check the GeDialog manual in our C++ documentation? Don't worry, I think, the code snippets are simple enough to understand for Python developers as well, and it may provide some more insight and context.