-
Notifications
You must be signed in to change notification settings - Fork 44
Description
The basic type Flags just a wraps a number value but offers no value. The number in most cases is still presented to the user as is, and the options, usually documented in the nif.xml is unlikely to read by a user .
There are two structures which we currently use which provide what the "Flags" real functionality should.
- - where only one "flag" value is selectable, eg different shader types.
- a combination of "flags" value
<add name="Flags" type="Flags">
Controller flags (usually 0x000C). Probably controls loops.
Bit 0 : Anim type, 0=APP_TIME 1=APP_INIT
Bit 1-2 : Cycle type 00=Loop 01=Reverse 10=Loop
Bit 3 : Active
Bit 4 : Play backwards
</add>This could be reworked as
<bitflag name="AnimationFlags">
Controller flags (usually 0x000C). Probably controls loops.
<option value="0" name="Anim type">APP_TIME</option>
<option value="1" name="Anim type">APP_INIT</option>
<option value="3" name="Cycle Type Loop">Loop</option>
<option value="4" name="Cycle Type Reverse">Reverse</option>
<option value="5" name="Cycle Type">Loop</option>
<option value="7" name="Active">Active</option>
<option value="8" name="Play backwards">Play backwards</option>
</bitflag>
Then the above would be simplified to this
<add name="Flags" type="AnimationFlags"></add>This example does highlight a potential redesign in implementation. We do not have any way to to allow certain flags to be mutually exclusive, only be able to select subset of flags, ie only one Cycle Type selectable.
Additionally most tools have to add additional logic so that the value is presented in a meaningful manner to the user. eg. NifSkope know to break Col Filter into 3 options,
*LINK property,
*Collision,
*Scaled
- 5 bits to represent the remaining options.
A partial solution, but using bitflags a generic implementation would just pull all the information directly. Less code to maintain if its generic.
The only downside is that it more bitflag types will need to be created and depending on the number of available options this will increase the size of the nif.xml. If the options can be conditional then some could be reused, like Col Filter & Skyrim Col Filter, but less readable.