Kaynağa Gözat

More handle fixes

Marko Pintera 11 yıl önce
ebeveyn
işleme
24434868e3

+ 1 - 1
BansheeCore/Include/BsOSInputHandler.h

@@ -93,7 +93,7 @@ namespace BansheeEngine
 		 * 				
 		 * 				
 		 * @note	Internal method.
 		 * @note	Internal method.
 		 */
 		 */
-		virtual void _inputWindowChanged(const RenderWindow& win) {}
+		virtual void _inputWindowChanged(const RenderWindow& win) { }
 
 
 	private:
 	private:
 		BS_MUTEX(mOSInputMutex);
 		BS_MUTEX(mOSInputMutex);

+ 6 - 2
BansheeEditor/Source/BsHandleSliderPlane.cpp

@@ -50,7 +50,11 @@ namespace BansheeEngine
 		assert(getState() == State::Active);
 		assert(getState() == State::Active);
 
 
 		mCurrentPointerPos += inputDelta;
 		mCurrentPointerPos += inputDelta;
-		mDelta.x = calcDelta(camera, mStartPosition, getRotation().rotate(mDirection1), mStartPointerPos, mCurrentPointerPos);
-		mDelta.y = calcDelta(camera, mStartPosition, getRotation().rotate(mDirection2), mStartPointerPos, mCurrentPointerPos);
+
+		Vector3 worldDir1 = getRotation().rotate(mDirection1);
+		Vector3 worldDir2 = getRotation().rotate(mDirection2);
+
+		mDelta.x = calcDelta(camera, mStartPosition, worldDir1, mStartPointerPos, mCurrentPointerPos);
+		mDelta.y = calcDelta(camera, mStartPosition, worldDir2, mStartPointerPos, mCurrentPointerPos);
 	}
 	}
 }
 }

+ 12 - 9
BansheeEditor/Source/BsSceneViewHandler.cpp

@@ -119,16 +119,19 @@ namespace BansheeEngine
 		Vector2I windowPos = parentWindow->screenToWindowPos(Cursor::instance().getScreenPosition());
 		Vector2I windowPos = parentWindow->screenToWindowPos(Cursor::instance().getScreenPosition());
 		const RenderWindowProperties& rwProps = parentWindow->getProperties();
 		const RenderWindowProperties& rwProps = parentWindow->getProperties();
 
 
+		INT32 maxWidth = std::max(0, (INT32)rwProps.getWidth() - 1);
+		INT32 maxHeight = std::max(0, (INT32)rwProps.getHeight() - 1);
+
 		Vector2I offset;
 		Vector2I offset;
-		if (windowPos.x < 0)
-			offset.x = (INT32)rwProps.getWidth();
-		else if (windowPos.x >= (INT32)rwProps.getWidth())
-			offset.x = -(INT32)rwProps.getWidth();
-
-		if (windowPos.y < 0)
-			offset.y = (INT32)rwProps.getHeight();
-		else if (windowPos.y >= (INT32)rwProps.getHeight())
-			offset.y = -(INT32)rwProps.getHeight();
+		if (windowPos.x <= 0)
+			offset.x = maxWidth;
+		else if (windowPos.x >= maxWidth)
+			offset.x = -maxWidth;
+
+		if (windowPos.y <= 0)
+			offset.y = maxHeight;
+		else if (windowPos.y >= maxHeight)
+			offset.y = -maxHeight;
 
 
 		windowPos += offset;
 		windowPos += offset;
 		
 		

+ 15 - 5
MBansheeEditor/Scene/SceneWindow.cs

@@ -48,6 +48,16 @@ namespace BansheeEditor
         {
         {
             sceneViewHandler.Update();
             sceneViewHandler.Update();
 
 
+            bool handleActive = false;
+            if (Input.IsButtonUp(ButtonCode.MouseLeft))
+            {
+                if (sceneViewHandler.IsHandleActive())
+                {
+                    sceneViewHandler.ClearHandleSelection();
+                    handleActive = true;
+                }
+            }
+
             if (!HasFocus)
             if (!HasFocus)
                 return;
                 return;
 
 
@@ -60,13 +70,13 @@ namespace BansheeEditor
                 }
                 }
                 else if (Input.IsButtonUp(ButtonCode.MouseLeft))
                 else if (Input.IsButtonUp(ButtonCode.MouseLeft))
                 {
                 {
-                    bool ctrlHeld = Input.IsButtonHeld(ButtonCode.LeftControl) ||
-                                    Input.IsButtonHeld(ButtonCode.RightControl);
+                    if (!handleActive)
+                    {
+                        bool ctrlHeld = Input.IsButtonHeld(ButtonCode.LeftControl) ||
+                            Input.IsButtonHeld(ButtonCode.RightControl);
 
 
-                    if (sceneViewHandler.IsHandleActive())
-                        sceneViewHandler.ClearHandleSelection();
-                    else
                         sceneViewHandler.PickObject(scenePos, ctrlHeld);
                         sceneViewHandler.PickObject(scenePos, ctrlHeld);
+                    }
                 }
                 }
 
 
                 sceneViewHandler.UpdateHandle(scenePos, Input.PointerDelta);
                 sceneViewHandler.UpdateHandle(scenePos, Input.PointerDelta);

+ 5 - 11
TODO.txt

@@ -12,14 +12,12 @@
 
 
 See GDrive/Resources doc for resources refactor
 See GDrive/Resources doc for resources refactor
 
 
-Slider colliders are not valid after handle moves
- - Caused by distance scaling
-Wrapping the cursor causes mouse delta to be huge. I need to compensate.
-Don't forget to update mDirection calculations for all slider types
-
 I can get mono errors by checking g_print calls in goutput.c
 I can get mono errors by checking g_print calls in goutput.c
  - Calling thunks incorrectly can cause those weird errors with no real callstack
  - Calling thunks incorrectly can cause those weird errors with no real callstack
 
 
+Mouse wrap doesn't seem to work the first time
+If you release mouse outside the window the handle doesn't get deselected and wrap remains active
+
 Other:
 Other:
 Window resize end callback
 Window resize end callback
 Add cutoff plane when rendering discs for rotation handle.
 Add cutoff plane when rendering discs for rotation handle.
@@ -38,20 +36,16 @@ Test:
 
 
 -----------------
 -----------------
 
 
-Move handle is buggy as hell - It moves in wrong direction sometimes, sometimes it skips, other times collision seems to be wrong
 Need a way to drag and drop items from Scene tree view to Scene view
 Need a way to drag and drop items from Scene tree view to Scene view
 
 
 AFTER I have scene widget in C#:
 AFTER I have scene widget in C#:
- - Finish up C# Handles class so it returns proper values
- - Ensure fixed handle size and handle snapping works
  - Implement free move handle and remaining handles
  - Implement free move handle and remaining handles
  - Test custom handles from C#
  - Test custom handles from C#
+ - Test handle snapping
 
 
 IMPLEMENT SELECTION RENDERING
 IMPLEMENT SELECTION RENDERING
 
 
-IMPROVE SceneGrid LOOK
- - LIKELY USE PIXEL SceneGrid WITH AA
- - OR (better) instead of drawing rows and columns of lines, just draw a plane with procedural texture
+IMPROVE SceneGrid LOOK - Use the shader created in Unity
 
 
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 Handles
 Handles