Jump to content

[1.3.0] Filter Extensions 3.0.4 (Jul 11)


Crzyrndm

Recommended Posts

Hi, I love the option to hide unpurchased parts, and until now that's all I've actually used this mod for. I just decided to add a category to include all unpurchased parts so I didn't have to go back to the R&D building to unlock parts, however reading the syntax in the opening post this doesn't seem to be possible.

Is there a way to do this I've missed, or alternatively are you able to add a category containing unpurchased parts when the 'hide unpurchased parts' option is turned on?

Link to comment
Share on other sites

The stock resources category covers the different fuel tanks (with some modifications to the subcategories)

Fair enough, I've been thinking about it and what I'd really like would be a main category for fuel tanks and then a sub for each size, I might see if I can work out how to write a custom config file to do that.

Link to comment
Share on other sites

Fair enough, I've been thinking about it and what I'd really like would be a main category for fuel tanks and then a sub for each size, I might see if I can work out how to write a custom config file to do that.

You probably want to duplicate most of the bulkhead category definition and add a template like

FILTER
{
CHECK
{
type = resource
value = notAResource
contains = false
}
}

That should filter out anything that doesn't have any resources in it (if not, Ill just have to think of something else :D).

NOTE: You don't need to touch any subcategories if that works, just copy the category, add the filter node to it and change the name.

Link to comment
Share on other sites

