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  // Clear any references we're holding to data internal to the cooked
385  // detail. We should *NOT* be holding such references, but we are
386  // where we are.
387  void clearReferencesToCookedDetail() override;
388 
389  void rollbackCurrentDelta() override;
390  void mirrorDelta(MirrorParmCache &cache);
391  void applyAndClearCurrentDelta() override;
392  void applyPermanentDelta() override;
393  virtual void initializeInput(OP_Context &context);
394 
395  bool getGroupCentroid(OP_Context &context,
396  UT_Vector3 &centroid) override;
397 
398  void doErase() override;
399 
400  // This function takes the transform parameters and modifies the gdp
401  // pointer, while creating the appropriate deltas in myCurrentDelta.
402  // It is virtual so that HDK classes may hook into this.
403  virtual void doTransform(MirrorParmCache &mirror_cache,
404  AttribAction &falloff_action);
405 
406  int MERGEMODE() override { return 0; }
407  void SCRIPT(UT_String &, fpreal) override {}
408 
409  int AXIS() override
410  { return evalInt(SOP_EDIT_SCULPT_AXIS_IDX, 0, 0); }
411  fpreal USERX(fpreal t) override
412  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 0, t); }
413  fpreal USERY(fpreal t) override
414  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 1, t); }
415  fpreal USERZ(fpreal t) override
416  { return evalFloat(SOP_EDIT_SCULPT_USER_IDX, 2, t); }
417 
419  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,0,t); }
421  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,1,t); }
423  { return evalFloat(SOP_EDIT_SCULPT_RAY_ORIENT_IDX,2,t); }
424  fpreal RAYHITX(fpreal t) override
425  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,0,t); }
426  fpreal RAYHITY(fpreal t) override
427  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,1,t); }
428  fpreal RAYHITZ(fpreal t) override
429  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPOS_IDX,2,t); }
430  fpreal RAYHITU(fpreal t) override
431  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 0,t); }
432  fpreal RAYHITV(fpreal t) override
433  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 1,t); }
434  fpreal RAYHITW(fpreal t) override
435  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITUVW_IDX, 2,t); }
437  { return evalFloat(SOP_EDIT_SCULPT_RAY_HITPRESSURE_IDX, 0, t); }
438  int PRIMHIT(fpreal t) override
439  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPRIM_IDX, 0,t); }
440  int PTHIT(fpreal t) override
441  { return evalInt(SOP_EDIT_SCULPT_RAY_HITPT_IDX, 0, t); }
442  int EVENT() override
443  { return evalInt(SOP_EDIT_SCULPT_RAY_EVENT_IDX, 0,0); }
444  bool USE_FOREGROUND() override
445  { return evalInt(SOP_EDIT_SCULPT_COLOR_SWITCHER_IDX,
446  0, 0) == 0; }
447  fpreal FGR(fpreal t) override
448  { return evalFloat(SOP_EDIT_SCULPT_FG_IDX, 0, t); }
449  fpreal FGG(fpreal ) override
450  { return 0.0; }
451  fpreal FGB(fpreal ) override
452  { return 0.0; }
453  fpreal BGR(fpreal t) override
454  { return evalFloat(SOP_EDIT_SCULPT_BG_IDX, 0, t); }
455  fpreal BGG(fpreal ) override
456  { return 0.0; }
457  fpreal BGB(fpreal ) override
458  { return 0.0; }
459 
461  { return evalFloat(SOP_EDIT_SCULPT_SOFTEDGE_IDX, 0, t); }
462  void KERNEL(UT_String &str, fpreal t) override
463  { evalString(str, SOP_EDIT_SCULPT_KERNEL_IDX, 0, t); }
464  int UPTYPE(fpreal t) override
465  { return evalInt(SOP_EDIT_SCULPT_UPTYPE_IDX, 0, t);}
466  fpreal UPX(fpreal t) override
467  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 0, t);}
468  fpreal UPY(fpreal t) override
469  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 1, t);}
470  fpreal UPZ(fpreal t) override
471  { return evalFloat(SOP_EDIT_SCULPT_UPVECTOR_IDX, 2, t);}
472 
474  { return evalFloat(SOP_EDIT_SCULPT_PAPER_IDX, 0, t);}
476  { return evalFloat(SOP_EDIT_SCULPT_SPLATTER_IDX, 0, t); }
477  void BITMAP(UT_String &str, fpreal t) override
478  { evalString(str, SOP_EDIT_SCULPT_BITMAP_IDX, 0, t); }
479  int BITMAPCHAN(fpreal t) override
480  { return evalInt(SOP_EDIT_SCULPT_BITMAPCHAN_IDX, 0, t); }
481  fpreal ANGLE(fpreal t) override
482  { return evalFloat(SOP_EDIT_SCULPT_ANGLE_IDX, 0, t); }
483  fpreal SQUASH(fpreal t) override
484  { return evalFloat(SOP_EDIT_SCULPT_SQUASH_IDX, 0, t); }
485 
486  int DOSTAMPING() override { return 0; }
487  int WRITEALPHA() override { return 0; }
488  int OVERRIDECD() override { return 0; }
489  void CDNAME(UT_String &, fpreal) override { }
490  int OVERRIDEALPHA() override { return 0; }
491  void ALPHANAME(UT_String &, fpreal) override { }
492  int OVERRIDENML() override { return 0; }
493  void NMLNAME(UT_String & /*str*/, fpreal /*t*/) override {}
494  int ADDATTRIB() override { return 0; }
495 
496  fpreal SYMMETRYDIRX(fpreal /*t*/) override { return 0.0; }
497  fpreal SYMMETRYDIRY(fpreal /*t*/) override { return 0.0; }
498  fpreal SYMMETRYDIRZ(fpreal /*t*/) override { return 0.0; }
499  fpreal SYMMETRYORIGX(fpreal /*t*/) override { return 0.0; }
500  fpreal SYMMETRYORIGY(fpreal /*t*/) override { return 0.0; }
501  fpreal SYMMETRYORIGZ(fpreal /*t*/) override { return 0.0; }
502  int DOREFLECTION() override { return 0; }
503  int DOPOINTREFLECTION() override { return 0; }
504  int DOROTATION() override { return 0; }
505  int SYMMETRYROT(fpreal /*t*/) override { return 0; }
506  fpreal SYMMETRYDIST(fpreal /*t*/) override { return 0.0; }
507  int DOUVREFLECTION() override { return 0; }
508  fpreal SYMMETRYUVORIGU(fpreal /*t*/) override { return 0.0; }
509  fpreal SYMMETRYUVORIGV(fpreal /*t*/) override { return 0.0; }
510  fpreal SYMMETRYUVANGLE(fpreal /*t*/) override { return 0.0;}
511 
512  int USECONNECTIVITY() override
513  { return evalInt(SOP_EDIT_SCULPT_USECONNECTIVITY_IDX, 0, 0); }
514  int USENORMALS() override
515  { return evalInt(SOP_EDIT_SCULPT_USENORMALS_IDX, 0, 0); }
516  int USEDEPTH() override
517  { return evalInt(SOP_EDIT_SCULPT_USEDEPTH_IDX, 0, 0); }
518  fpreal DEPTH(fpreal t) override
519  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 0, t); }
520  fpreal HEIGHT(fpreal t) override
521  { return evalFloat(SOP_EDIT_SCULPT_DEPTH_IDX, 1, t); }
522 
523 
524  // Find out if the brush has moved or done anything to cause us to add its
525  // effect to the current gdp.
526  bool hasStrokeChanged(fpreal t) override;
527  bool hasStyleChanged(fpreal t) override;
528 
529  // Find if the nib file has changed:
530  bool hasNibFileChanged(fpreal t) override;
531  bool hasAccumStencilChanged(fpreal t) override;
532  bool hasNibLookChanged(fpreal t) override;
533 
534  // Do we want our cook selection to be updated and displayed?
535  bool wantsCookSelection() const override { return true; }
536 
538  { return &myCoordinateFrames; }
539 
540  const GA_PointGroup *getPointGroup() override { return myPointGroup; }
541  virtual const GA_Group *getGroup() { return myGroup; }
542 
543  void syncNodeVersion(const char *old_version,
544  const char *cur_version,
545  bool *node_deleted) override;
546 
547 private: // methods
548 
549  // Selection
550  int GRPTYPE(fpreal t) const
551  { return evalInt(SOP_EDIT_GRPTYPE_IDX, 0, t); }
552 
553  // Access to switcher parm
554  int SWITCHER(fpreal t) const
555  { return evalInt(SOP_EDIT_SWITCHER_IDX, 0, t); }
556  void SET_SWITCHER(int i)
557  { setInt(SOP_EDIT_SWITCHER_IDX, 0, 0, i); }
558 
559  // Transform
560  int TRS(fpreal t) const
561  { return evalInt(SOP_EDIT_TRS_IDX, 0, t); }
562  int XYZ(fpreal t) const
563  { return evalInt(SOP_EDIT_XYZ_IDX, 0, t); }
564  fpreal TX(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 0, t); }
565  fpreal TY(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 1, t); }
566  fpreal TZ(fpreal t) const { return evalFloat(SOP_EDIT_T_IDX, 2, t); }
567  fpreal RX(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 0, t); }
568  fpreal RY(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 1, t); }
569  fpreal RZ(fpreal t) const { return evalFloat(SOP_EDIT_R_IDX, 2, t); }
570  fpreal SX(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 0, t); }
571  fpreal SY(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 1, t); }
572  fpreal SZ(fpreal t) const { return evalFloat(SOP_EDIT_S_IDX, 2, t); }
573  fpreal SHEAR_XY(fpreal t) const
574  { return evalFloat(SOP_EDIT_SHEAR_IDX, 0, t); }
575  fpreal SHEAR_XZ(fpreal t) const
576  { return evalFloat(SOP_EDIT_SHEAR_IDX, 1, t); }
577  fpreal SHEAR_YZ(fpreal t) const
578  { return evalFloat(SOP_EDIT_SHEAR_IDX, 2, t); }
579  fpreal PX(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 0, t); }
580  void SET_PX(fpreal f) { setFloat(SOP_EDIT_P_IDX, 0, 0, f); }
581  fpreal PY(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 1, t); }
582  void SET_PY(fpreal f) { setFloat(SOP_EDIT_P_IDX, 1, 0, f); }
583  fpreal PZ(fpreal t) const { return evalFloat(SOP_EDIT_P_IDX, 2, t); }
584  void SET_PZ(fpreal f) { setFloat(SOP_EDIT_P_IDX, 2, 0, f); }
585  fpreal PRX(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 0,t); }
586  fpreal PRY(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 1,t); }
587  fpreal PRZ(fpreal t) const { return evalFloat(SOP_EDIT_PR_IDX, 2,t); }
588  int PREXFORM_TRS(fpreal t) const
589  { return evalInt(SOP_EDIT_PREXFORM_TRS_IDX, 0, t); }
590  int PREXFORM_XYZ(fpreal t) const
591  { return evalInt(SOP_EDIT_PREXFORM_XYZ_IDX, 0, t); }
592  fpreal PREXFORM_TX(fpreal t) const
593  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 0, t); }
594  fpreal PREXFORM_TY(fpreal t) const
595  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 1, t); }
596  fpreal PREXFORM_TZ(fpreal t) const
597  { return evalFloat(SOP_EDIT_PREXFORM_T_IDX, 2, t); }
598  fpreal PREXFORM_RX(fpreal t) const
599  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 0, t); }
600  fpreal PREXFORM_RY(fpreal t) const
601  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 1, t); }
602  fpreal PREXFORM_RZ(fpreal t) const
603  { return evalFloat(SOP_EDIT_PREXFORM_R_IDX, 2, t); }
604  fpreal PREXFORM_SX(fpreal t) const
605  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 0, t); }
606  fpreal PREXFORM_SY(fpreal t) const
607  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 1, t); }
608  fpreal PREXFORM_SZ(fpreal t) const
609  { return evalFloat(SOP_EDIT_PREXFORM_S_IDX, 2, t); }
610  fpreal PREXFORM_SHEAR_XY(fpreal t) const
611  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 0, t); }
612  fpreal PREXFORM_SHEAR_XZ(fpreal t) const
613  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 1, t); }
614  fpreal PREXFORM_SHEAR_YZ(fpreal t) const
615  { return evalFloat(SOP_EDIT_PREXFORM_SHEAR_IDX, 2, t); }
616  fpreal LPX(fpreal t) const
617  { return evalFloat(SOP_EDIT_LP_IDX, 0, t); }
618  fpreal LPY(fpreal t) const
619  { return evalFloat(SOP_EDIT_LP_IDX, 1, t); }
620  fpreal LPZ(fpreal t) const
621  { return evalFloat(SOP_EDIT_LP_IDX, 2, t); }
622  fpreal LPRX(fpreal t) const
623  { return evalFloat(SOP_EDIT_LPR_IDX, 0, t); }
624  fpreal LPRY(fpreal t) const
625  { return evalFloat(SOP_EDIT_LPR_IDX, 1, t); }
626  fpreal LPRZ(fpreal t) const
627  { return evalFloat(SOP_EDIT_LPR_IDX, 2, t); }
628  int LPREXFORM_TRS(fpreal t) const
629  { return evalInt(SOP_EDIT_LPREXFORM_TRS_IDX, 0, t); }
630  int LPREXFORM_XYZ(fpreal t) const
631  { return evalInt(SOP_EDIT_LPREXFORM_XYZ_IDX, 0, t); }
632  fpreal LPREXFORM_TX(fpreal t) const
633  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 0, t); }
634  fpreal LPREXFORM_TY(fpreal t) const
635  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 1, t); }
636  fpreal LPREXFORM_TZ(fpreal t) const
637  { return evalFloat(SOP_EDIT_LPREXFORM_T_IDX, 2, t); }
638  fpreal LPREXFORM_RX(fpreal t) const
639  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 0, t); }
640  fpreal LPREXFORM_RY(fpreal t) const
641  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 1, t); }
642  fpreal LPREXFORM_RZ(fpreal t) const
643  { return evalFloat(SOP_EDIT_LPREXFORM_R_IDX, 2, t); }
644  fpreal LPREXFORM_SX(fpreal t) const
645  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 0, t); }
646  fpreal LPREXFORM_SY(fpreal t) const
647  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 1, t); }
648  fpreal LPREXFORM_SZ(fpreal t) const
649  { return evalFloat(SOP_EDIT_LPREXFORM_S_IDX, 2, t); }
650  fpreal LPREXFORM_SHEAR_XY(fpreal t) const
651  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 0, t); }
652  fpreal LPREXFORM_SHEAR_XZ(fpreal t) const
653  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 1, t); }
654  fpreal LPREXFORM_SHEAR_YZ(fpreal t) const
655  { return evalFloat(SOP_EDIT_LPREXFORM_SHEAR_IDX, 2, t); }
656  int KEEP(fpreal t) const
657  { return evalInt(SOP_EDIT_KEEP_IDX, 0, t); }
658  int XFORMSPACE(fpreal t) const
659  { return evalInt(SOP_EDIT_XFORMSPACE_IDX, 0, t); }
660  int LOCALFRAME(fpreal t) const
661  { return evalInt(SOP_EDIT_LOCALFRAME_IDX, 0, t); }
662 
663  fpreal LOCAL_UPX(fpreal t) const
664  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 0, t); }
665  fpreal LOCAL_UPY(fpreal t) const
666  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 1, t); }
667  fpreal LOCAL_UPZ(fpreal t) const
668  { return evalFloat(SOP_EDIT_LOCALSPACEUPVECTOR_IDX, 2, t); }
669  void LEADISLANDHINT(UT_String &str, fpreal t) const
670  { evalString(str, SOP_EDIT_LEADISLANDHINT_IDX, 0, t); }
671  bool SLIDEONSURFACE(fpreal t) const
672  { return evalInt( SOP_EDIT_SLIDEONSURFACE_IDX, 0, t) == 1; }
673 
674  // Peak
675  fpreal DIST(fpreal t) const
676  { return evalFloat(SOP_EDIT_DIST_IDX, 0, t); }
677  int LEADNML(fpreal t) const
678  { return evalInt(SOP_EDIT_LEADNML_IDX, 0, t); }
679 
680  // Soft
681  fpreal SOFTRADIUS(fpreal t) const
682  { return evalFloat(SOP_EDIT_SOFTRADIUS_IDX, 0, t); }
683  int SOFTTYPE(fpreal t) const
684  { return evalInt(SOP_EDIT_SOFTTYPE_IDX, 0, t); }
685  fpreal TANDEG0(fpreal t) const
686  { return evalFloat(SOP_EDIT_TANGENT_IDX, 0, t); }
687  fpreal TANDEG1(fpreal t) const
688  { return evalFloat(SOP_EDIT_TANGENT_IDX, 1, t); }
689  void EDIT_KERNEL(UT_String &str, fpreal t)
690  { evalString(str, SOP_EDIT_KERNEL_IDX, 0, t); }
691  int DIST_METRIC(fpreal t) const
692  { return evalInt(SOP_EDIT_DIST_METRIC_IDX, 0, t); }
693  bool APPLY_ROLLOFF(fpreal t) const
694  { return evalInt(SOP_EDIT_APPLY_ROLLOFF_IDX, 0, t) != 0; }
695  void DIST_ATTR(UT_String& str, fpreal t) const
696  { evalString(str, SOP_EDIT_DIST_ATTR_IDX, 0, t); }
697  void LEAD_ATTR(UT_String& str, fpreal t) const
698  { evalString(str, SOP_EDIT_LEAD_POINT_ATTR_IDX, 0, t); }
699  int VISUALIZE_FALLOFF(fpreal t) const
700  { return evalInt(SOP_EDIT_VISFALLOFF_IDX, 0, t); }
701  bool falloffAttributeRequested(fpreal t) const;
702 
703  bool USEORIENT(fpreal t) const
704  { return evalInt(SOP_EDIT_USEORIENT_IDX, 0, t) != 0; }
705 
706  // Symmetry
707  bool USEMIRROR(fpreal t) const
708  { return evalInt(SOP_EDIT_USEMIRROR_IDX, 0, t) != 0; }
709  fpreal SYMMETRYAXISX(fpreal t) const
710  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 0, t); }
711  fpreal SYMMETRYAXISY(fpreal t) const
712  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 1, t); }
713  fpreal SYMMETRYAXISZ(fpreal t) const
714  { return evalFloat(SOP_EDIT_SYMMETRYAXIS_IDX, 2, t); }
715  fpreal SYMMETRYORIGINX(fpreal t) const
716  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 0, t); }
717  fpreal SYMMETRYORIGINY(fpreal t) const
718  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 1, t); }
719  fpreal SYMMETRYORIGINZ(fpreal t) const
720  { return evalFloat(SOP_EDIT_SYMMETRYORIGIN_IDX, 2, t); }
721  fpreal SYMMETRYDISTANCE(fpreal t) const
722  { return evalFloat(SOP_EDIT_SYMMETRYDISTANCE_IDX, 0, t); }
723  fpreal SYMMETRYTHRESHOLD(fpreal t) const
724  { return evalFloat(SOP_EDIT_SYMMETRYTHRESHOLD_IDX, 0, t); }
725  fpreal SYMMETRYPLANETOL(fpreal t) const
726  { return evalFloat(SOP_EDIT_SYMMETRYPLANETOL_IDX, 0, t); }
727 
728  int UPDATENMLS(fpreal t) const
729  { return evalInt(SOP_EDIT_UPDATENMLS_IDX, 0, t); }
730 
731  void updateMirrorParmCache(MirrorParmCache &cache, fpreal t);
732  bool getSoftSymmetryParms(GEO_Detail::SoftSymmetryParms &symmetry,
733  MirrorParmCache &cache, fpreal t);
734 
735  // Transform / Peak
736  bool isTransform(fpreal t) const { return SWITCHER(t) == 0; }
737  bool isPeak(fpreal t) const { return SWITCHER(t) != 0; }
738  void doPeak(fpreal t, MirrorParmCache &mirror_cache,
739  AttribAction &falloff_action);
740 
741  // Soft-related methods
742  bool isSoft(fpreal t) const { return SOFTRADIUS(t) != 0.0; }
743 
744 private: // data
745 
746  UT_Vector3 myInitialCentroid;
747 
748  GDT_CoordinateFrames myCoordinateFrames;
749  bool myUsedOrient;
750  int myCurrentInputId;
751  int myCurrentGeoCookCount;
752  int myReferenceInputId;
753  int myReferenceGeoCookCount;
754  const GA_PrimitiveGroup *myPrimitiveGroup;
755  const GA_PointGroup *myPointGroup;
756  UT_String myPrimitiveClosureName;
757  UT_String myPointClosureName;
758 
759  GU_DetailHandle myHandleXformGuideHandle;
760  UT_Matrix4D myLeadLocalFrame;
761 
762  bool myVisualizationFlag;
763  bool mySetFalloffOnLastCook;
764  bool myOverwroteInputFalloff;
765 
766  // cached data for local space transforms
767  LocalSpaceCache *myLocalSpaceCache;
768 
769  // cached data for soft transforms
770  GU_SurfaceDistanceCache mySurfaceDistanceCache;
771 
772  // syncNodeVersion is called after resolveObsoleteParms, so we save what the
773  // value of IgnorePointConnectivity is in resolveObsoleteParms, then if we
774  // need to we use it in syncNodeVersion
775  bool myPreSoftDistanceMetric;
776 };
777 
778 #endif
int EVENT() override
Definition: SOP_Edit.h:442
virtual void setVisualization(bool)
Definition: SOP_Node.h:858
virtual bool updateParmsFlags()
int DOSTAMPING() override
Definition: SOP_Edit.h:486
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:14163
const GA_PointGroup * getPointGroup() override
Definition: SOP_Edit.h:540
fpreal SQUASH(fpreal t) override
Definition: SOP_Edit.h:483
fpreal ANGLE(fpreal t) override
Definition: SOP_Edit.h:481
void SCRIPT(UT_String &, fpreal) override
Definition: SOP_Edit.h:407
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:473
void NMLNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:493
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
fpreal FGB(fpreal) override
Definition: SOP_Edit.h:451
fpreal RAYHITZ(fpreal t) override
Definition: SOP_Edit.h:428
virtual const GA_Group * getGroup()
Definition: SOP_Edit.h:541
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:449
void setHitPressure(fpreal p, fpreal t) override
Definition: SOP_Edit.h:225
fpreal SYMMETRYDIRZ(fpreal) override
Definition: SOP_Edit.h:498
virtual void getXformOrder(UT_XformOrder &xord, const CH_Channel *chp) const
constexpr SYS_FORCE_INLINE T & z() noexcept
Definition: UT_Vector3.h:656
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
fpreal DEPTH(fpreal t) override
Definition: SOP_Edit.h:518
GLuint const GLchar * name
Definition: glcorearb.h:786
fpreal RAYHITX(fpreal t) override
Definition: SOP_Edit.h:424
bool wantsCookSelection() const override
Definition: SOP_Edit.h:535
GLdouble GLdouble t
Definition: glew.h:1403
int OVERRIDEALPHA() override
Definition: SOP_Edit.h:490
fpreal SOFTEDGE(fpreal t) override
Definition: SOP_Edit.h:460
fpreal RAYHITW(fpreal t) override
Definition: SOP_Edit.h:434
int altersGeometry() const override
Definition: SOP_Edit.h:271
bool USE_FOREGROUND() override
Definition: SOP_Edit.h:444
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
struct _cl_event * event
Definition: glcorearb.h:2961
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
int PTHIT(fpreal t) override
Definition: SOP_Edit.h:440
void CDNAME(UT_String &, fpreal) override
Definition: SOP_Edit.h:489
void setProjectionType(int projtype) override
Definition: SOP_Edit.h:258
fpreal BGG(fpreal) override
Definition: SOP_Edit.h:455
void useBackgroundColor() override
Definition: SOP_Edit.h:266
int DOUVREFLECTION() override
Definition: SOP_Edit.h:507
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:499
fpreal USERX(fpreal t) override
Definition: SOP_Edit.h:411
bool unloadData() override
fpreal SYMMETRYORIGY(fpreal) override
Definition: SOP_Edit.h:500
fpreal UPY(fpreal t) override
Definition: SOP_Edit.h:468
int BITMAPCHAN(fpreal t) override
Definition: SOP_Edit.h:479
fpreal RAYHITPRESSURE(fpreal t) override
Definition: SOP_Edit.h:436
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
const GLdouble * v
Definition: glcorearb.h:837
virtual void beginNewOperation()
fpreal HEIGHT(fpreal t) override
Definition: SOP_Edit.h:520
int PROJECTIONTYPE() override
Definition: SOP_Edit.h:303
int DOPOINTREFLECTION() override
Definition: SOP_Edit.h:503
int UPTYPE(fpreal t) override
Definition: SOP_Edit.h:464
int DOROTATION() override
Definition: SOP_Edit.h:504
int MERGEMODE() override
Definition: SOP_Edit.h:406
void KERNEL(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:462
int SYMMETRYROT(fpreal) override
Definition: SOP_Edit.h:505
void setRadius(fpreal r, fpreal t) override
Definition: SOP_Edit.h:229
int USEDEPTH() override
Definition: SOP_Edit.h:516
GLfloat GLfloat p
Definition: glew.h:16656
SOP_BrushOp
Definition: SOP_BrushBase.h:39
int OVERRIDENML() override
Definition: SOP_Edit.h:492
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:422
fpreal RADIUSPRESSURE(fpreal t) override
Definition: SOP_Edit.h:280
fpreal RAYHITY(fpreal t) override
Definition: SOP_Edit.h:426
fpreal RAYORIENTX(fpreal t) override
Definition: SOP_Edit.h:418
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:487
GDT_CoordinateFrames * getCoordinateFrames()
Definition: SOP_Edit.h:537
int getNumGuides() override
Definition: SOP_Edit.h:352
void clearAllDeltas(fpreal t) override
int PRIMHIT(fpreal t) override
Definition: SOP_Edit.h:438
void setAccumulateStencil(bool yesno) override
Definition: SOP_Edit.h:195
fpreal SYMMETRYORIGZ(fpreal) override
Definition: SOP_Edit.h:501
void BITMAP(UT_String &str, fpreal t) override
Definition: SOP_Edit.h:477
fpreal RAYHITU(fpreal t) override
Definition: SOP_Edit.h:430
GLuint GLfloat * val
Definition: glcorearb.h:1608
fpreal UPZ(fpreal t) override
Definition: SOP_Edit.h:470
fpreal OPACITYPRESSURE(fpreal t) override
Definition: SOP_Edit.h:284
int OVERRIDECD() override
Definition: SOP_Edit.h:488
bool inBrushMode(fpreal t)
Definition: SOP_Edit.h:287
int USENORMALS() override
Definition: SOP_Edit.h:514
fpreal BGB(fpreal) override
Definition: SOP_Edit.h:457
int ADDATTRIB() override
Definition: SOP_Edit.h:494
fpreal FGR(fpreal t) override
Definition: SOP_Edit.h:447
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:496
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:491
int AXIS() override
Definition: SOP_Edit.h:409
void setHitPrimitive(int primidx, fpreal t) override
Definition: SOP_Edit.h:211
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:509
bool myCookedFlag
Definition: SOP_GDT.h:134
#define SOP_API
Definition: SOP_API.h:10
GLfloat f
Definition: glcorearb.h:1926
fpreal USERY(fpreal t) override
Definition: SOP_Edit.h:413
const GA_PrimitiveGroup * getPrimitiveSelection() const override
Definition: SOP_Edit.h:340
fpreal SYMMETRYDIST(fpreal) override
Definition: SOP_Edit.h:506
fpreal UPX(fpreal t) override
Definition: SOP_Edit.h:466
void setUseOrient(bool f)
Definition: SOP_Edit.h:335
fpreal SYMMETRYUVORIGU(fpreal) override
Definition: SOP_Edit.h:508
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:31
SOP_BrushShape
Definition: SOP_BrushBase.h:65
fpreal USERZ(fpreal t) override
Definition: SOP_Edit.h:415
GLboolean r
Definition: glcorearb.h:1222
constexpr SYS_FORCE_INLINE T & y() noexcept
Definition: UT_Vector3.h:654
virtual int isRefInput(unsigned idx) const
fpreal RAYHITV(fpreal t) override
Definition: SOP_Edit.h:432
fpreal SYMMETRYDIRY(fpreal) override
Definition: SOP_Edit.h:497
fpreal SYMMETRYUVANGLE(fpreal) override
Definition: SOP_Edit.h:510
int DOREFLECTION() override
Definition: SOP_Edit.h:502
fpreal RAYORIENTY(fpreal t) override
Definition: SOP_Edit.h:420
int USECONNECTIVITY() override
Definition: SOP_Edit.h:512
fpreal SPLATTER(fpreal t) override
Definition: SOP_Edit.h:475
constexpr SYS_FORCE_INLINE T & x() noexcept
Definition: UT_Vector3.h:652
fpreal BGR(fpreal t) override
Definition: SOP_Edit.h:453