adds object as source

This commit is contained in:
Michel Fedde 2024-01-30 17:00:03 +01:00
parent b14c7a19db
commit 9765e28786
4 changed files with 22 additions and 3 deletions

View file

@ -1 +1 @@
1.0.0+build.18
1.1.0+build.1

View file

@ -50,4 +50,5 @@ class BakeToIDMapOperator(bpy.types.Operator):
target = get_target(props.target)
target.paint_targets(props, targets, colors)
source.after_painting(context, props)
if 'after_painting' in dir(source):
source.after_painting(context, props)

View file

@ -1,9 +1,11 @@
from . sources import material_index as source_mat_index
from . sources import object as source_object
from . targets import vertex_colors as target_vertex_colors
_sources = [
source_mat_index
source_mat_index,
source_object
]
_targets = [

View file

@ -0,0 +1,16 @@
source_id = 'OBJECT'
name = 'Object ID'
description = 'Uses the object id as basis for the ID mask.'
connected_properties = []
def get_targets(context):
targets = []
for obj in context.selected_objects:
mesh = obj.data
targets.append((mesh, mesh.polygons))
return targets
def estimate_ids(context, props):
return len(context.selected_objects)