00001 /* 00002 * Copyright (c) 2012 00003 * Side Effects Software Inc. All rights reserved. 00004 * 00005 * Redistribution and use of Houdini Development Kit samples in source and 00006 * binary forms, with or without modification, are permitted provided that the 00007 * following conditions are met: 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. The name of Side Effects Software may not be used to endorse or 00011 * promote products derived from this software without specific prior 00012 * written permission. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS 00015 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00016 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00017 * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 00018 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00019 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00020 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00021 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00022 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00023 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 * 00025 *---------------------------------------------------------------------------- 00026 * This code is for creating the state to go with this op. 00027 */ 00028 00029 #ifndef __MSS_CustomBrushState_H__ 00030 #define __MSS_CustomBrushState_H__ 00031 00032 #include <MSS/MSS_SingleOpState.h> 00033 #include <GU/GU_Detail.h> 00034 00035 class JEDI_View; 00036 00037 namespace HDK_Sample { 00038 class MSS_CustomBrushState : public MSS_SingleOpState 00039 { 00040 public: 00041 MSS_CustomBrushState(JEDI_View &view, PI_StateTemplate &templ, 00042 BM_SceneManager *scene, 00043 char *cursor = BM_DEFAULT_CURSOR); 00044 virtual ~MSS_CustomBrushState(); 00045 00046 /// used by DM to create our state 00047 static BM_State *ourConstructor(BM_View &view, PI_StateTemplate &templ, 00048 BM_SceneManager *scene); 00049 00050 /// parameters for this state 00051 static PRM_Template *ourTemplateList; 00052 00053 /// The name and type of this class: 00054 virtual const char *className() const; 00055 00056 protected: 00057 /// called when the user enters the state 00058 virtual int enter(BM_SimpleState::BM_EntryType how); 00059 00060 /// called when the user leaves the state 00061 virtual void exit(); 00062 00063 /// called when the user temporarily leaves the state (mouse leaves the 00064 /// viewport) 00065 virtual void interrupt(BM_SimpleState * = 0); 00066 00067 /// called when the user returns to the state after leaving temporarily 00068 /// (mouse re-enters the viewport) 00069 virtual void resume(BM_SimpleState * = 0); 00070 00071 /// Respond to mouse or keyboard events. 00072 virtual int handleMouseEvent(UI_Event *event); 00073 00074 /// Render the brush "cursor" geometry: 00075 virtual void doRender(RE_Render *r, short x, short y, int ghost); 00076 00077 /// sets the prompt's text 00078 virtual void updatePrompt(); 00079 00080 /// repositions the brush's guide geometry 00081 void updateBrush(int x, int y); 00082 00083 private: 00084 bool myIsBrushVisible; 00085 GU_Detail myBrushCursor; 00086 UT_Matrix4 myBrushCursorXform; 00087 fpreal myBrushRadius; 00088 00089 /// These are used track the resizing of the cursor in the viewport 00090 bool myResizingCursor; 00091 short myLastCursorX, myLastCursorY; 00092 short myResizeCursorX, myResizeCursorY; 00093 }; 00094 } // End HDK_Sample namespace 00095 00096 #endif
1.5.9