work
save startup blend for animation tab & whatnot
This commit is contained in:
@@ -30,6 +30,13 @@ RENDER_OBTYPES = ["MESH", "CURVE", "SURFACE", "METABALL", "TEXT"]
|
||||
_BLE_5_PLUS = bpy.app.version >= (5, 0, 0)
|
||||
|
||||
|
||||
def _image_tile_count(image) -> int:
|
||||
"""Return the number of tiles for a UDIM image, 1 for regular images."""
|
||||
if getattr(image, "source", "") == "TILED" and hasattr(image, "tiles"):
|
||||
return max(1, len(image.tiles))
|
||||
return 1
|
||||
|
||||
|
||||
def check_material(props, mat):
|
||||
e = bpy.context.scene.render.engine
|
||||
shaders = []
|
||||
@@ -62,7 +69,10 @@ def check_material(props, mat):
|
||||
if n.image not in textures:
|
||||
textures.append(n.image)
|
||||
props.texture_count += 1
|
||||
total_pixels += n.image.size[0] * n.image.size[1]
|
||||
# Multiply per-tile pixel area by tile count so that
|
||||
# UDIM images (source='TILED') report the correct total.
|
||||
n_tiles = _image_tile_count(n.image)
|
||||
total_pixels += n_tiles * n.image.size[0] * n.image.size[1]
|
||||
|
||||
maxres = max(n.image.size[0], n.image.size[1])
|
||||
props.texture_resolution_max = max(
|
||||
@@ -138,7 +148,10 @@ def check_render_engine(props, obs):
|
||||
|
||||
textures.append(n.image)
|
||||
props.texture_count += 1
|
||||
total_pixels += n.image.size[0] * n.image.size[1]
|
||||
# Multiply per-tile pixel area by tile count so that
|
||||
# UDIM images (source='TILED') report the correct total.
|
||||
n_tiles = _image_tile_count(n.image)
|
||||
total_pixels += n_tiles * n.image.size[0] * n.image.size[1]
|
||||
|
||||
maxres = max(n.image.size[0], n.image.size[1])
|
||||
props.texture_resolution_max = max(
|
||||
@@ -344,7 +357,7 @@ def check_meshprops(props, obs):
|
||||
props.manifold = manifold
|
||||
|
||||
|
||||
def countObs(props, obs):
|
||||
def count_objects(props, obs):
|
||||
ob_types = {}
|
||||
count = len(obs)
|
||||
for ob in obs:
|
||||
@@ -425,7 +438,21 @@ def get_autotags():
|
||||
check_anim(props, obs)
|
||||
check_meshprops(props, obs)
|
||||
check_modifiers(props, obs)
|
||||
countObs(props, obs)
|
||||
count_objects(props, obs)
|
||||
|
||||
elif ui.asset_type == "SCENE":
|
||||
scene = bpy.context.scene
|
||||
props = scene.blenderkit
|
||||
if props.name == "":
|
||||
props.name = scene.name
|
||||
dim, bbox_min, bbox_max = utils.get_scene_dimensions(scene)
|
||||
props.dimensions = dim
|
||||
props.bbox_min = bbox_min
|
||||
props.bbox_max = bbox_max
|
||||
scene_objects = list(scene.objects)
|
||||
check_meshprops(props, scene_objects)
|
||||
count_objects(props, scene_objects)
|
||||
|
||||
elif ui.asset_type == "MATERIAL":
|
||||
# reset some properties here, because they might not get re-filled at all when they aren't needed anymore.
|
||||
|
||||
@@ -434,6 +461,7 @@ def get_autotags():
|
||||
props.texture_resolution_max = 0
|
||||
props.texture_resolution_min = 0
|
||||
check_material(props, mat)
|
||||
|
||||
elif ui.asset_type == "HDR":
|
||||
# reset some properties here, because they might not get re-filled at all when they aren't needed anymore.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user