HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Edit.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 Edit SOP, which works in conjunction with the
9  * Edit State and the GDT classes.
10  *
11  */
12 
13 #ifndef __SOP_Edit_h__
14 #define __SOP_Edit_h__
15 
16 #include "SOP_API.h"
17 
18 #include "SOP_BrushBase.h"
19 
21 #include <GU/GU_SurfaceDistance.h>
22 
23 class PRM_MenuEntry;
24 
25 enum {
26  // Group parameters
27  SOP_EDIT_GRP_IDX, // = SOP_GDT_GRP_IDX,
29 
31 #define SOP_EDIT_NUM_EDIT_PARMS (3)
32 #define SOP_EDIT_NUM_SCULPT_PARMS (1)
33 
34  // Main Transform/Peak Switcher
36 
37  // Transform parameters
38 #define SOP_EDIT_NUM_TRANSFORM_PARMS (12)
46 #define SOP_EDIT_NUM_PIVOTXFORM_PARMS (2)
50 #define SOP_EDIT_NUM_PREXFORM_PARMS (6)
61 
62  // Peak Parameters
63 #define SOP_EDIT_NUM_PEAK_PARMS (2)
66 
67  // Commit Button
69 
70  // Soft Parameters
72 
73 #define SOP_EDIT_NUM_SOFT_PARMS (9)
83 
84 // SCULPT parameters
85 
86  // Group parameters
88 
89 #define SOP_EDIT_SCULPT_NUM_DEFORM_PARMS (8)
100 
101 #define SOP_EDIT_SCULPT_NUM_NIB_PARMS (18)
120 
121 #define SOP_EDIT_SCULPT_NUM_RAY_PARMS (11)
133 
135 
136  // Symmetry Parameters
143 
145 
146  // Reset Button
148 };
149 
151 {
152 friend class MSS_EditState;
153 public:
154  SOP_Edit(OP_Network *net, const char *name, OP_Operator *entry);
155  virtual ~SOP_Edit();
156 
157  virtual int isRefInput(unsigned int i) const override;
158  virtual void unloadDataHack() override;
159  virtual bool unloadData() override;
160 
161  // Allow toggling of operation type
162  void toggleXformPeak();
163 
164  virtual bool updateParmsFlags() override;
165 
166  static OP_Node *myConstructor(OP_Network *net,
167  const char *name,
168  OP_Operator *entry);
169 
170  static PRM_Template myTemplateList[];
171  static PRM_Template myObsoleteList[];
172 
173  // Get the selection group string:
174  // We have to override this since the parameter's index has changed
175  virtual void getSelString(UT_String &str) override
176  { evalString(str, SOP_EDIT_GRP_IDX, 0, 0.0); }
177 
178  virtual void setAccumulateStencil(bool yesno) override
179  {
181  }
182  virtual void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
183  {
187  }
188  virtual void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
189  {
190  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 0, t, orient.x());
191  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 1, t, orient.y());
192  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 2, t, orient.z());
193  }
194  virtual void setHitPrimitive(int primidx, fpreal t) override
195  {
196  setInt(SOP_EDIT_SCULPT_RAY_HITPRIM_IDX, 0, t, primidx);
197  }
198  virtual void setHitPoint(int pt, fpreal t) override
199  {
201  }
202  virtual void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
203  {
207  }
208  virtual void setHitPressure(fpreal p, fpreal t) override
209  {
211  }
212  virtual void setRadius(fpreal r, fpreal t) override
213  {
215  }
216  virtual void setUVRadius(fpreal r, fpreal t) override
217  {
219  }
220  virtual void setBrushEvent(SOP_BrushEvent event) override
221  {
222  setInt(SOP_EDIT_SCULPT_RAY_EVENT_IDX, 0, 0, int(event));
223  }
224  virtual void setBrushOp(SOP_BrushOp op) override
225  {
226  int iop;
227  switch (op)
228  {
229  case SOP_BRUSHOP_SMOOTH: iop = 1; break;
230  case SOP_BRUSHOP_SMOOTHDEFORM: iop = 2; break;
231  case SOP_BRUSHOP_ERASE: iop = 3; break;
232  case SOP_BRUSHOP_DEFORM:
233  default: iop = 0; break;
234  }
235  setInt(SOP_EDIT_SCULPT_OP_IDX, 0, 0, iop);
236  }
237  virtual void setBrushShape(SOP_BrushShape shape) override
238  {
239  setInt(SOP_EDIT_SCULPT_SHAPE_IDX, 0, 0, int(shape));
240  }
241  virtual void setProjectionType(int projtype) override
242  {
243  setInt(SOP_EDIT_SCULPT_PROJTYPE_IDX, 0, 0, projtype);
244  }
245  virtual void useForegroundColor() override
246  {
248  }
249  virtual void useBackgroundColor() override
250  {
252  }
253 
254  virtual int altersGeometry() const override { return 1; }
255  virtual int altersColor() const override { return 0; }
256 
257  int MODE()
258  { return evalInt(SOP_EDIT_MODESWITCHER_IDX, 0, 0); }
259  virtual fpreal RAWRADIUS(fpreal t) override
260  { return evalFloat(SOP_EDIT_SCULPT_RAD_IDX, 0, t); }
261  virtual fpreal RAWUVRADIUS(fpreal t) override
262  { return evalFloat(SOP_EDIT_SCULPT_UVRAD_IDX, 0, t); }
263  virtual fpreal RADIUSPRESSURE(fpreal t) override
264  { return evalFloat(SOP_EDIT_SCULPT_RADPRESSURE_IDX, 0, t); }
265  virtual fpreal RAWOPACITY(fpreal t) override
266  {return evalFloat(SOP_EDIT_SCULPT_OPAC_IDX, 0, t); }
267  virtual fpreal OPACITYPRESSURE(fpreal t) override
269 
271  { return evalInt("modeswitcher", 0, t); }
272 
273  virtual SOP_BrushOp OP() override
274  {
275  switch (evalInt(SOP_EDIT_SCULPT_OP_IDX, 0, 0))
276  {
277  case 0: return SOP_BRUSHOP_DEFORM;
278  case 1: return SOP_BRUSHOP_SMOOTH;
279  case 2: return SOP_BRUSHOP_SMOOTHDEFORM;
280  case 3: return SOP_BRUSHOP_ERASE;
281  default: return SOP_BRUSHOP_DEFORM;
282  }
283  }
284  virtual int ACCUMSTENCIL() override
286  virtual int PROJECTIONTYPE() override
287  { return evalInt(SOP_EDIT_SCULPT_PROJTYPE_IDX, 0, 0); }
288  virtual int REALTIME() override
289  { return evalInt(SOP_EDIT_SCULPT_REALTIME_IDX, 0, 0); }
290  virtual int SHAPE(fpreal t) override
291  { return evalInt(SOP_EDIT_SCULPT_SHAPE_IDX, 0, t); }
292 
293  virtual OP_ERROR cookInputGroups(OP_Context &context,
294  int alone = 0) override;
295 
296  virtual void getXformOrder(UT_XformOrder &xord,
297  const CH_Channel *chp) const override;
298 
299  virtual void resolveObsoleteParms(
300  PRM_ParmList *obsolete_parms) override;
301 
302  // This will force myRayIntersect to be recomputed
303  void clearRayIntersect();
304 
305  virtual void beginNewOperation() override;
306  virtual void clearAllDeltas(fpreal t) override;
307 
308  // Functions for the BlendShapes SOP hack to only apply scaled deltas
309  // without cooking
310  void applyScaledDeltas(
311  GEO_Detail &apply_gdp,
312  const GDT_CoordinateFrames *coord_frames,
313  float scale,
314  const GA_PointGroup *ptgroup);
315 
316  bool getCookedFlag() const { return myCookedFlag; }
317 
318  void setUseOrient(bool f)
319  { setInt(SOP_EDIT_USEORIENT_IDX, 0, 0, f ? 1 : 0); }
320 
321  bool hasChange(fpreal t);
322 
323  virtual const GA_PrimitiveGroup *getPrimitiveSelection() const override
324  { return myPrimitiveGroup; }
325 
326  virtual void setVisualization(int val) override;
327 
328  // An enum by which functions can report actions taken regarding a
329  // particular attribute.
331  {
332  NO_CHANGE, CHANGED_EXISTING, REPLACED_EXISTING, ADDED_MISSING
333  };
334 
335 
336 protected:
337  // Helper class for avoiding evaluating mirror parameters multiple times
338  // during a cook.
340  {
341  public:
344  float myDistance;
345  float myPlaneTol;
348  };
349 
350  void clearTransformParms();
351  virtual OP_ERROR cookMySop(OP_Context &context) override;
352  virtual const char *inputLabel(unsigned idx) const override;
353 
354  virtual void rollbackCurrentDelta() override;
355  void mirrorDelta(MirrorParmCache &cache);
356  virtual void applyAndClearCurrentDelta() override;
357  virtual void applyPermanentDelta() override;
358  virtual void initializeInput(OP_Context &context);
359 
360  virtual bool getGroupCentroid(OP_Context &context,
361  UT_Vector3 &centroid) override;
362 
363  virtual void doErase() override;
364 
365  // This function takes the transform parameters and modifies the gdp
366  // pointer, while creating the appropriate deltas in myCurrentDelta.
367  // It is virtual so that HDK classes may hook into this.
368  virtual void doTransform(MirrorParmCache &mirror_cache,
369  AttribAction &falloff_action);
370 
371  virtual int MERGEMODE() override { return 0; }
372  virtual void SCRIPT(UT_String &, fpreal) override {}
373 
374  virtual int AXIS() override
375  { return evalInt(SOP_EDIT_SCULPT_AXIS_IDX, 0, 0); }
376  virtual fpreal USERX(fpreal t) override
377  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 0, t); }
378  virtual fpreal USERY(fpreal t) override
379  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 1, t); }
380  virtual fpreal USERZ(fpreal t) override
381  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 2, t); }
382 
383  virtual fpreal RAYORIENTX(fpreal t) override
384  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,0,t); }
385  virtual fpreal RAYORIENTY(fpreal t) override
386  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,1,t); }
387  virtual fpreal RAYORIENTZ(fpreal t) override
388  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,2,t); }
389  virtual fpreal RAYHITX(fpreal t) override
390  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,0,t); }
391  virtual fpreal RAYHITY(fpreal t) override
392  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,1,t); }
393  virtual fpreal RAYHITZ(fpreal t) override
394  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,2,t); }
395  virtual fpreal RAYHITU(fpreal t) override
396  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 0,t); }
397  virtual fpreal RAYHITV(fpreal t) override
398  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 1,t); }
399  virtual fpreal RAYHITW(fpreal t) override
400  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 2,t); }
401  virtual fpreal RAYHITPRESSURE(fpreal t) override
402  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPRESSURE_IDX, 0, t); }
403  virtual int PRIMHIT(fpreal t) override
404  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPRIM_IDX, 0,t); }
405  virtual int PTHIT(fpreal t) override
406  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPT_IDX, 0, t); }
407  virtual int EVENT() override
408  { return evalInt(SOP_EDIT_SCULPT_RAY_EVENT_IDX, 0,0); }
409  virtual bool USE_FOREGROUND() override
410  { return evalInt(SOP_EDIT_SCULPT_COLOR_SWITCHER_IDX,
411  0, 0) == 0; }
412  virtual fpreal FGR(fpreal t) override { return evalFloat(SOP_EDIT_SCULPT_FG_IDX, 0, t); }
413  virtual fpreal FGG(fpreal ) override { return 0.0; }
414  virtual fpreal FGB(fpreal ) override { return 0.0; }
415  virtual fpreal BGR(fpreal t) override { return evalFloat(SOP_EDIT_SCULPT_BG_IDX, 0, t); }
416  virtual fpreal BGG(fpreal ) override { return 0.0; }
417  virtual fpreal BGB(fpreal ) override { return 0.0; }
418 
419  virtual fpreal SOFTEDGE(fpreal t) override
420  { return evalFloat(SOP_EDIT_SCULPT_SOFTEDGE_IDX, 0, t); }
421  virtual void KERNEL(UT_String &str, fpreal t) override
422  { evalString(str, SOP_EDIT_SCULPT_KERNEL_IDX, 0, t); }
423  virtual int UPTYPE(fpreal t) override
424  { return evalInt(SOP_EDIT_SCULPT_UPTYPE_IDX, 0, t);}
425  virtual fpreal UPX(fpreal t) override
426  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 0, t);}
427  virtual fpreal UPY(fpreal t) override
428  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 1, t);}
429  virtual fpreal UPZ(fpreal t) override
430  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 2, t);}
431 
432  virtual fpreal PAPERNOISE(fpreal t) override
433  { return evalFloat(SOP_EDIT_SCULPT_PAPER_IDX, 0, t);}
434  virtual fpreal SPLATTER(fpreal t) override
435  { return evalFloat(SOP_EDIT_SCULPT_SPLATTER_IDX, 0, t); }
436  virtual void BITMAP(UT_String &str, fpreal t) override
437  { evalString(str, SOP_EDIT_SCULPT_BITMAP_IDX, 0, t); }
438  virtual int BITMAPCHAN(fpreal t) override
439  { return evalInt(SOP_EDIT_SCULPT_BITMAPCHAN_IDX, 0, t); }
440  virtual fpreal ANGLE(fpreal t) override
441  { return evalFloat(SOP_EDIT_SCULPT_ANGLE_IDX, 0, t); }
442  virtual fpreal SQUASH(fpreal t) override
443  { return evalFloat(SOP_EDIT_SCULPT_SQUASH_IDX, 0, t); }
444 
445  virtual int DOSTAMPING() override { return 0; }
446  virtual int WRITEALPHA() override { return 0; }
447  virtual int OVERRIDECD() override { return 0; }
448  virtual void CDNAME(UT_String &, fpreal) override { }
449  virtual int OVERRIDEALPHA() override { return 0; }
450  virtual void ALPHANAME(UT_String &, fpreal) override { }
451  virtual int OVERRIDENML() override { return 0; }
452  virtual void NMLNAME(UT_String & /*str*/, fpreal /*t*/) override {}
453  virtual int ADDATTRIB() override { return 0; }
454 
455  virtual fpreal SYMMETRYDIRX(fpreal /*t*/) override { return 0.0; }
456  virtual fpreal SYMMETRYDIRY(fpreal /*t*/) override { return 0.0; }
457  virtual fpreal SYMMETRYDIRZ(fpreal /*t*/) override { return 0.0; }
458  virtual fpreal SYMMETRYORIGX(fpreal /*t*/) override { return 0.0; }
459  virtual fpreal SYMMETRYORIGY(fpreal /*t*/) override { return 0.0; }
460  virtual fpreal SYMMETRYORIGZ(fpreal /*t*/) override { return 0.0; }
461  virtual int DOREFLECTION() override { return 0; }
462  virtual int DOPOINTREFLECTION() override { return 0; }
463  virtual int DOROTATION() override { return 0; }
464  virtual int SYMMETRYROT(fpreal /*t*/) override { return 0; }
465  virtual fpreal SYMMETRYDIST(fpreal /*t*/) override { return 0.0; }
466  virtual int DOUVREFLECTION() override { return 0; }
467  virtual fpreal SYMMETRYUVORIGU(fpreal /*t*/) override { return 0.0; }
468  virtual fpreal SYMMETRYUVORIGV(fpreal /*t*/) override { return 0.0; }
469  virtual fpreal SYMMETRYUVANGLE(fpreal /*t*/) override { return 0.0;}
470 
471  virtual int USECONNECTIVITY() override
472  { return evalInt(SOP_EDIT_SCULPT_USECONNECTIVITY_IDX, 0, 0); }
473  virtual int USENORMALS() override
474  { return evalInt(SOP_EDIT_SCULPT_USENORMALS_IDX, 0, 0); }
475  virtual int USEDEPTH() override
476  { return evalInt(SOP_EDIT_SCULPT_USEDEPTH_IDX, 0, 0); }
477  virtual fpreal DEPTH(fpreal t) override
478  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 0, t); }
479  virtual fpreal HEIGHT(fpreal t) override
480  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 1, t); }
481 
482 
483  // Find out if the brush has moved or done anything to cause us to add its
484  // effect to the current gdp.
485  virtual bool hasStrokeChanged(fpreal t) override;
486  virtual bool hasStyleChanged(fpreal t) override;
487 
488  // Find if the nib file has changed:
489  virtual bool hasNibFileChanged(fpreal t) override;
490  virtual bool hasAccumStencilChanged(fpreal t) override;
491  virtual bool hasNibLookChanged(fpreal t) override;
492 
493  // Do we want our cook selection to be updated and displayed?
494  virtual bool wantsCookSelection() const override { return true; }
495 
497  { return &myCoordinateFrames; }
498 
499  virtual const GA_PointGroup *getPointGroup() override { return myPointGroup; }
500  virtual const GA_Group *getGroup() { return myGroup; }
501 
502  virtual void syncNodeVersion(const char *old_version,
503  const char *cur_version,
504  bool *node_deleted) override;
505 
506 private: // methods
507 
508  // Selection
509  int GRPTYPE(fpreal t) const
510  { return evalInt(SOP_EDIT_GRPTYPE_IDX, 0, t); }
511 
512  // Access to switcher parm
513  int SWITCHER(fpreal t) const
514  { return evalInt(SOP_EDIT_SWITCHER_IDX, 0, t); }
515  void SET_SWITCHER(int i)
516  { setInt(SOP_EDIT_SWITCHER_IDX, 0, 0, i); }
517 
518  // Transform
519  int TRS(fpreal t) const
520  { return evalInt(SOP_EDIT_TRS_IDX, 0, t); }
521  int XYZ(fpreal t) const
522  { return evalInt(SOP_EDIT_XYZ_IDX, 0, t); }
523  fpreal TX(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 0, t); }
524  fpreal TY(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 1, t); }
525  fpreal TZ(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 2, t); }
526  fpreal RX(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 0, t); }
527  fpreal RY(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 1, t); }
528  fpreal RZ(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 2, t); }
529  fpreal SX(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 0, t); }
530  fpreal SY(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 1, t); }
531  fpreal SZ(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 2, t); }
532  fpreal SHEAR_XY(fpreal t) const
533  { return evalFloat(SOP_EDIT_SHEAR_IDX, 0, t); }
534  fpreal SHEAR_XZ(fpreal t) const
535  { return evalFloat(SOP_EDIT_SHEAR_IDX, 1, t); }
536  fpreal SHEAR_YZ(fpreal t) const
537  { return evalFloat(SOP_EDIT_SHEAR_IDX, 2, t); }
538  fpreal PX(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 0, t); }
539  void SET_PX(fpreal f) { setFloat(SOP_EDIT_P_IDX, 0, 0, f); }
540  fpreal PY(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 1, t); }
541  void SET_PY(fpreal f) { setFloat(SOP_EDIT_P_IDX, 1, 0, f); }
542  fpreal PZ(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 2, t); }
543  void SET_PZ(fpreal f) { setFloat(SOP_EDIT_P_IDX, 2, 0, f); }
544  fpreal PRX(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 0,t); }
545  fpreal PRY(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 1,t); }
546  fpreal PRZ(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 2,t); }
547  int PREXFORM_TRS(fpreal t) const
548  { return evalInt(SOP_EDIT_PREXFORM_TRS_IDX, 0, t); }
549  int PREXFORM_XYZ(fpreal t) const
550  { return evalInt(SOP_EDIT_PREXFORM_XYZ_IDX, 0, t); }
551  fpreal PREXFORM_TX(fpreal t) const
552  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 0, t); }
553  fpreal PREXFORM_TY(fpreal t) const
554  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 1, t); }
555  fpreal PREXFORM_TZ(fpreal t) const
556  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 2, t); }
557  fpreal PREXFORM_RX(fpreal t) const
558  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 0, t); }
559  fpreal PREXFORM_RY(fpreal t) const
560  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 1, t); }
561  fpreal PREXFORM_RZ(fpreal t) const
562  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 2, t); }
563  fpreal PREXFORM_SX(fpreal t) const
564  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 0, t); }
565  fpreal PREXFORM_SY(fpreal t) const
566  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 1, t); }
567  fpreal PREXFORM_SZ(fpreal t) const
568  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 2, t); }
569  fpreal PREXFORM_SHEAR_XY(fpreal t) const
570  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 0, t); }
571  fpreal PREXFORM_SHEAR_XZ(fpreal t) const
572  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 1, t); }
573  fpreal PREXFORM_SHEAR_YZ(fpreal t) const
574  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 2, t); }
575  int KEEP(fpreal t) const
576  { return evalInt(SOP_EDIT_KEEP_IDX, 0, t); }
577  bool LOCALSPACE(fpreal t) const
578  { return evalInt( SOP_EDIT_LOCALSPACE_IDX, 0, t) == 1; }
579 
580  fpreal LOCAL_UPX(fpreal t) const
581  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 0, t); }
582  fpreal LOCAL_UPY(fpreal t) const
583  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 1, t); }
584  fpreal LOCAL_UPZ(fpreal t) const
585  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 2, t); }
586  bool SLIDEONSURFACE(fpreal t) const
587  { return evalInt( SOP_EDIT_SLIDEONSURFACE_IDX, 0, t) == 1; }
588 
589  // Peak
590  fpreal DIST(fpreal t) const
591  { return evalFloat(SOP_EDIT_DIST_IDX, 0, t); }
592  int LEADNML(fpreal t) const
593  { return evalInt(SOP_EDIT_LEADNML_IDX, 0, t); }
594 
595  // Soft
596  fpreal SOFTRADIUS(fpreal t) const
597  { return evalFloat(SOP_EDIT_SOFTRADIUS_IDX, 0, t); }
598  int SOFTTYPE(fpreal t) const
599  { return evalInt(SOP_EDIT_SOFTTYPE_IDX, 0, t); }
600  fpreal TANDEG0(fpreal t) const
601  { return evalFloat(SOP_EDIT_TANGENT_IDX, 0, t); }
602  fpreal TANDEG1(fpreal t) const
603  { return evalFloat(SOP_EDIT_TANGENT_IDX, 1, t); }
604  void EDIT_KERNEL(UT_String &str, fpreal t)
605  { evalString(str, SOP_EDIT_KERNEL_IDX, 0, t); }
606  int DIST_METRIC(fpreal t) const
607  { return evalInt(SOP_EDIT_DIST_METRIC_IDX, 0, t); }
608  bool APPLY_ROLLOFF(fpreal t) const
609  { return evalInt(SOP_EDIT_APPLY_ROLLOFF_IDX, 0, t) != 0; }
610  void DIST_ATTR(UT_String& str, fpreal t) const
611  { evalString(str, SOP_EDIT_DIST_ATTR_IDX, 0, t); }
612  void LEAD_ATTR(UT_String& str, fpreal t) const
613  { evalString(str, SOP_EDIT_LEAD_POINT_ATTR_IDX, 0, t); }
614  int VISUALIZE_FALLOFF(fpreal t) const
615  { return evalInt(SOP_EDIT_VISFALLOFF_IDX, 0, t); }
616  bool falloffAttributeRequested(fpreal t) const;
617 
618  bool USEORIENT(fpreal t) const
619  { return evalInt(SOP_EDIT_USEORIENT_IDX, 0, t) != 0; }
620 
621  // Symmetry
622  bool USEMIRROR(fpreal t) const
623  { return evalInt(SOP_EDIT_USEMIRROR_IDX, 0, t) != 0; }
624  fpreal SYMMETRYAXISX(fpreal t) const
625  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 0, t); }
626  fpreal SYMMETRYAXISY(fpreal t) const
627  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 1, t); }
628  fpreal SYMMETRYAXISZ(fpreal t) const
629  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 2, t); }
630  fpreal SYMMETRYORIGINX(fpreal t) const
631  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 0, t); }
632  fpreal SYMMETRYORIGINY(fpreal t) const
633  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 1, t); }
634  fpreal SYMMETRYORIGINZ(fpreal t) const
635  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 2, t); }
636  fpreal SYMMETRYDISTANCE(fpreal t) const
637  { return evalFloat(SOP_EDIT_SYMMETRYDISTANCE_IDX, 0, t); }
638  fpreal SYMMETRYTHRESHOLD(fpreal t) const
639  { return evalFloat(SOP_EDIT_SYMMETRYTHRESHOLD_IDX, 0, t); }
640  fpreal SYMMETRYPLANETOL(fpreal t) const
641  { return evalFloat(SOP_EDIT_SYMMETRYPLANETOL_IDX, 0, t); }
642 
643  int UPDATENMLS(fpreal t) const
644  { return evalInt(SOP_EDIT_UPDATENMLS_IDX, 0, t); }
645 
646  void updateMirrorParmCache(MirrorParmCache &cache, fpreal t);
647  bool getSoftSymmetryParms(GEO_Detail::SoftSymmetryParms &symmetry,
648  MirrorParmCache &cache, fpreal t);
649 
650  // Transform / Peak
651  bool isTransform(fpreal t) const { return SWITCHER(t) == 0; }
652  bool isPeak(fpreal t) const { return SWITCHER(t) != 0; }
653  void doPeak(fpreal t, MirrorParmCache &mirror_cache,
654  AttribAction &falloff_action);
655 
656  // Soft-related methods
657  bool isSoft(fpreal t) const { return SOFTRADIUS(t) != 0.0; }
658 
659 private: // data
660 
661  UT_Vector3 myInitialCentroid;
662 
663  GDT_CoordinateFrames myCoordinateFrames;
664  bool myUsedOrient;
665  int myCurrentInputId;
666  int myCurrentGeoCookCount;
667  int myReferenceInputId;
668  int myReferenceGeoCookCount;
669  const GA_PrimitiveGroup *myPrimitiveGroup;
670  const GA_PointGroup *myPointGroup;
671  UT_String myPrimitiveClosureName;
672  UT_String myPointClosureName;
673 
674  bool myVisualizationFlag;
675  bool mySetFalloffOnLastCook;
676  bool myOverwroteInputFalloff;
677 
678  // cached data for soft transforms
679  GU_SurfaceDistanceCache mySurfaceDistanceCache;
680 
681  // syncNodeVersion is called after resolveObsoleteParms, so we save what the
682  // value of IgnorePointConnectivity is in resolveObsoleteParms, then if we
683  // need to we use it in syncNodeVersion
684  bool myPreSoftDistanceMetric;
685 };
686 
687 #endif
virtual OP_ERROR cookInputGroups(OP_Context &context, int alone=0)
virtual fpreal SYMMETRYUVANGLE(fpreal) override
Definition: SOP_Edit.h:469
virtual fpreal RADIUSPRESSURE(fpreal t) override
Definition: SOP_Edit.h:263
virtual bool updateParmsFlags()
virtual fpreal OPACITYPRESSURE(fpreal t) override
Definition: SOP_Edit.h:267
virtual bool wantsCookSelection() const override
Definition: SOP_Edit.h:494
virtual int OVERRIDEALPHA() override
Definition: SOP_Edit.h:449
virtual void setProjectionType(int projtype) override
Definition: SOP_Edit.h:241
virtual void ALPHANAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:450
virtual fpreal HEIGHT(fpreal t) override
Definition: SOP_Edit.h:479
virtual int PTHIT(fpreal t) override
Definition: SOP_Edit.h:405
virtual fpreal SYMMETRYDIRX(fpreal) override
Definition: SOP_Edit.h:455
virtual int WRITEALPHA() override
Definition: SOP_Edit.h:446
virtual void setHitPressure(fpreal p, fpreal t) override
Definition: SOP_Edit.h:208
virtual fpreal FGG(fpreal) override
Definition: SOP_Edit.h:413
const GLdouble * v
Definition: glcorearb.h:836
virtual fpreal FGB(fpreal) override
Definition: SOP_Edit.h:414
virtual void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
Definition: SOP_Edit.h:188
virtual int UPTYPE(fpreal t) override
Definition: SOP_Edit.h:423
virtual fpreal SYMMETRYDIRZ(fpreal) override
Definition: SOP_Edit.h:457
virtual const GA_Group * getGroup()
Definition: SOP_Edit.h:500
virtual void setAccumulateStencil(bool yesno) override
Definition: SOP_Edit.h:178
virtual int DOUVREFLECTION() override
Definition: SOP_Edit.h:466
virtual fpreal SYMMETRYORIGZ(fpreal) override
Definition: SOP_Edit.h:460
virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const
virtual int MERGEMODE() override
Definition: SOP_Edit.h:371
virtual int AXIS() override
Definition: SOP_Edit.h:374
virtual fpreal UPY(fpreal t) override
Definition: SOP_Edit.h:427
virtual fpreal DEPTH(fpreal t) override
Definition: SOP_Edit.h:477
fpreal evalFloat(int pi, int vi, fpreal t) const
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual void setBrushShape(SOP_BrushShape shape) override
Definition: SOP_Edit.h:237
virtual void BITMAP(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:436
virtual int PRIMHIT(fpreal t) override
Definition: SOP_Edit.h:403
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:498
virtual fpreal SYMMETRYUVORIGV(fpreal) override
Definition: SOP_Edit.h:468
virtual int PROJECTIONTYPE() override
Definition: SOP_Edit.h:286
virtual fpreal ANGLE(fpreal t) override
Definition: SOP_Edit.h:440
virtual fpreal RAYORIENTZ(fpreal t) override
Definition: SOP_Edit.h:387
virtual void clearAllDeltas(fpreal t)
virtual fpreal RAWOPACITY(fpreal t) override
Definition: SOP_Edit.h:265
virtual int ACCUMSTENCIL() override
Definition: SOP_Edit.h:284
png_uint_32 i
Definition: png.h:2877
virtual fpreal BGR(fpreal t) override
Definition: SOP_Edit.h:415
virtual fpreal RAWRADIUS(fpreal t) override
Definition: SOP_Edit.h:259
virtual int USECONNECTIVITY() override
Definition: SOP_Edit.h:471
bool getCookedFlag() const
Definition: SOP_Edit.h:316
virtual fpreal BGB(fpreal) override
Definition: SOP_Edit.h:417
struct _cl_event * event
Definition: glcorearb.h:2960
virtual fpreal RAYHITU(fpreal t) override
Definition: SOP_Edit.h:395
virtual void NMLNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:452
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:502
virtual int ADDATTRIB() override
Definition: SOP_Edit.h:453
GA_API const UT_StringHolder scale
GLfloat f
Definition: glcorearb.h:1925
int MODE()
Definition: SOP_Edit.h:257
virtual void setBrushEvent(SOP_BrushEvent event) override
Definition: SOP_Edit.h:220
virtual const GA_PrimitiveGroup * getPrimitiveSelection() const override
Definition: SOP_Edit.h:323
virtual fpreal FGR(fpreal t) override
Definition: SOP_Edit.h:412
virtual fpreal PAPERNOISE(fpreal t) override
Definition: SOP_Edit.h:432
virtual bool unloadData()
virtual int SHAPE(fpreal t) override
Definition: SOP_Edit.h:290
virtual fpreal SYMMETRYDIRY(fpreal) override
Definition: SOP_Edit.h:456
virtual void useForegroundColor() override
Definition: SOP_Edit.h:245
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual int BITMAPCHAN(fpreal t) override
Definition: SOP_Edit.h:438
virtual void useBackgroundColor() override
Definition: SOP_Edit.h:249
virtual void beginNewOperation()
virtual fpreal RAYORIENTY(fpreal t) override
Definition: SOP_Edit.h:385
virtual fpreal USERZ(fpreal t) override
Definition: SOP_Edit.h:380
virtual fpreal UPX(fpreal t) override
Definition: SOP_Edit.h:425
virtual void setHitPoint(int pt, fpreal t) override
Definition: SOP_Edit.h:198
virtual void getSelString(UT_String &str) override
Get the selection group string:
Definition: SOP_Edit.h:175
virtual fpreal SYMMETRYORIGY(fpreal) override
Definition: SOP_Edit.h:459
SOP_BrushOp
Definition: SOP_BrushBase.h:38
virtual int EVENT() override
Definition: SOP_Edit.h:407
virtual int OVERRIDECD() override
Definition: SOP_Edit.h:447
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual fpreal RAYHITPRESSURE(fpreal t) override
Definition: SOP_Edit.h:401
virtual void setBrushOp(SOP_BrushOp op) override
Definition: SOP_Edit.h:224
virtual void setRadius(fpreal r, fpreal t) override
Definition: SOP_Edit.h:212
GA_API const UT_StringHolder orient
GDT_CoordinateFrames * getCoordinateFrames()
Definition: SOP_Edit.h:496
virtual fpreal SYMMETRYUVORIGU(fpreal) override
Definition: SOP_Edit.h:467
virtual fpreal USERY(fpreal t) override
Definition: SOP_Edit.h:378
virtual void CDNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:448
virtual fpreal RAYHITV(fpreal t) override
Definition: SOP_Edit.h:397
virtual fpreal UPZ(fpreal t) override
Definition: SOP_Edit.h:429
virtual int altersColor() const override
Definition: SOP_Edit.h:255
virtual fpreal SPLATTER(fpreal t) override
Definition: SOP_Edit.h:434
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:500
double fpreal
Definition: SYS_Types.h:270
virtual bool USE_FOREGROUND() override
Definition: SOP_Edit.h:409
virtual fpreal SYMMETRYDIST(fpreal) override
Definition: SOP_Edit.h:465
bool inBrushMode(fpreal t)
Definition: SOP_Edit.h:270
virtual fpreal RAYHITY(fpreal t) override
Definition: SOP_Edit.h:391
virtual int DOROTATION() override
Definition: SOP_Edit.h:463
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
virtual int USENORMALS() override
Definition: SOP_Edit.h:473
virtual int SYMMETRYROT(fpreal) override
Definition: SOP_Edit.h:464
virtual void resolveObsoleteParms(PRM_ParmList *)
virtual void setUVRadius(fpreal r, fpreal t) override
Definition: SOP_Edit.h:216
void setInt(int parmi, int vectori, fpreal t, exint value)
virtual fpreal SQUASH(fpreal t) override
Definition: SOP_Edit.h:442
virtual fpreal RAYHITW(fpreal t) override
Definition: SOP_Edit.h:399
virtual fpreal RAWUVRADIUS(fpreal t) override
Definition: SOP_Edit.h:261
GLuint GLfloat * val
Definition: glcorearb.h:1607
AttribAction
Definition: SOP_Edit.h:330
virtual int DOSTAMPING() override
Definition: SOP_Edit.h:445
bool myCookedFlag
Definition: SOP_GDT.h:113
#define SOP_API
Definition: SOP_API.h:10
virtual void setVisualization(int)
Definition: SOP_Node.h:832
virtual int USEDEPTH() override
Definition: SOP_Edit.h:475
void setUseOrient(bool f)
Definition: SOP_Edit.h:318
virtual int DOREFLECTION() override
Definition: SOP_Edit.h:461
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
Definition: SOP_Edit.h:202
virtual const GA_PointGroup * getPointGroup() override
Definition: SOP_Edit.h:499
virtual int DOPOINTREFLECTION() override
Definition: SOP_Edit.h:462
virtual fpreal RAYORIENTX(fpreal t) override
Definition: SOP_Edit.h:383
virtual fpreal BGG(fpreal) override
Definition: SOP_Edit.h:416
exint evalInt(int pi, int vi, fpreal t) const
SOP_BrushEvent
Definition: SOP_BrushBase.h:30
GLboolean r
Definition: glcorearb.h:1221
virtual int OVERRIDENML() override
Definition: SOP_Edit.h:451
SOP_BrushShape
Definition: SOP_BrushBase.h:62
virtual int altersGeometry() const override
Definition: SOP_Edit.h:254
virtual SOP_BrushOp OP() override
Definition: SOP_Edit.h:273
virtual fpreal RAYHITZ(fpreal t) override
Definition: SOP_Edit.h:393
virtual void unloadDataHack()
Do not use this function! Using it will likely cause crashes.
virtual int isRefInput(unsigned idx) const
virtual void setHitPrimitive(int primidx, fpreal t) override
Definition: SOP_Edit.h:194
virtual fpreal SYMMETRYORIGX(fpreal) override
Definition: SOP_Edit.h:458
virtual void SCRIPT(UT_String &, fpreal) override
Definition: SOP_Edit.h:372
virtual fpreal RAYHITX(fpreal t) override
Definition: SOP_Edit.h:389
virtual void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
Definition: SOP_Edit.h:182
virtual fpreal SOFTEDGE(fpreal t) override
Definition: SOP_Edit.h:419
virtual int REALTIME() override
Definition: SOP_Edit.h:288
virtual void KERNEL(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:421
virtual fpreal USERX(fpreal t) override
Definition: SOP_Edit.h:376