linuxgurugamer

[1.5.1+] Editor Extensions Redux released (with SelectRoot merge. StripSymmetry & NoOffsetLimits)

Recommended Posts

3 minutes ago, Boop said:

so with EER, the behavior you expect is:

1. Press and release 'Alt', and only 'Alt'.

2. Both angle and symmetry instantly decrease to the lowest value and stay there until you begin changing them again.

Is that accurate?

Nope.  Should be "Press X with the Alt modifier to reset symmetry to 1" and "Press C with the Alt modifier to reset angle snap to none".  i.e. Similar to how Shift makes things go backward, Alt makes them get reset.

I'm not sure if the Alt key was hardcoded or came from a stock keybinding for something else.

Edited by Fwiffo

Share this post


Link to post
Share on other sites

@Boop Getting there.  That issue is corrected.

But left/right clicking on the Angle snap icon with the mouse isn't working.  I believe it should cycle the setting up/down (although I think the old EER just switched between the current setting and no-snap).  It works fine on the Symmetry icon.

If you think of anything else that might have broke which you want me to test, let me know.  I've got to go AFK for a while, so you can have a nice breather without me breathing down your neck ;-).

Edited by Fwiffo

Share this post


Link to post
Share on other sites
8 hours ago, Fwiffo said:

 I've got to go AFK for a while, so you can have a nice breather without me breathing down your neck ;-)

I noticed a massive bug whereby each subsequent visit to the VAB/SPH after the very first would be utterly broken and took the opportunity to go to bed ;.;

Looking at it fresh today helped a lot.  Here is the latest version, with the added benefit of having been built against the latest source for the first time: https://drive.google.com/file/d/0B5NCh5cbU4lsaGxLVWtRbm9LV0E/view?usp=sharing

Some notes:

* I couldn't actually reproduce your Fuel Tank symmetry behavior, so I've either accidentally 'fixed' it or I'm doing something wrong.
* There will still probably be a slight 'bounce' when pressing 'R' to change symmetry mode as I haven't hijacked that key with the new method yet.
* The mouse-click on Symmetry Mode and Angle Snap gizmos works for me, although it doesn't work on Symmetry Mode in the 'EER way' - it cycles through stock settings of 1x/2x/3x/4x/6x/8x - not sure if I've missed something there or if that was never addressed by EER.

Share this post


Link to post
Share on other sites

Looking forward to the changes, I (and others) really appreciate your work.  I've been busy with other mods, so this is very helpful.

Once you get me the changes, I'll get a semi-official build and then compare between 1.1.3 and 1.2 to see if everything is ok.

 

Share this post


Link to post
Share on other sites
6 minutes ago, linuxgurugamer said:

Looking forward to the changes, I (and others) really appreciate your work.  I've been busy with other mods, so this is very helpful.

Once you get me the changes, I'll get a semi-official build and then compare between 1.1.3 and 1.2 to see if everything is ok.

 

 

I think I have enough for a serious final test :0.0:

Here's what I did to fix the SymMode and AngleSnap responsiveness - note that all changes are made solely in EditorExtensionsRedux.cs, which I've uploaded to Google Drive in case you prefer getting it that way without integrating it all manually: https://drive.google.com/file/d/0B5NCh5cbU4lsNDhTal9kbmN2dnM/view?usp=sharing

 

1. We need these class-level variables - I personally put them just before "Start()" as that made them handy to see for the next step:

        //Boop: Cache the editor hotkeys so we can keep consistency with whatever is in the settings.cfg file.
        KeyCode HotkeyEditor_toggleSymModePrimary = GameSettings.Editor_toggleSymMode.primary;
        KeyCode HotkeyEditor_toggleSymModeSecondary = GameSettings.Editor_toggleSymMode.secondary;
        KeyCode HotkeyEditor_toggleAngleSnapPrimary = GameSettings.Editor_toggleAngleSnap.primary;
        KeyCode HotkeyEditor_toggleAngleSnapSecondary = GameSettings.Editor_toggleAngleSnap.secondary;

