Changeset 381 for cafu/trunk
- Timestamp:
- 09/15/11 13:49:12 (8 months ago)
- Location:
- cafu/trunk/CaWE/ModelEditor
- Files:
-
- 5 modified
-
ModelDocument.cpp (modified) (2 diffs)
-
ModelDocument.hpp (modified) (4 diffs)
-
ScenePropGrid.cpp (modified) (3 diffs)
-
ScenePropGrid.hpp (modified) (1 diff)
-
SceneView3D.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cafu/trunk/CaWE/ModelEditor/ModelDocument.cpp
r345 r381 63 63 ModelEditor::ModelDocumentT::ModelDocumentT(GameConfigT* GameConfig, const wxString& FileName) 64 64 : m_Model(LoadModel(FileName)), 65 m_SequenceBB(m_Model->GetBB(-1, 0.0f)), 65 66 m_Submodels(), 66 67 m_Gui(new cf::GuiSys::GuiImplT("Win1=gui:new('WindowT'); gui:SetRootWindow(Win1); gui:activate(true); " … … 106 107 delete m_Gui; 107 108 delete m_Model; 109 } 110 111 112 void ModelEditor::ModelDocumentT::SetSelection(ModelElementTypeT Type, const ArrayT<unsigned int>& NewSel) 113 { 114 wxASSERT(Type<4); 115 m_Selection[Type]=NewSel; 116 117 if (Type==ANIM) 118 { 119 if (m_Selection[ANIM].Size()==0) 120 { 121 m_SequenceBB=m_Model->GetBB(-1, 0.0f); 122 } 123 else 124 { 125 m_SequenceBB=BoundingBox3fT(); 126 127 for (unsigned long SelNr=0; SelNr<m_Selection[ANIM].Size(); SelNr++) 128 { 129 const CafuModelT::AnimT& Anim=m_Model->GetAnims()[m_Selection[ANIM][SelNr]]; 130 131 for (unsigned long FrameNr=0; FrameNr<Anim.Frames.Size(); FrameNr++) 132 m_SequenceBB+=Anim.Frames[FrameNr].BB; 133 } 134 } 135 } 108 136 } 109 137 -
cafu/trunk/CaWE/ModelEditor/ModelDocument.hpp
r345 r381 25 25 #include "ObserverPattern.hpp" 26 26 #include "ElementTypes.hpp" 27 #include "Math3D/BoundingBox.hpp" 27 28 #include "Math3D/Vector3.hpp" 28 29 #include "Templates/Array.hpp" … … 102 103 const CafuModelT* GetModel() const { return m_Model; } 103 104 const ArrayT<unsigned int>& GetSelection(ModelElementTypeT Type) const { wxASSERT(Type<4); return m_Selection[Type]; } 105 const BoundingBox3fT& GetSequenceBB() const { return m_SequenceBB; } 104 106 const ArrayT<EditorMaterialI*>& GetEditorMaterials() const { return m_EditorMaterials; } 105 107 const AnimStateT& GetAnimState() const { return m_AnimState; } … … 112 114 113 115 CafuModelT* GetModel() { return m_Model; } 114 void SetSelection(ModelElementTypeT Type, const ArrayT<unsigned int>& NewSel) { wxASSERT(Type<4); m_Selection[Type]=NewSel; }116 void SetSelection(ModelElementTypeT Type, const ArrayT<unsigned int>& NewSel); 115 117 AnimStateT& GetAnimState() { return m_AnimState; } 116 118 void LoadSubmodel(const wxString& FileName); … … 134 136 CafuModelT* m_Model; ///< The model that is being edited. 135 137 ArrayT<unsigned int> m_Selection[4]; ///< The selected joints, meshes, animations and GUI fixtures. 138 BoundingBox3fT m_SequenceBB; ///< The bounding-box encompassing all frames of the currently selected animation sequence(s). 136 139 ArrayT<EditorMaterialI*> m_EditorMaterials; ///< One editor material for each material in the model (its material manager). 137 140 AnimStateT m_AnimState; ///< The current state of the model animation. -
cafu/trunk/CaWE/ModelEditor/ScenePropGrid.cpp
r380 r381 47 47 m_GridSpacing(Options.Grid.InitialSpacing), 48 48 m_GroundPlane_Show(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/GroundPlane_Show", 1l)!=0), 49 m_GroundPlane_PosZ(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/GroundPlane_PosZ", 0.0f)), 50 m_GroundPlane_AutoZ(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/GroundPlane_AutoZ", 1l)!=0), 49 51 m_Model_ShowMesh(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/Model_ShowMesh", 1l)!=0), 50 52 m_Model_ShowSkeleton(wxConfigBase::Get()->Read("ModelEditor/SceneSetup/Model_ShowSkeleton", 0l)!=0), … … 118 120 wxPGProperty* GroundPlane=AppendIn(SceneElemsCat, new wxStringProperty("Ground Plane", wxPG_LABEL, "<composed>")); 119 121 AppendIn(GroundPlane, new wxBoolProperty("Show", wxPG_LABEL, m_GroundPlane_Show)); 120 AppendIn(GroundPlane, new wxFloatProperty("Height (z-Pos)", wxPG_LABEL, Ground->GetBB().Max.z)); 122 AppendIn(GroundPlane, new wxFloatProperty("Height (z-Pos)", wxPG_LABEL, m_GroundPlane_PosZ)); 123 AppendIn(GroundPlane, new wxBoolProperty("Auto Height", wxPG_LABEL, m_GroundPlane_AutoZ)); 121 124 AppendIn(GroundPlane, new wxStringProperty("Material", wxPG_LABEL, Ground->GetFaces()[0].GetMaterial()->GetName())); // TODO: MaterialProperty 122 125 … … 199 202 else if (PropName=="Camera.Advanced.far plane dist") Camera.FarPlaneDist=PropValueF; 200 203 else if (PropName=="Ground Plane.Show") m_GroundPlane_Show=Prop->GetValue().GetBool(); 201 else if (PropName=="Ground Plane.Height (z-Pos)") 202 { 203 Ground->TrafoMove(Vector3fT(0, 0, PropValueF - Ground->GetBB().Max.z)); 204 } 204 else if (PropName=="Ground Plane.Height (z-Pos)") m_GroundPlane_PosZ=PropValueF; 205 else if (PropName=="Ground Plane.Auto Height") m_GroundPlane_AutoZ=Prop->GetValue().GetBool(); 205 206 else if (PropName=="Ground Plane.Material") 206 207 { -
cafu/trunk/CaWE/ModelEditor/ScenePropGrid.hpp
r380 r381 54 54 float m_GridSpacing; 55 55 bool m_GroundPlane_Show; 56 float m_GroundPlane_PosZ; 57 bool m_GroundPlane_AutoZ; 56 58 bool m_Model_ShowMesh; 57 59 bool m_Model_ShowSkeleton; -
cafu/trunk/CaWE/ModelEditor/SceneView3D.cpp
r380 r381 578 578 MatSys::Renderer->SetCurrentLightDirMap(NULL); // The MatSys provides a default for LightDirMaps when NULL is set. 579 579 580 // Update the z-position of the ground plane. 581 if (ScenePropGrid->m_GroundPlane_Show) 582 { 583 MapBrushT* Ground=m_Parent->GetModelDoc()->GetGround(); 584 const float DeltaZ=(ScenePropGrid->m_GroundPlane_AutoZ 585 ? m_Parent->GetModelDoc()->GetSequenceBB().Min.z 586 : ScenePropGrid->m_GroundPlane_PosZ) - Ground->GetBB().Max.z; 587 588 if (fabs(DeltaZ) > 0.0001f) 589 Ground->TrafoMove(Vector3fT(0, 0, DeltaZ)); 590 } 591 580 592 // Render the world axes. They're great for technical and emotional reassurance. 581 593 if (ScenePropGrid->m_ShowOrigin)
