Drivers: implement fallback values for RNA path based variables.
As discussed in #105407, it can be useful to support returning a fallback value specified by the user instead of failing the driver if a driver variable cannot resolve its RNA path. This especially applies to context variables referencing custom properties, since when the object with the driver is linked into another scene, the custom property can easily not exist there. This patch adds an optional fallback value setting to properties based on RNA path (including ordinary Single Property variables due to shared code and similarity). When enabled, RNA path lookup failures (including invalid array index) cause the fallback value to be used instead of marking the driver invalid. A flag is added to track when this happens for UI use. It is also exposed to python for lint type scripts. When the fallback value is used, the input field containing the property RNA path that failed to resolve is highlighted in red (identically to the case without a fallback), and the driver can be included in the With Errors filter of the Drivers editor. However, the channel name is not underlined in red, because the driver as a whole evaluates successfully. Pull Request: https://projects.blender.org/blender/blender/pulls/110135
This commit is contained in:
committed by
Gitea
parent
bbd7872680
commit
d0ef66ddff
@@ -93,6 +93,7 @@ class GRAPH_PT_filters(DopesheetFilterPopoverBase, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
st = context.space_data
|
||||
|
||||
DopesheetFilterPopoverBase.draw_generic_filters(context, layout)
|
||||
layout.separator()
|
||||
@@ -100,6 +101,12 @@ class GRAPH_PT_filters(DopesheetFilterPopoverBase, Panel):
|
||||
layout.separator()
|
||||
DopesheetFilterPopoverBase.draw_standard_filters(context, layout)
|
||||
|
||||
if st.mode == 'DRIVERS':
|
||||
layout.separator()
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Drivers:")
|
||||
col.prop(st.dopesheet, "show_driver_fallback_as_error")
|
||||
|
||||
|
||||
class GRAPH_PT_snapping(Panel):
|
||||
bl_space_type = 'GRAPH_EDITOR'
|
||||
|
||||
Reference in New Issue
Block a user