fixes crash when baking without enough colors
This commit is contained in:
parent
c16e4c268b
commit
28ab2072e5
3 changed files with 2 additions and 26 deletions
|
|
@ -10,7 +10,6 @@ bl_info = {
|
|||
import bpy
|
||||
|
||||
from . panels.panel_options import BakeToIDOptionsPanel
|
||||
from . panels.panel_advanced import BakeToIDAdvancedMenu
|
||||
from . operators.bake_to_id_map import BakeToIDMapOperator
|
||||
from . panels.panel import BakeToIDMapPanel
|
||||
from . panels.panel_info import BakeToIDInfoPanel
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import math
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
class BakeToIDAdvancedMenu(bpy.types.Panel):
|
||||
bl_idname = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS_ADVANCED"
|
||||
bl_parent_id = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS"
|
||||
bl_label = "Advanced"
|
||||
bl_space_type = "VIEW_3D"
|
||||
bl_region_type = "UI"
|
||||
bl_category = "Tool"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
props = context.scene.bake_to_id_props
|
||||
layout.label(text="Colors")
|
||||
layout.prop(props, "adv_total_hues")
|
||||
layout.prop(props, "adv_total_satuations")
|
||||
layout.prop(props, "adv_total_brightnesses")
|
||||
layout.label(text="Max ID-count: " + str(
|
||||
))
|
||||
|
|
@ -10,6 +10,7 @@ connected_properties = [
|
|||
|
||||
def paint_targets(props, targets, colors):
|
||||
sorted_targets = {}
|
||||
colors_amount = len(colors)
|
||||
for i in range(len(targets)):
|
||||
target = targets[i]
|
||||
obj = target[0]
|
||||
|
|
@ -18,7 +19,7 @@ def paint_targets(props, targets, colors):
|
|||
if obj not in sorted_targets:
|
||||
sorted_targets[obj] = []
|
||||
|
||||
sorted_targets[obj].append((indecies, colors[i]))
|
||||
sorted_targets[obj].append((indecies, colors[i % colors_amount]))
|
||||
|
||||
layer_name = props.target_vertex_color_attribute_name
|
||||
for mesh in sorted_targets:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue