Cafu Engine
Delete.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_MODELEDITOR_COMMAND_DELETE_HPP_INCLUDED
8 #define CAFU_MODELEDITOR_COMMAND_DELETE_HPP_INCLUDED
9 
10 #include "../../CommandPattern.hpp"
11 #include "../ElementTypes.hpp"
12 #include "Models/Loader_cmdl.hpp"
13 
14 
15 namespace ModelEditor
16 {
17  class CommandSelectT;
18  class ModelDocumentT;
19 
20 
21  class CommandDeleteT : public CommandT
22  {
23  public:
24 
25  CommandDeleteT(ModelDocumentT* ModelDoc, ModelElementTypeT Type, const ArrayT<unsigned int>& Indices);
26  ~CommandDeleteT();
27 
28  const wxString& GetMessage() const { return m_Message; }
29 
30  // CommandT implementation.
31  bool Do();
32  void Undo();
33  wxString GetName() const;
34 
35 
36  private:
37 
38  struct MeshInfoT
39  {
40  CafuModelT::MeshT Mesh; ///< The deleted mesh.
41  ArrayT<MaterialT*> SkinsMaterials; ///< The material in each skin for this mesh.
42  ArrayT<MatSys::RenderMaterialT*> SkinsRenderMaterials; ///< The render material in each skin for this mesh.
43  };
44 
45  ModelDocumentT* m_ModelDoc;
46  const ModelElementTypeT m_Type;
47  const ArrayT<unsigned int> m_Indices;
48  ArrayT<CafuModelT::JointT> m_Joints; ///< The deleted joints (if m_Type==JOINT).
49  ArrayT<MeshInfoT> m_MeshInfos; ///< Information about the deleted meshes (if m_Type==MESH).
50  ArrayT<CafuModelT::SkinT> m_Skins; ///< The deleted skins (if m_Type==SKIN).
51  ArrayT<CafuModelT::GuiFixtureT> m_GuiFixtures; ///< The deleted GUI fixtures (if m_Type==GFIX).
52  ArrayT<CafuModelT::AnimT> m_Anims; ///< The deleted anims (if m_Type==ANIM).
53  ArrayT<CafuModelT::ChannelT> m_Channels; ///< The deleted channels (if m_Type==CHAN).
54  wxString m_Message; ///< Calling Do() may place an error or info message here that the caller is supposed to show to the user (when the command is first run).
55  CommandSelectT* m_CommandSelect; ///< The command that unselects the elements before they are deleted.
56  };
57 }
58 
59 #endif
Definition: Delete.hpp:21
void Undo()
This method un-does the command.
Definition: Delete.cpp:197
bool Do()
This method executes the command.
Definition: Delete.cpp:121
wxString GetName() const
Returns the name (a description) of the command.
Definition: Delete.cpp:241
This struct defines a triangle mesh in the model.
Definition: Model_cmdl.hpp:63
Definition: Select.hpp:18
Definition: Select.hpp:16
This class represents a general command for implementing modifications to the applications document...
Definition: CommandPattern.hpp:30
Definition: ModelDocument.hpp:30