Re: [info-performer] pfvMousePicker LNK2019

Date view Thread view Subject view Author view

From: Paolo Farinelli (paolo++at++sgi.com)
Date: 09/14/2004 21:46:22


Hi Denis,
pls excuse the delay.. very busy days..

First of all, the pfv picker will not detect double-clicks,
only single clicks.

So, you may be doing (or not doing) something in your
interactor class that is causing it not to work..

I tested by modifying sample04 in the following way:

1. Change specialFocus so that it doesn't request "interact" state,
    but instead maintains picker-state to be Focus-Event :

int myInteractor::specialFocus( pfvPicker* p,int ev,int
prmsn,pfvPickerRequest*r )
{
    if((ev==LEFT_DOWN) || (ev==RIGHT_DOWN) )
    {
        r->state = PFPICKER_FOCUS_EVENT;
        r->selector = NULL;
        r->interactor = NULL;
               
                pfNotify (PFNFY_NOTICE, PFNFY_PRINT,
                    "myInteractor::specialFocus - this = 0x%x", this );

             /* Here you should be able to determine which object was
picked */

    }
    return 1;
}

2. Comment out methods:
myInteractor::startInteraction, ::updateInteraction and endInteraction
from both the .C and the .h files.

3. I dindn't modify main.C at all.

When I run the program, I can move the mouse over any object, and
by left-clicking on it, I see the printout telling me which interactor
was picked.

I also noticed that you can call picker->getPickResult in main, and
you will get a pointer to the picked interactor. However, the pointer
returned by getPickResult is not reset to NULL unless you generate
another event (mouse or kbd). So you keep on getting the same pointer
frame after frame..

Hope this helps,

Best Regards,
Paolo

Denis Mohnhaupt wrote:

>From: "Paolo Farinelli" <paolo++at++sgi.com>
>
>
>>Let me know if you need further assistance.
>>
>>
>
>Thanks for the answer Paolo and Alex, I just skipped the pick() call and use
>it via update().
>Now it compiles but I dont get any picking feedback, so I must do something
>wrong.
>I implemented it similar to sample4. All I want is, whenever I receive a
>MFC-Message about an left doubleclick within my scene window,
>I want to get the according geometry node (actually the dcs node). No
>interaction, focus etc.
>
>So here is what I do:
>
>###at Init:
>m_pPicker = new pfvMousePicker;
>m_pPicker->setNodeDataSlot("PICKER");
>
>m_pPicker->setChannel(channel_);
>
>m_pPicker->setState(PFPICKER_FOCUS_EVENT, NULL, NULL);
>
>
>
>###when I insert a new object into the scene:
>
>pSOI = new SceneObjInteractor(); //my own interactor class, mostly the same
>as in sample 4
>
>pSOI->node = pDCS; //i dont know if this is redundant according to the next
>line
>
>pSOI->nodeSetup(pDCS, m_pPicker);
>
>
>
>###then when i receive a left mousebutton dblclick message:
>
>pfvInteractor* piatest;
>
>m_pPicker->update(); //btw i also call m_pPicker->update() every frame
>
>m_pPicker->getPickResults(&piatest);
>
>int id = -1;
>
>if(piatest)
>
>{
>
> id = (int) ((SceneObjInteractor*)pia)->GetId(); //memberfunction of my
>interactor class
>
>}
>
>m_dlgLibrary.SelectSceneObjPerID(id);
>
>
>
>and here, even when i am right before a huge object and doubleclick,
>
>m_pPicker->getPickResults(&piatest); always delivers piatest == NULL;
>
>furthermore i have breakpoints in each memberfunction of my interactor
>class, except of the cunstructor, none is ever called
>
>what did i miss?
>
>
>
>thnx in advance
>
>Denis
>
>P.S. btw there is a typo in pfMousePicker.h in the #ifndef line
>
>-----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>-----------------------------------------------------------------------
>
>
>
>

-- 
Paolo Farinelli                                           paolo++at++sgi.com
Member of Technical Staff, OpenGL Performer              1-650-933-1808
Silicon Graphics        1600 Amphitheatre Pkwy, Mountain View, CA 94043


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Sep 14 2004 - 21:46:31 PDT