I did that specifically so that if the User (or a future KSP version, or maybe another Mod) ever changes those buttons then we still know what we're looking for.  Then it turned out to be vital later (step 3).

 

2. This then needs to go into "Start()", suggest straight after your "Log.Debug ("Start()");" line:

    //Boop: Nuke the editor hotkeys so we can hijack them.
    GameSettings.Editor_toggleSymMode.primary = KeyCode.None;
    GameSettings.Editor_toggleSymMode.secondary = KeyCode.None;
    GameSettings.Editor_toggleAngleSnap.primary = KeyCode.None;
    GameSettings.Editor_toggleAngleSnap.secondary = KeyCode.None;

This is how we ambush the (by default) "X" and "C" keys.


3. Now put this in "OnDestroy()":

            //Boop - restore the hotkeys - without this, the hotkeys fail to work on each subsequent visit to the VAB/SPH after the first.
            GameSettings.Editor_toggleSymMode.primary = HotkeyEditor_toggleSymModePrimary;
            GameSettings.Editor_toggleSymMode.secondary = HotkeyEditor_toggleSymModeSecondary;
            GameSettings.Editor_toggleAngleSnap.primary = HotkeyEditor_toggleAngleSnapPrimary;
            GameSettings.Editor_toggleAngleSnap.secondary = HotkeyEditor_toggleAngleSnapSecondary;


 That fixed the nastiest bug I managed to introduce (and lost nearly 2 hours to) ;.;


4. Last but not least, the new SymMode and AngleSnap code needs to go into the "Update()", suggest directly after your "if (!validVersion) return;" statement:

            //Boop: Override stock Angle Snap manipulation
            if ((Input.GetKeyDown(HotkeyEditor_toggleAngleSnapPrimary) || Input.GetKeyDown(HotkeyEditor_toggleAngleSnapSecondary)))
            {                
                int currentAngleIndex = cfg.AngleSnapValues.IndexOf(editor.srfAttachAngleSnap);
                float newAngle;

                if (Input.GetKey(GameSettings.Editor_fineTweak.primary) || Input.GetKey(GameSettings.Editor_fineTweak.secondary))
                {
                    // Decrease snap
                    newAngle = cfg.AngleSnapValues[currentAngleIndex == 0 ? cfg.AngleSnapValues.Count - 1 : currentAngleIndex - 1];
                }
                else if (Input.GetKey(GameSettings.MODIFIER_KEY.primary) || Input.GetKey(GameSettings.MODIFIER_KEY.secondary))
                {
                    // Reset snap
                    newAngle = 0;
                }
                else
                {
                    // Increase snap
                    newAngle = cfg.AngleSnapValues[currentAngleIndex == cfg.AngleSnapValues.Count - 1 ? 0 : currentAngleIndex + 1];                    
                }

                currentAngleIndex = cfg.AngleSnapValues.IndexOf(editor.srfAttachAngleSnap);

                editor.srfAttachAngleSnap = newAngle;

                if (editor.srfAttachAngleSnap == 0)
                {
                    GameSettings.VAB_USE_ANGLE_SNAP = false;
                }
                else
                {
                    GameSettings.VAB_USE_ANGLE_SNAP = true;
                }

                lastSrfAttachAngleSnap = editor.srfAttachAngleSnap;
                last_VAB_USE_ANGLE_SNAP = GameSettings.VAB_USE_ANGLE_SNAP;

                updateGizmoSnaps();

                var gizmos = HighLogic.FindObjectsOfType<EditorGizmos.GizmoOffset>();

                if (gizmos.Length > 0)
                {
                    var gizmo = gizmos[0];
                    if (editor.srfAttachAngleSnap == 0 && gizmo.useGrid)
                        gizmo.useGrid = false;
                    else if (editor.srfAttachAngleSnap != 0 && !gizmo.useGrid)
                        gizmo.useGrid = true;
                }

                return;
            }

            //Boop: Override stock Symmetry manipulation.
            if ((Input.GetKeyDown(HotkeyEditor_toggleSymModePrimary) || Input.GetKeyDown(HotkeyEditor_toggleSymModeSecondary)))
            {
                if (Input.GetKey(GameSettings.Editor_fineTweak.primary) || Input.GetKey(GameSettings.Editor_fineTweak.secondary))
                {
                    if (editor.symmetryMethod == SymmetryMethod.Radial)
                    {
                        if (editor.symmetryMode > 0)
                        {
                            editor.symmetryMode--;
                        }
                    }
                    else if (editor.symmetryMode == 1)
                    {
                        editor.symmetryMode = 0;
                    }
                    else
                    {
                        editor.symmetryMode = 1;
                    }
                    return;
                }
                else if (Input.GetKey(GameSettings.MODIFIER_KEY.primary) || Input.GetKey(GameSettings.MODIFIER_KEY.secondary))
                {
                    editor.symmetryMode = 0;
                }
                else
                {
                    if (editor.symmetryMethod == SymmetryMethod.Radial)
                    {
                        if (editor.symmetryMode < cfg.MaxSymmetry - 1)
                        {
                            editor.symmetryMode++;
                        }
                    }
                    else if (editor.symmetryMode == 1)
                    {
                        editor.symmetryMode = 0;
                    }
                    else
                    {
                        editor.symmetryMode = 1;
                    }
                    return;
                }
            }

            

