Ejemplo n.º 1
0
TouchSensorObject::TouchSensorObject() : HelperObject() 
{
    IParamBlock* pb = CreateParameterBlock(descVer0, PB_TS_LENGTH,
                                           CURRENT_VERSION);
    pb->SetValue(PB_TS_SIZE, 0, 0.0f);
    pb->SetValue(PB_TS_ENABLED, 0, TRUE);
    pb->SetValue(PB_TS_NUMOBJS, 0, 0);
    MakeRefByID(FOREVER, 0, pb);
    assert(pblock);
    previousMode = NULL;
    triggerObject = NULL;
    objects.SetCount(0);
    BuildObjectList(this);
}
Ejemplo n.º 2
0
ProxSensorObject::ProxSensorObject() : HelperObject() 
{
	pblock = NULL;
    IParamBlock* pb = CreateParameterBlock(descVer0, PB_PS_PB_LENGTH,
                                           CURRENT_VERSION);
    pb->SetValue(PB_PS_LENGTH, 0, 0.0f);
    pb->SetValue(PB_PS_WIDTH, 0, 0.0f);
    pb->SetValue(PB_PS_HEIGHT, 0, 0.0f);
    pb->SetValue(PB_PS_ENABLED, 0, TRUE);
    pb->SetValue(PB_PS_NUMOBJS, 0, 0);
    ReplaceReference( 0, pb);
    assert(pblock);
    previousMode = NULL;
    objects.SetCount(0);
    BuildObjectList(this);
}
Ejemplo n.º 3
0
SwitchObject::SwitchObject()
    : HelperObject()
{
    pblock = NULL;
    IParamBlock *pb = CreateParameterBlock(descVer0, PB_S_LENGTH,
                                           CURRENT_VERSION);
    pb->SetValue(PB_S_SIZE, 0, 0.0f);
    pb->SetValue(PB_S_NUMOBJS, 0, 0);
    pb->SetValue(PB_S_DEFAULT, 0, -1);
    pb->SetValue(PB_S_ALLOW_NONE, 0, TRUE);
#if MAX_PRODUCT_VERSION_MAJOR > 8
    ReplaceReference(0, pb);
#else
    MakeRefByID(FOREVER, 0, pb);
#endif
    assert(pblock);
    previousMode = NULL;
    // triggerObject = NULL;
    objects.SetCount(0);
    BuildObjectList(this);

    needsScript = true;
}
Ejemplo n.º 4
0
BOOL CALLBACK
RollupDialogProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ,
                  TouchSensorObject* th)
{
    if ( !th && message != WM_INITDIALOG ) return FALSE;

    switch ( message ) {
    case WM_INITDIALOG:
//        SetDlgFont( hDlg, th->iObjParams->GetAppHFont() );

        th->TouchSensorPickButton = GetICustButton(GetDlgItem(hDlg,IDC_PICK));
        th->TouchSensorPickButton->SetType(CBT_CHECK);
        th->TouchSensorPickButton->SetButtonDownNotify(TRUE);
        th->TouchSensorPickButton->SetHighlightColor(GREEN_WASH);
        th->TouchSensorPickButton->SetCheck(FALSE);

        th->ParentPickButton = GetICustButton(GetDlgItem(hDlg,IDC_PICK_PARENT));
        th->ParentPickButton->SetType(CBT_CHECK);
        th->ParentPickButton->SetButtonDownNotify(TRUE);
        th->ParentPickButton->SetHighlightColor(GREEN_WASH);
        th->ParentPickButton->SetCheck(FALSE);
        
        // Now we need to fill in the list box IDC_LIST
        th->hRollup = hDlg;
        BuildObjectList(th);

//        EnableWindow(GetDlgItem(hDlg, IDC_DEL),
//                     (th->objects.Count() > 0));
        th->dlgPrevSel = -1;
        if (th->triggerObject)
            Static_SetText(GetDlgItem(hDlg,IDC_TRIGGER_OBJ),
                           th->triggerObject->GetName());
        
        if (pickMode) SetPickMode(NULL);
        return TRUE;			

    case WM_DESTROY:
        if (pickMode) SetPickMode(NULL);
     // th->iObjParams->ClearPickMode();
     // th->previousMode = NULL;
        ReleaseICustButton( th->TouchSensorPickButton );
        ReleaseICustButton( th->ParentPickButton );
        return FALSE;

    case WM_MOUSEACTIVATE:
//        th->iObjParams->RealizeParamPanel();
        return FALSE;

    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MOUSEMOVE:
//        th->iObjParams->RollupMouseMessage(hDlg,message,wParam,lParam);
        return FALSE;

    case WM_COMMAND:			
        switch( LOWORD(wParam) ) {
        case IDC_PICK: // Pick an object from the scene
            // Set the pickmode...
            switch (HIWORD(wParam)) {
            case BN_BUTTONDOWN:
                if (pickMode == PARENT_PICK_MODE) {
                    SetPickMode(NULL);
                    th->ParentPickButton->SetCheck(FALSE);
                }
                theTSPick.SetTouchSensor(th);
                SetPickMode(&theTSPick, TOUCH_PICK_MODE);
                /*
                if (th->previousMode) {
                    // reset the command mode
                    th->iObjParams->SetCommandMode(th->previousMode);
                    th->previousMode = NULL;
                } else {
                    th->previousMode = th->iObjParams->GetCommandMode();
                    thePick.SetTouchSensor(th);
                    th->iObjParams->SetPickMode(&thePick);
                }
                */
                break;
            }
            break;
        case IDC_PICK_PARENT: // Pick an object from the scene
            // Set the pickmode...
            switch (HIWORD(wParam)) {
            case BN_BUTTONDOWN:
                if (pickMode == TOUCH_PICK_MODE) {
                    SetPickMode(NULL);
                    th->TouchSensorPickButton->SetCheck(FALSE);
                }
                thePPick.SetTouchSensor(th);
                SetPickMode(&thePPick, PARENT_PICK_MODE);
                /*
                if (th->previousMode) {
                    // reset the command mode
                    th->iObjParams->SetCommandMode(th->previousMode);
                    th->previousMode = NULL;
                } else {
                    th->previousMode = th->iObjParams->GetCommandMode();
                    theParentPick.SetTouchSensor(th);
                    th->iObjParams->SetPickMode(&theParentPick);
                }
                */
                break;
            }
            break;
        case IDC_DEL: { // Delete the object from the list
            int index =	SendMessage(GetDlgItem(hDlg,IDC_LIST),
                                    LB_GETCURSEL, 0, 0);
            if (index != LB_ERR) {
                TouchSensorObj *obj = (TouchSensorObj *)
                    SendDlgItemMessage(hDlg, IDC_LIST,
                                       LB_GETITEMDATA, index, 0);
                for (int i = 0; i < th->objects.Count(); i++) {
                    if (obj == th->objects[i]) {
                        // remove the item from the list
                        SendDlgItemMessage(hDlg, IDC_LIST,
                                           LB_DELETESTRING,
                                           (WPARAM) index, 0);
                        th->dlgPrevSel = -1;
                        // Remove the reference to obj->node
                        th->DeleteReference(i+2);
                        // remove the object from the table
                        th->objects.Delete(i, 1);
                        th->pblock->SetValue(PB_TS_NUMOBJS,
                                             th->iObjParams->GetTime(),
                                             th->objects.Count());
                        break;
                    }
                }
                EnableWindow(GetDlgItem(hDlg, IDC_DEL),
                             (th->objects.Count() > 0));
                if (th->objects.Count() <= 0) {
                    th->iObjParams->RedrawViews(th->iObjParams->GetTime());
                }
            }
        }
        break;
        case IDC_LIST:
            switch(HIWORD(wParam)) {
            case LBN_SELCHANGE: {
                int sel = SendMessage(GetDlgItem(hDlg,IDC_LIST),
                                      LB_GETCURSEL, 0, 0);
                if (th->dlgPrevSel != -1) {
                    // save any editing
                    TouchSensorObj *obj = (TouchSensorObj *)
                        SendDlgItemMessage(hDlg, IDC_LIST,
                                           LB_GETITEMDATA, th->dlgPrevSel, 0);
                    obj->ResetStr();
                    SendMessage(GetDlgItem(hDlg,IDC_LIST),
                                LB_DELETESTRING, th->dlgPrevSel, 0);
                    int ind = SendMessage(GetDlgItem(hDlg,
                                                     IDC_LIST),
                                          LB_ADDSTRING, 0,
                                          (LPARAM)obj->listStr.data());
                    SendMessage(GetDlgItem(hDlg,IDC_LIST),
                                LB_SETITEMDATA, (WPARAM)ind, (LPARAM)obj);
                    SendMessage(GetDlgItem(hDlg,IDC_LIST),
                                LB_SETCURSEL, sel, 0);
                }
                th->dlgPrevSel = sel;
                if (sel >= 0) {
                    TouchSensorObj *obj = (TouchSensorObj *)
                        SendDlgItemMessage(hDlg, IDC_LIST,
                                           LB_GETITEMDATA, sel, 0);
                    assert(obj);

                } else {
                }
                th->iObjParams->RedrawViews(th->iObjParams->GetTime());
            }
            break;
            case LBN_SELCANCEL:
                break;
            }
            break;
        }
        return FALSE;
    default:
        return FALSE;
    }
}