44 #define MSS_CLICK_BUTTONS (DM_PRIMARY_BUTTON|DM_SECONDARY_BUTTON)
46 using namespace HDK_Sample;
55 "SOP_proto_custombrush",
69 BM_SceneManager *scene)
77 BM_SceneManager *scene,
80 myBrushHandle((DM_SceneManager &)workbench(),
"MSS_CustomBrushState")
82 myIsBrushVisible =
false;
83 myResizingCursor =
false;
87 cparms.
gdp = &myBrushCursor;
91 #if defined(HOUDINI_11)
112 return "MSS_CustomBrushState";
138 myIsBrushVisible =
false;
162 myIsBrushVisible =
false;
185 myResizingCursor =
true;
187 else if (myResizingCursor)
193 myBrushRadius *= powf(1.01, dist);
196 myResizingCursor =
false;
225 sop->
setFloat(
"origin", 0, t, rayorig.
x());
226 sop->
setFloat(
"origin", 1, t, rayorig.
y());
227 sop->
setFloat(
"origin", 2, t, rayorig.
z());
229 sop->
setFloat(
"direction", 0, t, dir.
x());
230 sop->
setFloat(
"direction", 1, t, dir.
y());
231 sop->
setFloat(
"direction", 2, t, dir.
z());
233 sop->
setFloat(
"radius", 0, t, myBrushRadius);
328 myBrushHandle.
renderWire(r, 0, 0, 0, clr, &myBrushCursor);
344 showPrompt(
"LMB to apply stroke. MMB to erase. Shift-LMB to adjust radius.");
360 myBrushCursorXform.
translate(delta.
x(), delta.
y(), delta.
z());
363 myBrushCursorXform.
prescale(myBrushRadius, myBrushRadius, 1);
366 myIsBrushVisible =
true;
const GU_Detail * getCookedGeo(OP_Context &, int forced=0)
void popMatrix(bool all_matrices=true, RE_MatrixMode mmode=RE_MATRIX_VIEWING)
GA_API const UT_StringHolder dist
UT_Matrix4T< fpreal64 > UT_Matrix4D
void interrupt(BM_SimpleState *state=0) override
void interrupt(BM_SimpleState *=0) override
fpreal getTime() const
Obtains the current global time.
void mapToWorld(float x, float y, UT_Vector3 &dir, UT_Vector3 &rayorig)
Map viewport coordinates to worldspace location and direction.
void beginDistributedUndoBlock(const char *operation, UT_UndoBlockType blocktype, bool ignore_log=false)
void xformToObjectCoord(UT_Vector3 &p)
static PRM_Template * ourTemplateList
parameters for this state
UT_Vector3T< float > UT_Vector3
const unsigned PI_NETMASK_SOP
constexpr SYS_FORCE_INLINE T & z() noexcept
#define DM_SECONDARY_BUTTON
**But if you need a result
~MSS_CustomBrushState() override
int enter(BM_SimpleState::BM_EntryType how) override
void setString(const UT_StringRef &val, CH_StringMeaning meaning, int parmi, int vectori, fpreal t)
void showPrompt(const char *msg)
Set the status bar text.
Temporary container for either a RV_Render and an RE_Render.
virtual int registerState(PI_StateTemplate *type)
void newModelState(BM_ResourceManager *m)
int enter(BM_SimpleState::BM_EntryType how) override
called when the user enters the state
void pushMatrix(bool all_matrices=true, RE_MatrixMode mmode=RE_MATRIX_VIEWING)
bool setHighlight(bool on_off)
static BM_State * ourConstructor(BM_View &view, PI_StateTemplate &templ, BM_SceneManager *scene)
used by DM to create our state
MSS_CustomBrushState(JEDI_View &view, PI_StateTemplate &templ, BM_SceneManager *scene, const char *cursor=BM_DEFAULT_CURSOR)
void wantsLocates(int yesNo)
void removeClickInterest(int buttons)
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
void setViewportMask(unsigned mask)
void prescale(T sx, T sy, T sz, T sw=1)
#define MSS_CLICK_BUTTONS
void exit() override
called when the user leaves the state
virtual void updatePrompt()
sets the prompt's text
void identity()
Set the matrix to identity.
void updateBrush(int x, int y)
repositions the brush's guide geometry
void resume(BM_SimpleState *=0) override
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
GEO_API const TypeMask GEOPRIMBEZCURVE
void translate(T dx, T dy, T dz=0)
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
UT_Vector3T< T > rowVecMult3(const UT_Vector3T< T > &v, const UT_Matrix4T< S > &m)
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
void renderWire(RE_RenderContext r, int pickflag, uint id1, uint id2, const UT_Color &color, GU_Detail *gdp=NULL, const UT_DMatrix4 *xform=NULL)
int handleMouseEvent(UI_Event *event) override
Respond to mouse or keyboard events.
void addClickInterest(int buttons)
void resume(BM_SimpleState *state=0) override
#define DM_VIEWPORT_PERSPECTIVE
const char * className() const override
The name and type of this class:
void getViewportItransform(UT_Matrix4 &xform)
Get cameraspace to worldspace transform.
void multiplyMatrix(const UT_Matrix4 &m)
constexpr SYS_FORCE_INLINE T & y() noexcept
static GEO_Primitive * build(const GU_PrimCircleParms &parms, GA_PrimitiveTypeId type=GEO_PRIMCIRCLE)
OP_Node * getNode() const
void xformToObjectVector(UT_Vector3 &v)
void endDistributedUndoBlock(bool ignore_log=false)
void doRender(RE_RenderContext r, int x, int y, int ghost) override
Render the brush "cursor" geometry:
constexpr SYS_FORCE_INLINE T & x() noexcept