MPxContext update on doDrag issue

60 views
Skip to first unread message

Janos Hunyadi

unread,
Mar 19, 2015, 5:39:02 PM3/19/15
to python_in...@googlegroups.com
I'm writing a custom context and the drag event of the context sets a plug on a separate custom MPxNode (animContextContainer in my example) that has a compound array input plug that's being set by the context via MPlug.

MPlug currP = m_inPosXYDPlug.elementByLogicalIndex(m_currPlug, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);

MPlug plug_x1 = currP.child(0);
MPlug plug_y1 = currP.child(1);
MPlug plug_x2 = currP.child(2);
MPlug plug_y2 = currP.child(2);
plug_x1.setValue(x1);
plug_y1.setValue(y1);
plug_x2.setValue(x2);
plug_y2.setValue(y2);

The results of that is passed on by a direct connection to a test Locator just to see that everything works. 
All works fine, the context sets the values but the value only gets passed to the locator once the mouse is released, even though during the dragging event I constantly send the data to the plug and is changing in the attribute editor in real-time.

Is the DG refresh only supposed to propagate to the other nodes once the context is released (mouse button)? Is this normal, or is there a workaround for this?


Janos Hunyadi

unread,
Mar 20, 2015, 8:56:35 AM3/20/15
to python_in...@googlegroups.com
Ok... one thing I figured out that if I use a custom manipulator instead of a context (hence having a direct connection to the node ) the value changes appropriately. But it seems like I need to re-implement the whole thing by creating a custom DG node (container) + a context (for selecting the object) + locator + manipulator ... so convoluted :D

Janos Hunyadi

unread,
Mar 20, 2015, 9:56:08 AM3/20/15
to python_in...@googlegroups.com
If anyone is interested I figured it out. I just needed to implement a refresh method to the doDrag function. Aka:

M3dView view = M3dView::active3dView();
view.refresh();

Even though this is viewport 2.0 ...
Reply all
Reply to author
Forward
0 new messages