HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  ~SOP_UVEdit() override;
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  bool updateParmsFlags() override;
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 
90  int alone = 0) override;
91 
92  void getXformOrder(UT_XformOrder &xord,
93  const CH_Channel *chp) const override;
94 
95  void setVisualization(bool val) override;
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  void getDescriptiveParmName(UT_String &name) const override
107  {
108  name = "uvattrib";
109  }
110 
111 protected:
113  const char *inputLabel(unsigned idx) const override;
114 
115  void applyAndClearCurrentDelta() override;
116 
117  bool getGroupCentroid(
119  UT_Vector3 &centroid) override;
120 
121 private:
122 #ifdef INTEL_COMPILER
123  SOP_UVEdit(const SOP_UVEdit& ) : SOP_GDT(NULL, NULL, NULL) { }
124 #endif
125 
126 private:
127  // Selection
128  int GRPTYPE() const { return evalInt(I_GROUPTYPE, 0, 0); }
129 
130  // Transform
131  int TRS() const { return evalInt(I_TRS, 0, 0); }
132  int XYZ() const { return evalInt(I_XYZ, 0, 0); }
133  fpreal TX() const { return evalFloat(I_T, 0, 0); }
134  fpreal TY() const { return evalFloat(I_T, 1, 0); }
135  fpreal TZ() const { return evalFloat(I_T, 2, 0); }
136  fpreal RX() const { return evalFloat(I_R, 0, 0); }
137  fpreal RY() const { return evalFloat(I_R, 1, 0); }
138  fpreal RZ() const { return evalFloat(I_R, 2, 0); }
139  fpreal SX() const { return evalFloat(I_S, 0, 0); }
140  fpreal SY() const { return evalFloat(I_S, 1, 0); }
141  fpreal SZ() const { return evalFloat(I_S, 2, 0); }
142  fpreal SHEAR_XY() const { return evalFloat(I_SHEAR, 0, 0); }
143  fpreal SHEAR_XZ() const { return evalFloat(I_SHEAR, 1, 0); }
144  fpreal SHEAR_YZ() const { return evalFloat(I_SHEAR, 2, 0); }
145  fpreal PX() const { return evalFloat(I_P, 0, 0); }
146  void SET_PX(float f) { setFloat(I_P, 0, 0, f); }
147  fpreal PY() const { return evalFloat(I_P, 1, 0); }
148  void SET_PY(float f) { setFloat(I_P, 1, 0, f); }
149  fpreal PZ() const { return evalFloat(I_P, 2, 0); }
150  void SET_PZ(float f) { setFloat(I_P, 2, 0, f); }
151 
152  // Soft
153  fpreal RADIUS() const { return evalFloat(
154  SOP_UVEDIT_RADIUS_IDX, 0, 0); }
155  int SOFTTYPE() const { return evalInt(
156  SOP_UVEDIT_SOFTTYPE_IDX, 0, 0); }
157  fpreal TANDEG0() const { return evalFloat(
158  SOP_UVEDIT_TANGENT_IDX,0, 0); }
159  fpreal TANDEG1() const { return evalFloat(
160  SOP_UVEDIT_TANGENT_IDX,1, 0); }
161  void KERNEL(UT_String &str) const
162  { evalString(str,
163  SOP_UVEDIT_KERNEL_IDX, 0, 0); }
164  int METRIC() const { return evalInt(
165  SOP_UVEDIT_METRIC_IDX, 0, 0); }
166  int GLOBAL() const { return evalInt(
167  SOP_UVEDIT_GLOBAL_IDX, 0, 0); }
168  int UVGLOBAL() const { return evalInt(
170  int VISUALIZE_FALLOFF(fpreal t) const
171  { return evalInt(SOP_UVEDIT_VISFALLOFF_IDX, 0, t); }
172  bool falloffAttributeRequested(fpreal t) const;
173 
174  // UVSew
175  int UVSEW() const { return evalInt(
176  SOP_UVEDIT_UVSEW_IDX, 0, 0); }
177 
178 
179  // Group Calculations
180  void computeTransformGroups(GA_AttributeOwner owner, bool changed_input);
181  void computeSelectionCentroid(GA_AttributeOwner owner, UT_Vector3 &centroid);
182 
183  // UV Transform
184  void doTransform(GA_AttributeOwner owner, const GA_RWHandleV3 &uvattrib, fpreal t, AttribAction &falloff_action);
185  // Soft-related methods
186  bool isSoft() const { return RADIUS() != 0.0; }
187 
188  UT_Vector3 myInitialCentroid;
189 
190  GA_VertexGroup *myVtxGroup;
191  GA_PointGroup *myPtGroup;
192 
193  GEO_SoftTransformCache mySoftCache;
194  bool mySoftCacheDirty;
195 
196  bool myVisualizationFlag;
197  bool mySetFalloffOnLastCook;
198  bool myOverwroteInputFalloff;
199 };
200 
201 #endif
virtual void applyAndClearCurrentDelta()
virtual void setVisualization(bool)
Definition: SOP_Node.h:849
virtual bool updateParmsFlags()
GLuint const GLchar * name
Definition: glew.h:1814
Definition: OBJ_Node.h:156
GLuint const GLfloat * val
Definition: glew.h:2794
const char * inputLabel(unsigned idx) const override
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:157
void getDescriptiveParmName(UT_String &name) const override
Definition: SOP_UVEdit.h:106
GLclampf f
Definition: glew.h:3499
Definition: OBJ_Node.h:155
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual bool getGroupCentroid(OP_Context &, UT_Vector3 &)
Definition: SOP_Node.h:1600
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
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
fpreal64 fpreal
Definition: SYS_Types.h:277
#define SOP_API
Definition: SOP_API.h:10
exint evalInt(int pi, int vi, fpreal t) const
virtual OP_ERROR cookMySop(OP_Context &context)=0
GLdouble GLdouble t
Definition: glew.h:1398
Definition: OBJ_Node.h:154