[Bf-blender-cvs] [059f7413c4c] master: Cleanup: redundant NULL checks, simplify tool fallback arg checks
Campbell Barton
noreply at git.blender.org
Thu Dec 12 11:10:55 CET 2019
Commit: 059f7413c4cf2fed8a4189ade4a609f9758f6022
Author: Campbell Barton
Date: Thu Dec 12 21:09:22 2019 +1100
Branches: master
https://developer.blender.org/rB059f7413c4cf2fed8a4189ade4a609f9758f6022
Cleanup: redundant NULL checks, simplify tool fallback arg checks
===================================================================
M release/scripts/startup/bl_ui/space_toolsystem_common.py
M source/blender/makesrna/intern/rna_workspace_api.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 8c5f2e9cbe5..532f5e023b6 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -929,9 +929,8 @@ def _activate_by_item(context, space_type, item, index, *, as_fallback=False):
data_block=item.data_block or "",
operator=item.operator or "",
index=index,
-
- idname_fallback=item_fallback.idname if item_fallback else "",
- keymap_fallback=item_fallback.keymap[0] if (item_fallback and item_fallback.keymap) else "",
+ idname_fallback=(item_fallback and item_fallback.idname) or "",
+ keymap_fallback=(item_fallback and item_fallback.keymap and item_fallback.keymap[0]) or "",
)
WindowManager = bpy.types.WindowManager
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index f244a674e57..5cc55bfad8a 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -63,8 +63,8 @@ static void rna_WorkSpaceTool_setup(ID *id,
STRNCPY(tref_rt.op, op_idname);
tref_rt.index = index;
- STRNCPY(tref_rt.idname_fallback, idname_fallback ? idname_fallback : NULL);
- STRNCPY(tref_rt.keymap_fallback, keymap_fallback ? keymap_fallback : NULL);
+ STRNCPY(tref_rt.idname_fallback, idname_fallback);
+ STRNCPY(tref_rt.keymap_fallback, keymap_fallback);
WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, idname);
}
More information about the Bf-blender-cvs
mailing list