HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_HDKObject.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018
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  * This is an example of an implementation of the Object Merge SOP to
27  * demonstrate using DYNAMIC_PATHs, MULTIPARMS, and proper cooking of other
28  * SOPs.
29  */
30 
31 #ifndef __SOP_HDKObject_h__
32 #define __SOP_HDKObject_h__
33 
34 #include <CH/CH_ExprLanguage.h>
35 #include <SOP/SOP_Node.h>
36 
37 namespace HDK_Sample {
38 class SOP_HDKObject : public SOP_Node
39 {
40 public:
41  SOP_HDKObject(OP_Network *net, const char *name,
42  OP_Operator *entry);
43  virtual ~SOP_HDKObject();
44 
45  virtual bool updateParmsFlags();
46  static OP_Node *myConstructor(OP_Network *net, const char *name, OP_Operator *entry);
49 
50  // Because the object merge can reference an op chain which has a
51  // subnet with different D & R we must follow all our node's
52  // d & r status
53  virtual int getDandROpsEqual();
54  virtual int updateDandROpsEqual(int = 1)
55  { return getDandROpsEqual(); }
56 
57  int NUMOBJ() { return evalInt("numobj", 0, 0.0f); }
58  void setNUMOBJ(int num_obj)
59  { setInt("numobj", 0, 0.0f, num_obj); }
60 
61  int ENABLEMERGE(int i)
62  {
63  return evalIntInst("enable#", &i, 0, 0.0f);
64  }
65  void setENABLEMERGE(int i, int val)
66  {
67  setIntInst(val, "enable#", &i, 0, 0.0f);
68  }
69 
70  void SOPPATH(UT_String &str, int i, fpreal t)
71  {
72  evalStringInst("objpath#", &i, str, 0, t);
73  }
74  void setSOPPATH( UT_String &str, CH_StringMeaning meaning,
75  int i, fpreal t)
76  {
77  setStringInst(str, meaning, "objpath#", &i, 0, t);
78  }
79 
80  void XFORMPATH(UT_String &str, fpreal t)
81  {
82  evalString(str, "xformpath", 0, t);
83  }
84 protected:
85  virtual OP_ERROR cookMySop(OP_Context &context);
86 };
87 } // End HDK_Sample namespace
88 
89 #endif
void setSOPPATH(UT_String &str, CH_StringMeaning meaning, int i, fpreal t)
Definition: SOP_HDKObject.h:74
void setStringInst(const UT_String &value, CH_StringMeaning meaning, const char *parmname, const int *inst, int vectori, fpreal t, int nestlevel=1)
void XFORMPATH(UT_String &str, fpreal t)
Definition: SOP_HDKObject.h:80
CH_StringMeaning
void SOPPATH(UT_String &str, int i, fpreal t)
Definition: SOP_HDKObject.h:70
UT_ErrorSeverity
Definition: UT_Error.h:25
void setENABLEMERGE(int i, int val)
Definition: SOP_HDKObject.h:65
static PRM_Template myObsoleteList[]
Definition: SOP_HDKObject.h:48
png_uint_32 i
Definition: png.h:2877
void setIntInst(exint value, const char *parmname, const int *inst, int vectori, fpreal t, int nestlevel=1)
GLfloat f
Definition: glcorearb.h:1925
virtual int updateDandROpsEqual(int=1)
Definition: SOP_HDKObject.h:54
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual OP_ERROR cookMySop(OP_Context &context)
void evalStringInst(const char *name, const int *inst, UT_String &val, int vi, fpreal t, int nestlevel=1) const
GLuint const GLchar * name
Definition: glcorearb.h:785
static PRM_Template myTemplateList[]
Definition: SOP_HDKObject.h:47
double fpreal
Definition: SYS_Types.h:263
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
Definition: SOP_HDKObject.C:85
void setInt(int parmi, int vectori, fpreal t, exint value)
GLuint GLfloat * val
Definition: glcorearb.h:1607
void setNUMOBJ(int num_obj)
Definition: SOP_HDKObject.h:58
exint evalInt(int pi, int vi, fpreal t) const
SOP_HDKObject(OP_Network *net, const char *name, OP_Operator *entry)
Definition: SOP_HDKObject.C:92
virtual int getDandROpsEqual()
exint evalIntInst(const char *name, const int *inst, int vi, fpreal t, int nestlevel=1) const
virtual bool updateParmsFlags()