00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul Isaacs (MMM yyyy) 00025 ** Modified by : David Mott (MMM yyyy) 00026 ** Modified by : Howard Look (MMM yyyy) 00027 **=======================================================================*/ 00028 /*======================================================================= 00029 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00030 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00031 *** *** 00032 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00033 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00034 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00035 *** *** 00036 *** RESTRICTED RIGHTS LEGEND *** 00037 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00038 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00039 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00040 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00041 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00042 *** *** 00043 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00044 *** BORDEAUX, FRANCE *** 00045 *** ALL RIGHTS RESERVED *** 00046 **=======================================================================*/ 00047 /*======================================================================= 00048 ** Modified by : VSG (MMM YYYY) 00049 **=======================================================================*/ 00050 00051 00052 #ifndef _SO_DRAGGER_ 00053 #define _SO_DRAGGER_ 00054 00055 #include <Inventor/SbBox.h> 00056 #include <Inventor/SbViewportRegion.h> 00057 #include <Inventor/SbLinear.h> 00058 #include <Inventor/nodekits/SoInteractionKit.h> 00059 #include <Inventor/misc/SoCallbackList.h> 00060 #include <Inventor/fields/SoSFBool.h> 00061 #include <Inventor/nodes/SoMatrixTransform.h> 00062 #include <Inventor/nodes/SoScale.h> 00063 00064 00065 class SoPickedPoint; 00066 class SoAction; 00067 class SoHandleEventAction; 00068 class SoGetBoundingBoxAction; 00069 class SoGetMatrixAction; 00070 class SoSearchAction; 00071 class SoEvent; 00072 class SoPath; 00073 class SoTempPath; 00074 class SbPList; 00075 00076 class SoDragger; // forward reference 00077 00078 // The following typedef is used in defining the callback function lists. 00082 typedef void SoDraggerCB(void *userData, SoDragger *dragger ); 00083 00085 // 00086 // Class: SoDragger 00087 // 00088 // Base class for draggers which are operated by a start (mouse down) 00089 // followed by dragging, followed by end (mouse up). 00090 // 00092 00554 class SoDragger : public SoInteractionKit { 00555 00556 SO_KIT_HEADER(SoDragger); 00557 00558 SO_KIT_CATALOG_ENTRY_HEADER(motionMatrix); 00559 00560 public: 00561 00565 SoSFBool isActive; 00566 00575 SoSFBool enableCallbacks; 00576 00577 // Dragger Callbacks 00578 // In all cases, the callback data will be a pointer to the dragger 00579 // that caused the callback. Each type of callback maintains a list of 00580 // callbacks, so many callback functions may be registered, if desired. 00581 00590 void addStartCallback(SoDraggerCB *f, void *userData = NULL); 00591 00596 void removeStartCallback(SoDraggerCB *f, void *userData = NULL); 00597 00604 void addMotionCallback(SoDraggerCB *f, void *userData = NULL); 00605 00610 void removeMotionCallback(SoDraggerCB *f, void *userData = NULL); 00611 00618 void addFinishCallback(SoDraggerCB *f, void *userData = NULL); 00619 00624 void removeFinishCallback(SoDraggerCB *f, void *userData = NULL); 00625 00633 void addValueChangedCallback(SoDraggerCB *f, void *userData = NULL); 00634 00639 void removeValueChangedCallback(SoDraggerCB *f, void *userData = NULL); 00640 00645 void setMinGesture(int pixels) { minGesture = (float)pixels; } 00646 00652 void setMinGesture(float pixels) { minGesture = pixels; } 00653 00658 int getMinGesture() const { return (int)minGesture; } 00659 00665 float getMinGestureFloat() const { return minGesture; } 00666 00671 static void setMinScale(float newMinScale); 00672 00676 static float getMinScale(); 00677 00689 SbBool enableValueChangedCallbacks( SbBool newVal ); 00690 00692 enum TrackerDirectMode { 00696 NONE, 00700 MOVE, 00704 ROTATE, 00708 FREE, 00713 DEFAULT 00714 }; 00715 00721 void setTrackerDirectMode( TrackerDirectMode mode = DEFAULT ); 00722 00726 TrackerDirectMode getTrackerDirectMode() const; 00727 00733 static void setInitialTrackerDirectMode( TrackerDirectMode mode = DEFAULT ); 00734 00738 static TrackerDirectMode getInitialTrackerDirectMode(); 00739 00751 void setMotionMatrix( const SbMatrix &newMatrix ); 00752 00765 const SbMatrix &getMotionMatrix(); 00766 00767 private: 00768 00769 // In addition to the public callback functions, these callback 00770 // functions can also be used by subclasses to find out when things 00771 // have happened. 00772 00773 // otherEvent callbacks are called in response to events other than 00774 // the button1 Press/Release and location/tracker. 00775 void addOtherEventCallback(SoDraggerCB *f, void *userData = NULL); 00776 void removeOtherEventCallback(SoDraggerCB *f, void *userData = NULL); 00777 void clearOtherEventCallbacks(); 00778 00779 // Compound draggers should call this for each child dragger 00780 // so that user callbacks (valueChanged, start, motion, finish, other event) 00781 // registered with the parent dragger will be invoked based on the child 00782 // dragger. Also, this will add the 'transferMotion' callback as a 00783 // valueChanged callback on the child. Child dragger enableCallbacks field 00784 // will be automatically connected from parent dragger enableCallbacks field, 00785 // so that when parent dragger enableCallbacks field is set, value is the same 00786 // for child draggers 00787 void registerChildDragger(SoDragger *child); 00788 void unregisterChildDragger(SoDragger *child); 00789 00790 // These two routines tie the child to the parent, but WITHOUT the 00791 // transferMotion callback. It is good 00792 // for child draggers that need to move independently of their parents, 00793 // but which should still call the parents (valueChanged, start, motion, 00794 // end, and otherEvent) callbacks when they are dragged. 00795 void registerChildDraggerMovingIndependently(SoDragger *child); 00796 void unregisterChildDraggerMovingIndependently(SoDragger *child); 00797 00798 // Get the matrix which converts from one dragger space to another. 00799 SbMatrix getLocalToWorldMatrix( SoAction* action = NULL ); 00800 SbMatrix getWorldToLocalMatrix( SoAction* action = NULL ); 00801 00802 // Returns the starting point in local coordinates. 00803 SbVec3f getLocalStartingPoint(); 00804 // Returns the starting point in world coordinates. 00805 SbVec3f getWorldStartingPoint(); 00806 00807 // Get the matrix which converts from the space of one part into 00808 // local space. Good to use if transforms occur between 'motionMatrix' 00809 // and the space you want to work in. 00810 // Note: This routine will try not to create parts that don't exist. 00811 // Instead it finds the existing part that precedes it in traversal. 00812 // But this only works if the partName is in this nodekit's catalog. 00813 // If the part is nested within another kit below this one or 00814 // sitting inside a list part, the part will be created when it 00815 // doesn't exist. 00816 void getPartToLocalMatrix( const SbName &partName, 00817 SbMatrix &partToLocalMatrix, 00818 SbMatrix &localToPartMatrix); 00819 00820 // Transforms a given matrix from one space into another space 00821 void transformMatrixLocalToWorld( const SbMatrix &fromMatrix, 00822 SbMatrix &toMatrix); 00823 void transformMatrixWorldToLocal( const SbMatrix &fromMatrix, 00824 SbMatrix &toMatrix); 00825 void transformMatrixToLocalSpace( const SbMatrix &fromMatrix, 00826 SbMatrix &toMatrix, const SbName &fromSpacePartName); 00827 00828 // Invokes the valueChangedCallbacks. 00829 // These are invoked whenever setMotionMatrix() changes the motion matrix. 00830 // If a subclass wishes to invoke the valueChanged callbacks for some 00831 // other reason, they may call valueChanged(). Example: SoSpotLightDragger 00832 // changes its angle field without altering the motionMatrix. So it 00833 // calls valueChanged() to invoke callbacks. 00834 00835 void valueChanged(); 00836 00837 // Used to calculate motion relative to the dragger's position at the 00838 // beginning of the dragging. 00839 const SbMatrix &getStartMotionMatrix() { return startMotionMatrix; } 00840 00841 // By default, saves the motionMatrix as the startMotionMatrix. 00842 // Subclasses may want to save additional info. For example, the 00843 // centerballDragger also saves the matrix that moves the center relative 00844 // to the motionMatrix. 00845 virtual void saveStartParameters(); 00846 00847 // Information that's good to have during a valueChanged callback 00848 const SoPath *getPickPath() const; 00849 const SoEvent *getEvent() const; 00850 00851 // Creates a new path leading to this dragger, if the last path given by 00852 // setTempPathToThis() is still valid. Will return NULL if not possible. 00853 // You must ref() and unref() this new path if you 00854 // don't want it (and all the nodes along it) to stay around forever. 00855 SoPath *createPathToThis(); 00856 00857 // Surrogate Pick Information. This is relevant if the we are dragging 00858 // based on the pick of a surrogate part. This happens when you call 00859 // SoInteractionKit::setPartAsPath() and thus specify a 'stand-in' path 00860 // to pick when initiating a drag. 00861 // Owner: 00862 // Path to the InteractionKit that owns the surrogate part. 00863 const SoPath *getSurrogatePartPickedOwner() const 00864 { return pathToSurrogatePickOwner;} 00865 // Name: 00866 // Name of the surrogate part within the owners list. 00867 const SbName &getSurrogatePartPickedName() const 00868 { return surrogateNameInPickOwner; } 00869 // SurrogatePath: 00870 // The owner's surrogate path for this name. This path may 00871 // differ from the actual pickPath, but it is guaranteed to 00872 // be contained within the pickPath. 00873 const SoPath *getSurrogatePartPickedPath() const 00874 { return surrogatePathInPickOwner;} 00875 00876 // Set the point where the drag begins. 00877 // The pickedPoint version would usually be the result of a pick. 00878 void setStartingPoint( const SoPickedPoint *newPoint ); 00879 // The SbVec3f version would usually be a point saved from the end of 00880 // another gesture. For example, when a modifier key goes down, we might 00881 // save the current position and use it to begin another connected gesture. 00882 void setStartingPoint( const SbVec3f &newPoint ); 00883 00884 // Information about the window an event occurred in. 00885 // Upon construction, the values are defaults. 00886 // When drag begins, new values are taken from the handleEventAction 00887 // and used for the duration of the drag. 00888 // When drag ends, new values are taken from the final handleEventAction. 00889 // 00890 // DEPRECATED SINCE OIV 9.3 00891 // Dragger must not store information related to viewer settings. 00892 // In a multi-viewers configuration, draggers internal computation can be 00893 // corrupted by using one of these values set from another viewer 00894 // This has been solved by directly getting viewvolume and viewport from 00895 // the state, or from the current action. 00896 00897 #if 1 SoDEPRECATED 00907 const SbViewVolume &getViewVolume() { return viewVolume; } 00908 SoDEPRECATED 00910 void setViewVolume(const SbViewVolume &vol) { viewVolume = vol; } 00911 SoDEPRECATED 00913 const SbViewportRegion &getViewportRegion() { return vpRegion; } 00914 SoDEPRECATED 00916 void setViewportRegion(const SbViewportRegion ®) { vpRegion = reg; } 00917 00918 #endif 00920 // Get the most recent handleEventAction. 00921 SoHandleEventAction *getHandleEventAction() const { return handleEventAction; } 00922 void setHandleEventAction( SoHandleEventAction *newAction ); 00923 00924 // A path leading to 'this.' It is used to calculate the 00925 // motionMatrix. It is set when a dragger first grabs event, through the 00926 // handleEvent action, or by setCameraInfo() if NULL at the time. 00927 void setTempPathToThis(const SoPath *somethingClose); 00928 00929 // Called when the dragger gains or loses status as "grabber" of events. 00930 virtual void grabEventsSetup(); 00931 virtual void grabEventsCleanup(); 00932 00933 // Changes only that part of the matrix for which this dragger has fields. 00934 // For instance, when called by an SoTranslate1Dragger, any rotations and 00935 // scales in the matrix will remain unchanged. But the translation will 00936 // be replaced with value in the 'translation' field. 00937 // First, factor mtx to get values for the following: 00938 // trans, rot, scale, scaleOrient. 00939 // If there's a center field, send it to the factor method. 00940 // Replace any of these four values if fields are found named 00941 // 'translation' 'scaleFactor' 'rotation' and/or 'scaleOrientation' 00942 // Note that this could be all or none of the 4 listed. 00943 // Values for which no fields are found remain unchanged. 00944 // Build a new matrix using the new values. Some may be the originals 00945 // and some may have been replaced. 00946 void workFieldsIntoTransform( SbMatrix &mtx ); 00947 00948 // Same as above, but values are given explicitly as pointers. 00949 // If the pointers are NULL, the values in the matrix are not changed. 00950 static void workValuesIntoTransform( SbMatrix &mtx, 00951 const SbVec3f *translationPtr, 00952 const SbRotation *rotationPtr, 00953 const SbVec3f *scaleFactorPtr, 00954 const SbRotation *scaleOrientationPtr, 00955 const SbVec3f *centerPtr); 00956 00957 // Faster versions of getTransform() and factor() that take advantage of 00958 // the case where there is no scaleOrientation. Reverts to slow method 00959 // if it needs to. 00960 // This method will not work if the matrix given contains any scales 00961 // less than zero, and it does not check for that case. 00962 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation, 00963 SbRotation &rotation, SbVec3f &scaleFactor, 00964 SbRotation &scaleOrientation, 00965 const SbVec3f ¢er); 00966 static void getTransformFast( SbMatrix &mtx, SbVec3f &translation, 00967 SbRotation &rotation, SbVec3f &scaleFactor, 00968 SbRotation &scaleOrientation); 00969 00970 // Appends the given motion to the end of 'mtx'. 00971 // 'conversion' transforms from the space the motion is defined in 00972 // to the space 'mtx'. 00973 static SbMatrix appendTranslation( const SbMatrix &mtx, 00974 const SbVec3f &translation, 00975 const SbMatrix *conversion = NULL ); 00976 static SbMatrix appendScale( const SbMatrix &mtx, 00977 const SbVec3f &scale, const SbVec3f &scaleCenter, 00978 const SbMatrix *conversion = NULL ); 00979 static SbMatrix appendRotation( const SbMatrix &mtx, 00980 const SbRotation &rot, const SbVec3f &rotCenter, 00981 const SbMatrix *conversion = NULL ); 00982 00983 // Is the current tracker direct mode MOVE, ROTATE or FREE ? 00984 SbBool isTrackerDirectMode() const; 00985 00986 private: 00987 void GLRender(SoGLRenderAction *action); 00988 00989 static void initClass(); 00990 static void exitClass(); 00991 SB_THREAD_TLS_HEADER(); 00992 00993 // Initialize ALL Inventor dragger classes 00994 static void initClasses(); 00995 static void exitClasses(); 00996 00997 // These control behavior of the rotational parts. If FRONT, no matter 00998 // where you hit the dragger relative to its center, it will behave as if 00999 // you are dragging from the front. If BACK, the rear. If USE_PICK, 01000 // then it depends on the relationship between the picked point and the 01001 // center of the dragger. 01002 enum ProjectorFrontSetting { 01003 FRONT, BACK, USE_PICK 01004 }; 01005 void setFrontOnProjector( ProjectorFrontSetting newVal ) 01006 { projectorFrontSetting = newVal; } 01007 ProjectorFrontSetting getFrontOnProjector() const 01008 { return projectorFrontSetting;} 01009 01010 inline void setInteracting(bool flag) { m_draggerInteracting = flag; } 01011 01012 private: 01013 01014 // Constructor 01015 SoDragger(); 01016 01017 // Sensor attached to enableCallbacks field 01018 SoFieldSensor* m_enableSensor; 01019 01020 //Field sensor callback 01021 static void enableCB( void *, SoSensor * ); 01022 01023 // Get the last known position of the locator (mouse). 01024 // 2D locater positions have (0,0) at lower-left, and are 01025 // relative to the viewport. 01026 // Normalized positions go from 0.0 to 1.0. 01027 // Regular positions go from 0 to (vpSize - 1) 01028 SbVec2f getNormalizedLocaterPosition(); 01029 const SbVec2f& getLocaterPosition(); 01030 01031 // Get the 3D tracker device's ray in world coords (new in v3.0) 01032 SbLine getTrackerRay(); 01033 01034 // Get the position of the locater when dragging started. 01035 const SbVec2f& getStartLocaterPosition() const { return startLocater; } 01036 01037 // The start locater position is automatically set when button 1 01038 // goes down over the dragger. Subclasses may wish to reset it, such 01039 // as when a constraint key goes down during dragging. 01040 void setStartLocaterPosition(const SbVec2f& p) { startLocater = p; } 01041 01042 // Has the locater moved far enough from where it started to 01043 // choose a constraint gesture. 01044 SbBool isAdequateConstraintMotion(); 01045 01046 // Given a pickPath and a surrogatePath, decides whether it should 01047 // grab based on the surrogate. First, the pickPath must 01048 // contain the surrogatePath, indicating that the surrogate was picked. 01049 // Second, we consider the part of the pickPath below the point where 01050 // the surrogatePath ends. 01051 // If this bottom section contains other draggers, then we will pass it up. 01052 // This is because the other draggers will want to grab when they find out 01053 // they've been picked. 01054 virtual SbBool shouldGrabBasedOnSurrogate( const SoPath *pickPath, 01055 const SoPath *surrogatePath ); 01056 01057 // 01058 // The dragger looks in this action to get information about the camera 01059 // and the viewport. Usually the action used is just the handleEventAction. 01060 void setCameraInfo( SoAction *action ); 01061 01062 // This is called during traversal by a HandleEventAction. It 01063 // calls ha->setHandled() if the event is handled. 01064 virtual void handleEvent(SoHandleEventAction *ha); 01065 01066 // This should be called by every child dragger of a compound dragger 01067 // as a result of compoundDragger->registerChildDragger( childDragger ); 01068 // Called on the compoundDragger when childDragger's value changes. 01069 // Gets the motionMatrix from a the child dragger. Appends that change 01070 // to the parent dragger's savedStartMatrix, and sets the result as the 01071 // parent's motionMatrix. 01072 // Then, it zeros out the motionMatrix of the child dragger. 01073 void transferMotion(SoDragger *child); 01074 01075 // Set/get whether the dragger should be ignored during bounding 01076 // box calculations. 01077 void setIgnoreInBbox( SbBool newVal ) { ignoreInBbox = newVal; } 01078 SbBool isIgnoreInBbox() { return ignoreInBbox; } 01079 01080 // Implements getBoundingBox action. Differs from separator as follows: 01081 // If the 'ignoreInBbox' flag is set to TRUE, then it will return without 01082 // traversing children. 01083 virtual void getBoundingBox(SoGetBoundingBoxAction *action); 01084 01085 // Stubs used by compound draggers to get user callbacks from 01086 // the child dragger 01087 static void childTransferMotionAndValueChangedCB(void *, SoDragger *); 01088 static void childValueChangedCB(void *, SoDragger *); 01089 static void childStartCB(void *, SoDragger *); 01090 static void childMotionCB(void *, SoDragger *); 01091 static void childFinishCB(void *, SoDragger *); 01092 static void childOtherEventCB(void *, SoDragger *); 01093 01094 // Called by the above child callbacks. Establishes which child dragger 01095 // is currently active. Set at beginning of child callback, returned to 01096 // original value at end. Returns current value at time method is called. 01097 void setActiveChildDragger( SoDragger *newChildDragger ); 01098 SoDragger *getActiveChildDragger() const { return activeChildDragger; } 01099 01100 // Called by the SoBaseKit::write() method. 01101 // 01102 // Draggers don't want to write out fields if they have default vals. 01103 // 01104 // sets isActive to default if default and not connected. 01105 // 01106 // Looks for fields named: 01107 // 'rotation' with value SbRotation::identity() 01108 // 'translation' with value (0,0,0) 01109 // 'center' with value (0,0,0) 01110 // 'scaleFactor' with value (1,1,1) 01111 // and sets them to default if they are not connected from a field. 01112 // (most draggers are missing at least some of these, but thats okay) 01113 // 01114 // Then calls the method for SoInteractionKit. 01115 // 01116 // NOTE: Parts which are set to default may still wind up writing to file 01117 // if, for example, they lie on a path. 01118 virtual void setDefaultOnNonWritingFields(); 01119 01120 // In tracker direct mode, apply motion of tracked input device 01121 // directly to dragger's motion matrix. (new for v5.0) 01122 virtual SbBool applyTrackerMotion(); 01123 01124 virtual ~SoDragger(); 01125 01126 // Class static thread local storage 01127 struct MTstruct { 01128 SoGetMatrixAction *m_matrixAction; 01129 SoSearchAction *m_searchAction; 01130 }; 01131 01132 // Support for tracker direct mode (for immersive environments) 01133 // 01134 // Allows direct mode to be set for all draggers 01135 static TrackerDirectMode m_initialDirectMode; 01136 // Current direct mode for this dragger instance 01137 TrackerDirectMode m_directMode; 01138 // Default direct mode for this class of dragger 01139 TrackerDirectMode m_defaultDirectMode; 01140 // Saved start position of tracked input device 01141 SbVec3f m_trackerStartPos; 01142 // Saved start orientation of tracked input device 01143 SbRotation m_trackerStartRot; 01144 01145 SbViewVolume viewVolume; // view volume for xsection tests 01146 SbViewportRegion vpRegion; // view volume for xsection tests 01147 01148 private: 01149 01150 // lists of callback functions 01151 SoCallbackList *startCallbacks; 01152 SoCallbackList *motionCallbacks; 01153 SoCallbackList *finishCallbacks; 01154 SoCallbackList *valueChangedCallbacks; 01155 01156 SoCallbackList *otherEventCallbacks; 01157 01158 SbBool valueChangedCallbacksEnabled; 01159 SoDragger *activeChildDragger; 01160 01161 SoHandleEventAction *handleEventAction; // current event action 01162 01163 // A record of the world space point which initiated the dragging. 01164 // This might be set from a pickedPoint of a handleEventAction, 01165 // or explicitly from a given point when a meta-key callback 01166 // changes gestures mid-stream and wants to select its own transitional 01167 // starting point. 01168 SbVec3f startingWorldPoint; 01169 01170 // Used by parent draggers to save initial matrix when motion begins. 01171 SbMatrix startMotionMatrix; 01172 01173 // Where the locater was when dragging was initiated 01174 SbVec2f startLocater; 01175 01176 01177 // sets pick path and tempPathToThis 01178 void setPickPath(SoPath *newPickPath); 01179 SoPath *pickPath; // pick path to the dragger 01180 01181 // sets surrogate part picks. 01182 void setNoPickedSurrogate(); 01183 void setPickedSurrogate( SoPath *pathToOwner, SbName &nameUsedByOwner, 01184 SoPath *pathUsedByOwner ); 01185 01186 SbName surrogateNameInPickOwner; 01187 SoPath *pathToSurrogatePickOwner; 01188 SoPath *surrogatePathInPickOwner; 01189 01190 // A tempPath leading to 'this.' It is used to calculate the 01191 // motionMatrix. It is set when a dragger first grabs event, through the 01192 // handleEvent action, or by setCameraInfo() if NULL at the time. 01193 // A tempPath does not increase any ref counts, so keeping this path 01194 // will not prevent this node from being deleted. However, we must be 01195 // very careful before using it, since some nodes my get deleted out from 01196 // under us. The variable tempPathNumKidsHack helps us fix up paths 01197 // that have changed since the path was set. 01198 SoTempPath *tempPathToThis; 01199 SbPList *tempPathNumKidsHack; 01200 // Determines if this path can actually be used. Since a temp path 01201 // does not ref the nodes, some nodes my get deleted out from 01202 // under us. This routine makes sure that everythings all right. 01203 SbBool isTempPathToThisOk(); 01204 // Creates a temp path copy of the full path. 01205 SoTempPath *createTempPathFromFullPath( const SoFullPath *fp ) const; 01206 01207 // Minimum number of pixels to move before choosing a constraint 01208 // based on the gesture. 01209 float minGesture; 01210 01211 // The smallest scale that any dragger will write. If the user attempts 01212 // to go below this amount, the dragger will set it to this minimum. 01213 // Default is .0001 01214 static float minScale; 01215 01216 // We keep these matrices and their inverses around 01217 // to use when converting between spaces. The four 01218 // pairs are cached; the pair becomes invalud when its 01219 // valid flag is set to FALSE. 01220 01221 // Called to make sure these matrixes are up to date. 01222 void validateMatrices( SoAction* ); 01223 01224 // These matrices are ones that are commonly queried by 01225 // subclasses. So, we cache them. 01226 // Two things determine the localToWorld matrix. The pathToThis and 01227 // the motionMatrix. If either value is invalid, we need to recalculate. 01228 // But depending on which one it is, we either need to run a matrix 01229 // action on the pick path or just on the motionMatrix. 01230 SbBool cachedPathToThisValid; 01231 SbBool cachedMotionMatrixValid; 01232 SbMatrix cachedMotionMatrix; 01233 // PostMotion is the matrix space just AFTER the motion matrix. 01234 SbMatrix postMotionToWorldMatrix; 01235 SbMatrix worldToPostMotionMatrix; 01236 // PreMotion is the matrix space just BEFORE the motion matrix. 01237 SbMatrix preMotionToWorldMatrix; 01238 SbMatrix worldToPreMotionMatrix; 01239 01240 // Used so that draggers don't try to include themselves 01241 // as part of their own sizing boxes. By default this is FALSE. 01242 SbBool ignoreInBbox; 01243 01244 // True if we are interacting in order to update the SoInteractionElement 01245 bool m_draggerInteracting; 01246 01247 ProjectorFrontSetting projectorFrontSetting; 01248 int m_savedRenderCaching; 01249 }; 01250 01251 #endif /* _SO_DRAGGER_ */ 01252 01253