BlenderKit: several fixes

- crucial typo bug in previous timers commit(linking of collections gone wrong)
 - increase size of first row of UI in panel
 - fix a bug when mesh isn't generated in bounding box calculations (reported bug)
This commit is contained in:
Vilém Duha 2019-09-07 20:20:10 +02:00
parent 7ebd5e94df
commit 1760af58fc
3 changed files with 27 additions and 22 deletions

View File

@ -107,7 +107,7 @@ def link_group(file_name, obnames=[], location=(0, 0, 0), link=False, **kwargs):
if col.library is not None:
fp = bpy.path.abspath(col.library.filepath)
fp1 = bpy.path.abspath(file_name)
if fp1 == fp1:
if fp == fp1:
main_object.instance_collection = col
break;

View File

@ -584,12 +584,15 @@ class VIEW3D_PT_blenderkit_unified(Panel):
wm = bpy.context.window_manager
layout = self.layout
# layout.prop_tabs_enum(ui_props, "asset_type", icon_only = True)
row = layout.row()
row.scale_x = 1.6
row.scale_y = 1.6
#
row.prop(ui_props, 'down_up', expand=True, icon_only=True)
# row.label(text='')
row = row.split().row()
row.prop(ui_props, 'asset_type', expand=True, icon_only=True)
w = context.region.width

View File

@ -315,17 +315,18 @@ def get_bounds_snappable(obs, use_modifiers=False):
# to_mesh(context.depsgraph, apply_modifiers=self.applyModifiers, calc_undeformed=False)
obcount += 1
for c in mesh.vertices:
coord = c.co
parent_coord = matrix_parent.inverted() @ mw @ Vector(
(coord[0], coord[1], coord[2])) # copy this when it works below.
minx = min(minx, parent_coord.x)
miny = min(miny, parent_coord.y)
minz = min(minz, parent_coord.z)
maxx = max(maxx, parent_coord.x)
maxy = max(maxy, parent_coord.y)
maxz = max(maxz, parent_coord.z)
# bpy.data.meshes.remove(mesh)
if mesh is not None:
for c in mesh.vertices:
coord = c.co
parent_coord = matrix_parent.inverted() @ mw @ Vector(
(coord[0], coord[1], coord[2])) # copy this when it works below.
minx = min(minx, parent_coord.x)
miny = min(miny, parent_coord.y)
minz = min(minz, parent_coord.z)
maxx = max(maxx, parent_coord.x)
maxy = max(maxy, parent_coord.y)
maxz = max(maxz, parent_coord.z)
# bpy.data.meshes.remove(mesh)
if ob.type == 'CURVE':
object_eval.to_mesh_clear()
@ -356,15 +357,16 @@ def get_bounds_worldspace(obs, use_modifiers=False):
ob_eval = ob.evaluated_get(depsgraph)
mesh = ob_eval.to_mesh()
obcount += 1
for c in mesh.vertices:
coord = c.co
world_coord = mw @ Vector((coord[0], coord[1], coord[2]))
minx = min(minx, world_coord.x)
miny = min(miny, world_coord.y)
minz = min(minz, world_coord.z)
maxx = max(maxx, world_coord.x)
maxy = max(maxy, world_coord.y)
maxz = max(maxz, world_coord.z)
if mesh is not None:
for c in mesh.vertices:
coord = c.co
world_coord = mw @ Vector((coord[0], coord[1], coord[2]))
minx = min(minx, world_coord.x)
miny = min(miny, world_coord.y)
minz = min(minz, world_coord.z)
maxx = max(maxx, world_coord.x)
maxy = max(maxy, world_coord.y)
maxz = max(maxz, world_coord.z)
ob_eval.to_mesh_clear()
if obcount == 0: