leftButtonClicked signal not firing in plugin

Any question about the main GUI application (frontend)
Post Reply
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

leftButtonClicked signal not firing in plugin

Post by vinayan »

hi,

I am trying to get the x and y screen points picked on the screen by user. I tried the below code for this. Same things are working fine in the SegmentationTool and similar tools in the core. I also tried setting the picking mode ccGLWindow::POINT_PICKING. Any idea where I am going wrong?

Code: Select all

ccGLWindow* glWindow = m_app->getActiveGLWindow();

//    if (glWindow)
//        glWindow->setPickingMode(ccGLWindow::POINT_PICKING);

connect(glWindow,SIGNAL(leftButtonClicked(int,int)),this,SLOT(draw3dPoint(int,int)));

void qMyPlugin::draw3dPoint(int x, int y)
{
    m_app->dispToConsole(QString::number(x) + "," + QString::number(y) ,ccMainAppInterface::ERR_CONSOLE_MESSAGE);
}
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: leftButtonClicked signal not firing in plugin

Post by daniel »

You probably have to setup the right 'interaction mode' on the window (and don't forget to restore it to its default once the picking process has finished, otherwise you won't be able to interact with entities anymore):

Code: Select all

//tell the window to send all signals (leftButtonClicked, rightButtonClicked, mouseMoved, buttonReleased, etc.)
m_associatedWin->setInteractionMode(ccGLWindow::INTERACT_SEND_ALL_SIGNALS);

...

//restore the default interaction mode
m_associatedWin->setInteractionMode(ccGLWindow::TRANSFORM_CAMERA());
Daniel, CloudCompare admin
vinayan
Posts: 27
Joined: Thu Nov 03, 2016 4:11 pm

Re: leftButtonClicked signal not firing in plugin

Post by vinayan »

thank you! I will try this.
jedfrechette
Posts: 45
Joined: Mon Jan 20, 2014 6:31 pm
Location: Albuquerque, NM
Contact:

Re: leftButtonClicked signal not firing in plugin

Post by jedfrechette »

I don't mean to hijack this thread but I've been wanting to spend some time looking at CloudCompare's UI and how its user efficiency could be improved. Particularly with regard to the use of interactive tools. This process of switching between navigating the scene and using a tool is one of the first things on my list.

Would you be open to a pull request that only activates TRANSFORM_CAMERA() when a modifier key is pressed? By default all signals would get sent to the currently active tool, but when you wanted to move the camera you would, for example, use ALT+Left Mouse to rotate. This matches the paradigm that you see in a lot of 3D DCC (and some point cloud) applications where the user needs to constantly switch between navigating the scene and using an interactive tool. I think it works very well for these types of applications where the role of the 3D viewport goes beyond simply visualizing the scene and instead provides a window through which the user can interact with the scene's contents directly.

I don't know when I''ll actually have time to work on this, but it would be great to know your thoughts.
Jed
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: leftButtonClicked signal not firing in plugin

Post by daniel »

Hi,

This is interesting. And I believe that adding such a shortcut would be very easy (in the ccGLWindow class)... We'll just have to find something else than 'ALT' (it's already used to select multiple entities).

Moreover, in the 'interactive segmentation tool' and the 'interactive transformation tool', you can already 'pause' the tool (with the space bar) to move the camera and then restart the tool (hit the space bar again).

And last but not least, I'm not sure we should let this happen in the 'interactive segmentation tool' as the segmentation polyline is a 2D entity linked to the screen (in pixels) and if you move the object / camera in the 3D world, the polyline won't have a meaning anymore...
Daniel, CloudCompare admin
jedfrechette
Posts: 45
Joined: Mon Jan 20, 2014 6:31 pm
Location: Albuquerque, NM
Contact:

Re: leftButtonClicked signal not firing in plugin

Post by jedfrechette »

daniel wrote:We'll just have to find something else than 'ALT' (it's already used to select multiple entities).
ALT is the modifier that is probably most commonly used for this, at least for DCC applications. It's what Maya uses [1] and nearly everybody else has either adopted that convention or at least offers an alternative navigation scheme that matches Maya. In the realm of point cloud software Sequoia is the only one off the top of my head that offers "Maya like" navigation.

That being said, I'm not a big fan of ALT since your hand ends up in a weird position if you want to keep your other fingers on the home row, say to easily access other shortcuts.
daniel wrote:Moreover, in the 'interactive segmentation tool' and the 'interactive transformation tool', you can already 'pause' the tool (with the space bar) to move the camera and then restart the tool (hit the space bar again).
The space bar would be my personal preference over ALT. It's what Houdini uses [2] and it keeps your hand in a much more comfortable position. Conceptually it also makes sense, when typing space is probably the most commonly used key and when working in 3D, navigation is probably the most commonly used function. In the point cloud realm PolyWorks uses the space bar for navigation, but like the interactive tools in CC it is a toggle between navigating and interacting. A toggle works OK, but I think using a continuous press offers some benefits. For example, if a lower resolution version of the cloud is being rendered during navigation releasing the modifier is a clear signal that navigation is done and I want to see the full resolution model, even if I'm not ready to use the interactive tool yet. Using press and hold as a modifier also keeps the possibility open of using a short press on the space bar to do something else important down the road. Maybe pop up a tool palette under the cursor.
daniel wrote:And last but not least, I'm not sure we should let this happen in the 'interactive segmentation tool' as the segmentation polyline is a 2D entity linked to the screen (in pixels) and if you move the object / camera in the 3D world, the polyline won't have a meaning anymore...
I wouldn't immediately discount this behavior. It is exactly how Mari's Paint Buffer works [3] and can be really useful. Instead of directly painting/selecting in 3D you actually work on an invisible 2D plane in front of the camera. Your 2D work then gets projected, i.e. "Baked', to 3D as a separate step. Although with the default setting this extra step is largely invisible to the user. That two step process offers the benefit that you don't need to get your 2D work perfect the first time. For example, if the initial 2D polyline I draw is off by a few pixels in one area, instead of drawing a new one maybe I just move the camera/object a little bit so that it fits within the outline. Doing the projection as a separate step also offers some performance benefits. You can build up a potentially complex 2D selection in multiple steps and only commit to the expensive 2D-to-3D projection once you're happy with it.

I haven't looked at all of the permutations, but it seems like the hold-modifier-to-nav paradigm could be made to work with the segment tool's current behavior. However, with some tweaks I think that tool could also be made much more efficient. That's a topic for another day though.

Best,

[1] http://help.autodesk.com/view/MAYAUL/20 ... ew_hotkeys
[2] https://www.sidefx.com/docs/houdini14.0/start/hotkeys
[3] https://vimeo.com/148
Jed
Post Reply