Josh Engebretson 10 роки тому
батько
коміт
6d93b5ac68

BIN
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/3d_rotate.png


BIN
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/3d_scale.png


BIN
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/3d_translate.png


+ 7 - 0
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/skin/skin.tb.txt

@@ -146,6 +146,13 @@ elements
 	TextCode
 		background-color #23241f
 
+	3DScaleBitmap
+		bitmap 3d_scale.png		
+	3DTranslateBitmap
+		bitmap 3d_translate.png		
+	3DRotateBitmap
+		bitmap 3d_rotate.png		
+
 	InspectorTopLayout
 		background-color #333333
 

+ 6 - 9
Data/AtomicEditor/Resources/EditorData/AtomicEditor/editor/ui/maintoolbar.tb.txt

@@ -7,15 +7,12 @@ TBLayout: distribution: gravity
 		@include definitions>menubutton
 		TBSkinImage: skin: PlayButton
 		id maintoolbar_play
-	TBButton 
-		@include definitions>menubutton
-		text: "T"
+	TBButton: skin: TBButton.flat
+		TBSkinImage: skin: 3DTranslateBitmap
 		id 3d_translate
-	TBButton 
-		@include definitions>menubutton
-		text: "R"
+	TBButton: skin: TBButton.flat
+		TBSkinImage: skin: 3DRotateBitmap
 		id 3d_rotate
-	TBButton 
-		@include definitions>menubutton
-		text: "S"
+	TBButton: skin: TBButton.flat
+		TBSkinImage: skin: 3DScaleBitmap
 		id 3d_scale

+ 2 - 2
Source/AtomicEditor/Source/AEEditor.cpp

@@ -163,6 +163,8 @@ void Editor::HandlePlayStarted(StringHash eventType, VariantMap& eventData)
 
 void Editor::HandlePlayStop(StringHash eventType, VariantMap& eventData)
 {    
+    SendEvent(E_EDITORPLAYSTOPPED);
+
     if (!player_)
         return;
 
@@ -183,8 +185,6 @@ void Editor::HandlePlayStop(StringHash eventType, VariantMap& eventData)
     player_->Invalidate();
     player_ = NULL;
 
-    SendEvent(E_EDITORPLAYSTOPPED);
-
 }
 
 void Editor::HandlePlayStopped(StringHash eventType, VariantMap& eventData)

+ 15 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneEditor3D.cpp

@@ -91,6 +91,9 @@ SceneEditor3D ::SceneEditor3D(Context* context, const String &fullpath, TBTabCon
     eventData[EditorActiveSceneChange::P_SCENE] = scene_;
     SendEvent(E_EDITORACTIVESCENECHANGE, eventData);
 
+    SubscribeToEvent(E_EDITORPLAYSTARTED, HANDLER(SceneEditor3D, HandlePlayStarted));
+    SubscribeToEvent(E_EDITORPLAYSTOPPED, HANDLER(SceneEditor3D, HandlePlayStopped));
+
 }
 
 SceneEditor3D::~SceneEditor3D()
@@ -140,6 +143,18 @@ void SceneEditor3D::HandleEditorActiveNodeChange(StringHash eventType, VariantMa
     SelectNode(node);
 }
 
+void SceneEditor3D::HandlePlayStarted(StringHash eventType, VariantMap& eventData)
+{
+    sceneView_->Disable();
+
+}
+
+void SceneEditor3D::HandlePlayStopped(StringHash eventType, VariantMap& eventData)
+{
+    sceneView_->Enable();
+}
+
+
 
 
 }

+ 2 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneEditor3D.h

@@ -51,6 +51,8 @@ private:
 
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     void HandleEditorActiveNodeChange(StringHash eventType, VariantMap& eventData);
+    void HandlePlayStarted(StringHash eventType, VariantMap& eventData);
+    void HandlePlayStopped(StringHash eventType, VariantMap& eventData);
 
     SharedPtr<Scene> scene_;
 

+ 24 - 2
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneView3D.cpp

@@ -40,7 +40,8 @@ SceneView3D ::SceneView3D(Context* context, SceneEditor3D *sceneEditor) :
     yaw_(0.0f),
     pitch_(0.0f),
     mouseLeftDown_(false),
-    mouseMoved_(false)
+    mouseMoved_(false),
+    enabled_(true)
 {
 
     sceneEditor_ = sceneEditor;
@@ -93,10 +94,31 @@ SceneView3D::~SceneView3D()
 
 }
 
