I'm currently developing a treeview-plugin for all my scripts/presets etc.. I was wondering if it is possible to drag and drop items of said treeview directly to my layout.
I'm currently thinking along those lines:
In my declared ListItem (obj) I have a property of Instance which can hold the reference to the CommandPlugin for each script.
# of course this just a placeholder (but a valid one...)
In the GenerateDragArray I will create an Array with my said Instance/Reference, also I've tried setting different flags for GetDragType to c4d.DRAGTYPE_COMMAND etc....
def GenerateDragArray(self, root, userdata, obj):
def GetDragType(self, root, userdata, obj):
def SetDragObject(self, root, userdata, obj):
...but, sadly it's NOT working as I would expect...
Is this possible with python in general, or a limitation? What am I missing?
thank you for reaching out to us. I'll answer/point out some stuff in bullet points:
object has no attribute im_function
About the core of your question: Your major misconception here is that you can just "replace" the drag object. Which is not what TreeViewFunctions is intended for. It is just a view model / interface layer between the TreeViewCustomGui logic and the data (layer) you want to be represented in that GUI.
Cinema solves this internally with a special core message (COREMSG_COMMANDDRAGSIMULATION), but this unfortunately does not translate to Python, since it requires you to access the internal representation of a GeUserArea, which is not possible in Python.
So your best bet would be to actually make the data you pass to TreeViewCustomGui.SetRoot() to be the actual PluginData nodes you want to drag. So that you are actually dragging a plugin node and not some stand in. There is however no guarantee that this will work, I would have to try that myself.
@lasselauch said in Drag and Drop "Command" from Treeview:
I highly doubt that this is possible with Python. The docs state not supported.
You should give C++ a try.
@mp5gosu Damn. That's really not the answer I wanted to hear, Robert!
I understand that this thread has not yet come to a final conclusion, but without further feedback, we will consider this thread as solved by Monday and flag it accordingly.