HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_UndoModel.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_UndoModel.h ( SOP Library, C++)
7  *
8  * COMMENTS: class to handle undos for hard and soft modelling
9  * changes
10  */
11 
12 #ifndef __SOP_UndoModel_h__
13 #define __SOP_UndoModel_h__
14 
15 #include "SOP_API.h"
16 #include <OP/OP_Node.h>
17 #include <UT/UT_Undo.h>
18 #include <UT/UT_String.h>
19 
20 class SOP_SoftLockData;
21 class SOP_Node;
22 class SOP_SoftLockData;
23 class GU_Detail;
24 
26 {
27 public:
28  SOP_UndoModel();
29  ~SOP_UndoModel() override;
30 
32 
33  void init(OP_LockTypes prev_lock,
34  OP_LockTypes new_lock,
35  SOP_Node *sop,
36  SOP_SoftLockData *prev_slockdata = 0,
37  SOP_SoftLockData *new_slockdata = 0);
38 
39  void undo() override;
40  void redo() override;
41 
42  void setName(const char *name) { myName.harden(name); }
43  const char *getName() { return (const char *)myName; }
44 
45 protected:
46  typedef enum
47  {
49  SOPUNDOMODEL_REDO
50  } SOP_UndoModelOperation;
51 
52  bool hasSopUndo() { return myHasSopUndo; }
53 
54  void doUndo(void *modeler);
55  void doRedo(void *modeler);
56 
57 private:
58  void loadForHardLock(SOP_UndoModelOperation operation,
59  void *modeler);
60  void loadForSoftLock(SOP_UndoModelOperation operation,
61  void *modeler);
62  void unlockSop(SOP_UndoModelOperation operation,
63  void *modeler);
64 
65  // verb helper method
66  void createSopSlockData( SOP_SoftLockData &loaded_diff,
67  SOP_Node *sop) const;
68 
69  int myOpId;
70 
71  UT_String myOldHardLockFileName;
72  UT_String myNewHardLockFileName;
73  UT_String mySoftLockFileName;
74 
75  OP_LockTypes myPrevLock;
76  OP_LockTypes myNewLock;
77 
78  bool myHasSopUndo;
79 
80  UT_String myName;
81 };
82 #endif
virtual void redo()=0
GLuint const GLchar * name
Definition: glew.h:1814
OP_NodeFlags::OP_LockTypes OP_LockTypes
Definition: OP_Node.h:1207
virtual void undo()=0
const char * getName()
Definition: SOP_UndoModel.h:43
void setName(const char *name)
Definition: SOP_UndoModel.h:42
bool hasSopUndo()
Definition: SOP_UndoModel.h:52
#define SOP_API
Definition: SOP_API.h:10