Jump to content

[Win][0.23] Kerbal Orderly Parts - Dec 27 - New Version Available


Recommended Posts

UPDATED DECEMBER 27

KSP 0.23 Compatible

-Lets you change the order of parts in the VAB/SPH.

-CFG editing window allows quick adjustment of part statistics.

-Change parts to the "Hidden" category to hide them from the VAB/SPH. (Does not destroy ships in flight)

-Change parts to the "Disable" category to prevent them loading at all. (Destroys ships in flight, models/textures remain available for other parts)

At this time, all stock parts are detected/modifiable and properly appear in game. This should work fine with parts from any mod but I suggest backing up your Save and GameData folder before trying this tool, just in case. As I test or receive reports, I will post a list of known compatible/incompatible mods

It's been reported that game-breaking explodiness of vessels can result from the use of this tool. I have not seen this consistently happen, but please submit to me any .craft that gives consistent failure so that I may test with it to find a way to avoid this buginess in the future.

Download via dropbox:

KerbalOrderlyParts_2.3.zip

Source code included

2.3 Changes:

-Fixed exception thrown when discovering parts a second time

-Fixed problems caused by {} brackets found in commented lines

-Added exception to fix delta-wings, which still refer to a DAE file that doesn't exist >:/

-Fixed parts with MODEL_MULTI_PARTICLE{} being detected as a MODEL{} (Rapier Engines)

-Fixed Goo Canister, Science Jr, and MediumDish which reference model.mu instead of the actual files used

This utility is primarily intended to aid in sorting a mod-bloated parts-list. You can adjust parts up and down the list, move them from one category to another, and sort them into subcategories (which can then also be sorted relative to one another). Two specialized categories exist: "Hidden" and "Disable". Moving parts to the "Hidden" category hides them from showing in the VAB/SPH, but allows them to remain accessible to flights in progress and .craft files loaded in. Moving parts to the "Disable" category prevents them from loading at all, which will cause flights in progress using those parts to vanish.

The tool also features a Part{} CFG editor window, which allows you to quickly make changes to parts without having to navigate through the GameData folders to get to them. (Make sure you hit "Save"! Right now, there is no warning or autosave for moving away after making CFG changes).

The utility "takes ownership" of your parts by finding all PART{} definitions and splitting them out to a special "KOPSorting" folder within GameData. All parts using references to local models are restructured to point at their original folders. This means any parts or plugins that require resources be installed in a specific location will continue to work just fine. The utility allows you to revert the PART{} nodes back to their original .cfgs, but keep in mind that any category or .cfg changes made with the tool remain in effect.

Screenshots:

KOPMainMenu.png

KOPManagementList.png

KOPManagementWithCFG.png

INSTALLATION:

Place the utility anywhere on your computer and run it.

-It will create a .dat folder where ever you run it from, so I would stick it in GameData and create a shortcut for it, just to be tidy.

QUICK INSTRUCTIONS:

-Run the utility

-Choose your Kerbal GameData directory (KSP\GameData)

-Click Discover and Prepare Parts (Do this now and anytime you add new parts)

-Click Manage Parts to open the management window

-Select the currently viewed Category and SubCategory using the dropdowns at the top-left

-Use the center buttons to adjust the order of parts

-Click "Show .CFG Editor" to see/edit the PART{} node directly

-All changes are immediate (except to the CFG editor, click save there). You may open KSP without closing the utility, but don't make changes while KSP is loading or you may cause problems. Changes made while KSP is open will not appear until you reload parts or restart KSP.

Happy Launching!

---

Disclaimer:

This should go without saying, but BACKUP YOUR DATA before trying any new mod or utility!

-I take no responsibility for files or saves you corrupt or lose as a result of using this utility.

O/S Compatibility:

Tested Working on Windows 7

Should work on Windows 8, Windows Vista, Windows XP (FEEDBACK APPRECIATED)

Might work on Linux or Mac systems using emulation software (FEEDBACK APPRECIATED)

General License:

