PDA

View Full Version : Maya Crash with deleteUI()


francisvega
02-17-2011, 01:35 PM
Hi all!

I'm trying to implement drag&drop with maya layouts, simple: drag a button from one grid layout into another. To "simulate" this, I'm deleting the dragged button from original layout and create a new one at target layout...

I stopped in the delete layout part, when I try to do deleteUI() maya crashed :S I try with evalDeferred too and crash too

I see the bug in http://thnkr.com/bt/view.php?id=54 I dont know if exists any workaround or so...

I put here the code I run...


import maya.cmds as cmds

def DRAG (dragControl, x, y, modifiers):
pass

def DROP (dragControl, dropControl, messages, x, y, dragType):
cmds.evalDeferred(cmds.deleteUI(dragControl))

cmds.window()
col = cmds.columnLayout(columnAttach=('both', 5), rowSpacing=1, columnWidth=200)
cmds.gridLayout(p=col, ag=1, cwh=[90,120])
cmds.button(dgc=DRAG, w=50, h=80)
cmds.gridLayout(p=col, dpc=DROP, bgc=(0.3, 0.2, 0.3), ag=1, cwh=[90,120])
cmds.showWindow()


Thnx very much!

mduvekot
02-17-2011, 04:21 PM
Wouldn't it be easier to parent the button to the second gridLayout that you're going to drop it on?

cmds.button(buttonName, edit=True, parent=gridLayoutName)

CGTalk Moderation
02-17-2011, 04:21 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.