Link input in dialog?
-
On 01/03/2018 at 05:56, xxxxxxxx wrote:
I'm a newbie in python and c4d api/dom etc. (even tho i have pretty vast programming experience)
So my question may look silly. But how can i add a selection field (like Link input for UserData) in the python scripted dialog. I've seen a lot of scripts which only operate with object input via doc.GetSelectedObjects(), but it's not very convenient, especially when u need few different objects selected (with different roles), so i wanted to create a dialog with selection input, but couldn't find one.
So well, i've thought to create my own via text field to display object name/id + "Select" button, but the thing is i couldn't make the dialog to be asynchronous, when i use anything except DIALOG_TYPE_MODAL dialog just makes C4D hang up =\
I guess i didn't understood something very important about user input handling via dialogs...So i'm looking for help from more experienced devs: how can i make a script which will allow to select few different objects in the same way as i can do that (say with Python Generator + UserData fields) ???
P.S. i'm already thinking about getting rid of that silly script manager and doing what i want via Python Generator (e.g. action performed via Quicktab userdata-field with resetting it into default state? =), but it still makes no sense cuz i need to operate on existing objects in the scene and not create anything new lol
-
On 02/03/2018 at 07:47, xxxxxxxx wrote:
Hi Markus_13, thanks for writing us.
With regard to your issue, it's actually not possible to create a GUI element in a dialog generated by a Python script. It should be instead created a CommandData Python plugin hosting the dialog and managing the relationship and interaction between the data referenced by the GUI elements and the code itself.
On out GitHub repository it's available a Python plugin example that could shed some light on implementing a python plugin with an asynchronous dialog.
Last but not least although it could work to some extent, using a Python Generator for this purposes could result actually sub-optimal.Best, Riccardo