Feel free to do anything with the included utility or the included source code provided you do not claim credit for its original creation. I ask that derivative works include a mention of the author, KSP forum user JumpsterG.

Edited by JumpsterG
Added buginess warning
Link to comment
Share on other sites

Err, when I click sort parts, I get this.

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at System.ThrowHelper.ThrowArgumentOutOfRangeException()

at System.Collections.Generic.List`1.get_Item(Int32 index)

at KerbalOrderlyParts.frmSorter.loadPart(Object folder)

at KerbalOrderlyParts.frmSorter.recursiveLoadParts(String rootFolder)

at KerbalOrderlyParts.frmSorter.recursiveLoadParts(String rootFolder)

at KerbalOrderlyParts.frmSorter.loadParts()

at KerbalOrderlyParts.frmSorter.frmSorter_Load(Object sender, EventArgs e)

at System.Windows.Forms.Form.OnLoad(EventArgs e)

at System.Windows.Forms.Form.OnCreateControl()

at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

at System.Windows.Forms.Control.CreateControl()

at System.Windows.Forms.Control.WmShowWindow(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.Form.WmShowWindow(Message& m)

at System.Windows.Forms.Form.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************

mscorlib

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.296 (RTMGDR.030319-2900)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

----------------------------------------

KerbalOrderlyParts

Assembly Version: 1.0.0.0

Win32 Version: 1.0.0.0

CodeBase: file:///C:/Users/Cooly/Desktop/Kerbal%20Space%20Program/KSP%200.19/KSP_win/KerbalOrderlyParts.exe

----------------------------------------

Microsoft.VisualBasic

Assembly Version: 10.0.0.0

Win32 Version: 10.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

----------------------------------------

System

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1001 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

System.Core

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.233 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

----------------------------------------

System.Windows.Forms

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1002 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System.Drawing

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1001 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

System.Runtime.Remoting

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll

----------------------------------------

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

For example:

<configuration>

<system.windows.forms jitDebugging="true" />

</configuration>

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

Link to comment
Share on other sites

Hi folks, I'm back. Sorry for the exception, I admit I threw this together pretty haphazardly and did not give it any testing further than seeing it work for my needs. I'll work out a few kinks and put out a new version in the next day or so.

ROFLCopter64bit, yeah the utility does not automatically subcategorize parts for you (at this time, maybe something to add). In order to create your own subcategories, just double-click on "UnCatagorized" and type or paste a new or existing subcategory. You can also click and drag from the subcategory box to move the entire subcategory up and down the list (you'll see a multibox icon under the mouse). I found going down the list applying a subcategory to everything first (causing them to lump together) and then reordering within subcategories was the easiest way to do things.

I personally am not thrilled with the click and drag functionality yet and cringe everytime I see the list jump back to the top after a change, so hopefully I can work out a more polished interface in the future.

Link to comment
Share on other sites

New version is up, check original post. Fixed the exception on your initial sort and improved functionality. Let me know if you run into other issues or if there is a feature that I have overlooked that would make the utility better.

If I update further, I will probably improve the click and drag behavior (insertion indicators, more intuitive adjusting of subcategory) and add an option to automatically create default subcategories for common or well-known parts (perhaps based on Atanvaryar's strategy: http://forum.kerbalspaceprogram.com/showthread.php/24690-WIP-Part-sorting-mod)

Link to comment
Share on other sites

New version is up, check original post. Fixed the exception on your initial sort and improved functionality. Let me know if you run into other issues or if there is a feature that I have overlooked that would make the utility better.

ArgumentOutOfRangeException still occurs with 1.1, running compiled exe or source code at line 248 of frmSorter.vb

This particular instance occurred on a part called Hermes Haystack. The part.OriginalCategory = "DoNotShowInConstruction" which obviously was not part of listOfCats. Therefore, an exception was thrown while attempting listOfCats.IndexOf() on that category.

Link to comment
Share on other sites

Ah, I didn't foresee unexpected values for category (or test with any parts that did). Thanks for the specific feedback. This will be fixed later today. I'm not sure how I'll display these parts with unrecognized categories, though... Maybe an 8th Category button? Does this present a need to assign new categories to parts as well? Hmm...

A workaround would be to edit the part.cfg (or just OrderlySorting.txt if it was created) category yourself to an accepted value. This assumes the mod that introduced the part doesn't require the specific value. Alternatively, you could remove the part temporarily and add it in after the sorting is done.

On a side note, sorry for the ugly code. This is coded in my off time in a very "I need this function now, so I will code it now" style. Sometime I will refactor and document properly, but for now, just getting it working is all I care about.

Link to comment
Share on other sites

On a side note, sorry for the ugly code. This is coded in my off time in a very "I need this function now, so I will code it now" style. Sometime I will refactor and document properly, but for now, just getting it working is all I care about.

Honestly, your coding style was less jarring to me than the fact that you used VB. :sticktongue: Been a long time since I had to deal with it, but I notice that a lot of people in these parts seem to use it rather than C#. Functionally identical, but I don't know how you guys put up with it. :sticktongue:

Link to comment
Share on other sites

IndexOutOfRangeException on line 487 of frmSorter.vb

"UnCategorized" is not a part of listOfSubCats, and as such, attempting listOfSubCats.IndexOf() causes indexing to fail.

Here's a tip: Any time you want to do IndexOf(), you should do Contains() first. That or use a Dictionary and its TryGetValue method. If you refactor to use Dictionaries instead, you may actually get a performance boost.

Link to comment
Share on other sites

Hey JeBuSBrian, I'm trying to recreate this error and I'm scratching my head wondering how you got a part's subcategory to be "UnCategorized" instead of an empty string (how it should be set for uncategorized subcategory). If you're coming off a previous version (1.1 or previous), have you tried removing the sorting files and starting fresh? I don't remember changing how the subcategory is stored but... Regardless, I will make some changes to try to catch this error.

I don't do contains() checks here (silly of me) because if there's a problem with the data at this point, something went wrong elsewhere (invalid values should not have been created). I'm actually a big fan of hashtables and dictionaries for the reasons you describe. After I fix the current bug and know that this is working out of the box for people, I will spend a version just redoing the logic and optimizing.

EDIT: I think I may have found it (or at least a similar bug). The case where you double-click to manually change a part from an existing subcategory to the text "UnCategorized" would allow the text through without creating a matching element in listOfSubCats. Fixed this, but will keep looking for other pitfalls before releasing a new version later today.

Edited by JumpsterG
Link to comment
Share on other sites

Hey JeBuSBrian, I'm trying to recreate this error and I'm scratching my head wondering how you got a part's subcategory to be "UnCategorized" instead of an empty string (how it should be set for uncategorized subcategory). If you're coming off a previous version (1.1 or previous), have you tried removing the sorting files and starting fresh? I don't remember changing how the subcategory is stored but... Regardless, I will make some changes to try to catch this error.

I don't do contains() checks here (silly of me) because if there's a problem with the data at this point, something went wrong elsewhere (invalid values should not have been created). I'm actually a big fan of hashtables and dictionaries for the reasons you describe. After I fix the current bug and know that this is working out of the box for people, I will spend a version just redoing the logic and optimizing.

EDIT: I think I may have found it (or at least a similar bug). The case where you double-click to manually change a part from an existing subcategory to the text "UnCategorized" would allow the text through without creating a matching element in listOfSubCats. Fixed this, but will keep looking for other pitfalls before releasing a new version later today.

Yeah, actually that double click one was the first crash I managed to get on that version, but because I was running the exe and not the source, I didn't have the debugger running to catch it. So I had no idea what caused it, and couldn't figure out how to reproduce it later.

As for the UnCategorized, it may well be that it was left over from a previous version's sort attempt. Can't say I wanted to manually go through and delete several hundred of them, so I just left 'em. If that's what caused it, don't worry about it so much.

Link to comment
Share on other sites

Okay, so I'm running 1.2 now, and all the parts are still coming up as UnCategorized. I've deleted all of the files from the previous versions, so it's not coming from that. I have only the single part that fires line 276 in frmSorter.vb, so that's the only part that *should* get UnCategorized.

But I notice that line 431 also sets every txtSubCat.Text = "UnCategorized"

Frankly, I'm baffled as to how the sorter works for you.

To be more specific about line 431, every part.DesiredSubCategory equals an empty string. Therefore, they all get set to "UnCategorized" by 431.

Edited by JeBuSBrian
Link to comment
Share on other sites

It wont sort them into subcategories for you (yet). I think in a later version I will try to give it some intelligence when reading part.cfg to figure out what a part should be, but for now the idea is that you can specify (by typing in) your own subcategories, at which point it automatically lumps them together in the list. Or you can always just move the uncategorized parts around if you find subcategorizing annoying to manage.

Link to comment
Share on other sites

Updated version available on Original post. Now compatible with the new KSP 0.2 parts infrastructure. If you have sorting files around from a previous version, use the "Remove Sorting Data" button before sorting, since the format of the sorting files has changed.

This version underwent a number of structural changes, and I have only been able to test a handful of mod parts thus far, so please report any bugs you find.

Link to comment
Share on other sites

I have not used Kerbal Orderly Parts before, but I'm having some trouble. I have not tested the sorting in-game, as problem #3 worries me about possible file corruption.

I'm running KSP 0.20 with these mods:

KW-Rocketry-v0.2.33
KW-Unofficial-.20-Fix
Protractor-v-2.4.1
KSPX 0.2.2

KW rocketry(and fix) is contained in KSP\Parts. Protractor and KSPX is in KSP\GameData\Protractor and KSP\GameData\KSPX, repectivly.

Running Windows XP32, I am having a few problems with KOP 1.4.

1) Loading the first time, and immediately after removing sort data, all my parts are there. KW rocketry engines are in the Pods section. Only the KW Ullage Motor is in Propulsion. KW Fairings and Structural are in the Control section. KW stack separators are in the structural section. KW nosecones are in Aero.

2) Tooltips do not work until I close and re-open the sort window. And then click another section's button. Tooltips start working then.

3) Every time I close and re-open the sort window, the complete set of parts gets repeated, collated. I.e.:

S.A.S Module Large    S.A.S Module Large    ASAS Module, Micro        ASAS Module, Micro
1 2 3 4

Additionally, only the last of the duplicate entries is able to display a tooltip. I.e.


SAS Module, SAS Module, SAS Module, ASAS Module Micro, ASAS Module Micro, ASAS Module Micro.
Tooltip Tooltip

Removing the mods, of course, solves problem #1. Problem #2 and #3 are persistent even with the stock game without mods.

Edited by KrazyKrl
Retested without mods.
Link to comment
Share on other sites

Hi KrazyKrl, thanks for the PM and bug report.

1) I'm going to get my hands on KW rocketry and test it myself today. Off my head, I'd guess the parts are getting shoved into the wrong categories because they use the old numerical values for the categories in their part.cfg files and the utility isn't smart about handling them. This doesn't cause any technical problems, the parts will just be ordered where you see them. You can work around this by simply dragging the parts to the categories you want them to be (click the part and drag to the button at the top).

2) Tooltips have been annoying since I introduced them. At the moment its very random when they work and when they don't, so it's been hard to troubleshoot. Hopefully I'll have this fixed in a version or two, because it is a very good feature.

3) This is a bug that I will have to address for next version, but I believe it is only a glitch in the sorter and not the actual sorting files. The workaround is to close the program entirely after using the sort window before using it again. I'll test this myself later, but if you try this and still get these duplicates, let me know.

EDIT: I've posted a new version (1.4.1) including fixes for problems 1 and 3. First time sorting of parts with numerical values for category should now place them where they were intended to go. The sorting window will now correctly initialize its variables, so no more duplicates. Tooltips still to be worked out...

Edited by JumpsterG
Link to comment
Share on other sites

Some parts were missing when sorted, and reappeared when unsorted. When I checked on them I found that when sorted, all the missing parts had an extra PART{...} tag appended. Removing the tags manually solved the problem and let me keep my sort.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...