I think this mod is exactly what I need for TAC Life Support. Unfortunately I have no clue how to write a cfg file for it, even after reading everything here (it's all Greek to me). I tend to almost exclusively use "Filter by function" in the VAB. Unfortunately, TAC-LS adds a bunch of parts to the Utility tab that end up causing me to have to scroll through to find the stock Squad parts. What I'd like in a filter:

Remove every (part).cfg from the "Utility" Filter by Funcion tab that contains the line: manufacturer = Thunder Aerospace Corporation

Add a custom Tab to the Filter by Function category, named "Life Support"

Add every (part).cfg that contains "manufacturer = Thunder Aerospace Corporation" to this new Life Support subcategory.

Essentially I want to move all TAC-LS parts from the Utility subcategory to a new Life Support subcategory. Can anyone provide me with the code to do that?

Also, where does this file get placed? Is this a Module Manager cfg file, or does it need to go in the 000_FilterExtensions folder, or what? Any help would be appreciated. Thanks!

Edit: As I attempt to understand this mod, it seems that this code:


@SUBCATEGORY[Utility]:AFTER[FilterExtension]:NEEDS[ThunderAerospace]
{
@FILTER,*
{
CHECK
{
type = manufacturer
value = Thunder Aerospace Corporation
invert = true
}
}
}

Should prevent any of TAC-LS parts from appearing in the Utilities tab, but it doesn't work.

Edit: After several hours of trying to wrap my head around this mod, as well as Module Manager, I give up. I've tried several examples suggested earlier in this thread to no avail. It doesn't help that there is conflicting advice posted in this thread by the mod author. For example, both of these code snippets were given as an example of how to add a new subcategory named Life Support:


SUBCATEGORY:NEEDS[ThunderAerospace]
{
name = Life Support
icon = StorageLS

FILTER (filters, etc)


SUBCATEGORY
{
category = Filter by Function
title = Life Support
icon = StorageLS

FILTER (filters, etc)

As you can see, one uses the "name" convention for Life Support, and one uses the "title" convention. One mentions "category = Filter by Function" while the other makes no mention of it. Ugh... In addition to these problems I've been having, I think it's also possible that RoverDude's MKS/OKS may be messing with the "Filter by Function" category/subcategory, causing a problem with this mod. His mod installs a folder named "USI Tools" which apparently uses a DLL to add two additional tabs to "Filter by Function", essentially hardcoding the VAB's filter by function tab. I suspect this could interfere also with the category numbering, with Science being 7, did RoverDude give his two categories numbers 8 & 9? Whatever the case, I'm completely stumped, and am removing this mod until someone else comes up with a TAC-LS cfg file to remove all the TAC parts from Utility and place them in their own Filter by Function tab.

Edited by Targa
Link to comment
Share on other sites

As you can see, one uses the "name" convention for Life Support, and one uses the "title" convention. One mentions "category = Filter by Function" while the other makes no mention of it.

The syntax where the subcategory set the category links is pre version 2.0, the current syntax is the one without the category reference.

Adding a new TACLS subcategory to Filter by Function

SUBCATEGORY
{
name = TACLS
icon = StorageLS

FILTER
{
CHECK
{
type = manufacturer
value = Thunder Aerospace Corporation
}
}
}

@CATEGORY[Filter?by?Function]
{
@SUBCATEGORIES
{
list = TACLS // note: this is the name field for the subcategory. Insert a position index if needed
}
}

Your filter to exclude the parts from the Utility category looks correct to me so I'm not sure why that didn't work. To see if it is a Module Manager syntax error or an issue with FE, open up the ModuleManager.ConfigCache file with a text editor and search for the Utility subcategory (name = Utility will probably be fastest) to see what it ends up looking like

RE: subcategories added by other mod .dlls

They are always added after FE is done with the category. You get all the indexed FE subcategories, all the unindexed FE subcategories, and then any subcategories added by another mod.

Edited by Crzyrndm
Link to comment
Share on other sites

Been trying different things for hours and nothing I do does the trick. The ONLY thing that I could get to work is using this to remove all TACLS items from the Utilities tab:


@PART[Tac*|HexCan*]:AFTER[FilterExtension]:NEEDS[ThunderAerospace]
{
-category = dummy
}

There's nothing in ModuleManager.ConfigCache with "name = Utility". The word "Utility" is only referenced in specific part descriptions. The following code DID get into the ConfigCache, but didn't appear to do anything:

SUBCATEGORY
{
name = TACLS
icon = StorageLS

FILTER
{
CHECK
{
type = manufacturer
value = Thunder Aerospace Corporation
}
}
}

I don't believe the filter by name or manufacturer works at all, when trying to use "invert = true" to remove items from a category. Another rather misleading and confusing thing for me is the fact that all the example code in this thread references "AFTER[FilterExtension]" with regard to MM, yet the name of your DLL is FilterExtensionS, which lead to doubling every code test to make sure a simple typo wasn't the issue. Included in the download is a "FilterExtensions Configs" folder that contains a bunch of different cfg's. One of those is FilterByFunction.cfg, which contains the code:

CATEGORY
{
name = Filter by Function
type = stock
value = replace

SUBCATEGORIES
{
list = 0,Pods
list = 1,Fuel Tanks
list = 2,Engines
list = 3,Command and Control
list = 4,Structural
list = 5,Aerodynamics
list = 6,Utility
list = 7,Science
}
}

When this cfg is used, all "filter by Function" tabs in the VAB are removed completely, so I don't see what use this cfg is to anyone (just as an aside, not that it was my issue, but I did tack on "list = 8,TACLS" which of course didn't work, since all the tabs were missing). At this point I've given up completely, and I'll wait for (hopefully) the author of TAC-LS to move his parts to their own Filter by Function tab.

Link to comment
Share on other sites

When this cfg is used, all "filter by Function" tabs in the VAB are removed completely

Ok, I was under the assumption you had the default configs available. From what you're saying, this is not the case. Copy these two .cfg's (1, 2) somewhere and try again with the .cfg's from my previous post and your first .cfg from here.

PS

Manual or CKAN install (and if CKAN, which components)? CKAN should have the required cfg's being distributed with the plugin unless I'm mistaken.

Link to comment
Share on other sites

It's very late and I'm not staying awake until 2:30am like I did last night messing around with this (haha), so I'll try again tomorrow. Just wanted to mention that I did a manual install. Some documentation would go a long way to preventing confusion. In the OP it states: "Configs and icons contributed by users are distributed with the download". So I naturally assumed that the folder named "000_FilterExtensions Configs" was simply a bunch of community tweaks to the VAB/SPH, as well as a few different ones of your own (I was especially under this impression after viewing the many cfg's contained in that folder), so I didn't install that at all. I notice now that if I install it, it completely reworks the Filter by Function tabs, giving me many more than stock. Not sure if I like that or not yet... At any rate, after a reinstall of everything (including the cfg folder) I did a quick test and still no joy. No TACLS tab, nothing. Keep in mind that the code we spoke about here was "@SUBCATEGORY[utility]", yet with the CFG folder installed and all those extra tabs, there is no longer a tab named "Utility", and the TAC-LS parts have been moved into the new "Misc" tab.

Link to comment
Share on other sites

The top level of that folder is a whole lot of resources/subcategories predefined for use. Removing both subfolders will result in no extra changes being made (everything is stock except for the Filter by Manufacturer tab, which is part of the plugin)

RE: Documentation

I know. It's downright awful and I'm not particularly happy with myself over it (I'm also not amazingly happy with the concept of doing it, which is why it hasn't been done yet...)

Link to comment
Share on other sites

Finally got it to work! It's probably not exactly the way it should be written, but as long as it works, I'm OK with that.

TAC Life Support cfgs

This is what I did to create a new VAB/SPH Filter by Function category named "Life Support", place all the TAC-LS parts in it, and remove the TAC-LS parts from the Utility category. You're free to mess around with your own config files if you want something different from Filter Extensions.

Step 1: Download and install Filter Extensions mod. This should give you 2 folders. One named 000_FilterExtensions and another one named 000_FilterExtensions Configs.

Step 2: In the 000_FilterExtensions Configs folder, delete the subfolder named StockRework.

Step 3. In the 000_FilterExtensions Configs folder, open the file named FilterByFunction.cfg with Notepad or similar text editor. Add another line reading: list = 8,Life Support. It should look like the code below:

FilterByFunction.cfg - adds a new category named "Life Support"


CATEGORY
{
name = Filter by Function
type = stock
value = replace

SUBCATEGORIES
{
list = 0,Pods
list = 1,Fuel Tanks
list = 2,Engines
list = 3,Command and Control
list = 4,Structural
list = 5,Aerodynamics
list = 6,Utility
list = 7,Science
list = 8,Life Support
}
}

Step 4: In the 000_FilterExtensions Configs folder, open the file named SubCategories_Stock.cfg. Scroll down until you find the line "name = Utility". In this section add a check for Life Support and TACLS title. The code of that part should look like this:

Subcategories_Stock.cfg - Removes TAC-LS parts from the Utility category


SUBCATEGORY
{
name = Utility
icon = stockIcon_utility

FILTER
{
CHECK
{
type = title
value = Life Support, TACLS
invert = true
}
CHECK
{
type = category
value = Utility
}
}
}

Step 5: In the 000_FilterExtensions Configs folder, create a new text document named Subcategories_LifeSupport.cfg, paste the following code into it and save:

Subcategories_LifeSupport.cfg - Adds all TAC-LS parts to the new Life Support filter by function category


SUBCATEGORY
{
name = Life Support
icon = StorageLS
FILTER
{
CHECK
{
type = title
value = Life Support, TACLS
}
}
}

Enjoy a spam-free Utility tab in the VAB/SPH!

Universal Storage parts for life support can also be added to these filters. If you wish to move them to the Life Support tab and remove them from the Utility tab, change the following two files that you've already edited to this:

Subcategories_Stock.cfg


SUBCATEGORY
{
name = Utility
icon = stockIcon_utility

FILTER
{
CHECK
{
type = title
value = Life Support, TACLS, water, supplies, oxygen, food, waste, CarbonDioxide
invert = true
}
CHECK
{
type = category
value = Utility
}
}
}

Subcategories_LifeSupport.cfg


SUBCATEGORY
{
name = Life Support
icon = StorageLS
FILTER
{
CHECK
{
type = title
value = Life Support, TACLS, water, supplies, oxygen, food, waste, CarbonDioxide
}
}
}

Edited by Targa
Link to comment
Share on other sites

That sounds very fishy, and shouldn't have anything to do with the check type used. IIRC, the parts you say are missing are the ones set as "category = none" which shouldn't be an issue but I'll have to give it a sharp poke...

- - - Updated - - -

Version 2.3.1

  • Fixed: Parts with "category = none" receiving incomplete filtering data

Thanks for taking a "poke" at this. Unfortunately it didn't seem to work. The KIS/KAS parts do not show up under the mod tab for KAS. Rover Dude has also labeled most of his parts in the UKS 31.5 pre-release with "Category = none" and created his own tab for them. Those parts also don't show up in the USI mod tab. I'm not sure if the problem is that the mod developers marked the parts as "category = none" or that they created a tab for their own parts. Whatever they did they are also affecting Malah's Part Search as none of the parts with a "category = none" are searchable either.

Link to comment
Share on other sites

Hmm, will do some further testing then

Whatever they did they are also affecting Malah's Part Search as none of the parts with a "category = none" are searchable either.

What it comes down to is that any parts with an invalid category name (ie. not pods,Propulsion,fuel tanks, etc.) were never meant to be visible prior to 0.90 and the changes to the filters. For the most part, this is still the case, although as more authors create their own categories it is slowly changing.

To prevent the intentionally hidden parts (asteroid, EVA kerbals, flag, procedural parts upgrades, etc, etc.) from being visible in the parts list, filtering out the "category = none" parts used to be all that was required. FE is not *meant* to be using that any more but it seems like there are some locations where that change is not being fully applied.

Link to comment
Share on other sites

Found the problem, and it's not the part category this time, but a simple syntax error. There is not a valid subcategory for those parts (all only shows everything in the subcategories, not everything that passes the category template. I will consider whether that should be changed, but for now...)

Replace the KAS/KIS category definition with this

CATEGORY:NEEDS[KAS|KIS]
{
name = KAS & KIS
icon = KAS
colour = #FFF0F0F0
all = true

SUBCATEGORIES
{
list = 0,KAS parts
list = 1,KIS parts
}
}

SUBCATEGORY
{
name = KAS parts
icon = KAS
FILTER
{
CHECK
{
type = folder
value = KAS
}
}
}
SUBCATEGORY
{
name = KIS parts
icon = KIS
FILTER
{
CHECK
{
type = folder
value = KIS
}
}
}

- - - Updated - - -

Or possibly a more generic alternative

SUBCATEGORY
{
name = Undefined
icon = default

FILTER
{
CHECK
{
type = category
value = None
}
}
}

@CATEGORY
[*]:HAS[@FILTER[]]
{
@SUBCATEGORIES
{
list = Undefined
}
}

I'm not sure if that MM HAS syntax is actually valid but it isn't particularly necessary anyway

Edited by Crzyrndm
Link to comment
Share on other sites

Found the problem, and it's not the part category this time, but a simple syntax error. There is not a valid subcategory for those parts (all only shows everything in the subcategories, not everything that passes the category template. I will consider whether that should be changed, but for now...)

That fixed it. Thanks! I added an extra subcategory to UmbraSpaceIndustries with a folder check and that sorted USI out as well. Cheers.

Link to comment
Share on other sites

Version 2.4.0

  • kerbas_ad_astra: Added "square4" and "proc" bulkhead profiles
  • Changed: All shipped mod categories now include a subcategory for parts with "category = none"
  • Fixed: subcategory type check now has a depth limit and cannot result in an infinite loop
  • Fixed: Empty subcategories are now always removed the first time the editor is entered
  • Fixed: Small memory leak triggered entering the main menu for the first time squashed
  • Improvement: Added a subcategory override for the global setting "show unpurchased parts"
  • Improvement: Added custom type filter for unpurchased parts
  • Improvement: Added a category override for applying the category template to subcategories
  • Improvement: General code polishing, optimisation, and improvement

To exclude a subcategory from the category template, add ",dont template" to the subcategory when listed. eg.

@CATEGORY[Squad]
{
@SUBCATEGORIES
{
list = Not Squad, dont template
}
}

To override the global hiding of unpurchased parts, add the field "showUnpurchased = true" to the subcategory node

SUBCATEGORY
{
///
showUnpurchased = true
///
}

To check for an unpurchased part, use the custom type with the value "purchased". Will return true if the part is purchased, add "invert = true" to see unpurchased parts


CHECK
{
type = custom
value = purchased
}

Edited by Crzyrndm
Link to comment
Share on other sites

Did you change something major with this update? Because now, after all my hard work figuring out how to get TAC-LS into its own Life Support subcategory, when I install this update all of the subcategories in the VAB's Filter by Function are gone. Not even the stock ones show up now.

Link to comment
Share on other sites

That sounds like something failed in the code. Logs please

Yep, there's the issue. Take a look toward the end of the log file, lots of errors like this:


NullReferenceException: Object reference not set to an instance of an object
at UnityEngine.TextEditor.ClampPos () [0x00000] in <filename unknown>:0

at UnityEngine.GUI.DoTextField (Rect position, Int32 id, UnityEngine.GUIContent content, Boolean multiline, Int32 maxLength, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0

at UnityEngine.GUILayout.DoTextField (System.String text, Int32 maxLength, Boolean multiline, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) [0x00000] in <filename unknown>:0

at UnityEngine.GUILayout.TextField (System.String text, UnityEngine.GUILayoutOption[] options) [0x00000] in <filename unknown>:0

at FilterExtensions.Settings.drawWindow (Int32 id) [0x00000] in <filename unknown>:0

at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0

at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0

output_log.txt

I should also mention that about 50% of the time (in any version), when I click the button in the main game window that's supposed to open the settings window for this mod, all I get is a thin horizontal gray line.

Edited by Targa
Link to comment
Share on other sites

Still broken. Works slightly better I suppose, since now it's showing 6 VAB categories rather than 2. All non-standard however. When I enter the VAB, the Filter by Function tabs are: Multi Coupler, Docking Ports, Control Surface, Air Intake, Landing Gear, Landing Legs.

This happens with both the configs from the previous version as well as the configs from the latest version.

EDIT: After checking many times, I found that this dll is working, with one problem. The above mentioned scenario only happens the first time you enter the VAB. Once you exit the VAB and re-enter, everything is back to normal for the duration of the game. Also wanted to mention that this time neither of the log files contain any errors, only "loading" messages.

Edited by Targa
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...