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 (13)
46 #define SOP_EDIT_NUM_PIVOTXFORM_PARMS (2)
50 #define SOP_EDIT_NUM_PREXFORM_PARMS (6)
58 #define SOP_EDIT_NUM_LOCALPIVOTXFORM_PARMS (2)
62 #define SOP_EDIT_NUM_LOCALPREXFORM_PARMS (6)
71 #define SOP_EDIT_NUM_XFORMSPACE_PARMS (4)
76 
78 
79  // Peak Parameters
80 #define SOP_EDIT_NUM_PEAK_PARMS (2)
83 
84  // Commit Button
86 
87  // Soft Parameters
89 
90 #define SOP_EDIT_NUM_SOFT_PARMS (9)
100 
101 // SCULPT parameters
102 
103  // Group parameters
105 
106 #define SOP_EDIT_SCULPT_NUM_DEFORM_PARMS (8)
117 
118 #define SOP_EDIT_SCULPT_NUM_NIB_PARMS (18)
137 
138 #define SOP_EDIT_SCULPT_NUM_RAY_PARMS (11)
150 
152 
153  // Symmetry Parameters
160 
162 
163  // Reset Button
165 };
166 
168 {
169 friend class MSS_EditState;
170 public:
171  SOP_Edit(OP_Network *net, const char *name, OP_Operator *entry);
172  ~SOP_Edit() override;
173 
174  int isRefInput(unsigned int i) const override;
175  void unloadDataHack() override;
176  bool unloadData() override;
177 
178  // Allow toggling of operation type
179  void toggleXformPeak();
180 
181  bool updateParmsFlags() override;
182 
183  static OP_Node *myConstructor(OP_Network *net,
184  const char *name,
185  OP_Operator *entry);
186 
187  static PRM_Template myTemplateList[];
188  static PRM_Template myObsoleteList[];
189 
190  // Get the selection group string:
191  // We have to override this since the parameter's index has changed
192  void getSelString(UT_String &str) override
193  { evalString(str, SOP_EDIT_GRP_IDX, 0, 0.0); }
194 
195  void setAccumulateStencil(bool yesno) override
196  {
198  }
199  void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
200  {
204  }
205  void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
206  {
207  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 0, t, orient.x());
208  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 1, t, orient.y());
209  setFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX, 2, t, orient.z());
210  }
211  void setHitPrimitive(int primidx, fpreal t) override
212  {
213  setInt(SOP_EDIT_SCULPT_RAY_HITPRIM_IDX, 0, t, primidx);
214  }
215  void setHitPoint(int pt, fpreal t) override
216  {
218  }
219  void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
220  {
224  }
225  void setHitPressure(fpreal p, fpreal t) override
226  {
228  }
229  void setRadius(fpreal r, fpreal t) override
230  {
232  }
233  void setUVRadius(fpreal r, fpreal t) override
234  {
236  }
238  {
239  setInt(SOP_EDIT_SCULPT_RAY_EVENT_IDX, 0, 0, int(event));
240  }
241  void setBrushOp(SOP_BrushOp op) override
242  {
243  int iop;
244  switch (op)
245  {
246  case SOP_BRUSHOP_SMOOTH: iop = 1; break;
247  case SOP_BRUSHOP_SMOOTHDEFORM: iop = 2; break;
248  case SOP_BRUSHOP_ERASE: iop = 3; break;
249  case SOP_BRUSHOP_DEFORM:
250  default: iop = 0; break;
251  }
252  setInt(SOP_EDIT_SCULPT_OP_IDX, 0, 0, iop);
253  }
254  void setBrushShape(SOP_BrushShape shape) override
255  {
256  setInt(SOP_EDIT_SCULPT_SHAPE_IDX, 0, 0, int(shape));
257  }
258  void setProjectionType(int projtype) override
259  {
260  setInt(SOP_EDIT_SCULPT_PROJTYPE_IDX, 0, 0, projtype);
261  }
262  void useForegroundColor() override
263  {
265  }
266  void useBackgroundColor() override
267  {
269  }
270 
271  int altersGeometry() const override { return 1; }
272  int altersColor() const override { return 0; }
273 
274  int MODE()
275  { return evalInt(SOP_EDIT_MODESWITCHER_IDX, 0, 0); }
277  { return evalFloat(SOP_EDIT_SCULPT_RAD_IDX, 0, t); }
279  { return evalFloat(SOP_EDIT_SCULPT_UVRAD_IDX, 0, t); }
281  { return evalFloat(SOP_EDIT_SCULPT_RADPRESSURE_IDX, 0, t); }
283  {return evalFloat(SOP_EDIT_SCULPT_OPAC_IDX, 0, t); }
286 
288  { return evalInt("modeswitcher", 0, t); }
289 
290  SOP_BrushOp OP() override
291  {
292  switch (evalInt(SOP_EDIT_SCULPT_OP_IDX, 0, 0))
293  {
294  case 0: return SOP_BRUSHOP_DEFORM;
295  case 1: return SOP_BRUSHOP_SMOOTH;
296  case 2: return SOP_BRUSHOP_SMOOTHDEFORM;
297  case 3: return SOP_BRUSHOP_ERASE;
298  default: return SOP_BRUSHOP_DEFORM;
299  }
300  }
301  int ACCUMSTENCIL() override
303  int PROJECTIONTYPE() override
304  { return evalInt(SOP_EDIT_SCULPT_PROJTYPE_IDX, 0, 0); }
305  int REALTIME() override
306  { return evalInt(SOP_EDIT_SCULPT_REALTIME_IDX, 0, 0); }
307  int SHAPE(fpreal t) override
308  { return evalInt(SOP_EDIT_SCULPT_SHAPE_IDX, 0, t); }
309 
311  int alone = 0) override;
312 
313  void getXformOrder(UT_XformOrder &xord,
314  const CH_Channel *chp) const override;
315 
317  PRM_ParmList *obsolete_parms) override;
318 
319  // This will force myRayIntersect to be recomputed
320  void clearRayIntersect();
321 
322  void beginNewOperation() override;
323  void clearAllDeltas(fpreal t) override;
324 
325  // Functions for the BlendShapes SOP hack to only apply scaled deltas
326  // without cooking
327  void applyScaledDeltas(
328  GEO_Detail &apply_gdp,
329  const GDT_CoordinateFrames *coord_frames,
330  float scale,
331  const GA_PointGroup *ptgroup);
332 
333  bool getCookedFlag() const { return myCookedFlag; }
334 
335  void setUseOrient(bool f)
336  { setInt(SOP_EDIT_USEORIENT_IDX, 0, 0, f ? 1 : 0); }
337 
338  bool hasChange(fpreal t);
339 
340  const GA_PrimitiveGroup *getPrimitiveSelection() const override
341  { return myPrimitiveGroup; }
342 
343  void setVisualization(bool val) override;
344 
345  // An enum by which functions can report actions taken regarding a
346  // particular attribute.
348  {
349  NO_CHANGE, CHANGED_EXISTING, REPLACED_EXISTING, ADDED_MISSING
350  };
351 
352  int getNumGuides() override { return 1; }
353  // TODO: This is a guide for exporting additional data to the PI, not the
354  // state.
355  GuideType getGuideType(int guide_idx) override
356  {return GuideType::STATE; }
357 
358  static const char *theLeadWorldXformAttribName;
359 
360  class LocalSpaceCache;
361 
362 
363 protected:
364  // Helper class for avoiding evaluating mirror parameters multiple times
365  // during a cook.
367  {
368  public:
371  float myDistance;
372  float myPlaneTol;
375  };
376 
377  void clearTransformParms();
378  OP_ERROR cookMySop(OP_Context &context) override;
379  const char *inputLabel(unsigned idx) const override;
380 
381  GU_DetailHandle cookMyGuide(int guide_idx,
382  OP_Context &context) override;
383 
384  void rollbackCurrentDelta() override;
385  void mirrorDelta(MirrorParmCache &cache);
386  void applyAndClearCurrentDelta() override;
387  void applyPermanentDelta() override;
388  virtual void initializeInput(OP_Context &context);
389 
390  bool getGroupCentroid(OP_Context &context,
391  UT_Vector3 &centroid) override;
392 
393  void doErase() override;
394 
395  // This function takes the transform parameters and modifies the gdp
396  // pointer, while creating the appropriate deltas in myCurrentDelta.
397  // It is virtual so that HDK classes may hook into this.
398  virtual void doTransform(MirrorParmCache &mirror_cache,
399  AttribAction &falloff_action);
400 
401  int MERGEMODE() override { return 0; }
402  void SCRIPT(UT_String &, fpreal) override {}
403 
404  int AXIS() override
405  { return evalInt(SOP_EDIT_SCULPT_AXIS_IDX, 0, 0); }
406  fpreal USERX(fpreal t) override
407  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 0, t); }
408  fpreal USERY(fpreal t) override
409  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 1, t); }
410  fpreal USERZ(fpreal t) override
411  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 2, t); }
412 
414  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,0,t); }
416  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,1,t); }
418  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,2,t); }
419  fpreal RAYHITX(fpreal t) override
420  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,0,t); }
421  fpreal RAYHITY(fpreal t) override
422  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,1,t); }
423  fpreal RAYHITZ(fpreal t) override
424  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,2,t); }
425  fpreal RAYHITU(fpreal t) override
426  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 0,t); }
427  fpreal RAYHITV(fpreal t) override
428  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 1,t); }
429  fpreal RAYHITW(fpreal t) override
430  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 2,t); }
432  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPRESSURE_IDX, 0, t); }
433  int PRIMHIT(fpreal t) override
434  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPRIM_IDX, 0,t); }
435  int PTHIT(fpreal t) override
436  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPT_IDX, 0, t); }
437  int EVENT() override
438  { return evalInt(SOP_EDIT_SCULPT_RAY_EVENT_IDX, 0,0); }
439  bool USE_FOREGROUND() override
440  { return evalInt(SOP_EDIT_SCULPT_COLOR_SWITCHER_IDX,
441  0, 0) == 0; }
442  fpreal FGR(fpreal t) override
443  { return evalFloat(SOP_EDIT_SCULPT_FG_IDX, 0, t); }
444  fpreal FGG(fpreal ) override
445  { return 0.0; }
446  fpreal FGB(fpreal ) override
447  { return 0.0; }
448  fpreal BGR(fpreal t) override
449  { return evalFloat(SOP_EDIT_SCULPT_BG_IDX, 0, t); }
450  fpreal BGG(fpreal ) override
451  { return 0.0; }
452  fpreal BGB(fpreal ) override
453  { return 0.0; }
454 
456  { return evalFloat(SOP_EDIT_SCULPT_SOFTEDGE_IDX, 0, t); }
457  void KERNEL(UT_String &str, fpreal t) override
458  { evalString(str, SOP_EDIT_SCULPT_KERNEL_IDX, 0, t); }
459  int UPTYPE(fpreal t) override
460  { return evalInt(SOP_EDIT_SCULPT_UPTYPE_IDX, 0, t);}
461  fpreal UPX(fpreal t) override
462  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 0, t);}
463  fpreal UPY(fpreal t) override
464  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 1, t);}
465  fpreal UPZ(fpreal t) override
466  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 2, t);}
467 
469  { return evalFloat(SOP_EDIT_SCULPT_PAPER_IDX, 0, t);}
471  { return evalFloat(SOP_EDIT_SCULPT_SPLATTER_IDX, 0, t); }
472  void BITMAP(UT_String &str, fpreal t) override
473  { evalString(str, SOP_EDIT_SCULPT_BITMAP_IDX, 0, t); }
474  int BITMAPCHAN(fpreal t) override
475  { return evalInt(SOP_EDIT_SCULPT_BITMAPCHAN_IDX, 0, t); }
476  fpreal ANGLE(fpreal t) override
477  { return evalFloat(SOP_EDIT_SCULPT_ANGLE_IDX, 0, t); }
478  fpreal SQUASH(fpreal t) override
479  { return evalFloat(SOP_EDIT_SCULPT_SQUASH_IDX, 0, t); }
480 
481  int DOSTAMPING() override { return 0; }
482  int WRITEALPHA() override { return 0; }
483  int OVERRIDECD() override { return 0; }
484  void CDNAME(UT_String &, fpreal) override { }
485  int OVERRIDEALPHA() override { return 0; }
486  void ALPHANAME(UT_String &, fpreal) override { }
487  int OVERRIDENML() override { return 0; }
488  void NMLNAME(UT_String & /*str*/, fpreal /*t*/) override {}
489  int ADDATTRIB() override { return 0; }
490 
491  fpreal SYMMETRYDIRX(fpreal /*t*/) override { return 0.0; }
492  fpreal SYMMETRYDIRY(fpreal /*t*/) override { return 0.0; }
493  fpreal SYMMETRYDIRZ(fpreal /*t*/) override { return 0.0; }
494  fpreal SYMMETRYORIGX(fpreal /*t*/) override { return 0.0; }
495  fpreal SYMMETRYORIGY(fpreal /*t*/) override { return 0.0; }
496  fpreal SYMMETRYORIGZ(fpreal /*t*/) override { return 0.0; }
497  int DOREFLECTION() override { return 0; }
498  int DOPOINTREFLECTION() override { return 0; }
499  int DOROTATION() override { return 0; }
500  int SYMMETRYROT(fpreal /*t*/) override { return 0; }
501  fpreal SYMMETRYDIST(fpreal /*t*/) override { return 0.0; }
502  int DOUVREFLECTION() override { return 0; }
503  fpreal SYMMETRYUVORIGU(fpreal /*t*/) override { return 0.0; }
504  fpreal SYMMETRYUVORIGV(fpreal /*t*/) override { return 0.0; }
505  fpreal SYMMETRYUVANGLE(fpreal /*t*/) override { return 0.0;}
506 
507  int USECONNECTIVITY() override
508  { return evalInt(SOP_EDIT_SCULPT_USECONNECTIVITY_IDX, 0, 0); }
509  int USENORMALS() override
510  { return evalInt(SOP_EDIT_SCULPT_USENORMALS_IDX, 0, 0); }
511  int USEDEPTH() override
512  { return evalInt(SOP_EDIT_SCULPT_USEDEPTH_IDX, 0, 0); }
513  fpreal DEPTH(fpreal t) override
514  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 0, t); }
515  fpreal HEIGHT(fpreal t) override
516  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 1, t); }
517 
518 
519  // Find out if the brush has moved or done anything to cause us to add its
520  // effect to the current gdp.
521  bool hasStrokeChanged(fpreal t) override;
522  bool hasStyleChanged(fpreal t) override;
523 
524  // Find if the nib file has changed:
525  bool hasNibFileChanged(fpreal t) override;
526  bool hasAccumStencilChanged(fpreal t) override;
527  bool hasNibLookChanged(fpreal t) override;
528 
529  // Do we want our cook selection to be updated and displayed?
530  bool wantsCookSelection() const override { return true; }
531 
533  { return &myCoordinateFrames; }
534 
535  const GA_PointGroup *getPointGroup() override { return myPointGroup; }
536  virtual const GA_Group *getGroup() { return myGroup; }
537 
538  void syncNodeVersion(const char *old_version,
539  const char *cur_version,
540  bool *node_deleted) override;
541 
542 private: // methods
543 
544  // Selection
545  int GRPTYPE(fpreal t) const
546  { return evalInt(SOP_EDIT_GRPTYPE_IDX, 0, t); }
547 
548  // Access to switcher parm
549  int SWITCHER(fpreal t) const
550  { return evalInt(SOP_EDIT_SWITCHER_IDX, 0, t); }
551  void SET_SWITCHER(int i)
552  { setInt(SOP_EDIT_SWITCHER_IDX, 0, 0, i); }
553 
554  // Transform
555  int TRS(fpreal t) const
556  { return evalInt(SOP_EDIT_TRS_IDX, 0, t); }
557  int XYZ(fpreal t) const
558  { return evalInt(SOP_EDIT_XYZ_IDX, 0, t); }
559  fpreal TX(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 0, t); }
560  fpreal TY(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 1, t); }
561  fpreal TZ(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 2, t); }
562  fpreal RX(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 0, t); }
563  fpreal RY(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 1, t); }
564  fpreal RZ(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 2, t); }
565  fpreal SX(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 0, t); }
566  fpreal SY(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 1, t); }
567  fpreal SZ(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 2, t); }
568  fpreal SHEAR_XY(fpreal t) const
569  { return evalFloat(SOP_EDIT_SHEAR_IDX, 0, t); }
570  fpreal SHEAR_XZ(fpreal t) const
571  { return evalFloat(SOP_EDIT_SHEAR_IDX, 1, t); }
572  fpreal SHEAR_YZ(fpreal t) const
573  { return evalFloat(SOP_EDIT_SHEAR_IDX, 2, t); }
574  fpreal PX(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 0, t); }
575  void SET_PX(fpreal f) { setFloat(SOP_EDIT_P_IDX, 0, 0, f); }
576  fpreal PY(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 1, t); }
577  void SET_PY(fpreal f) { setFloat(SOP_EDIT_P_IDX, 1, 0, f); }
578  fpreal PZ(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 2, t); }
579  void SET_PZ(fpreal f) { setFloat(SOP_EDIT_P_IDX, 2, 0, f); }
580  fpreal PRX(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 0,t); }
581  fpreal PRY(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 1,t); }
582  fpreal PRZ(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 2,t); }
583  int PREXFORM_TRS(fpreal t) const
584  { return evalInt(SOP_EDIT_PREXFORM_TRS_IDX, 0, t); }
585  int PREXFORM_XYZ(fpreal t) const
586  { return evalInt(SOP_EDIT_PREXFORM_XYZ_IDX, 0, t); }
587  fpreal PREXFORM_TX(fpreal t) const
588  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 0, t); }
589  fpreal PREXFORM_TY(fpreal t) const
590  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 1, t); }
591  fpreal PREXFORM_TZ(fpreal t) const
592  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 2, t); }
593  fpreal PREXFORM_RX(fpreal t) const
594  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 0, t); }
595  fpreal PREXFORM_RY(fpreal t) const
596  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 1, t); }
597  fpreal PREXFORM_RZ(fpreal t) const
598  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 2, t); }
599  fpreal PREXFORM_SX(fpreal t) const
600  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 0, t); }
601  fpreal PREXFORM_SY(fpreal t) const
602  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 1, t); }
603  fpreal PREXFORM_SZ(fpreal t) const
604  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 2, t); }
605  fpreal PREXFORM_SHEAR_XY(fpreal t) const
606  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 0, t); }
607  fpreal PREXFORM_SHEAR_XZ(fpreal t) const
608  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 1, t); }
609  fpreal PREXFORM_SHEAR_YZ(fpreal t) const
610  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 2, t); }
611  fpreal LPX(fpreal t) const
612  { return evalFloat(SOP_EDIT_LP_IDX, 0, t); }
613  fpreal LPY(fpreal t) const
614  { return evalFloat(SOP_EDIT_LP_IDX, 1, t); }
615  fpreal LPZ(fpreal t) const
616  { return evalFloat(SOP_EDIT_LP_IDX, 2, t); }
617  fpreal LPRX(fpreal t) const
618  { return evalFloat(SOP_EDIT_LPR_IDX, 0, t); }
619  fpreal LPRY(fpreal t) const
620  { return evalFloat(SOP_EDIT_LPR_IDX, 1, t); }
621  fpreal LPRZ(fpreal t) const
622  { return evalFloat(SOP_EDIT_LPR_IDX, 2, t); }
623  int LPREXFORM_TRS(fpreal t) const
624  { return evalInt(SOP_EDIT_LPREXFORM_TRS_IDX, 0, t); }
625  int LPREXFORM_XYZ(fpreal t) const
626  { return evalInt(SOP_EDIT_LPREXFORM_XYZ_IDX, 0, t); }
627  fpreal LPREXFORM_TX(fpreal t) const
628  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 0, t); }
629  fpreal LPREXFORM_TY(fpreal t) const
630  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 1, t); }
631  fpreal LPREXFORM_TZ(fpreal t) const
632  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 2, t); }
633  fpreal LPREXFORM_RX(fpreal t) const
634  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 0, t); }
635  fpreal LPREXFORM_RY(fpreal t) const
636  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 1, t); }
637  fpreal LPREXFORM_RZ(fpreal t) const
638  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 2, t); }
639  fpreal LPREXFORM_SX(fpreal t) const
640  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 0, t); }
641  fpreal LPREXFORM_SY(fpreal t) const
642  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 1, t); }
643  fpreal LPREXFORM_SZ(fpreal t) const
644  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 2, t); }
645  fpreal LPREXFORM_SHEAR_XY(fpreal t) const
646  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 0, t); }
647  fpreal LPREXFORM_SHEAR_XZ(fpreal t) const
648  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 1, t); }
649  fpreal LPREXFORM_SHEAR_YZ(fpreal t) const
650  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 2, t); }
651  int KEEP(fpreal t) const
652  { return evalInt(SOP_EDIT_KEEP_IDX, 0, t); }
653  int XFORMSPACE(fpreal t) const
654  { return evalInt(SOP_EDIT_XFORMSPACE_IDX, 0, t); }
655  int LOCALFRAME(fpreal t) const
656  { return evalInt(SOP_EDIT_LOCALFRAME_IDX, 0, t); }
657 
658  fpreal LOCAL_UPX(fpreal t) const
659  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 0, t); }
660  fpreal LOCAL_UPY(fpreal t) const
661  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 1, t); }
662  fpreal LOCAL_UPZ(fpreal t) const
663  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 2, t); }
664  void LEADISLANDHINT(UT_String &str, fpreal t) const
665  { evalString(str, SOP_EDIT_LEADISLANDHINT_IDX, 0, t); }
666  bool SLIDEONSURFACE(fpreal t) const
667  { return evalInt( SOP_EDIT_SLIDEONSURFACE_IDX, 0, t) == 1; }
668 
669  // Peak
670  fpreal DIST(fpreal t) const
671  { return evalFloat(SOP_EDIT_DIST_IDX, 0, t); }
672  int LEADNML(fpreal t) const
673  { return evalInt(SOP_EDIT_LEADNML_IDX, 0, t); }
674 
675  // Soft
676  fpreal SOFTRADIUS(fpreal t) const
677  { return evalFloat(SOP_EDIT_SOFTRADIUS_IDX, 0, t); }
678  int SOFTTYPE(fpreal t) const
679  { return evalInt(SOP_EDIT_SOFTTYPE_IDX, 0, t); }
680  fpreal TANDEG0(fpreal t) const
681  { return evalFloat(SOP_EDIT_TANGENT_IDX, 0, t); }
682  fpreal TANDEG1(fpreal t) const
683  { return evalFloat(SOP_EDIT_TANGENT_IDX, 1, t); }
684  void EDIT_KERNEL(UT_String &str, fpreal t)
685  { evalString(str, SOP_EDIT_KERNEL_IDX, 0, t); }
686  int DIST_METRIC(fpreal t) const
687  { return evalInt(SOP_EDIT_DIST_METRIC_IDX, 0, t); }
688  bool APPLY_ROLLOFF(fpreal t) const
689  { return evalInt(SOP_EDIT_APPLY_ROLLOFF_IDX, 0, t) != 0; }
690  void DIST_ATTR(UT_String& str, fpreal t) const
691  { evalString(str, SOP_EDIT_DIST_ATTR_IDX, 0, t); }
692  void LEAD_ATTR(UT_String& str, fpreal t) const
693  { evalString(str, SOP_EDIT_LEAD_POINT_ATTR_IDX, 0, t); }
694  int VISUALIZE_FALLOFF(fpreal t) const
695  { return evalInt(SOP_EDIT_VISFALLOFF_IDX, 0, t); }
696  bool falloffAttributeRequested(fpreal t) const;
697 
698  bool USEORIENT(fpreal t) const
699  { return evalInt(SOP_EDIT_USEORIENT_IDX, 0, t) != 0; }
700 
701  // Symmetry
702  bool USEMIRROR(fpreal t) const
703  { return evalInt(SOP_EDIT_USEMIRROR_IDX, 0, t) != 0; }
704  fpreal SYMMETRYAXISX(fpreal t) const
705  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 0, t); }
706  fpreal SYMMETRYAXISY(fpreal t) const
707  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 1, t); }
708  fpreal SYMMETRYAXISZ(fpreal t) const
709  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 2, t); }
710  fpreal SYMMETRYORIGINX(fpreal t) const
711  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 0, t); }
712  fpreal SYMMETRYORIGINY(fpreal t) const
713  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 1, t); }
714  fpreal SYMMETRYORIGINZ(fpreal t) const
715  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 2, t); }
716  fpreal SYMMETRYDISTANCE(fpreal t) const
717  { return evalFloat(SOP_EDIT_SYMMETRYDISTANCE_IDX, 0, t); }
718  fpreal SYMMETRYTHRESHOLD(fpreal t) const
719  { return evalFloat(SOP_EDIT_SYMMETRYTHRESHOLD_IDX, 0, t); }
720  fpreal SYMMETRYPLANETOL(fpreal t) const
721  { return evalFloat(SOP_EDIT_SYMMETRYPLANETOL_IDX, 0, t); }
722 
723  int UPDATENMLS(fpreal t) const
724  { return evalInt(SOP_EDIT_UPDATENMLS_IDX, 0, t); }
725 
726  void updateMirrorParmCache(MirrorParmCache &cache, fpreal t);
727  bool getSoftSymmetryParms(GEO_Detail::SoftSymmetryParms &symmetry,
728  MirrorParmCache &cache, fpreal t);
729 
730  // Transform / Peak
731  bool isTransform(fpreal t) const { return SWITCHER(t) == 0; }
732  bool isPeak(fpreal t) const { return SWITCHER(t) != 0; }
733  void doPeak(fpreal t, MirrorParmCache &mirror_cache,
734  AttribAction &falloff_action);
735 
736  // Soft-related methods
737  bool isSoft(fpreal t) const { return SOFTRADIUS(t) != 0.0; }
738 
739 private: // data
740 
741  UT_Vector3 myInitialCentroid;
742 
743  GDT_CoordinateFrames myCoordinateFrames;
744  bool myUsedOrient;
745  int myCurrentInputId;
746  int myCurrentGeoCookCount;
747  int myReferenceInputId;
748  int myReferenceGeoCookCount;
749  const GA_PrimitiveGroup *myPrimitiveGroup;
750  const GA_PointGroup *myPointGroup;
751  UT_String myPrimitiveClosureName;
752  UT_String myPointClosureName;
753 
754  GU_DetailHandle myHandleXformGuideHandle;
755  UT_Matrix4D myLeadLocalFrame;
756 
757  bool myVisualizationFlag;
758  bool mySetFalloffOnLastCook;
759  bool myOverwroteInputFalloff;
760 
761  // cached data for local space transforms
762  LocalSpaceCache *myLocalSpaceCache;
763 
764  // cached data for soft transforms
765  GU_SurfaceDistanceCache mySurfaceDistanceCache;
766 
767  // syncNodeVersion is called after resolveObsoleteParms, so we save what the
768  // value of IgnorePointConnectivity is in resolveObsoleteParms, then if we
769  // need to we use it in syncNodeVersion
770  bool myPreSoftDistanceMetric;
771 };
772 
773 #endif
int EVENT() override
Definition: SOP_Edit.h:437
virtual void setVisualization(bool)
Definition: SOP_Node.h:849
virtual bool updateParmsFlags()
int DOSTAMPING() override
Definition: SOP_Edit.h:481
GLuint const GLchar * name
Definition: glew.h:1814
const GA_PointGroup * getPointGroup() override
Definition: SOP_Edit.h:535
fpreal SQUASH(fpreal t) override
Definition: SOP_Edit.h:478
fpreal ANGLE(fpreal t) override
Definition: SOP_Edit.h:476
void SCRIPT(UT_String &, fpreal) override
Definition: SOP_Edit.h:402
void setHitUVW(fpreal u, fpreal v, fpreal w, fpreal t) override
Definition: SOP_Edit.h:219
void setHitPoint(int pt, fpreal t) override
Definition: SOP_Edit.h:215
fpreal PAPERNOISE(fpreal t) override
Definition: SOP_Edit.h:468
void NMLNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:488
fpreal FGB(fpreal) override
Definition: SOP_Edit.h:446
GLuint const GLfloat * val
Definition: glew.h:2794
fpreal RAYHITZ(fpreal t) override
Definition: SOP_Edit.h:423
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
virtual const GA_Group * getGroup()
Definition: SOP_Edit.h:536
int ACCUMSTENCIL() override
Definition: SOP_Edit.h:301
void setBrushEvent(SOP_BrushEvent event) override
Definition: SOP_Edit.h:237
void setRayOrigin(const UT_Vector3 &orig, fpreal t) override
Definition: SOP_Edit.h:199
fpreal FGG(fpreal) override
Definition: SOP_Edit.h:444
void setHitPressure(fpreal p, fpreal t) override
Definition: SOP_Edit.h:225
fpreal SYMMETRYDIRZ(fpreal) override
Definition: SOP_Edit.h:493
virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const
SOP_BrushOp OP() override
Definition: SOP_Edit.h:290
fpreal evalFloat(int pi, int vi, fpreal t) const
UT_ErrorSeverity
Definition: UT_Error.h:25
const GLdouble * v
Definition: glew.h:1391
fpreal DEPTH(fpreal t) override
Definition: SOP_Edit.h:513
fpreal RAYHITX(fpreal t) override
Definition: SOP_Edit.h:419
bool wantsCookSelection() const override
Definition: SOP_Edit.h:530
int OVERRIDEALPHA() override
Definition: SOP_Edit.h:485
fpreal SOFTEDGE(fpreal t) override
Definition: SOP_Edit.h:455
fpreal RAYHITW(fpreal t) override
Definition: SOP_Edit.h:429
int altersGeometry() const override
Definition: SOP_Edit.h:271
bool USE_FOREGROUND() override
Definition: SOP_Edit.h:439
int REALTIME() override
Definition: SOP_Edit.h:305
bool getCookedFlag() const
Definition: SOP_Edit.h:333
int SHAPE(fpreal t) override
Definition: SOP_Edit.h:307
int PTHIT(fpreal t) override
Definition: SOP_Edit.h:435
void CDNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:484
void setProjectionType(int projtype) override
Definition: SOP_Edit.h:258
fpreal BGG(fpreal) override
Definition: SOP_Edit.h:450
void useBackgroundColor() override
Definition: SOP_Edit.h:266
int DOUVREFLECTION() override
Definition: SOP_Edit.h:502
int altersColor() const override
Definition: SOP_Edit.h:272
static const char * theLeadWorldXformAttribName
Definition: SOP_Edit.h:358
int MODE()
Definition: SOP_Edit.h:274
fpreal SYMMETRYORIGX(fpreal) override
Definition: SOP_Edit.h:494
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
GLclampf f
Definition: glew.h:3499
fpreal USERX(fpreal t) override
Definition: SOP_Edit.h:406
bool unloadData() override
fpreal SYMMETRYORIGY(fpreal) override
Definition: SOP_Edit.h:495
fpreal UPY(fpreal t) override
Definition: SOP_Edit.h:463
int BITMAPCHAN(fpreal t) override
Definition: SOP_Edit.h:474
fpreal RAYHITPRESSURE(fpreal t) override
Definition: SOP_Edit.h:431
void evalString(UT_String &val, int pi, int vi, fpreal t) const
void unloadDataHack() override
Do not use this function! Using it will likely cause crashes.
fpreal RAWUVRADIUS(fpreal t) override
Definition: SOP_Edit.h:278
SYS_FORCE_INLINE T & z()
Definition: UT_Vector3.h:515
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
virtual void beginNewOperation()
fpreal HEIGHT(fpreal t) override
Definition: SOP_Edit.h:515
int PROJECTIONTYPE() override
Definition: SOP_Edit.h:303
int DOPOINTREFLECTION() override
Definition: SOP_Edit.h:498
int UPTYPE(fpreal t) override
Definition: SOP_Edit.h:459
int DOROTATION() override
Definition: SOP_Edit.h:499
int MERGEMODE() override
Definition: SOP_Edit.h:401
void KERNEL(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:457
int SYMMETRYROT(fpreal) override
Definition: SOP_Edit.h:500
void setRadius(fpreal r, fpreal t) override
Definition: SOP_Edit.h:229
int USEDEPTH() override
Definition: SOP_Edit.h:511
SOP_BrushOp
Definition: SOP_BrushBase.h:38
int OVERRIDENML() override
Definition: SOP_Edit.h:487
void getSelString(UT_String &str) override
Get the selection group string:
Definition: SOP_Edit.h:192
fpreal RAYORIENTZ(fpreal t) override
Definition: SOP_Edit.h:417
fpreal RADIUSPRESSURE(fpreal t) override
Definition: SOP_Edit.h:280
fpreal RAYHITY(fpreal t) override
Definition: SOP_Edit.h:421
fpreal RAYORIENTX(fpreal t) override
Definition: SOP_Edit.h:413
void setRayOrientation(const UT_Vector3 &orient, fpreal t) override
Definition: SOP_Edit.h:205
OP_ERROR cookInputGroups(OP_Context &context, int alone=0) override
void setBrushShape(SOP_BrushShape shape) override
Definition: SOP_Edit.h:254
GA_API const UT_StringHolder orient
int WRITEALPHA() override
Definition: SOP_Edit.h:482
GDT_CoordinateFrames * getCoordinateFrames()
Definition: SOP_Edit.h:532
int getNumGuides() override
Definition: SOP_Edit.h:352
void clearAllDeltas(fpreal t) override
int PRIMHIT(fpreal t) override
Definition: SOP_Edit.h:433
void setAccumulateStencil(bool yesno) override
Definition: SOP_Edit.h:195
fpreal SYMMETRYORIGZ(fpreal) override
Definition: SOP_Edit.h:496
void BITMAP(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:472
fpreal RAYHITU(fpreal t) override
Definition: SOP_Edit.h:425
GLfloat GLfloat p
Definition: glew.h:16321
fpreal UPZ(fpreal t) override
Definition: SOP_Edit.h:465
cl_event event
Definition: glew.h:3695
fpreal OPACITYPRESSURE(fpreal t) override
Definition: SOP_Edit.h:284
int OVERRIDECD() override
Definition: SOP_Edit.h:483
bool inBrushMode(fpreal t)
Definition: SOP_Edit.h:287
int USENORMALS() override
Definition: SOP_Edit.h:509
fpreal BGB(fpreal) override
Definition: SOP_Edit.h:452
int ADDATTRIB() override
Definition: SOP_Edit.h:489
fpreal FGR(fpreal t) override
Definition: SOP_Edit.h:442
void setFloat(int parmi, int vectori, fpreal t, fpreal value, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING)
fpreal SYMMETRYDIRX(fpreal) override
Definition: SOP_Edit.h:491
virtual void resolveObsoleteParms(PRM_ParmList *)
fpreal64 fpreal
Definition: SYS_Types.h:277
void setInt(int parmi, int vectori, fpreal t, exint value)
void ALPHANAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:486
int AXIS() override
Definition: SOP_Edit.h:404
void setHitPrimitive(int primidx, fpreal t) override
Definition: SOP_Edit.h:211
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
void setBrushOp(SOP_BrushOp op) override
Definition: SOP_Edit.h:241
AttribAction
Definition: SOP_Edit.h:347
void setUVRadius(fpreal r, fpreal t) override
Definition: SOP_Edit.h:233
GuideType getGuideType(int guide_idx) override
Definition: SOP_Edit.h:355
fpreal SYMMETRYUVORIGV(fpreal) override
Definition: SOP_Edit.h:504
bool myCookedFlag
Definition: SOP_GDT.h:125
#define SOP_API
Definition: SOP_API.h:10
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
fpreal USERY(fpreal t) override
Definition: SOP_Edit.h:408
const GA_PrimitiveGroup * getPrimitiveSelection() const override
Definition: SOP_Edit.h:340
fpreal SYMMETRYDIST(fpreal) override
Definition: SOP_Edit.h:501
fpreal UPX(fpreal t) override
Definition: SOP_Edit.h:461
void setUseOrient(bool f)
Definition: SOP_Edit.h:335
fpreal SYMMETRYUVORIGU(fpreal) override
Definition: SOP_Edit.h:503
fpreal RAWRADIUS(fpreal t) override
Definition: SOP_Edit.h:276
void useForegroundColor() override
Definition: SOP_Edit.h:262
exint evalInt(int pi, int vi, fpreal t) const
fpreal RAWOPACITY(fpreal t) override
Definition: SOP_Edit.h:282
SOP_BrushEvent
Definition: SOP_BrushBase.h:30
SOP_BrushShape
Definition: SOP_BrushBase.h:62
fpreal USERZ(fpreal t) override
Definition: SOP_Edit.h:410
virtual int isRefInput(unsigned idx) const
fpreal RAYHITV(fpreal t) override
Definition: SOP_Edit.h:427
fpreal SYMMETRYDIRY(fpreal) override
Definition: SOP_Edit.h:492
GLdouble GLdouble t
Definition: glew.h:1398
fpreal SYMMETRYUVANGLE(fpreal) override
Definition: SOP_Edit.h:505
int DOREFLECTION() override
Definition: SOP_Edit.h:497
fpreal RAYORIENTY(fpreal t) override
Definition: SOP_Edit.h:415
int USECONNECTIVITY() override
Definition: SOP_Edit.h:507
fpreal SPLATTER(fpreal t) override
Definition: SOP_Edit.h:470
fpreal BGR(fpreal t) override
Definition: SOP_Edit.h:448