Changeset 396
- Timestamp:
- 09/28/11 00:53:05 (8 months ago)
- Location:
- cafu/trunk
- Files:
-
- 13 modified
-
CaWE/ModelEditor/ChildFrame.cpp (modified) (7 diffs)
-
CaWE/ModelEditor/ChildFrame.hpp (modified) (4 diffs)
-
CaWE/ModelEditor/Commands/Add.hpp (modified) (1 diff)
-
CaWE/ModelEditor/Commands/Delete.cpp (modified) (5 diffs)
-
CaWE/ModelEditor/Commands/Delete.hpp (modified) (1 diff)
-
CaWE/ModelEditor/Commands/Rename.cpp (modified) (3 diffs)
-
CaWE/ModelEditor/ElementTypes.hpp (modified) (1 diff)
-
CaWE/ModelEditor/ElementsList.cpp (modified) (4 diffs)
-
CaWE/ModelEditor/ElementsList.hpp (modified) (1 diff)
-
CaWE/ModelEditor/ObserverPattern.cpp (modified) (3 diffs)
-
CaWE/ModelEditor/ObserverPattern.hpp (modified) (3 diffs)
-
Libs/Models/Model_cmdl.cpp (modified) (4 diffs)
-
Libs/Models/Model_cmdl.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/ChildFrame.cpp
r395 r396 82 82 m_LastUsedType(JOINT), 83 83 m_Parent(Parent), 84 m_FileMenu(NULL), 85 m_EditMenu(NULL), 84 86 m_SceneView3D(NULL), 85 87 m_GlobalsInspector(NULL), … … 98 100 m_ScenePropGrid(NULL), 99 101 m_SubmodelsPanel(NULL), 100 m_TransformDialog(NULL), 101 m_FileMenu(NULL), 102 m_EditMenu(NULL) 102 m_TransformDialog(NULL) 103 103 { 104 104 // Register us with the parents list of children. … … 145 145 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_MESHES_LIST, "Meshes List", "Show or hide the meshes list"); 146 146 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_MESH_INSPECTOR, "Mesh Inspector", "Show or hide the mesh inspector"); 147 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_SKINS_LIST, "Skins List", "Show or hide the skins list"); 148 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_SKIN_INSPECTOR, "Skin Inspector", "Show or hide the skin inspector"); 149 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_GUIFIXTURES_LIST, "GUI Fixtures List", "Show or hide the GUI fixtures list"); 150 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_GUIFIXTURE_INSPECTOR, "GUI Fixture Inspector", "Show or hide the GUI fixture inspector"); 147 151 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_ANIMS_LIST, "Animations List", "Show or hide the animations list"); 148 152 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_ANIM_INSPECTOR, "Animation Inspector", "Show or hide the animation inspector"); 149 153 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_CHANNELS_LIST, "Channels List", "Show or hide the animation channels list"); 150 154 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_CHANNEL_INSPECTOR, "Channel Inspector", "Show or hide the animation channel inspector"); 151 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_GUIFIXTURES_LIST, "GUI Fixtures List", "Show or hide the GUI fixtures list");152 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_GUIFIXTURE_INSPECTOR, "GUI Fixture Inspector", "Show or hide the GUI fixture inspector");153 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_SKINS_LIST, "Skins List", "Show or hide the skins list");154 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_SKIN_INSPECTOR, "Skin Inspector", "Show or hide the skin inspector");155 155 ViewMenu->AppendSeparator(); 156 156 ViewMenu->AppendCheckItem(ID_MENU_VIEW_AUIPANE_SCENE_SETUP, "Scene Setup", "Show or hide the scene setup inspector"); … … 223 223 Float().Hide()); 224 224 225 m_SkinsList=new ElementsPanelT(this, wxSize(230, 150), SKIN); 226 m_AUIManager.AddPane(m_SkinsList, wxAuiPaneInfo(). 227 Name("SkinsList").Caption("Skins"). 228 Left().Position(5)); 229 230 m_SkinInspector=new wxStaticText(this, wxID_ANY, "\nSkins are used to assign alternative materials to the meshes in the model.\n\nTo use a skin, select it in the Skins list, then use the Mesh Inspector to assign a material to the mesh in the selected skin.", wxDefaultPosition, wxSize(260, 180)); 231 m_AUIManager.AddPane(m_SkinInspector, wxAuiPaneInfo(). 232 Name("SkinInspector").Caption("Skin Inspector"). 233 Float().Hide()); 234 235 m_GuiFixturesList=new ElementsPanelT(this, wxSize(230, 150), GFIX); 236 m_AUIManager.AddPane(m_GuiFixturesList, wxAuiPaneInfo(). 237 Name("GuiFixturesList").Caption("Gui Fixtures"). 238 Left().Position(7)); 239 240 m_GuiFixtureInspector=new GuiFixInspectorT(this, wxSize(260, 320)); 241 m_AUIManager.AddPane(m_GuiFixtureInspector, wxAuiPaneInfo(). 242 Name("GuiFixtureInspector").Caption("GUI Fixture Inspector"). 243 Float().Hide()); 244 225 245 m_AnimsList=new ElementsPanelT(this, wxSize(230, 400), ANIM); 226 246 m_AUIManager.AddPane(m_AnimsList, wxAuiPaneInfo(). 227 247 Name("AnimsList").Caption("Animations"). 228 Left().Position(5));248 Right().Position(0)); 229 249 230 250 m_AnimInspector=new AnimInspectorT(this, wxSize(240, 160)); … … 236 256 m_AUIManager.AddPane(m_ChannelsList, wxAuiPaneInfo(). 237 257 Name("ChannelsList").Caption("Channels"). 238 Left().Position(7));258 Right().Position(2)); 239 259 240 260 m_ChannelInspector=new ChannelInspectorT(this, wxSize(260, 320)); … … 243 263 Float().Hide()); 244 264 245 m_GuiFixturesList=new ElementsPanelT(this, wxSize(230, 150), GFIX);246 m_AUIManager.AddPane(m_GuiFixturesList, wxAuiPaneInfo().247 Name("GuiFixturesList").Caption("Gui Fixtures").248 Left().Position(9));249 250 m_GuiFixtureInspector=new GuiFixInspectorT(this, wxSize(260, 320));251 m_AUIManager.AddPane(m_GuiFixtureInspector, wxAuiPaneInfo().252 Name("GuiFixtureInspector").Caption("GUI Fixture Inspector").253 Float().Hide());254 255 265 m_ScenePropGrid=new ScenePropGridT(this, wxSize(230, 500)); 256 266 m_AUIManager.AddPane(m_ScenePropGrid, wxAuiPaneInfo(). 257 267 Name("ScenePropGrid").Caption("Scene Setup"). 258 Right().Position( 0));268 Right().Position(4)); 259 269 260 270 m_SubmodelsPanel=new SubmodelsPanelT(this, wxSize(230, 150)); 261 271 m_AUIManager.AddPane(m_SubmodelsPanel, wxAuiPaneInfo(). 262 272 Name("SubmodelsPanel").Caption("Submodels"). 263 Right().Position(1)); 264 265 m_SkinsList=new ElementsPanelT(this, wxSize(230, 150), SKIN); 266 m_AUIManager.AddPane(m_SkinsList, wxAuiPaneInfo(). 267 Name("SkinsList").Caption("Skins"). 268 Right().Position(2)); 269 270 m_SkinInspector=new wxStaticText(this, wxID_ANY, "\nSkins are used to assign alternative materials to the meshes in the model.\n\nTo use a skin, select it in the Skins list, then use the Mesh Inspector to assign a material to the mesh in the selected skin.", wxDefaultPosition, wxSize(260, 180)); 271 m_AUIManager.AddPane(m_SkinInspector, wxAuiPaneInfo(). 272 Name("SkinInspector").Caption("Skin Inspector"). 273 Float().Hide()); 273 Right().Position(5)); 274 274 275 275 m_TransformDialog=new TransformDialogT(this, wxSize(248, 240)); … … 305 305 AnimToolbar->AddSeparator(); 306 306 AnimToolbar->AddTool(ID_MENU_MODEL_TRANSFORM, "Transform", wxArtProvider::GetBitmap("transform-rotate-right", wxART_TOOLBAR), "Transform model"); 307 // AnimToolbar->AddTool(ID_MENU_MODEL_SKIN_ADD, "Add skin", wxArtProvider::GetBitmap("window-new", wxART_TOOLBAR), "Add skin"); 307 308 AnimToolbar->AddTool(ID_MENU_MODEL_GUIFIXTURE_ADD, "Add GUI fixture", wxArtProvider::GetBitmap("window-new", wxART_TOOLBAR), "Add GUI fixture"); 308 // AnimToolbar->AddTool(ID_MENU_MODEL_SKIN_ADD, "Add skin", wxArtProvider::GetBitmap("window-new", wxART_TOOLBAR), "Add skin");309 309 // AnimToolbar->AddTool(ID_MENU_MODEL_CHANNEL_ADD, "Add channel", wxArtProvider::GetBitmap("window-new", wxART_TOOLBAR), "Add channel"); 310 310 AnimToolbar->Realize(); -
cafu/trunk/CaWE/ModelEditor/ChildFrame.hpp
r395 r396 110 110 111 111 ParentFrameT* m_Parent; 112 wxMenu* m_FileMenu; 113 wxMenu* m_EditMenu; 114 112 115 wxAuiManager m_AUIManager; 113 116 SceneView3DT* m_SceneView3D; … … 117 120 ElementsPanelT* m_MeshesList; 118 121 MeshInspectorT* m_MeshInspector; 122 ElementsPanelT* m_SkinsList; 123 wxStaticText* m_SkinInspector; 124 ElementsPanelT* m_GuiFixturesList; 125 GuiFixInspectorT* m_GuiFixtureInspector; 119 126 ElementsPanelT* m_AnimsList; 120 127 AnimInspectorT* m_AnimInspector; 121 128 ElementsPanelT* m_ChannelsList; 122 129 ChannelInspectorT* m_ChannelInspector; 123 ElementsPanelT* m_SkinsList;124 wxStaticText* m_SkinInspector;125 ElementsPanelT* m_GuiFixturesList;126 GuiFixInspectorT* m_GuiFixtureInspector;127 130 ScenePropGridT* m_ScenePropGrid; 128 131 SubmodelsPanelT* m_SubmodelsPanel; 129 132 TransformDialogT* m_TransformDialog; 130 131 wxMenu* m_FileMenu;132 wxMenu* m_EditMenu;133 133 134 134 … … 144 144 ID_MENU_VIEW_AUIPANE_MESHES_LIST, 145 145 ID_MENU_VIEW_AUIPANE_MESH_INSPECTOR, 146 ID_MENU_VIEW_AUIPANE_SKINS_LIST, 147 ID_MENU_VIEW_AUIPANE_SKIN_INSPECTOR, 148 ID_MENU_VIEW_AUIPANE_GUIFIXTURES_LIST, 149 ID_MENU_VIEW_AUIPANE_GUIFIXTURE_INSPECTOR, 146 150 ID_MENU_VIEW_AUIPANE_ANIMS_LIST, 147 151 ID_MENU_VIEW_AUIPANE_ANIM_INSPECTOR, 148 152 ID_MENU_VIEW_AUIPANE_CHANNELS_LIST, 149 153 ID_MENU_VIEW_AUIPANE_CHANNEL_INSPECTOR, 150 ID_MENU_VIEW_AUIPANE_SKINS_LIST,151 ID_MENU_VIEW_AUIPANE_SKIN_INSPECTOR,152 ID_MENU_VIEW_AUIPANE_GUIFIXTURES_LIST,153 ID_MENU_VIEW_AUIPANE_GUIFIXTURE_INSPECTOR,154 154 ID_MENU_VIEW_AUIPANE_SCENE_SETUP, 155 155 ID_MENU_VIEW_AUIPANE_SUBMODELS_LIST, … … 164 164 ID_MENU_MODEL_ANIM_SKIP_FORWARD, 165 165 ID_MENU_MODEL_TRANSFORM, 166 ID_MENU_MODEL_SKIN_ADD, 166 167 ID_MENU_MODEL_GUIFIXTURE_ADD, 167 ID_MENU_MODEL_SKIN_ADD,168 168 ID_MENU_MODEL_CHANNEL_ADD, 169 169 ID_MENU_MODEL_LOAD_SUBMODEL, -
cafu/trunk/CaWE/ModelEditor/Commands/Add.hpp
r394 r396 55 55 // ArrayT<CafuModelT::MeshT> m_Meshes; ///< The added meshes (if m_Type==MESH). 56 56 // ArrayT<MatSys::MeshT> m_DrawMs; ///< The draw meshes related to m_Meshes. 57 // ArrayT<CafuModelT::AnimT> m_Anims; ///< The added anims (if m_Type==ANIM).58 57 ArrayT<CafuModelT::SkinT> m_Skins; ///< The added skins (if m_Type==SKIN). 59 58 ArrayT<CafuModelT::GuiFixtureT> m_GuiFixtures; ///< The added GUI fixtures (if m_Type==GFIX). 59 // ArrayT<CafuModelT::AnimT> m_Anims; ///< The added anims (if m_Type==ANIM). 60 60 ArrayT<CafuModelT::ChannelT> m_Channels; ///< The added channels (if m_Type==CHAN). 61 61 }; -
cafu/trunk/CaWE/ModelEditor/Commands/Delete.cpp
r394 r396 64 64 m_Joints(), 65 65 m_MeshInfos(), 66 m_Skins(), 67 m_GuiFixtures(), 66 68 m_Anims(), 67 69 m_Channels(), 68 m_Skins(),69 m_GuiFixtures(),70 70 m_Message(), 71 71 m_CommandSelect(CommandSelectT::Remove(m_ModelDoc, m_Type, m_Indices)) … … 78 78 { 79 79 case JOINT: m_Joints .PushBack(m_ModelDoc->GetModel()->GetJoints() [i]); break; 80 case SKIN: m_Skins .PushBack(m_ModelDoc->GetModel()->GetSkins() [i]); break; 81 case GFIX: m_GuiFixtures.PushBack(m_ModelDoc->GetModel()->GetGuiFixtures()[i]); break; 80 82 case ANIM: m_Anims .PushBack(m_ModelDoc->GetModel()->GetAnims() [i]); break; 81 83 case CHAN: m_Channels .PushBack(m_ModelDoc->GetModel()->GetChannels() [i]); break; 82 case SKIN: m_Skins .PushBack(m_ModelDoc->GetModel()->GetSkins() [i]); break;83 case GFIX: m_GuiFixtures.PushBack(m_ModelDoc->GetModel()->GetGuiFixtures()[i]); break;84 84 case MESH: 85 85 { … … 177 177 { 178 178 case JOINT: m_ModelDoc->GetModel()->m_Joints .RemoveAtAndKeepOrder(i); break; 179 case SKIN: m_ModelDoc->GetModel()->m_Skins .RemoveAtAndKeepOrder(i); break; 180 case GFIX: m_ModelDoc->GetModel()->m_GuiFixtures.RemoveAtAndKeepOrder(i); break; 179 181 case ANIM: m_ModelDoc->GetModel()->m_Anims .RemoveAtAndKeepOrder(i); break; 180 182 case CHAN: m_ModelDoc->GetModel()->m_Channels .RemoveAtAndKeepOrder(i); break; 181 case SKIN: m_ModelDoc->GetModel()->m_Skins .RemoveAtAndKeepOrder(i); break;182 case GFIX: m_ModelDoc->GetModel()->m_GuiFixtures.RemoveAtAndKeepOrder(i); break;183 183 case MESH: 184 184 { … … 218 218 { 219 219 case JOINT: m_ModelDoc->GetModel()->m_Joints .InsertAt(i, m_Joints [INr]); break; 220 case SKIN: m_ModelDoc->GetModel()->m_Skins .InsertAt(i, m_Skins [INr]); break; 221 case GFIX: m_ModelDoc->GetModel()->m_GuiFixtures.InsertAt(i, m_GuiFixtures[INr]); break; 220 222 case ANIM: m_ModelDoc->GetModel()->m_Anims .InsertAt(i, m_Anims [INr]); break; 221 223 case CHAN: m_ModelDoc->GetModel()->m_Channels .InsertAt(i, m_Channels [INr]); break; 222 case SKIN: m_ModelDoc->GetModel()->m_Skins .InsertAt(i, m_Skins [INr]); break;223 case GFIX: m_ModelDoc->GetModel()->m_GuiFixtures.InsertAt(i, m_GuiFixtures[INr]); break;224 224 case MESH: 225 225 { … … 259 259 case JOINT: Name+=(m_Indices.Size()==1) ? "joint" : "joints"; break; 260 260 case MESH: Name+=(m_Indices.Size()==1) ? "mesh" : "meshes"; break; 261 case SKIN: Name+=(m_Indices.Size()==1) ? "skin" : "skins"; break; 262 case GFIX: Name+=(m_Indices.Size()==1) ? "GUI fixture" : "GUI fixtures"; break; 261 263 case ANIM: Name+=(m_Indices.Size()==1) ? "animation" : "animations"; break; 262 264 case CHAN: Name+=(m_Indices.Size()==1) ? "channel" : "channels"; break; 263 case SKIN: Name+=(m_Indices.Size()==1) ? "skin" : "skins"; break;264 case GFIX: Name+=(m_Indices.Size()==1) ? "GUI fixture" : "GUI fixtures"; break;265 265 } 266 266 -
cafu/trunk/CaWE/ModelEditor/Commands/Delete.hpp
r394 r396 64 64 ArrayT<CafuModelT::JointT> m_Joints; ///< The deleted joints (if m_Type==JOINT). 65 65 ArrayT<MeshInfoT> m_MeshInfos; ///< Information about the deleted meshes (if m_Type==MESH). 66 ArrayT<CafuModelT::SkinT> m_Skins; ///< The deleted skins (if m_Type==SKIN). 67 ArrayT<CafuModelT::GuiFixtureT> m_GuiFixtures; ///< The deleted GUI fixtures (if m_Type==GFIX). 66 68 ArrayT<CafuModelT::AnimT> m_Anims; ///< The deleted anims (if m_Type==ANIM). 67 69 ArrayT<CafuModelT::ChannelT> m_Channels; ///< The deleted channels (if m_Type==CHAN). 68 ArrayT<CafuModelT::SkinT> m_Skins; ///< The deleted skins (if m_Type==SKIN).69 ArrayT<CafuModelT::GuiFixtureT> m_GuiFixtures; ///< The deleted GUI fixtures (if m_Type==GFIX).70 70 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). 71 71 CommandSelectT* m_CommandSelect; ///< The command that unselects the elements before they are deleted. -
cafu/trunk/CaWE/ModelEditor/Commands/Rename.cpp
r394 r396 76 76 case JOINT: return "Rename joint"; 77 77 case MESH: return "Rename mesh"; 78 case SKIN: return "Rename skin"; 79 case GFIX: return "Rename GUI fixture"; 78 80 case ANIM: return "Rename anim"; 79 81 case CHAN: return "Rename channel"; 80 case SKIN: return "Rename skin";81 case GFIX: return "Rename GUI fixture";82 82 } 83 83 … … 93 93 case JOINT: return m_ModelDoc->GetModel()->m_Joints [m_ElemNr].Name; 94 94 case MESH: return m_ModelDoc->GetModel()->m_Meshes [m_ElemNr].Name; 95 case SKIN: return m_ModelDoc->GetModel()->m_Skins [m_ElemNr].Name; 96 case GFIX: return m_ModelDoc->GetModel()->m_GuiFixtures[m_ElemNr].Name; 95 97 case ANIM: return m_ModelDoc->GetModel()->m_Anims [m_ElemNr].Name; 96 98 case CHAN: return m_ModelDoc->GetModel()->m_Channels [m_ElemNr].Name; 97 case SKIN: return m_ModelDoc->GetModel()->m_Skins [m_ElemNr].Name;98 case GFIX: return m_ModelDoc->GetModel()->m_GuiFixtures[m_ElemNr].Name;99 99 } 100 100 … … 111 111 case JOINT: m_ModelDoc->UpdateAllObservers_JointChanged (m_ElemNr); break; 112 112 case MESH: m_ModelDoc->UpdateAllObservers_MeshChanged (m_ElemNr); break; 113 case SKIN: m_ModelDoc->UpdateAllObservers_SkinChanged (m_ElemNr); break; 114 case GFIX: m_ModelDoc->UpdateAllObservers_GuiFixtureChanged(m_ElemNr); break; 113 115 case ANIM: m_ModelDoc->UpdateAllObservers_AnimChanged (m_ElemNr); break; 114 116 case CHAN: m_ModelDoc->UpdateAllObservers_ChannelChanged (m_ElemNr); break; 115 case SKIN: m_ModelDoc->UpdateAllObservers_SkinChanged (m_ElemNr); break;116 case GFIX: m_ModelDoc->UpdateAllObservers_GuiFixtureChanged(m_ElemNr); break;117 117 } 118 118 } -
cafu/trunk/CaWE/ModelEditor/ElementTypes.hpp
r394 r396 31 31 JOINT=0, 32 32 MESH =1, 33 ANIM=2,34 CHAN=3,35 SKIN=4,36 GFIX=533 SKIN =2, 34 GFIX =3, 35 ANIM =4, 36 CHAN =5 37 37 }; 38 38 } -
cafu/trunk/CaWE/ModelEditor/ElementsList.cpp
r395 r396 137 137 138 138 139 void ElementsListT::Notify_AnimChanged(SubjectT* Subject, unsigned int AnimNr)140 {141 if (m_IsRecursiveSelfNotify) return;142 if (m_TYPE!=ANIM) return;143 144 InitListItems();145 }146 147 148 void ElementsListT::Notify_ChannelChanged(SubjectT* Subject, unsigned int ChannelNr)149 {150 if (m_IsRecursiveSelfNotify) return;151 if (m_TYPE!=CHAN) return;152 153 InitListItems();154 }155 156 157 139 void ElementsListT::Notify_SkinChanged(SubjectT* Subject, unsigned int SkinNr) 158 140 { … … 176 158 177 159 160 void ElementsListT::Notify_AnimChanged(SubjectT* Subject, unsigned int AnimNr) 161 { 162 if (m_IsRecursiveSelfNotify) return; 163 if (m_TYPE!=ANIM) return; 164 165 InitListItems(); 166 } 167 168 169 void ElementsListT::Notify_ChannelChanged(SubjectT* Subject, unsigned int ChannelNr) 170 { 171 if (m_IsRecursiveSelfNotify) return; 172 if (m_TYPE!=CHAN) return; 173 174 InitListItems(); 175 } 176 177 178 178 void ElementsListT::Notify_SubjectDies(SubjectT* dyingSubject) 179 179 { … … 219 219 break; 220 220 } 221 222 case SKIN: 223 InsertItem(0, "default"); 224 SetItem(0, 1, "-1"); 225 if (Sel.Size()==0) Select(0); 226 227 for (unsigned long ElemNr=0; ElemNr<m_ModelDoc->GetModel()->GetSkins().Size(); ElemNr++) 228 { 229 InsertItem(ElemNr+1, m_ModelDoc->GetModel()->GetSkins()[ElemNr].Name); 230 SetItem(ElemNr+1, 1, wxString::Format("%lu", ElemNr)); 231 232 if (Sel.Find(ElemNr)!=-1) Select(ElemNr+1); 233 } 234 break; 235 236 case GFIX: 237 for (unsigned long ElemNr=0; ElemNr<m_ModelDoc->GetModel()->GetGuiFixtures().Size(); ElemNr++) 238 { 239 InsertItem(ElemNr, m_ModelDoc->GetModel()->GetGuiFixtures()[ElemNr].Name); 240 SetItem(ElemNr, 1, wxString::Format("%lu", ElemNr)); 241 242 if (Sel.Find(ElemNr)!=-1) Select(ElemNr); 243 } 244 break; 221 245 222 246 case ANIM: … … 241 265 242 266 if (Sel.Find(ElemNr)!=-1) Select(ElemNr+1); 243 }244 break;245 246 case SKIN:247 InsertItem(0, "default");248 SetItem(0, 1, "-1");249 if (Sel.Size()==0) Select(0);250 251 for (unsigned long ElemNr=0; ElemNr<m_ModelDoc->GetModel()->GetSkins().Size(); ElemNr++)252 {253 InsertItem(ElemNr+1, m_ModelDoc->GetModel()->GetSkins()[ElemNr].Name);254 SetItem(ElemNr+1, 1, wxString::Format("%lu", ElemNr));255 256 if (Sel.Find(ElemNr)!=-1) Select(ElemNr+1);257 }258 break;259 260 case GFIX:261 for (unsigned long ElemNr=0; ElemNr<m_ModelDoc->GetModel()->GetGuiFixtures().Size(); ElemNr++)262 {263 InsertItem(ElemNr, m_ModelDoc->GetModel()->GetGuiFixtures()[ElemNr].Name);264 SetItem(ElemNr, 1, wxString::Format("%lu", ElemNr));265 266 if (Sel.Find(ElemNr)!=-1) Select(ElemNr);267 267 } 268 268 break; -
cafu/trunk/CaWE/ModelEditor/ElementsList.hpp
r394 r396 53 53 void Notify_Deleted(SubjectT* Subject, ModelElementTypeT Type, const ArrayT<unsigned int>& Indices); 54 54 void Notify_MeshChanged(SubjectT* Subject, unsigned int MeshNr); 55 void Notify_SkinChanged(SubjectT* Subject, unsigned int SkinNr); 56 void Notify_GuiFixtureChanged(SubjectT* Subject, unsigned int GuiFixtureNr); 55 57 void Notify_AnimChanged(SubjectT* Subject, unsigned int AnimNr); 56 58 void Notify_ChannelChanged(SubjectT* Subject, unsigned int ChannelNr); 57 void Notify_SkinChanged(SubjectT* Subject, unsigned int SkinNr);58 void Notify_GuiFixtureChanged(SubjectT* Subject, unsigned int GuiFixtureNr);59 59 void Notify_SubjectDies(SubjectT* dyingSubject); 60 60 -
cafu/trunk/CaWE/ModelEditor/ObserverPattern.cpp
r394 r396 95 95 96 96 97 void SubjectT::UpdateAllObservers_SkinChanged(unsigned int SkinNr) 98 { 99 for (unsigned long ObsNr=0; ObsNr<m_Observers.Size(); ObsNr++) 100 m_Observers[ObsNr]->Notify_SkinChanged(this, SkinNr); 101 } 102 103 104 void SubjectT::UpdateAllObservers_GuiFixtureChanged(unsigned int GuiFixtureNr) 105 { 106 for (unsigned long ObsNr=0; ObsNr<m_Observers.Size(); ObsNr++) 107 m_Observers[ObsNr]->Notify_GuiFixtureChanged(this, GuiFixtureNr); 108 } 109 110 97 111 void SubjectT::UpdateAllObservers_AnimChanged(unsigned int AnimNr) 98 112 { … … 109 123 110 124 111 void SubjectT::UpdateAllObservers_S kinChanged(unsigned int SkinNr)125 void SubjectT::UpdateAllObservers_SubmodelsChanged() 112 126 { 113 127 for (unsigned long ObsNr=0; ObsNr<m_Observers.Size(); ObsNr++) 114 m_Observers[ObsNr]->Notify_SkinChanged(this, SkinNr); 115 } 116 117 118 void SubjectT::UpdateAllObservers_GuiFixtureChanged(unsigned int GuiFixtureNr) 119 { 120 for (unsigned long ObsNr=0; ObsNr<m_Observers.Size(); ObsNr++) 121 m_Observers[ObsNr]->Notify_GuiFixtureChanged(this, GuiFixtureNr); 128 m_Observers[ObsNr]->Notify_SubmodelsChanged(this); 122 129 } 123 130 … … 130 137 131 138 132 void SubjectT::UpdateAllObservers_SubmodelsChanged()133 {134 for (unsigned long ObsNr=0; ObsNr<m_Observers.Size(); ObsNr++)135 m_Observers[ObsNr]->Notify_SubmodelsChanged(this);136 }137 138 139 139 SubjectT::~SubjectT() 140 140 { -
cafu/trunk/CaWE/ModelEditor/ObserverPattern.hpp
r394 r396 74 74 virtual void Notify_MeshChanged(SubjectT* Subject, unsigned int MeshNr) { } 75 75 76 /// Notifies the observer that a skin has changed. 77 /// @param Subject The model document with the model in which the skin has changed. 78 /// @param SkinNr The number of the skin that has changed. 79 virtual void Notify_SkinChanged(SubjectT* Subject, unsigned int SkinNr) { } 80 81 /// Notifies the observer that a GUI fixture has changed. 82 /// @param Subject The model document with the model in which the GUI fixture has changed. 83 /// @param GuiFixtureNr The number of the GUI fixture that has changed. 84 virtual void Notify_GuiFixtureChanged(SubjectT* Subject, unsigned int GuiFixtureNr) { } 85 76 86 /// Notifies the observer that an animation sequence has changed. 77 87 /// @param Subject The model document with the model in which the anim has changed. … … 84 94 virtual void Notify_ChannelChanged(SubjectT* Subject, unsigned int ChannelNr) { } 85 95 86 /// Notifies the observer that a skin has changed. 87 /// @param Subject The model document with the model in which the skin has changed. 88 /// @param SkinNr The number of the skin that has changed. 89 virtual void Notify_SkinChanged(SubjectT* Subject, unsigned int SkinNr) { } 90 91 /// Notifies the observer that a GUI fixture has changed. 92 /// @param Subject The model document with the model in which the GUI fixture has changed. 93 /// @param GuiFixtureNr The number of the GUI fixture that has changed. 94 virtual void Notify_GuiFixtureChanged(SubjectT* Subject, unsigned int GuiFixtureNr) { } 96 /// Notifies the observer that the list of submodels has changed. 97 /// @param Subject The model document with the model in which the list of submodels has changed. 98 virtual void Notify_SubmodelsChanged(SubjectT* Subject) { } 95 99 96 100 /// Notifies the observer that the animation state has changed. 97 101 /// @param Subject The model document whose AnimStateT has changed. 98 102 virtual void Notify_AnimStateChanged(SubjectT* Subject) { } 99 100 /// Notifies the observer that the list of submodels has changed.101 /// @param Subject The model document with the model in which the list of submodels has changed.102 virtual void Notify_SubmodelsChanged(SubjectT* Subject) { }103 103 104 104 /// This method is called whenever a subject is about the be destroyed (and become unavailable). … … 134 134 virtual void UpdateAllObservers_JointChanged(unsigned int JointNr); 135 135 virtual void UpdateAllObservers_MeshChanged(unsigned int MeshNr); 136 virtual void UpdateAllObservers_SkinChanged(unsigned int SkinNr); 137 virtual void UpdateAllObservers_GuiFixtureChanged(unsigned int GuiFixtureNr); 136 138 virtual void UpdateAllObservers_AnimChanged(unsigned int AnimNr); 137 139 virtual void UpdateAllObservers_ChannelChanged(unsigned int ChannelNr); 138 virtual void UpdateAllObservers_SkinChanged(unsigned int SkinNr); 139 virtual void UpdateAllObservers_GuiFixtureChanged(unsigned int GuiFixtureNr); 140 virtual void UpdateAllObservers_SubmodelsChanged(); 140 141 virtual void UpdateAllObservers_AnimStateChanged(); 141 virtual void UpdateAllObservers_SubmodelsChanged();142 142 143 143 /// The virtual destructor. -
cafu/trunk/Libs/Models/Model_cmdl.cpp
r391 r396 122 122 123 123 124 CafuModelT::GuiFixtureT::GuiFixtureT() 125 : Name("GUI Fixture") 126 { 127 for (unsigned int PointNr=0; PointNr<3; PointNr++) 128 { 129 Points[PointNr].MeshNr =std::numeric_limits<unsigned int>::max(); 130 Points[PointNr].VertexNr=std::numeric_limits<unsigned int>::max(); 131 } 132 133 Trans[0]=0.0f; 134 Trans[1]=0.0f; 135 136 Scale[0]=1.0f; 137 Scale[1]=1.0f; 138 } 139 140 124 141 void CafuModelT::AnimT::RecomputeBB(unsigned int FrameNr, const ArrayT<JointT>& Joints, const ArrayT<MeshT>& Meshes) 125 142 { … … 189 206 } 190 207 } 191 }192 193 194 CafuModelT::GuiFixtureT::GuiFixtureT()195 : Name("GUI Fixture")196 {197 for (unsigned int PointNr=0; PointNr<3; PointNr++)198 {199 Points[PointNr].MeshNr =std::numeric_limits<unsigned int>::max();200 Points[PointNr].VertexNr=std::numeric_limits<unsigned int>::max();201 }202 203 Trans[0]=0.0f;204 Trans[1]=0.0f;205 206 Scale[0]=1.0f;207 Scale[1]=1.0f;208 208 } 209 209 … … 764 764 765 765 766 // *** Write the skins. *** 767 OutStream << "\nSkins=\n{\n"; 768 769 for (unsigned long SkinNr=0; SkinNr<m_Skins.Size(); SkinNr++) 770 { 771 const SkinT& Skin=m_Skins[SkinNr]; 772 773 OutStream << "\t{\n" 774 << "\t\tname=\"" << Skin.Name << "\";\n" 775 << "\t\tmaterials={ "; 776 777 for (unsigned long MatNr=0; MatNr<Skin.Materials.Size(); MatNr++) 778 { 779 OutStream << "\""; 780 if (Skin.Materials[MatNr]!=NULL) OutStream << Skin.Materials[MatNr]->Name; 781 OutStream << "\""; 782 if (MatNr+1 < Skin.Materials.Size()) OutStream << ", "; 783 } 784 785 OutStream << " };\n" 786 << "\t},\n"; 787 } 788 789 OutStream << "}\n"; 790 791 792 // *** Write the GUI fixtures. *** 793 OutStream << "\nGuiFixtures=\n{\n"; 794 795 for (unsigned long FixNr=0; FixNr<m_GuiFixtures.Size(); FixNr++) 796 { 797 const GuiFixtureT& GuiFixture=m_GuiFixtures[FixNr]; 798 799 OutStream << "\t{\n" 800 << "\t\tname=\"" << GuiFixture.Name << "\";\n" 801 << "\t\tpoints={ " << GuiFixture.Points[0].MeshNr << ", " << GuiFixture.Points[0].VertexNr << ", " 802 << GuiFixture.Points[1].MeshNr << ", " << GuiFixture.Points[1].VertexNr << ", " 803 << GuiFixture.Points[2].MeshNr << ", " << GuiFixture.Points[2].VertexNr << " };\n" 804 << "\t\ttrans={ " << GuiFixture.Trans[0] << ", " << GuiFixture.Trans[1] << " };\n" 805 << "\t\tscale={ " << GuiFixture.Scale[0] << ", " << GuiFixture.Scale[1] << " };\n" 806 << "\t},\n"; 807 } 808 809 OutStream << "}\n"; 810 811 812 // *** Write the GUI locations. *** 813 OutStream << "\nGuiLocs=\n{\n"; 814 815 for (unsigned long GuiLocNr=0; GuiLocNr<m_GuiLocs.Size(); GuiLocNr++) 816 { 817 const GuiLocT& GuiLoc=m_GuiLocs[GuiLocNr]; 818 819 OutStream << "\t" 820 << "{ " 821 << "Origin={ " << serialize(GuiLoc.Origin) << " }; " 822 << "AxisX={ " << serialize(GuiLoc.AxisX) << " }; " 823 << "AxisY={ " << serialize(GuiLoc.AxisY) << " }; " 824 << "},\n"; 825 } 826 827 OutStream << "}\n"; 828 829 766 830 // *** Write the animations. *** 767 831 OutStream << "\nAnimations=\n{\n"; … … 815 879 816 880 OutStream << "\t},\n"; 817 }818 819 OutStream << "}\n";820 821 822 // *** Write the skins. ***823 OutStream << "\nSkins=\n{\n";824 825 for (unsigned long SkinNr=0; SkinNr<m_Skins.Size(); SkinNr++)826 {827 const SkinT& Skin=m_Skins[SkinNr];828 829 OutStream << "\t{\n"830 << "\t\tname=\"" << Skin.Name << "\";\n"831 << "\t\tmaterials={ ";832 833 for (unsigned long MatNr=0; MatNr<Skin.Materials.Size(); MatNr++)834 {835 OutStream << "\"";836 if (Skin.Materials[MatNr]!=NULL) OutStream << Skin.Materials[MatNr]->Name;837 OutStream << "\"";838 if (MatNr+1 < Skin.Materials.Size()) OutStream << ", ";839 }840 841 OutStream << " };\n"842 << "\t},\n";843 }844 845 OutStream << "}\n";846 847 848 // *** Write the GUI fixtures. ***849 OutStream << "\nGuiFixtures=\n{\n";850 851 for (unsigned long FixNr=0; FixNr<m_GuiFixtures.Size(); FixNr++)852 {853 const GuiFixtureT& GuiFixture=m_GuiFixtures[FixNr];854 855 OutStream << "\t{\n"856 << "\t\tname=\"" << GuiFixture.Name << "\";\n"857 << "\t\tpoints={ " << GuiFixture.Points[0].MeshNr << ", " << GuiFixture.Points[0].VertexNr << ", "858 << GuiFixture.Points[1].MeshNr << ", " << GuiFixture.Points[1].VertexNr << ", "859 << GuiFixture.Points[2].MeshNr << ", " << GuiFixture.Points[2].VertexNr << " };\n"860 << "\t\ttrans={ " << GuiFixture.Trans[0] << ", " << GuiFixture.Trans[1] << " };\n"861 << "\t\tscale={ " << GuiFixture.Scale[0] << ", " << GuiFixture.Scale[1] << " };\n"862 << "\t},\n";863 }864 865 OutStream << "}\n";866 867 868 // *** Write the GUI locations. ***869 OutStream << "\nGuiLocs=\n{\n";870 871 for (unsigned long GuiLocNr=0; GuiLocNr<m_GuiLocs.Size(); GuiLocNr++)872 {873 const GuiLocT& GuiLoc=m_GuiLocs[GuiLocNr];874 875 OutStream << "\t"876 << "{ "877 << "Origin={ " << serialize(GuiLoc.Origin) << " }; "878 << "AxisX={ " << serialize(GuiLoc.AxisX) << " }; "879 << "AxisY={ " << serialize(GuiLoc.AxisY) << " }; "880 << "},\n";881 881 } 882 882 -
cafu/trunk/Libs/Models/Model_cmdl.hpp
r394 r396 133 133 134 134 135 /// This struct describes additional/alternative skins for the meshes of this model. 136 struct SkinT 137 { 138 std::string Name; ///< The name of this skin. 139 ArrayT<MaterialT*> Materials; ///< For each mesh \c m, <tt>Materials[m]</tt> is the material for the mesh in this skin. If <tt>Materials[m]</tt> is NULL, the material of the default skin is used. 140 ArrayT<MatSys::RenderMaterialT*> RenderMaterials; ///< Analogous to \c Materials, these are the (possibly NULL) render materials for the meshes in this skin. 141 }; 142 143 144 /// This struct defines how and where a GUI can be fixed to the model. 145 /// The GUI rectangle is defined by three points: the origin, the x-axis endpoint, and the y-axis endpoint, numbered 0, 1 and 2. 146 /// Each point is represented by an arbitrary vertex of one of meshes in the model. 147 /// The whole GUI rectangle can be translated and scaled, in order to compensate for cases where the mesh vertices do not 148 /// exactly match the desired rectangle dimensions. 149 /// More than one GUI can be fixed to a model, and if the referenced mesh vertices are animated, the GUI rectangle is animated, too. 150 struct GuiFixtureT 151 { 152 GuiFixtureT(); 153 154 struct PointT 155 { 156 unsigned int MeshNr; 157 unsigned int VertexNr; 158 }; 159 160 std::string Name; 161 PointT Points[3]; 162 float Trans[2]; 163 float Scale[2]; 164 }; 165 166 167 /// This (now obsolete) structure is used to describe the locations where GUIs can be attached to the model. 168 /// Note that the current static/fixed-position implementation (origin, x- and y-axis) is temporary though, 169 /// it should eventually be possible to attach GUIs even to animated models. 170 struct GuiLocT 171 { 172 Vector3fT Origin; 173 Vector3fT AxisX; 174 Vector3fT AxisY; 175 }; 176 177 135 178 /// This struct describes one animation sequence, e.g.\ "run", "walk", "jump", etc. 136 179 /// We use it to obtain an array of joints (ArrayT<JointT>, just like m_Joints) for any point (frame number) in the animation sequence. … … 173 216 174 217 175 /// This struct describes additional/alternative skins for the meshes of this model.176 struct SkinT177 {178 std::string Name; ///< The name of this skin.179 ArrayT<MaterialT*> Materials; ///< For each mesh \c m, <tt>Materials[m]</tt> is the material for the mesh in this skin. If <tt>Materials[m]</tt> is NULL, the material of the default skin is used.180 ArrayT<MatSys::RenderMaterialT*> RenderMaterials; ///< Analogous to \c Materials, these are the (possibly NULL) render materials for the meshes in this skin.181 };182 183 184 /// This struct defines how and where a GUI can be fixed to the model.185 /// The GUI rectangle is defined by three points: the origin, the x-axis endpoint, and the y-axis endpoint, numbered 0, 1 and 2.186 /// Each point is represented by an arbitrary vertex of one of meshes in the model.187 /// The whole GUI rectangle can be translated and scaled, in order to compensate for cases where the mesh vertices do not188 /// exactly match the desired rectangle dimensions.189 /// More than one GUI can be fixed to a model, and if the referenced mesh vertices are animated, the GUI rectangle is animated, too.190 struct GuiFixtureT191 {192 GuiFixtureT();193 194 struct PointT195 {196 unsigned int MeshNr;197 unsigned int VertexNr;198 };199 200 std::string Name;201 PointT Points[3];202 float Trans[2];203 float Scale[2];204 };205 206 207 /// This structure is used to describe the locations where GUIs can be attached to the model.208 /// Note that the current static/fixed-position implementation (origin, x- and y-axis) is temporary though,209 /// it should eventually be possible to attach GUIs even to animated models.210 struct GuiLocT211 {212 Vector3fT Origin;213 Vector3fT AxisX;214 Vector3fT AxisY;215 };216 217 218 218 /// Channels allow animations to play only on a subset of the joints, 219 219 /// so that multiple animations can play on different parts of the model at the same time. … … 275 275 const ArrayT<JointT>& GetJoints() const { return m_Joints; } 276 276 const ArrayT<MeshT>& GetMeshes() const { return m_Meshes; } 277 const ArrayT<AnimT>& GetAnims() const { return m_Anims; }278 277 const ArrayT<SkinT>& GetSkins() const { return m_Skins; } 279 278 const ArrayT<GuiFixtureT>& GetGuiFixtures() const { return m_GuiFixtures; } 279 const ArrayT<AnimT>& GetAnims() const { return m_Anims; } 280 280 const ArrayT<ChannelT>& GetChannels() const { return m_Channels; } 281 281 … … 291 291 void Draw(int SequenceNr, float FrameNr, int SkinNr, float LodDist, const SuperT* Super=NULL) const; 292 292 293 /// Returns the proper material for the given mesh in the given skin. 294 const MaterialT* GetMaterial(unsigned long MeshNr, int SkinNr) const; 295 293 296 /// Determines if <tt>GF.Points[PointNr].MeshNr</tt> is a valid index into this model. 294 297 bool IsMeshNrOK(const GuiFixtureT& GF, unsigned int PointNr) const; … … 296 299 /// Determines if <tt>GF.Points[PointNr].VertexNr</tt> is a valid index into this model. 297 300 bool IsVertexNrOK(const GuiFixtureT& GF, unsigned int PointNr) const; 298 299 /// Returns the proper material for the given mesh in the given skin.300 const MaterialT* GetMaterial(unsigned long MeshNr, int SkinNr) const;301 301 302 302 // The ModelT interface. … … 337 337 ArrayT<JointT> m_Joints; ///< Array of joints of this model. 338 338 mutable ArrayT<MeshT> m_Meshes; ///< Array of (sub)meshes of this model. 339 ArrayT<SkinT> m_Skins; ///< Array of additional/alternative skins for this model. 340 ArrayT<GuiFixtureT> m_GuiFixtures; ///< Array of GUI fixtures in the model. 341 ArrayT<GuiLocT> m_GuiLocs; ///< Array of locations where GUIs can be attached to this model. 339 342 ArrayT<AnimT> m_Anims; ///< Array of animations of this model. 340 ArrayT< SkinT> m_Skins; ///< Array of additional/alternative skins forthis model.343 ArrayT<ChannelT> m_Channels; ///< Array of channels in this model. 341 344 342 345 const bool m_UseGivenTangentSpace; ///< Whether this model should use the fixed, given tangent space that was loaded from the model file, or it the tangent space is dynamically recomputed (useful for animated models). 343 346 // const bool m_CastShadows; ///< Should this model cast shadows? 344 347 BoundingBox3fT m_BindPoseBB; ///< The bounding-box for the base pose of the model. 345 ArrayT<GuiFixtureT> m_GuiFixtures; ///< Array of GUI fixtures in the model.346 ArrayT<GuiLocT> m_GuiLocs; ///< Array of locations where GUIs can be attached to this model.347 ArrayT<ChannelT> m_Channels; ///< Array of channels in this model.348 348 349 349
