refactoring
better function name
This commit is contained in:
parent
d8f8441871
commit
bae99ee4c6
1 changed files with 6 additions and 6 deletions
12
butils.py
12
butils.py
|
@ -487,7 +487,7 @@ def ShowMessageBox(title = "Message Box", icon = 'INFO', message=""):
|
||||||
self.layout.label(text=n)
|
self.layout.label(text=n)
|
||||||
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
|
bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
|
||||||
|
|
||||||
def completely_delete_objs(objs):
|
def completely_delete_objects(objs):
|
||||||
context_override = bpy.context.copy()
|
context_override = bpy.context.copy()
|
||||||
context_override["selected_objects"] = list(objs)
|
context_override["selected_objects"] = list(objs)
|
||||||
with bpy.context.temp_override(**context_override):
|
with bpy.context.temp_override(**context_override):
|
||||||
|
@ -707,7 +707,7 @@ def is_glyph(o):
|
||||||
# for c in o.children:
|
# for c in o.children:
|
||||||
# if is_metrics_object(c):
|
# if is_metrics_object(c):
|
||||||
# metrics.append(c)
|
# metrics.append(c)
|
||||||
# completely_delete_objs(metrics)
|
# completely_delete_objects(metrics)
|
||||||
|
|
||||||
def get_max_bound_box(bb_1, bb_2 = None):
|
def get_max_bound_box(bb_1, bb_2 = None):
|
||||||
if type(bb_2) == type(None):
|
if type(bb_2) == type(None):
|
||||||
|
@ -793,7 +793,7 @@ def add_default_metrics_to_objects(objects=None, overwrite_existing=False):
|
||||||
targets.append(o)
|
targets.append(o)
|
||||||
reference_bound_box = get_max_bound_box(o.bound_box, reference_bound_box)
|
reference_bound_box = get_max_bound_box(o.bound_box, reference_bound_box)
|
||||||
elif len(metrics) >= 0 and overwrite_existing:
|
elif len(metrics) >= 0 and overwrite_existing:
|
||||||
completely_delete_objs(metrics)
|
completely_delete_objects(metrics)
|
||||||
targets.append(o)
|
targets.append(o)
|
||||||
reference_bound_box = get_max_bound_box(o.bound_box, reference_bound_box)
|
reference_bound_box = get_max_bound_box(o.bound_box, reference_bound_box)
|
||||||
else:
|
else:
|
||||||
|
@ -811,7 +811,7 @@ def remove_metrics_from_objects(objects=None):
|
||||||
for c in o.children:
|
for c in o.children:
|
||||||
if is_metrics_object(c):
|
if is_metrics_object(c):
|
||||||
metrics.append(c)
|
metrics.append(c)
|
||||||
completely_delete_objs(metrics)
|
completely_delete_objects(metrics)
|
||||||
|
|
||||||
def align_metrics_of_objects_to_active_object(objects=None):
|
def align_metrics_of_objects_to_active_object(objects=None):
|
||||||
if type(objects) == type(None):
|
if type(objects) == type(None):
|
||||||
|
@ -849,7 +849,7 @@ def align_metrics_of_objects_to_active_object(objects=None):
|
||||||
bb = get_metrics_bound_box(metrics[0].bound_box,
|
bb = get_metrics_bound_box(metrics[0].bound_box,
|
||||||
reference_bound_box)
|
reference_bound_box)
|
||||||
if len(metrics) > 0:
|
if len(metrics) > 0:
|
||||||
completely_delete_objs(metrics)
|
completely_delete_objects(metrics)
|
||||||
|
|
||||||
add_metrics_obj_from_bound_box(o, bb)
|
add_metrics_obj_from_bound_box(o, bb)
|
||||||
return ""
|
return ""
|
||||||
|
@ -889,7 +889,7 @@ def align_metrics_of_objects(objects=None):
|
||||||
else:
|
else:
|
||||||
bound_box = get_metrics_bound_box(metrics[0].bound_box,
|
bound_box = get_metrics_bound_box(metrics[0].bound_box,
|
||||||
reference_bound_box)
|
reference_bound_box)
|
||||||
completely_delete_objs(metrics)
|
completely_delete_objects(metrics)
|
||||||
|
|
||||||
add_metrics_obj_from_bound_box(t, bound_box)
|
add_metrics_obj_from_bound_box(t, bound_box)
|
||||||
return ""
|
return ""
|
||||||
|
|
Loading…
Reference in a new issue