Unfortunately I ran out of brain before I could look at the now redundant code that got left behind.  As far as I can tell, it's no longer necessary to hook-in to event handlers etc.  Much of your old code just gets ignored at the moment because of the 'unwiring' of the hotkeys, but the fact that much of it is in the "Update()" loop means we should probably tidy that up.

Props to @Fwiffo for testing and explaining what was supposed to be happening.  Also a lot of encouragement :)

Share this post


Link to post
Share on other sites

@Boop

check the offsets again, I found that the OnMouseIsOver is now 262, but you have it in the file as 255, others are probably off as well

Share this post


Link to post
Share on other sites
4 hours ago, Boop said:

I couldn't actually reproduce your Fuel Tank symmetry behavior, so I've either accidentally 'fixed' it or I'm doing something wrong.

It's still there.  But that's ok, 'cause it is in stock KSP, too.

Here's my build for KSP 1.1.3 for anyone who wants it.  @PickledTripod, @Fobok maybe you want to give it a whirl (or Boop's 1.2 build if you're on prerelease) and provide feedback on whether you find any other lingering bugs, before linuxgurugamer publishes the final release.

Edited by Fwiffo

Share this post


Link to post
Share on other sites

This is fantastic, it feels just like stock now! Super smooth and responsive no matter how quickly or in what order I press the keys. Thanks a lot @Boop and @Fwiffo!

Share this post


Link to post
Share on other sites

Tried out that new dll in 1.1.3, (with the settings.cfg fix to make right-shift work again), and it worked fantastically. :) So much smoother than it used to be. 

Share this post


Link to post
Share on other sites
3 hours ago, linuxgurugamer said:

@Boop

check the offsets again, I found that the OnMouseIsOver is now 262, but you have it in the file as 255, others are probably off as well

Darnit.  I see KSP has patched at least twice since I set that up - maybe that's it?

I'll have another look after dinner.

48 minutes ago, PickledTripod said:

This is fantastic, it feels just like stock now! Super smooth and responsive no matter how quickly or in what order I press the keys. Thanks a lot @Boop and @Fwiffo!

You're welcome!

Share this post


Link to post
Share on other sites

Most likely.  You will need to check after each patch

6 hours ago, Boop said:

I noticed a massive bug whereby each subsequent visit to the VAB/SPH after the very first would be utterly broken and took the opportunity to go to bed ;.;

Looking at it fresh today helped a lot.  Here is the latest version, with the added benefit of having been built against the latest source for the first time: https://drive.google.com/file/d/0B5NCh5cbU4lsaGxLVWtRbm9LV0E/view?usp=sharing

Some notes:

