[Bf-blender-cvs] [0e89d243184] master: Cleanup: Use elif in custom property edit operator, reduce whitespace
Hans Goudey
noreply at git.blender.org
Tue Jan 17 16:51:52 CET 2023
Commit: 0e89d2431840386fe9bdc2f11bd83dbfb5847ba2
Author: Hans Goudey
Date: Tue Jan 17 09:51:09 2023 -0600
Branches: master
https://developer.blender.org/rB0e89d2431840386fe9bdc2f11bd83dbfb5847ba2
Cleanup: Use elif in custom property edit operator, reduce whitespace
===================================================================
M release/scripts/startup/bl_operators/wm.py
===================================================================
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 291e412ee75..b8f5fc596c3 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1588,8 +1588,7 @@ class WM_OT_properties_edit(Operator):
self.default_string = rna_data["default"]
elif self.property_type in {'BOOL', 'BOOL_ARRAY'}:
self.default_int = self._convert_new_value_array(rna_data["default"], bool, 32)
-
- if self.property_type in {'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
+ elif self.property_type in {'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
self.array_length = len(item[name])
# The dictionary does not contain the description if it was empty.
@@ -1604,33 +1603,26 @@ class WM_OT_properties_edit(Operator):
def _get_converted_value(self, item, name_old, prop_type_new):
if prop_type_new == 'INT':
return self._convert_new_value_single(item[name_old], int)
-
- if prop_type_new == 'FLOAT':
+ elif prop_type_new == 'FLOAT':
return self._convert_new_value_single(item[name_old], float)
-
- if prop_type_new == 'BOOL':
+ elif prop_type_new == 'BOOL':
return self._convert_new_value_single(item[name_old], bool)
-
- if prop_type_new == 'INT_ARRAY':
+ elif prop_type_new == 'INT_ARRAY':
prop_type_old = self.get_property_type(item, name_old)
if prop_type_old in {'INT', 'FLOAT', 'INT_ARRAY', 'FLOAT_ARRAY', 'BOOL_ARRAY'}:
return self._convert_new_value_array(item[name_old], int, self.array_length)
-
- if prop_type_new == 'FLOAT_ARRAY':
+ elif prop_type_new == 'FLOAT_ARRAY':
prop_type_old = self.get_property_type(item, name_old)
if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
return self._convert_new_value_array(item[name_old], float, self.array_length)
-
- if prop_type_new == 'BOOL_ARRAY':
+ elif prop_type_new == 'BOOL_ARRAY':
prop_type_old = self.get_property_type(item, name_old)
if prop_type_old in {'INT', 'FLOAT', 'FLOAT_ARRAY', 'INT_ARRAY', 'BOOL_ARRAY'}:
return self._convert_new_value_array(item[name_old], bool, self.array_length)
else:
return [False] * self.array_length
-
- if prop_type_new == 'STRING':
+ elif prop_type_new == 'STRING':
return self.convert_custom_property_to_string(item, name_old)
-
# If all else fails, create an empty string property. That should avoid errors later on anyway.
return ""
@@ -1667,7 +1659,7 @@ class WM_OT_properties_edit(Operator):
default=self.default_int[0] if prop_type_new == 'INT' else self.default_int[:self.array_length],
description=self.description,
)
- if prop_type_new in {'BOOL', 'BOOL_ARRAY'}:
+ elif prop_type_new in {'BOOL', 'BOOL_ARRAY'}:
ui_data = item.id_properties_ui(name)
ui_data.update(
default=self.default_bool[0] if prop_type_new == 'BOOL' else self.default_bool[:self.array_length],
More information about the Bf-blender-cvs
mailing list