HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOP_UVEdit.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SOP Library (C++)
7  *
8  * COMMENTS: The UV Edit SOP
9  *
10  * IMPORTANT: Any changes made to this SOP will probably
11  * need to made to SOP_UVTransform, and vice versa!!!
12  *
13  */
14 
15 #ifndef __SOP_UVEdit_h__
16 #define __SOP_UVEdit_h__
17 
18 #include "SOP_API.h"
19 #include "SOP_GDT.h"
21 
22 class PRM_MenuEntry;
23 
24 enum {
25  // Group parameters
28 
30 
31  // Transform parameters
39 
40  // Soft Parameters
42 
43 #define SOP_UVEDIT_NUM_SOFT_PARMS (8)
52 
53  // UV Sew Parameters
55 
56 };
57 
58 class SOP_API SOP_UVEdit : public SOP_GDT
59 {
60 friend class MSS_UVEditState;
61 public:
62  SOP_UVEdit(OP_Network *net, const char *name, OP_Operator *entry);
63  virtual ~SOP_UVEdit();
64 
65  // Parameter indices (same as above, but different names):
66  enum
67  {
68  I_GROUP = SOP_GDT_GRP_IDX,
73  I_T,
74  I_R,
75  I_S,
78  };
79 
80  virtual bool updateParmsFlags();
81 
82  static OP_Node *myConstructor(OP_Network *net,
83  const char *name,
84  OP_Operator *entry);
85 
86  static PRM_Template myTemplateList[];
87  static PRM_Template myObsoleteList[];
88 
89  virtual OP_ERROR cookInputGroups(OP_Context &context,
90  int alone = 0);
91 
92  virtual void getXformOrder(UT_XformOrder &xord,
93  const CH_Channel *chp) const;
94 
95  virtual void setVisualization(int val);
96 
97  void TOGGLE_UVSEW();
98 
99  // An enum by which functions can report actions taken regarding a
100  // particular attribute.
102  {
103  NO_CHANGE, CHANGED_EXISTING, REPLACED_EXISTING, ADDED_MISSING
104  };
105 
106  virtual void getDescriptiveParmName(UT_String &name) const
107  {
108  name = "uvattrib";
109  }
110 
111 protected:
112  virtual OP_ERROR cookMySop(OP_Context &context);
113  virtual const char *inputLabel(unsigned idx) const;
114 
115  virtual void applyAndClearCurrentDelta();
116 
117  virtual bool getGroupCentroid(OP_Context &context,
118  UT_Vector3 &centroid);
119 
120 private:
121 #ifdef INTEL_COMPILER
122  SOP_UVEdit(const SOP_UVEdit& ) : SOP_GDT(NULL, NULL, NULL) { }
123 #endif
124 
125 private:
126  // Selection
127  int GRPTYPE() const { return evalInt(I_GROUPTYPE, 0, 0); }
128 
129  // Transform
130  int TRS() const { return evalInt(I_TRS, 0, 0); }
131  int XYZ() const { return evalInt(I_XYZ, 0, 0); }
132  fpreal TX() const { return evalFloat(I_T, 0, 0); }
133  fpreal TY() const { return evalFloat(I_T, 1, 0); }
134  fpreal TZ() const { return evalFloat(I_T, 2, 0); }
135  fpreal RX() const { return evalFloat(I_R, 0, 0); }
136  fpreal RY() const { return evalFloat(I_R, 1, 0); }
137  fpreal RZ() const { return evalFloat(I_R, 2, 0); }
138  fpreal SX() const { return evalFloat(I_S, 0, 0); }
139  fpreal SY() const { return evalFloat(I_S, 1, 0); }
140  fpreal SZ() const { return evalFloat(I_S, 2, 0); }
141  fpreal SHEAR_XY() const { return evalFloat(I_SHEAR, 0, 0); }
142  fpreal SHEAR_XZ() const { return evalFloat(I_SHEAR, 1, 0); }
143  fpreal SHEAR_YZ() const { return evalFloat(I_SHEAR, 2, 0); }
144  fpreal PX() const { return evalFloat(I_P, 0, 0); }
145  void SET_PX(float f) { setFloat(I_P, 0, 0, f); }
146  fpreal PY() const { return evalFloat(I_P, 1, 0); }
147  void SET_PY(float f) { setFloat(I_P, 1, 0, f); }
148  fpreal PZ() const { return evalFloat(I_P, 2, 0); }
149  void SET_PZ(float f) { setFloat(I_P, 2, 0, f); }
150 
151  // Soft
152  fpreal RADIUS() const { return evalFloat(
153  SOP_UVEDIT_RADIUS_IDX, 0, 0); }
154  int SOFTTYPE() const { return evalInt(
155  SOP_UVEDIT_SOFTTYPE_IDX, 0, 0); }
156  fpreal TANDEG0() const { return evalFloat(
157  SOP_UVEDIT_TANGENT_IDX,0, 0); }
158  fpreal TANDEG1() const { return evalFloat(
159  SOP_UVEDIT_TANGENT_IDX,1, 0); }
160  void KERNEL(UT_String &str) const
161  { evalString(str,
162  SOP_UVEDIT_KERNEL_IDX, 0, 0); }
163  int METRIC() const { return evalInt(
164  SOP_UVEDIT_METRIC_IDX, 0, 0); }
165  int GLOBAL() const { return evalInt(
166  SOP_UVEDIT_GLOBAL_IDX, 0, 0); }
167  int UVGLOBAL() const { return evalInt(
169  int VISUALIZE_FALLOFF(fpreal t) const
170  { return evalInt(SOP_UVEDIT_VISFALLOFF_IDX, 0, t); }
171  bool falloffAttributeRequested(fpreal t) const;
172 
173  // UVSew
174  int UVSEW() const { return evalInt(
175  SOP_UVEDIT_UVSEW_IDX, 0, 0); }
176 
177 
178  // Group Calculations
179  void computeTransformGroups(GA_AttributeOwner owner, bool changed_input);
180  void computeSelectionCentroid(GA_AttributeOwner owner, UT_Vector3 &centroid);
181 
182  // UV Transform
183  void doTransform(GA_AttributeOwner owner, const GA_RWHandleV3 &uvattrib, fpreal t, AttribAction &falloff_action);
184  // Soft-related methods
185  bool isSoft() const { return RADIUS() != 0.0; }
186 
187  UT_Vector3 myInitialCentroid;
188 
189  GA_VertexGroup *myVtxGroup;
190  GA_PointGroup *myPtGroup;
191 
192  GEO_SoftTransformCache mySoftCache;
193  bool mySoftCacheDirty;
194 
195  bool myVisualizationFlag;
196  bool mySetFalloffOnLastCook;
197  bool myOverwroteInputFalloff;
198 };
199 
200 #endif
virtual void applyAndClearCurrentDelta()
virtual bool updateParmsFlags()
Definition: OBJ_Node.h:152
virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const
fpreal evalFloat(int pi, int vi, fpreal t) const
UT_ErrorSeverity
Definition: UT_Error.h:25
Definition: OBJ_Node.h:153
virtual const char * inputLabel(unsigned idx) const override
3D Vector class.
GLfloat f
Definition: glcorearb.h:1925
Definition: OBJ_Node.h:151
void evalString(UT_String &val, int pi, int vi, fpreal t) const
void setFloat(int parmi, int vectori, fpreal t, fpreal value, int h=0)
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual bool getGroupCentroid(OP_Context &, UT_Vector3 &)
Definition: SOP_Node.h:1571
virtual OP_ERROR cookInputGroups(OP_Context &context, int alone=0)
#define SOP_GDT_GRP_IDX
Definition: SOP_GDT.h:22
GA_AttributeOwner
Definition: GA_Types.h:33
double fpreal
Definition: SYS_Types.h:269
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define SOP_API
Definition: SOP_API.h:10
virtual void setVisualization(int)
Definition: SOP_Node.h:835
exint evalInt(int pi, int vi, fpreal t) const
virtual OP_ERROR cookMySop(OP_Context &context)=0
virtual void getDescriptiveParmName(UT_String &name) const
Definition: SOP_UVEdit.h:106
Definition: OBJ_Node.h:150