cjddmut / Blender-Transforms-in-Unity3D

Use Blender-like hot keys to manipulate the transform (position, rotation, and scale) of objects in Unity 3D.
MIT License
46 stars 7 forks source link

The S Key mess up with First Person Navigation #6

Open A-G opened 9 years ago

A-G commented 9 years ago

Hi It seems BTU cause S key in the Fist Person Navigation (moving along the scene by holding RMB and using W,A,S,D,E,Q keys to navigate through the scene) be disabled and not functioning. Please ,if possible, use a condition that in case the RMB is held down, the buttons (or at least the S button) keeps its functionality. However this is a very great stuff and I really enjoyed it. Thanks

cjddmut commented 9 years ago

I didn't know anyone used this package other than me! :P

Good catch, I'll look into fixing that some time soon.

A-G commented 8 years ago

Still waiting to be fixed so I can use it ASAP...

A-G commented 8 years ago

Another simple solution reached my mind was to add a hotkey to disable the add-on when it's not needed (like the above situation..)

cjddmut commented 8 years ago

It's not a particularly hard fix, and another simple solution could even be to rebind the key away from S. I haven't had time to get around to it yet (between shipping a game and other projects). When I do get time I'll come up with a solution.

A-G commented 8 years ago

Actually I could fix it myself, but I wanted it to be at your github page... Thanks for paying attention.

On Wed, Feb 10, 2016 at 12:30 PM, C.J. Kimberlin notifications@github.com wrote:

It's not a particularly hard fix, and another simple solution could even be to rebind the key away from S. I haven't had time to get around to it yet (between shipping a game and other projects). When I do get time I'll come up with a solution.

— Reply to this email directly or view it on GitHub https://github.com/cjddmut/Blender-Transforms-in-Unity3D/issues/6#issuecomment-182262323 .

cjddmut commented 8 years ago

If you fix it set up a pull request to the repository.

A-G commented 8 years ago

OK. I'll study the asset at the weekend and try to fix it.

On Thu, Feb 11, 2016 at 1:27 AM, C.J. Kimberlin notifications@github.com wrote:

If you fix it set up a pull request to the repository.

— Reply to this email directly or view it on GitHub https://github.com/cjddmut/Blender-Transforms-in-Unity3D/issues/6#issuecomment-182598897 .

A-G commented 8 years ago

Hi... Sorry for late response... (was a little busy here) As you said "I haven't had time to get around to it yet", I forked your project to work on it and extend it over time... (if it is OK with you...) Also if you intend to continue working on it, tell me to remove my fork and turn my commits into pull requests (I thought that it would need your permission each time I pull a request and if you don't wanna continue working on it, I didn't wanted to disturb you. Correct me if I'm wrong as I'm not much familiar with the github system...)

Thanks!

On Thu, Feb 11, 2016 at 1:43 AM, Ali Goli ali.goli.1234567890@gmail.com wrote:

OK. I'll study the asset at the weekend and try to fix it.

On Thu, Feb 11, 2016 at 1:27 AM, C.J. Kimberlin notifications@github.com wrote:

If you fix it set up a pull request to the repository.

— Reply to this email directly or view it on GitHub https://github.com/cjddmut/Blender-Transforms-in-Unity3D/issues/6#issuecomment-182598897 .

maessof91 commented 2 years ago

Replace SceneGui in TransformManager.cs with the below

    public static bool rightMouseDown = false;
    static void SceneGUI(SceneView sceneView)
    {
        if (Event.current.type == EventType.MouseDown && Event.current.button == 1)
        {
            rightMouseDown = true;
        }

        if (Event.current.type == EventType.MouseUp && Event.current.button == 1)
        {
            rightMouseDown = false;
        }

        if (!Data.transformEditingEnabled)
        {
            return;
        }

        if (activeModal != null)
        {
            activeModal.Update();

            if (EditorWindow.focusedWindow != sceneView)
            {
                // SceneView lost focus but we're in a mode so we force it back.
                sceneView.Focus();
            }

            // We force the scene to continue to update if we are in a mode.
            HandleUtility.Repaint();
        }

        if (delayStart != null)
        {
            // We got a message to start!
            if (activeModal != null)
            {
                activeModal.Cancel();
            }

            activeModal = delayStart;
            delayStart = null;
            activeModal.Start();
        }

        if (Event.current.isKey && Event.current.type == EventType.KeyDown)
        {
            if (Event.current.keyCode == Data.translateKey)
            {
                Event.current.Use();

                if (activeModal != null)
                {
                    activeModal.Cancel();
                }

                activeModal = translateEdit;
                activeModal.Start();
            }
            else if (Event.current.keyCode == Data.rotateKey)
            {
                Event.current.Use();

                if (activeModal != null)
                {
                    activeModal.Cancel();
                }

                activeModal = rotateEdit;
                activeModal.Start();
            }
            if (Event.current.keyCode == Data.scaleKey && !rightMouseDown)
            {
                Event.current.Use();

                if (activeModal != null)
                {
                    activeModal.Cancel();
                }

                activeModal = scaleEdit;
                activeModal.Start();
            }
        }

        if (swallowMouse)
        {
            if (Event.current.button == mouseButton)
            {
                if (Event.current.type == EventType.MouseUp)
                {
                    swallowMouse = false;
                }

                Event.current.Use();
            }
        }
    }