+void SceneView3D::Enable()
+{
+    if (enabled_)
+        return;
+
+    enabled_ = true;
+
+    view3DWidget_->SetVisibilility(WIDGET_VISIBILITY_VISIBLE);
+}
+
+void SceneView3D::Disable()
+{
+    if (!enabled_)
+        return;
+
+    enabled_ = false;
+
+    view3DWidget_->SetVisibilility(WIDGET_VISIBILITY_INVISIBLE);
+
+}
+
 void SceneView3D::MoveCamera(float timeStep)
 {
     // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
+    if (GetSubsystem<UI>()->GetFocusElement() || !enabled_)
         return;
 
     Input* input = GetSubsystem<Input>();

+ 6 - 0
Source/AtomicEditor/Source/Editors/SceneEditor3D/SceneView3D.h

@@ -43,6 +43,10 @@ public:
     void SetPitch(float pitch) { pitch_ = pitch; }
     void SetYaw(float yaw) { yaw_ = yaw; }
 
+    void Enable();
+    void Disable();
+    bool IsEnabled() { return enabled_; }
+
 private:
 
     bool MouseInView();
@@ -63,6 +67,8 @@ private:
     bool mouseLeftDown_;
     bool mouseMoved_;
 
+    bool enabled_;
+
     SharedPtr<Camera> camera_;
     SharedPtr<DebugRenderer> debugRenderer_;
     SharedPtr<Octree> octree_;

+ 1 - 0
Source/AtomicEditor/Source/Player/UIPlayer.cpp

@@ -88,6 +88,7 @@ UIPlayer::UIPlayer(Context* context):
     Center();    
 
     SubscribeToEvent(E_UPDATE, HANDLER(UIPlayer, HandleUpdate));
+
 }
 
 Viewport *UIPlayer::SetView(Scene* scene, Camera* camera)

+ 6 - 0
Source/AtomicEditor/Source/UI/UIMainFrame.cpp

@@ -771,9 +771,15 @@ void MainFrame::HandleResourceEditorChanged(StringHash eventType, VariantMap& ev
     ResourceEditor* editor = static_cast<ResourceEditor*>(eventData[EditorResourceEditorChanged::P_RESOURCEEDITOR].GetPtr());
 
     if (!editor || !editor->RequiresInspector())
+    {
         ShowInspectorFrame(false);
+        maintoolbar_->Show3DWidgets(false);
+    }
     else
+    {
         ShowInspectorFrame(true);
+        maintoolbar_->Show3DWidgets(true);
+    }
 
 }
 

+ 17 - 0
Source/AtomicEditor/Source/UI/UIMainToolbar.cpp

@@ -24,6 +24,8 @@ MainToolbar::MainToolbar(Context* context) :
 {
     TBUI* tbui = GetSubsystem<TBUI>();
     tbui->LoadResourceFile(delegate_, "AtomicEditor/editor/ui/maintoolbar.tb.txt");
+
+    Show3DWidgets(false);
 }
 
 MainToolbar::~MainToolbar()
@@ -31,6 +33,21 @@ MainToolbar::~MainToolbar()
 
 }
 
+void MainToolbar::Show3DWidgets(bool value)
+{
+    TBButton* button = delegate_->GetWidgetByIDAndType<TBButton>(TBIDC("3d_translate"));
+    if (button)
+        button->SetVisibilility( value ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_GONE);
+
+    button = delegate_->GetWidgetByIDAndType<TBButton>(TBIDC("3d_rotate"));
+    if (button)
+        button->SetVisibilility( value ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_GONE);
+
+    button = delegate_->GetWidgetByIDAndType<TBButton>(TBIDC("3d_scale"));
+    if (button)
+        button->SetVisibilility( value ? WIDGET_VISIBILITY_VISIBLE : WIDGET_VISIBILITY_GONE);
+}
+
 bool MainToolbar::OnEvent(const TBWidgetEvent &ev)
 {
     if (ev.type == EVENT_TYPE_CLICK)

+ 2 - 0
Source/AtomicEditor/Source/UI/UIMainToolbar.h

@@ -23,6 +23,8 @@ public:
 
     bool OnEvent(const TBWidgetEvent &ev);
 
+    void Show3DWidgets(bool value);
+
 private:
 
 };

+ 3 - 3
Source/AtomicEditor/Source/UI/UIResourceFrame.cpp

@@ -129,8 +129,8 @@ void ResourceFrame::EditResource(const String& fullpath)
     }
     else if (ext == ".mdl")
     {
-        ModelResourceEditor* mre = new ModelResourceEditor(context_, fullpath, tabcontainer_);
-        editor = mre;
+        //ModelResourceEditor* mre = new ModelResourceEditor(context_, fullpath, tabcontainer_);
+        //editor = mre;
     }
     else if (ext == ".png" || ext == ".jpg" || ext == ".jpeg" || ext == ".gif" || ext == ".ogg")
     {
@@ -454,7 +454,7 @@ void ResourceFrame::HandlePlayStarted(StringHash eventType, VariantMap& eventDat
 void ResourceFrame::HandlePlayStopped(StringHash eventType, VariantMap& eventData)
 {
     //delegate_->SetVisibilility(WIDGET_VISIBILITY_VISIBLE);
-    delegate_->SetIgnoreInput(false);
+    //delegate_->SetIgnoreInput(false);
     //delegate_->SetState(WIDGET_STATE_DISABLED, false);
 }