OpenBRF Redux — A de-rusted, bug-fixed version of the tool

Users who are viewing this thread

Swyter

Grandmaster Knight
This is a de-rusted version of Marco Tarini's OpenBRF tool for modding Mount&Blade 1.011 and Warband; it comes with bug fixes and enhancements.

ico48.png
Download and change log here: https://github.com/Swyter/openbrf-redux

The idea is to keep the program well-maintained, develop it openly, and accept suggestions and improvements from the community. :party:

  • Fix OpenBRF switching to female versions of armour mesh when playing back skeletal animations. Suggested by @Earendil.
  • Fix the double right-clicking multi-mesh selection reset bug via some cursed workaround.
    • After trying for days to diagnose and track down this weird mix of Qt/OpenBRF bugs.
  • Add a new button in the transform texture coords tool to invert the texture UV coordinates in the horizontal dimension, not only vertically. Suggested by @kraggrim.
    • I believe the button actions were inverted from the start, Flipping U should flip it horizontally (X coordinate) and V vertically (Y coordinate). So changed that, too.
  • Fix a few typos: Transfrom ⇢ Transform, trasnfer ⇢ transfer.
  • Add an «Apply to last selected object only» checkbox to the vertex color tool, similar to the one in the roto-rescale tool. Suggested by @kraggrim.
  • Add two checkboxes to the roto-translate-rescale dialog tool, to independently switch between local and global rotation/scaling. By default everything is local, until now OpenBRF only supported global transforms.
    • Use the center point of all the selected elements when the «Apply to last element» checkbox is off, and keep using the center of just the last element when on. That way everything rotates nicely around their own shapes as expected.
    • Change the order of operations in the roto-translate-rescale tool from translation ⇢ rotation ⇢ scaling, to translation ⇢ scaling ⇢ rotation to avoid shearing.
  • Rename the customPreviewShaders.xml file to avoid throwing GLSL errors, for the time being. That way it stays there but doesn't get loaded.
  • Add the build time and a small | Redux suffix into the «About» menu.
  • Reduce the limitations when there are long lists of elements in text files. Raise the maximum .txt file reader line length and parser token count (to 512).
    • The limit for tokens in a single line for the OpenBRF .txt file parser was 256, which may fall short when there are many faces or materials in skins.txt and other similar files; raise it to 512. Dedicated to @Tocan.
  • Add support for detecting meshes with the _fem suffix as being used/mark them as blue, suggested by @Erundil.
  • Add the hardcoded strategic map tree meshes to the engine usage list, suggested by @Erundil.
  • Fix mixed-mode 1.011/Warband mods like TLD that have both older and newer-style .txt files.
    • Fix parsing the flora_kinds.txt and skyboxes.txt as M&B 1.011 just because item_kinds1.txt is using the older format; if the actions.txt file has the Warband format (that one doesn't have retro-compatibility support) then treat subsequent files as a Warband mod.
    • This gets rid of the parsing errors in the Data folder when opening the Warband version of The Last Days of the Third Age.
  • Add support for actually grabbing the hardcoded core_*.brf resources from the mod's Resource folder first, if they exist. This functionality was added after the first Warband patches.
    • This should fix any misleading «unknown shader» issue, when using custom shaders, and the like.
  • Fix the «Module > Open module folder in explorer» menu option, which didn't do anything.
  • Improve the actions.txt format auto-detection to find if the file has the Warband or the M&B 1.011 format, by counting how many space-separated elements are in an animation entry line.
  • Raise to 255 the 10 or 40-element limitation for hair and beard materials, as well as the item variants limit, in the @mtarini parser.
  • Make building the source code more straightforward, bundle slimmed down versions of the needed libraries.
 
Last edited:
Both Redux and old OpenBRF are prone to crashes when undoing changes with Ctrl+Z while check for usage is on, especially if we do it quickly by holding Ctrl+Z.
Without usage checking, Ctrl+Z works without problems usually.

Maybe fixable.
 
Swyter suggested moving this out of PM to this thread, so here goes.

I tested the thing where _fem meshes are not marked as used, but should be.
Basically if mesh abcd is used, then mesh abcd_fem should also be marked as used (if it exists).
Swyter fixed that, but my tests show that results are partial - mesh abcd_fem will be shown as used only if it's in the same file as mesh abcd.

Swyter pointed out that he's hooked the _fem mesh detection into the same logic that marks LODs as used or not - function/procedure/whatever called noDot.

So I went to test how OpenBRF marks LODs and discovered some weirdness there too (same results in both original OpenBRF and Redux).
Here are my findings:

Basically, in file A I had:
mesh_A
mesh_A.lod1
mesh_A.lod2
mesh_A.lod3
All were showing as used, so far so good.

I split it into 2 files.
File A:
mesh_A
mesh_A.lod1
File B:
mesh_A.lod2
mesh_A.lod3
Now in file B I see lods 2-3 marked as used, but in file A - lod1 and even mesh_A now show as unused.

Conclusion: the fix for _fem meshes didn't work well because the whole function was flawed to begin with and might need fixing.

Due to limited time I only tested on 1 file though. I hope there are people with more time than I have to test it better.
 
Thanks for testing, mate. Yeah, the function that marks suffixed versions of used meshes is kind of funky.

Marco probably had his good reasons to do it like this, but I've just expanded the original mechanism a bit. If someone has some time to investigate subtly broken bits and hence make fixing them easier, please post that here. Knowing is half the battle.

A bunch of the Warband regulars on the Discord server also had other potential suggestions to make OpenBRF a bit less annoying to use; yesterday I implemented support for local rotations/scaling, an option to only color tint the last selected mesh, raised the material/beard/hair limits for skins.txt and the other text files, added the map tree meshes to the hardcoded list, and made it use the mod's core_*.brf files in the resource usage finder if they exist, so custom shaders don't cause errors anymore.

Please post yours here, happy to discuss them and see what can be done, even if it's just small, quality-of-life stuff. Don't be shy. :fruity:
 
There's currently a regression in the double-click on a mesh name to select all parts and LODs in one go function. For some reason the second click fires a single-click Qt signal/event that resets the double-click event, kind of tricky to fix.

But it seems like double-clicking with the mouse wheel/middle button works just fine.

Holding Shift while double right-clicking also works. There's something wrong with single left clicks. 🐥

--

@kraggrim suggested adding another button in the texture coordinate tool to flip the UVs vertically and horizontally, so I added that yesterday. Keep them coming.
 
Last edited:
Perhaps you could fix the issue with the custom feminizer morpher files as described by mtarini here:

Some basic informations of frame differences between M&B and Warband are described at this section here, at the top "Female frame", although you might be aware of them:
https://earendil_ardamire.gitlab.io/modding-guide/Subpages/New_at_modding_Warband/BRF_Resource_Management.html#Skeletons
 
There's currently a regression in the double-click on a mesh name to select all parts and LODs in one go function. For some reason the second click fires a single-click Qt signal/event that resets the double-click event, kind of tricky to fix.

But it seems like double-clicking with the mouse wheel/middle button works just fine.

Holding Shift while double right-clicking also works. There's something wrong with single left clicks. 🐥
Just managed to "fix" this using a funky workaround after a very long and arduous debugging and testing session, didn't manage to find the root cause. So hopefully isn't any worse than any of the official versions, no more drawbacks! Please re-download from here.

Perhaps you could fix the issue with the custom feminizer morpher files as described by mtarini here:

Some basic informations of frame differences between M&B and Warband are described at this section here, at the top "Female frame", although you might be aware of them:
https://earendil_ardamire.gitlab.io/modding-guide/Subpages/New_at_modding_Warband/BRF_Resource_Management.html#Skeletons
Darn, sounds a bit messy, but added it to my to-do list anyway. Thanks for the suggestion! :grin:
 
Ah, before I forget, here was the workaround for it suggested by mtarini:
https://forums.taleworlds.com/index.php?threads/faq-and-troubleshooting.173577/#post-8345513

Another issue which you could perhaps fix the issue described here:
Not sure if anyone asked this before,
but does your latest version of OpenBRF always automatically switch to a female version of armour mesh while you're trying to play one of the preset animations?
I simply can't get my male armour meshes to play preset animations unless I separate their frames.

Is there any way to fix this problem?
Maroon wrote a little workaround for it:
As far as I can tell the "Play" button is used both for vertex frames and frames of an animation. So if you try to play an animation on a skinned armor that has multiple body types (and thus vertex frames), it'll play the animation and "play" the vertex frames, moving it to the last frame there is, in your case the female version. I think all you can do for now is remove the vertex frames when you're testing it and readding it afterwards. Or keep a copy of the armor with just the normal frame for testing purposes.
There are probably not many people around who have multiple frames at the armouries and tried to play the animations. It is also only broken in the "newer" OpenBRF version iirc since I have never had the problem at my older version (I use the version 0.0.79 at my old laptop).
 
Another issue which you could perhaps fix the issue described here:

Maroon wrote a little workaround for it:

There are probably not many people around who have multiple frames at the armouries and tried to play the animations. It is also only broken in the "newer" OpenBRF version iirc since I have never had the problem at my older version (I use the version 0.0.79 at my old laptop).
Hopefully fixed, please check the latest version. Surprisingly easy to find and fix, at least compared to the double-click bug above, just had to tweak a single line.
 
Last edited:
Back
Top Bottom