refactor
This commit is contained in:
parent
20458a8c5e
commit
6a89168707
7 changed files with 140 additions and 103 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import bpy
|
||||
|
||||
from .. operators.bake_to_id_map import BakeToIDMapOperator
|
||||
from ..types import get_source
|
||||
|
||||
|
||||
class BakeToIDInfoPanel(bpy.types.Panel):
|
||||
|
|
@ -16,5 +17,7 @@ class BakeToIDInfoPanel(bpy.types.Panel):
|
|||
|
||||
props = context.scene.bake_to_id_props
|
||||
|
||||
source = get_source(props.source)
|
||||
|
||||
layout.label(text="Selected Object-Count: " + str(len(context.selected_objects)))
|
||||
layout.label(text="Estimated ID-Count: " + str(BakeToIDMapOperator.count_ids(context, props)))
|
||||
layout.label(text="Estimated ID-Count: " + str(source.estimate_ids(context, props)))
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
import textwrap
|
||||
|
||||
import bpy
|
||||
|
||||
from src.types import get_source, get_target
|
||||
|
||||
|
||||
class BakeToIDOptionsPanel(bpy.types.Panel):
|
||||
bl_idname = "PANEL.BAKE_TO_ID_MAP_PT_SETTINGS_OPTIONS"
|
||||
|
|
@ -15,31 +19,15 @@ class BakeToIDOptionsPanel(bpy.types.Panel):
|
|||
props = context.scene.bake_to_id_props
|
||||
|
||||
layout.prop(props, "source")
|
||||
source = get_source(props.source)
|
||||
source_settings_box = layout.box()
|
||||
source_settings = self.get_source_settings(props)
|
||||
for setting in source_settings:
|
||||
for setting in source.connected_properties:
|
||||
source_settings_box.prop(props, setting)
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.prop(props, "target")
|
||||
target = get_target(props.target)
|
||||
target_settings_box = layout.box()
|
||||
target_settings = self.get_target_settings(props)
|
||||
for setting in target_settings:
|
||||
for setting in target.connected_properties:
|
||||
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 []
|
||||
Loading…
Add table
Add a link
Reference in a new issue