HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSS_BrushHairLenSelector.C
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024
3  * Side Effects Software Inc. All rights reserved.
4  *
5  * Redistribution and use of Houdini Development Kit samples in source and
6  * binary forms, with or without modification, are permitted provided that the
7  * following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. The name of Side Effects Software may not be used to endorse or
11  * promote products derived from this software without specific prior
12  * written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17  * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  *----------------------------------------------------------------------------
26  * Custom selector for the BrushHairLen SOP.
27  */
28 
29 #include <UT/UT_DSOVersion.h>
30 #include <SOP/SOP_BrushBase.h>
31 #include <BM/BM_ResourceManager.h>
33 
34 using namespace HDK_Sample;
35 
36 void
38 {
40  OP_Operator *op;
41 
42  // We create a PI_SelectorTemplate here to represent our new selector
43  // As we want to use this with our SOP, and as the selector .dso
44  // loads after the sop .dso, we also bind the selector here.
45 
46  // Create & register the selector.
47  sel = new PI_SelectorTemplate("brushhairlenselect", // Internal name
48  "Brush Hair Selector", // English name
49  "Sop"); // Where it works.
53 
54  // Bind the selector.
55  op = OP_Network::getOperatorTable(SOP_TABLE_NAME)->getOperator("proto_brushhairlen");
56  if (!op)
57  {
58  UT_ASSERT(!"Could not find required op!");
59  return;
60  }
61 
63  op, // OP_Operator to bind to.
64  "brushhairlenselect", // Internal name of selector.
65  "Brush Hair Selector", // English name of selector.
66  "Select the area to grow hair from.", // Prompt.
67  "group", // Parameter to write group to.
68  0, // Input number to wire up.
69  1, // 1 means this input is required.
70  "0x000000ff", // Prim/point mask selection.
71  0, // Can the user drag the object?
72  0, // Optional menu.
73  0, // Must * be used to select all?
74  0, // Extra info string passed to selector
75  false); // true if this from a ScriptOp.
76 }
77 
79  PI_SelectorTemplate &templ)
80  : MSS_ReusableSelector(viewer, templ, "proto_brushhairlen", "group",
81  0, // No group type field.
82  true) // We want to allow blank group names.
83 {
84  // Nothing needed.
85 }
86 
88 {
89  // Nothing needed.
90 }
91 
94  PI_SelectorTemplate &templ)
95 {
96  return new MSS_BrushHairLenSelector((OP3D_View &)viewer, templ);
97 }
98 
99 const char *
101 {
102  return "MSS_BrushHairLenSelector";
103 }
OP_OperatorTable * getOperatorTable() const
Definition: OP_Network.h:651
void newSelector(BM_ResourceManager *)
int bindSelector(OP_Operator *op, const char *sname, const char *seldescription, const char *prompt, const char *opparm, int opinput, int opinputreq, const char *primmask, int allowdrag, const char *menu, int astselall, const char *extrainfo, bool fromScriptOp)
MSS_BrushHairLenSelector(OP3D_View &viewer, PI_SelectorTemplate &templ)
OP3D_API PI_SelectionEntry OP3DthePrimSelTypes[]
OP_Operator * getOperator(const char *name) const
virtual int registerSelector(PI_SelectorTemplate *type)
#define SOP_TABLE_NAME
Definition: OP_Node.h:243
void * constructor() const
PI_API PI_ResourceManager * PIgetResourceManager()
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
static BM_InputSelector * ourConstructor(BM_View &Viewer, PI_SelectorTemplate &templ)