Closed reddraconi closed 1 year ago
Rather than checking whether the type is a basic, you should probably check whether the type is in self.parser.basics.booleans
- since only booleans can have true/false as their default values.
I'm probably confused, but when I ran codegen.py
in debug mode to see what the contents of self.parser.basics.booleans
was, it appears to be empty.
It also appears that cobra-tools/source/formats/base/base.xml
file doesn't have an entry for booleans.
Am I crazy?
Steps to reproduce:
cobra-tools
folder in VSCode (or whatever you like)cobra-tools/codegen/Bitfield.py
on line 82cobra-tools/codegen.py
in debug modeself
object that's currently in focus.0
.This was all because I was trying to figure out if I needed the .lower()
function in the square brackets or something else to make sure I triggered on an object in self.parser.basics.booleans
.
You're right in that base.xml doesn't have any booleans (boolean="true" in the xml struct). Nif.xml does have booleans, however.
Updated commit to add boolean type to base.xml
so that checking for boolean values in the BitFields won't cause bad things to happen when self.parser.basics.booleans
isn't populated.
As discovered in
https://github.com/niftools/blender_niftools_addon/issues/580
, when boolean values are generated for keys, they're not capitalized. This little patch should, hopefully, fix that.Admittedly, this code generation code is way above my ability.
I made the changes in my local branch, installed the
requirements.txt
, and attempted to build with no discernible issues. I then rancodegen.py
and didn't seen any suspicious output, so I hope this did the trick!