first commit

This commit is contained in:
Michel Fedde 2024-01-29 21:11:49 +01:00
commit 73df699a09
8 changed files with 482 additions and 0 deletions

16
panels/panel.py Normal file
View file

@ -0,0 +1,16 @@
import bpy
class BakeToIDMapPanel(bpy.types.Panel):
bl_idname = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS"
bl_label = "Bake to ID Map"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Tool"
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
self.layout.operator("object.bake_to_id_map", text="Bake")

24
panels/panel_advanced.py Normal file
View file

@ -0,0 +1,24 @@
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(
math.pow(math.pow(props.adv_total_hues, props.adv_total_satuations), props.adv_total_brightnesses)))

20
panels/panel_info.py Normal file
View file

@ -0,0 +1,20 @@
import bpy
from .. operators.bake_to_id_map import BakeToIDMapOperator
class BakeToIDInfoPanel(bpy.types.Panel):
bl_idname = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS_INFO"
bl_parent_id = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS"
bl_label = "Infos"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Tool"
def draw(self, context):
layout = self.layout
props = context.scene.bake_to_id_props
layout.label(text="Selected Object-Count: " + str(len(context.selected_objects)))
layout.label(text="Estimated ID-Count: " + str(BakeToIDMapOperator.count_ids(context, props)))

45
panels/panel_options.py Normal file
View file

@ -0,0 +1,45 @@
import bpy
class BakeToIDOptionsPanel(bpy.types.Panel):
bl_idname = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS_OPTIONS"
bl_parent_id = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS"
bl_label = "Options"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Tool"
def draw(self, context):
layout = self.layout
props = context.scene.bake_to_id_props
layout.prop(props, "source")
source_settings_box = layout.box()
source_settings = self.get_source_settings(props)
for setting in source_settings:
source_settings_box.prop(props, setting)
layout.separator()
layout.prop(props, "target")
target_settings_box = layout.box()
target_settings = self.get_target_settings(props)
for setting in target_settings:
target_settings_box.prop(props, setting)
def get_source_settings(self, props):
if props.source == 'MATERIAL_INDEX':
return [
'source_materials_remove_all'
]
return []
def get_target_settings(self, props):
if props.target == 'VERTEX_COLORS':
return [
'target_vertex_color_attribute_name'
]
return []