forked from bartvdbraak/blender
Cleanup: Change variable name, comment formatting
This commit is contained in:
parent
728e31e18a
commit
6391949601
@ -135,12 +135,12 @@ def rna_idprop_ui_create(
|
|||||||
|
|
||||||
def draw(layout, context, context_member, property_type, *, use_edit=True):
|
def draw(layout, context, context_member, property_type, *, use_edit=True):
|
||||||
|
|
||||||
def assign_props(prop, val, key):
|
def assign_props(prop, value, key):
|
||||||
prop.data_path = context_member
|
prop.data_path = context_member
|
||||||
prop.property_name = key
|
prop.property_name = key
|
||||||
|
|
||||||
try:
|
try:
|
||||||
prop.value = str(val)
|
prop.value = str(value)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -176,25 +176,24 @@ def draw(layout, context, context_member, property_type, *, use_edit=True):
|
|||||||
|
|
||||||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
|
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
|
||||||
|
|
||||||
for key, val in items:
|
for key, value in items:
|
||||||
is_rna = (key in rna_properties)
|
is_rna = (key in rna_properties)
|
||||||
|
|
||||||
# only show API defined for developers
|
# Only show API defined properties to developers.
|
||||||
if is_rna and not show_developer_ui:
|
if is_rna and not show_developer_ui:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
to_dict = getattr(val, "to_dict", None)
|
to_dict = getattr(value, "to_dict", None)
|
||||||
to_list = getattr(val, "to_list", None)
|
to_list = getattr(value, "to_list", None)
|
||||||
|
|
||||||
# val_orig = val # UNUSED
|
|
||||||
if to_dict:
|
if to_dict:
|
||||||
val = to_dict()
|
value = to_dict()
|
||||||
val_draw = str(val)
|
val_draw = str(value)
|
||||||
elif to_list:
|
elif to_list:
|
||||||
val = to_list()
|
value = to_list()
|
||||||
val_draw = str(val)
|
val_draw = str(value)
|
||||||
else:
|
else:
|
||||||
val_draw = val
|
val_draw = value
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
box = row.box()
|
box = row.box()
|
||||||
@ -210,10 +209,10 @@ def draw(layout, context, context_member, property_type, *, use_edit=True):
|
|||||||
|
|
||||||
row.label(text=key, translate=False)
|
row.label(text=key, translate=False)
|
||||||
|
|
||||||
# explicit exception for arrays.
|
# Explicit exception for arrays.
|
||||||
show_array_ui = to_list and not is_rna and 0 < len(val) <= MAX_DISPLAY_ROWS
|
show_array_ui = to_list and not is_rna and 0 < len(value) <= MAX_DISPLAY_ROWS
|
||||||
|
|
||||||
if show_array_ui and isinstance(val[0], (int, float)):
|
if show_array_ui and isinstance(value[0], (int, float)):
|
||||||
row.prop(rna_item, '["%s"]' % escape_identifier(key), text="")
|
row.prop(rna_item, '["%s"]' % escape_identifier(key), text="")
|
||||||
elif to_dict or to_list:
|
elif to_dict or to_list:
|
||||||
row.label(text=val_draw, translate=False)
|
row.label(text=val_draw, translate=False)
|
||||||
@ -225,8 +224,8 @@ def draw(layout, context, context_member, property_type, *, use_edit=True):
|
|||||||
|
|
||||||
if use_edit:
|
if use_edit:
|
||||||
row = split.row(align=True)
|
row = split.row(align=True)
|
||||||
# Do not allow editing of overridden properties (we cannot use a poll function of the operators here
|
# Do not allow editing of overridden properties (we cannot use a poll function
|
||||||
# since they's have no access to the specific property...).
|
# of the operators here since they's have no access to the specific property).
|
||||||
row.enabled = not(is_lib_override and key in rna_item.id_data.override_library.reference)
|
row.enabled = not(is_lib_override and key in rna_item.id_data.override_library.reference)
|
||||||
if is_rna:
|
if is_rna:
|
||||||
row.label(text="API Defined")
|
row.label(text="API Defined")
|
||||||
|
Loading…
Reference in New Issue
Block a user