* I couldn't actually reproduce your Fuel Tank symmetry behavior, so I've either accidentally 'fixed' it or I'm doing something wrong.
* There will still probably be a slight 'bounce' when pressing 'R' to change symmetry mode as I haven't hijacked that key with the new method yet.
* The mouse-click on Symmetry Mode and Angle Snap gizmos works for me, although it doesn't work on Symmetry Mode in the 'EER way' - it cycles through stock settings of 1x/2x/3x/4x/6x/8x - not sure if I've missed something there or if that was never addressed by EER.

This was addressed a while ago.  I got some grief because it wasn't working properly

Share this post


Link to post
Share on other sites
7 hours ago, linuxgurugamer said:

@Boop

check the offsets again, I found that the OnMouseIsOver is now 262, but you have it in the file as 255, others are probably off as well

Turns out that was the only one, no other offsets are off.  If you've already made that alteration to the source then we're good to go :cool:

Share this post


Link to post
Share on other sites
59 minutes ago, Boop said:

Turns out that was the only one, no other offsets are off.  If you've already made that alteration to the source then we're good to go :cool:

I haven't done anything yet, if I recall you said all the changes were in a single file?  Can you upload that for me again?

thanks

Share this post


Link to post
Share on other sites
1 hour ago, linuxgurugamer said:

Looks great!

I normally don't give special names to released, but this is the Boop release (will be that for final version as well):

https://github.com/linuxgurugamer/EditorExtensionsRedux/releases/tag/3.2.15.1

It was a pleasure, and that's the icing on the cake, so thanks for the opportunity to contribute.  Give me a holler if you need anything else, with this or the rest of your ever-expanding portfolio! :)

Share this post


Link to post
Share on other sites

I may take you up on that, thanks

It was a real pleasure working with you

Share this post


Link to post
Share on other sites

Folks, thank you so much for all your hard work to keep this very much needed build aid alive! I was fearful these new patches would once again break EE but reading all these posts puts me at ease. Thanks again all!

MJ

Share this post


Link to post
Share on other sites
12 minutes ago, Majorjim! said:

Folks, thank you so much for all your hard work to keep this very much needed build aid alive! I was fearful these new patches would once again break EE but reading all these posts puts me at ease. Thanks again all!

MJ

Due to the nature of the way EEX has to work, each patch does indeed break EEX, but, in general, it's fairly simple to update.  That being said, I can't say enough about @Boop, who, all on his own,decided to improve the EEX experience

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites
Just now, linuxgurugamer said:

Due to the nature of the way EEX has to work, each patch does indeed break EEX, but, in general, it's fairly simple to update.  That being said, I can't say enough about @Boop, who, all on his own,decided to improve the EEX experience

I'm out of likes for today but I will send some his way when possible. Thank you @Boop!

Share this post


Link to post
Share on other sites
23 hours ago, linuxgurugamer said:

That being said, I can't say enough about @Boop, who, all on his own,decided to improve the EEX experience

Agreed, HUGE props to @Boop

How about a high-five over this way too; I'm feeling a little left out!

Share this post


Link to post
Share on other sites
On 9/25/2016 at 8:57 AM, Fwiffo said:

Agreed, HUGE props to @Boop

How about a high-five over this way too; I'm feeling a little left out!

As I recall @Fwiffo was the original author of EEX, also assisted in this effort, so kudos to him as well

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites
10 hours ago, linuxgurugamer said:

As I recall @Fwiffo was the original author of EEX, so kudos to him as well

LOL I'll take the kudos, but not credit for EEX.  I'm just a guy who jumped in to help @Boop identify and fix some of the longstanding quirks to this mod.

Maybe you're thinking of MachXXV, Konryou or deadbeef,  who worked on its predecessors?

Anyway, the new version rocks; thanks all.

Share this post


Link to post
Share on other sites
37 minutes ago, Fwiffo said:

LOL I'll take the kudos, but not credit for EEX.  I'm just a guy who jumped in to help @Boop identify and fix some of the longstanding quirks to this mod.

Maybe you're thinking of MachXXV, Konryou or deadbeef,  who worked on its predecessors?

Anyway, the new version rocks; thanks all.

You're absolutely correct, it was MachXXV.  @Fwiffo was also instrumental in this release, thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.