BlenderKit: API hotfixes - to_mesh() and Image colourspace settings.
This commit is contained in:
parent
b002728942
commit
7d92fb16c9
|
@ -206,9 +206,9 @@ def check_meshprops(props, obs):
|
|||
if ob.type == 'MESH' or ob.type == 'CURVE':
|
||||
ob_eval = None
|
||||
if ob.type == 'CURVE':
|
||||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
ob_eval = ob.evaluated_get(depsgraph)
|
||||
mesh = ob_eval.to_mesh()
|
||||
# depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
# object_eval = ob.evaluated_get(depsgraph)
|
||||
mesh = ob.to_mesh()
|
||||
else:
|
||||
mesh = ob.data
|
||||
fco = len(mesh.polygons)
|
||||
|
|
|
@ -292,7 +292,7 @@ def load_previews():
|
|||
img.unpack(method='USE_ORIGINAL')
|
||||
img.filepath = tpath
|
||||
img.reload()
|
||||
|
||||
img.colorspace_settings.name = 'Linear'
|
||||
i += 1
|
||||
# print('previews loaded')
|
||||
|
||||
|
@ -571,7 +571,7 @@ def write_profile(adata):
|
|||
utils.p('writing profile')
|
||||
user = adata['user']
|
||||
# we have to convert to MB here, numbers too big for python int type
|
||||
if user.get('sumAssetFileSize') is not None:
|
||||
if user.get('sumAssetFilesSize') is not None:
|
||||
user['sumAssetFilesSize'] /= (1024 * 1024)
|
||||
user['sumPrivateAssetFilesSize'] /= (1024 * 1024)
|
||||
user['remainingPrivateQuota'] /= (1024 * 1024)
|
||||
|
@ -604,9 +604,8 @@ def fetch_profile(api_key):
|
|||
def get_profile():
|
||||
preferences = bpy.context.preferences.addons['blenderkit'].preferences
|
||||
a = bpy.context.window_manager.get('bkit profile')
|
||||
if a is None:
|
||||
thread = threading.Thread(target=fetch_profile, args=(preferences.api_key,), daemon=True)
|
||||
thread.start()
|
||||
thread = threading.Thread(target=fetch_profile, args=(preferences.api_key,), daemon=True)
|
||||
thread.start()
|
||||
return a
|
||||
|
||||
|
||||
|
|
|
@ -724,7 +724,7 @@ def draw_callback_2d_search(self, context):
|
|||
else:
|
||||
iname = utils.previmg_name(ui_props.active_index)
|
||||
img = bpy.data.images.get(iname)
|
||||
|
||||
img.colorspace_settings.name = 'Linear'
|
||||
draw_tooltip(ui_props.mouse_x, ui_props.mouse_y, text=ui_props.tooltip, img=img)
|
||||
|
||||
if ui_props.dragging and (
|
||||
|
|
|
@ -230,6 +230,7 @@ def get_hidden_image(tpath, bdata_name, force_reload=False):
|
|||
if img.packed_file is not None:
|
||||
img.unpack(method='USE_ORIGINAL')
|
||||
img.reload()
|
||||
img.colorspace_settings.name = 'Linear'
|
||||
return img
|
||||
|
||||
|
||||
|
@ -239,6 +240,7 @@ def get_thumbnail(name):
|
|||
img = bpy.data.images.get(name)
|
||||
if img == None:
|
||||
img = bpy.data.images.load(p)
|
||||
img.colorspace_settings.name = 'Linear'
|
||||
img.name = name
|
||||
img.name = name
|
||||
|
||||
|
@ -297,13 +299,14 @@ def get_bounds_snappable(obs, use_modifiers=False):
|
|||
# If to_mesh() works we can use it on curves and any other ob type almost.
|
||||
# disabled to_mesh for 2.8 by now, not wanting to use dependency graph yet.
|
||||
depsgraph = bpy.context.evaluated_depsgraph_get()
|
||||
object_eval = ob.evaluated_get(depsgraph)
|
||||
mesh = object_eval.to_mesh()
|
||||
|
||||
# if self.applyModifiers:
|
||||
# evaluated_get(depsgraph).to_mesh()
|
||||
# else:
|
||||
# to_mesh()
|
||||
object_eval = ob.evaluated_get(depsgraph)
|
||||
if ob.type == 'CURVE':
|
||||
mesh = object_eval.to_mesh()
|
||||
else:
|
||||
mesh = object_eval.data
|
||||
|
||||
# to_mesh(context.depsgraph, apply_modifiers=self.applyModifiers, calc_undeformed=False)
|
||||
obcount += 1
|
||||
for c in mesh.vertices:
|
||||
coord = c.co
|
||||
|
@ -315,8 +318,9 @@ def get_bounds_snappable(obs, use_modifiers=False):
|
|||
maxx = max(maxx, parent_coord.x)
|
||||
maxy = max(maxy, parent_coord.y)
|
||||
maxz = max(maxz, parent_coord.z)
|
||||
|
||||
object_eval.to_mesh_clear()
|
||||
# bpy.data.meshes.remove(mesh)
|
||||
if ob.type == 'CURVE':
|
||||
object_eval.to_mesh_clear()
|
||||
|
||||
if obcount == 0:
|
||||
minx, miny, minz, maxx, maxy, maxz = 0, 0, 0, 0, 0, 0
|
||||
|
|
Loading…
Reference in New Issue