Description3 parts:
1) To allow distinguishing uninitialized (not set) properties in the keymap items, a few changes to the RNA struct comparison function are needed: Instead of allowing only strict/non-strict comparison of 2 properties A and B in a struct, this now has 3 modes:
* STRICT: compare only the actual property values (same as 'strict' before)
* UNSET_MATCH_ANY: if either A or B is unset, consider them a match (same as non-strict before)
* UNSET_MATCH_NONE: if one property is set and the other not, consider them a mismatch.
The new UNSET_MATCH_NONE mode is useful for keymaps, because it allows keeping user-defined property values in the keymap even if they match the default property value (see wm_keymap_diff function in wm_keymap.c)
2) Fix for the RNA_property_is_idprop function: This was checking the "magic" flag, which is really only useful internally in RNA. Use the PROP_IDPROPERTY flag instead to identify id properties which can be unset (i.e. delete the underlying id property storage). The function is not used anywhere sofar, so no risk of functionality breaking.
3) A new operator is added for unsetting ID properties in the RMB context menu, next to the "Reset" operator. This only works on ID properties and deletes the ID property storage, so that the default value is used.
In the user preferences for keymaps the properties are shown in an inactive layout to indicate that the default value is used (which some operators such as the "select linked" op from the report use to trigger automatic behavior). When the user sets a property it gets set and stays that way until explicitly "unset" using the new operator.
Patch Set 1 #
Total comments: 8
Patch Set 2 : Fixed some issues pointed out by ideasman42 #Patch Set 3 : Minor compiler error fix #Patch Set 4 : UI improvements #Patch Set 5 : Removed a few unused commented lines #MessagesTotal messages: 7
|