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 * Custom selector for the BrushHairLen SOP. 00027 */ 00028 00029 #include <UT/UT_DSOVersion.h> 00030 #include <SOP/SOP_BrushBase.h> 00031 #include <BM/BM_ResourceManager.h> 00032 #include "MSS_BrushHairLenSelector.h" 00033 00034 using namespace HDK_Sample; 00035 00036 void 00037 newSelector(BM_ResourceManager * /*m*/) 00038 { 00039 PI_SelectorTemplate *sel; 00040 OP_Operator *op; 00041 00042 // We create a PI_SelectorTemplate here to represent our new selector 00043 // As we want to use this with our SOP, and as the selector .dso 00044 // loads after the sop .dso, we also bind the selector here. 00045 00046 // Create & register the selector. 00047 sel = new PI_SelectorTemplate("brushhairlenselect", // Internal name 00048 "Brush Hair Selector", // English name 00049 "Sop"); // Where it works. 00050 sel->constructor((void *) &MSS_BrushHairLenSelector::ourConstructor); 00051 sel->data(OP3DthePrimSelTypes); 00052 PIgetResourceManager()->registerSelector(sel); 00053 00054 // Bind the selector. 00055 op = OP_Network::getOperatorTable(SOP_TABLE_NAME)->getOperator("proto_brushhairlen"); 00056 if (!op) 00057 { 00058 UT_ASSERT(!"Could not find required op!"); 00059 return; 00060 } 00061 00062 PIgetResourceManager()->bindSelector( 00063 op, // OP_Operator to bind to. 00064 "brushhairlenselect", // Internal name of selector. 00065 "Brush Hair Selector", // English name of selector. 00066 "Select the area to grow hair from.", // Prompt. 00067 "group", // Parameter to write group to. 00068 0, // Input number to wire up. 00069 1, // 1 means this input is required. 00070 "0x000000ff", // Prim/point mask selection. 00071 0, // Can the user drag the object? 00072 0, // Optional menu. 00073 0, // Must * be used to select all? 00074 0, // Extra info string passed to selector 00075 false); // true if this from a ScriptOp. 00076 } 00077 00078 MSS_BrushHairLenSelector::MSS_BrushHairLenSelector(OP3D_View &viewer, 00079 PI_SelectorTemplate &templ) 00080 : MSS_ReusableSelector(viewer, templ, "proto_brushhairlen", "group", 00081 0, // No group type field. 00082 true) // We want to allow blank group names. 00083 { 00084 // Nothing needed. 00085 } 00086 00087 MSS_BrushHairLenSelector::~MSS_BrushHairLenSelector() 00088 { 00089 // Nothing needed. 00090 } 00091 00092 BM_InputSelector * 00093 MSS_BrushHairLenSelector::ourConstructor(BM_View &viewer, 00094 PI_SelectorTemplate &templ) 00095 { 00096 return new MSS_BrushHairLenSelector((OP3D_View &)viewer, templ); 00097 } 00098 00099 const char * 00100 MSS_BrushHairLenSelector::className() const 00101 { 00102 return "MSS_BrushHairLenSelector"; 00103 }
1.5.9