Atlas Materials UI Update
- Separated things out so it looks better. - Done small changes to make the ui look a bit better. - UI auto refreshes after a successful atlas.
This commit is contained in:
@@ -280,6 +280,17 @@ class AvatarToolKit_OT_AtlasMaterials(Operator):
|
|||||||
mesh.materials[i] = atlased_mat.material
|
mesh.materials[i] = atlased_mat.material
|
||||||
progress.step(f"Updated materials for {obj.name}")
|
progress.step(f"Updated materials for {obj.name}")
|
||||||
|
|
||||||
|
MaterialListBool.old_list.pop(context.scene.name, None)
|
||||||
|
was_open = context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown
|
||||||
|
context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown = False
|
||||||
|
|
||||||
|
if was_open:
|
||||||
|
bpy.ops.avatar_toolkit.expand_section_materials()
|
||||||
|
|
||||||
|
for area in context.screen.areas:
|
||||||
|
if area.type == 'VIEW_3D':
|
||||||
|
area.tag_redraw()
|
||||||
|
|
||||||
logger.info("Material atlas creation completed successfully")
|
logger.info("Material atlas creation completed successfully")
|
||||||
self.report({'INFO'}, t("TextureAtlas.atlas_completed"))
|
self.report({'INFO'}, t("TextureAtlas.atlas_completed"))
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|||||||
@@ -472,6 +472,23 @@
|
|||||||
"TextureAtlas.ambient_occlusion": "Ambient Occlusion",
|
"TextureAtlas.ambient_occlusion": "Ambient Occlusion",
|
||||||
"TextureAtlas.height": "Height",
|
"TextureAtlas.height": "Height",
|
||||||
"TextureAtlas.roughness": "Roughness",
|
"TextureAtlas.roughness": "Roughness",
|
||||||
|
"TextureAtlas.description_1": "Create a single material with combined textures",
|
||||||
|
"TextureAtlas.description_2": "to optimize your avatar for better performance.",
|
||||||
|
"TextureAtlas.texture_maps": "Texture Maps",
|
||||||
|
"TextureAtlas.material_ready": "Material is ready for atlas",
|
||||||
|
"TextureAtlas.material_not_ready": "Material needs at least one texture",
|
||||||
|
"TextureAtlas.select_all_tooltip": "Select all materials for atlas",
|
||||||
|
"TextureAtlas.select_none_tooltip": "Deselect all materials",
|
||||||
|
"TextureAtlas.expand_all_tooltip": "Expand all material settings",
|
||||||
|
"TextureAtlas.collapse_all_tooltip": "Collapse all material settings",
|
||||||
|
"TextureAtlas.estimated_size": "Estimated Atlas Size",
|
||||||
|
"TextureAtlas.materials": "materials",
|
||||||
|
"TextureAtlas.no_materials_selected": "No materials selected",
|
||||||
|
"TextureAtlas.select_armature_first": "Please select an armature first",
|
||||||
|
"TextureAtlas.how_to_use_1": "1. Select an armature in the scene",
|
||||||
|
"TextureAtlas.how_to_use_2": "2. Click 'Load Materials' to begin",
|
||||||
|
"TextureAtlas.load_error": "Error loading materials. Check console for details.",
|
||||||
|
"TextureAtlas.material_not_included": "Material is not included in atlas",
|
||||||
|
|
||||||
"Settings.label": "Settings",
|
"Settings.label": "Settings",
|
||||||
"Settings.language": "Language",
|
"Settings.language": "Language",
|
||||||
|
|||||||
@@ -472,6 +472,23 @@
|
|||||||
"TextureAtlas.ambient_occlusion": "アンビエントオクルージョン",
|
"TextureAtlas.ambient_occlusion": "アンビエントオクルージョン",
|
||||||
"TextureAtlas.height": "高さ",
|
"TextureAtlas.height": "高さ",
|
||||||
"TextureAtlas.roughness": "粗さ",
|
"TextureAtlas.roughness": "粗さ",
|
||||||
|
"TextureAtlas.description_1": "テクスチャを組み合わせた単一のマテリアルを作成",
|
||||||
|
"TextureAtlas.description_2": "アバターのパフォーマンスを最適化します。",
|
||||||
|
"TextureAtlas.texture_maps": "テクスチャマップ",
|
||||||
|
"TextureAtlas.material_ready": "マテリアルはアトラス作成の準備ができています",
|
||||||
|
"TextureAtlas.material_not_ready": "マテリアルには少なくとも1つのテクスチャが必要です",
|
||||||
|
"TextureAtlas.select_all_tooltip": "すべてのマテリアルを選択",
|
||||||
|
"TextureAtlas.select_none_tooltip": "すべての選択を解除",
|
||||||
|
"TextureAtlas.expand_all_tooltip": "すべてのマテリアル設定を展開",
|
||||||
|
"TextureAtlas.collapse_all_tooltip": "すべてのマテリアル設定を折りたたむ",
|
||||||
|
"TextureAtlas.estimated_size": "推定アトラスサイズ",
|
||||||
|
"TextureAtlas.materials": "マテリアル",
|
||||||
|
"TextureAtlas.no_materials_selected": "マテリアルが選択されていません",
|
||||||
|
"TextureAtlas.select_armature_first": "最初にアーマチュアを選択してください",
|
||||||
|
"TextureAtlas.how_to_use_1": "1. シーン内のアーマチュアを選択",
|
||||||
|
"TextureAtlas.how_to_use_2": "2. 「マテリアルを読み込む」をクリックして開始",
|
||||||
|
"TextureAtlas.load_error": "マテリアルの読み込みエラー。詳細はコンソールを確認してください。",
|
||||||
|
"TextureAtlas.material_not_included": "マテリアルはアトラスに含まれていません",
|
||||||
|
|
||||||
"Settings.label": "設定",
|
"Settings.label": "設定",
|
||||||
"Settings.language": "言語",
|
"Settings.language": "言語",
|
||||||
|
|||||||
@@ -472,6 +472,23 @@
|
|||||||
"TextureAtlas.ambient_occlusion": "앰비언트 오클루전",
|
"TextureAtlas.ambient_occlusion": "앰비언트 오클루전",
|
||||||
"TextureAtlas.height": "높이",
|
"TextureAtlas.height": "높이",
|
||||||
"TextureAtlas.roughness": "거칠기",
|
"TextureAtlas.roughness": "거칠기",
|
||||||
|
"TextureAtlas.description_1": "텍스처를 결합한 단일 재질 생성",
|
||||||
|
"TextureAtlas.description_2": "아바타의 성능을 최적화합니다.",
|
||||||
|
"TextureAtlas.texture_maps": "텍스처 맵",
|
||||||
|
"TextureAtlas.material_ready": "재질이 아틀라스 생성 준비가 되었습니다",
|
||||||
|
"TextureAtlas.material_not_ready": "재질에는 최소 하나의 텍스처가 필요합니다",
|
||||||
|
"TextureAtlas.select_all_tooltip": "모든 재질 선택",
|
||||||
|
"TextureAtlas.select_none_tooltip": "모든 선택 해제",
|
||||||
|
"TextureAtlas.expand_all_tooltip": "모든 재질 설정 펼치기",
|
||||||
|
"TextureAtlas.collapse_all_tooltip": "모든 재질 설정 접기",
|
||||||
|
"TextureAtlas.estimated_size": "예상 아틀라스 크기",
|
||||||
|
"TextureAtlas.materials": "재질",
|
||||||
|
"TextureAtlas.no_materials_selected": "선택된 재질이 없습니다",
|
||||||
|
"TextureAtlas.select_armature_first": "먼저 아마추어를 선택해주세요",
|
||||||
|
"TextureAtlas.how_to_use_1": "1. 장면에서 아마추어 선택",
|
||||||
|
"TextureAtlas.how_to_use_2": "2. '재질 불러오기'를 클릭하여 시작",
|
||||||
|
"TextureAtlas.load_error": "재질 로딩 오류. 자세한 내용은 콘솔을 확인하세요.",
|
||||||
|
"TextureAtlas.material_not_included": "재질이 아틀라스에 포함되지 않았습니다",
|
||||||
|
|
||||||
"Settings.label": "설정",
|
"Settings.label": "설정",
|
||||||
"Settings.language": "언어",
|
"Settings.language": "언어",
|
||||||
|
|||||||
+122
-27
@@ -5,6 +5,7 @@ from .main_panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
|
|||||||
from ..core.common import SceneMatClass, MaterialListBool, get_active_armature
|
from ..core.common import SceneMatClass, MaterialListBool, get_active_armature
|
||||||
from ..functions.atlas_materials import AvatarToolKit_OT_AtlasMaterials
|
from ..functions.atlas_materials import AvatarToolKit_OT_AtlasMaterials
|
||||||
from ..core.translations import t
|
from ..core.translations import t
|
||||||
|
from ..core.logging_setup import logger
|
||||||
|
|
||||||
class AvatarToolKit_OT_SelectAllMaterials(Operator):
|
class AvatarToolKit_OT_SelectAllMaterials(Operator):
|
||||||
bl_idname = 'avatar_toolkit.select_all_materials'
|
bl_idname = 'avatar_toolkit.select_all_materials'
|
||||||
@@ -56,9 +57,12 @@ class AvatarToolKit_OT_ExpandSectionMaterials(Operator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, context: Context) -> set:
|
def execute(self, context: Context) -> set:
|
||||||
|
try:
|
||||||
if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
||||||
context.scene.avatar_toolkit.materials.clear()
|
context.scene.avatar_toolkit.materials.clear()
|
||||||
newlist: list[Material] = []
|
newlist: list[Material] = []
|
||||||
|
|
||||||
|
logger.debug("Loading materials for texture atlas")
|
||||||
for obj in context.scene.objects:
|
for obj in context.scene.objects:
|
||||||
if len(obj.material_slots) > 0:
|
if len(obj.material_slots) > 0:
|
||||||
for mat_slot in obj.material_slots:
|
for mat_slot in obj.material_slots:
|
||||||
@@ -67,11 +71,19 @@ class AvatarToolKit_OT_ExpandSectionMaterials(Operator):
|
|||||||
newlist.append(mat_slot.material)
|
newlist.append(mat_slot.material)
|
||||||
newitem: SceneMatClass = context.scene.avatar_toolkit.materials.add()
|
newitem: SceneMatClass = context.scene.avatar_toolkit.materials.add()
|
||||||
newitem.mat = mat_slot.material
|
newitem.mat = mat_slot.material
|
||||||
|
|
||||||
MaterialListBool.old_list[context.scene.name] = newlist
|
MaterialListBool.old_list[context.scene.name] = newlist
|
||||||
context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown = True
|
context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown = True
|
||||||
|
logger.info(f"Loaded {len(newlist)} materials for texture atlas")
|
||||||
else:
|
else:
|
||||||
context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown = False
|
context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown = False
|
||||||
|
logger.debug("Hiding material list")
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error loading materials: {str(e)}", exc_info=True)
|
||||||
|
self.report({'ERROR'}, t("TextureAtlas.load_error"))
|
||||||
|
return {'CANCELLED'}
|
||||||
|
|
||||||
class AvatarToolKit_UL_MaterialTextureAtlasProperties(UIList):
|
class AvatarToolKit_UL_MaterialTextureAtlasProperties(UIList):
|
||||||
bl_label = t("TextureAtlas.material_list_label")
|
bl_label = t("TextureAtlas.material_list_label")
|
||||||
@@ -81,17 +93,30 @@ class AvatarToolKit_UL_MaterialTextureAtlasProperties(UIList):
|
|||||||
|
|
||||||
def draw_header(self, context):
|
def draw_header(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
row = layout.row(align=True)
|
|
||||||
|
|
||||||
row.operator("avatar_toolkit.select_all_materials", text="", icon='CHECKBOX_HLT')
|
row = layout.row(align=True)
|
||||||
row.operator("avatar_toolkit.select_none_materials", text="", icon='CHECKBOX_DEHLT')
|
row.scale_y = 1.2
|
||||||
row.operator("avatar_toolkit.expand_all_materials", text="", icon='DISCLOSURE_TRI_DOWN')
|
|
||||||
row.operator("avatar_toolkit.collapse_all_materials", text="", icon='DISCLOSURE_TRI_RIGHT')
|
row.operator("avatar_toolkit.select_all_materials", text="", icon='CHECKBOX_HLT',
|
||||||
row.prop(context.scene.avatar_toolkit, "material_search_filter", text="", icon='VIEWZOOM')
|
emboss=True).tooltip = t("TextureAtlas.select_all_tooltip")
|
||||||
|
row.operator("avatar_toolkit.select_none_materials", text="", icon='CHECKBOX_DEHLT',
|
||||||
|
emboss=True).tooltip = t("TextureAtlas.select_none_tooltip")
|
||||||
|
row.separator(factor=0.5)
|
||||||
|
row.operator("avatar_toolkit.expand_all_materials", text="", icon='DISCLOSURE_TRI_DOWN',
|
||||||
|
emboss=True).tooltip = t("TextureAtlas.expand_all_tooltip")
|
||||||
|
row.operator("avatar_toolkit.collapse_all_materials", text="", icon='DISCLOSURE_TRI_RIGHT',
|
||||||
|
emboss=True).tooltip = t("TextureAtlas.collapse_all_tooltip")
|
||||||
|
|
||||||
|
row.separator(factor=1.0)
|
||||||
|
search_row = row.row()
|
||||||
|
search_row.scale_x = 2.0
|
||||||
|
search_row.prop(context.scene.avatar_toolkit, "material_search_filter", text="", icon='VIEWZOOM')
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
row = box.row()
|
size_row = box.row()
|
||||||
row.label(text=f"Estimated Atlas Size: {self.calculate_atlas_size(context)}px")
|
size_row.alignment = 'CENTER'
|
||||||
|
size_text = self.calculate_atlas_size(context)
|
||||||
|
size_row.label(text=f"{t('TextureAtlas.estimated_size')}: {size_text}px", icon='TEXTURE')
|
||||||
|
|
||||||
def draw_item(self, context: Context, layout: UILayout, data: Object, item: SceneMatClass, icon, active_data, active_propname, index):
|
def draw_item(self, context: Context, layout: UILayout, data: Object, item: SceneMatClass, icon, active_data, active_propname, index):
|
||||||
if context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
if context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
||||||
@@ -99,34 +124,64 @@ class AvatarToolKit_UL_MaterialTextureAtlasProperties(UIList):
|
|||||||
context.scene.avatar_toolkit.material_search_filter.lower() not in item.mat.name.lower()):
|
context.scene.avatar_toolkit.material_search_filter.lower() not in item.mat.name.lower()):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Main material
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
row.prop(item.mat, "include_in_atlas", text="",
|
||||||
|
icon='CHECKBOX_HLT' if item.mat.include_in_atlas else 'CHECKBOX_DEHLT',
|
||||||
|
emboss=False)
|
||||||
|
|
||||||
row.prop(item.mat, "include_in_atlas", text="", icon='CHECKBOX_HLT' if item.mat.include_in_atlas else 'CHECKBOX_DEHLT')
|
# Material name
|
||||||
|
|
||||||
row.prop(item.mat, "material_expanded",
|
row.prop(item.mat, "material_expanded",
|
||||||
text=item.mat.name,
|
text=item.mat.name,
|
||||||
icon='DOWNARROW_HLT' if item.mat.material_expanded else 'RIGHTARROW',
|
icon='DOWNARROW_HLT' if item.mat.material_expanded else 'RIGHTARROW',
|
||||||
emboss=False)
|
emboss=False)
|
||||||
|
|
||||||
if item.mat.material_expanded and item.mat.include_in_atlas:
|
row.label(text="", icon='MATERIAL')
|
||||||
|
|
||||||
|
if item.mat.material_expanded:
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
col = box.column(align=True)
|
col = box.column(align=True)
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_albedo", "IMAGE_RGB")
|
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_normal", "NORMALS_FACE")
|
header_row = col.row()
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_emission", "LIGHT")
|
header_row.alignment = 'CENTER'
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_ambient_occlusion", "SHADING_SOLID")
|
header_row.label(text=t("TextureAtlas.texture_maps"), icon='IMAGE')
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_height", "IMAGE_ZDEPTH")
|
col.separator(factor=0.5)
|
||||||
self.draw_texture_row(col, item.mat, "texture_atlas_roughness", "MATERIAL")
|
self.draw_texture_row(col, item.mat, "texture_atlas_albedo", "IMAGE_RGB", t("TextureAtlas.albedo"))
|
||||||
|
self.draw_texture_row(col, item.mat, "texture_atlas_normal", "NORMALS_FACE", t("TextureAtlas.normal"))
|
||||||
|
self.draw_texture_row(col, item.mat, "texture_atlas_emission", "LIGHT", t("TextureAtlas.emission"))
|
||||||
|
self.draw_texture_row(col, item.mat, "texture_atlas_ambient_occlusion", "SHADING_SOLID", t("TextureAtlas.ambient_occlusion"))
|
||||||
|
self.draw_texture_row(col, item.mat, "texture_atlas_height", "IMAGE_ZDEPTH", t("TextureAtlas.height"))
|
||||||
|
self.draw_texture_row(col, item.mat, "texture_atlas_roughness", "MATERIAL", t("TextureAtlas.roughness"))
|
||||||
|
|
||||||
col.separator(factor=0.5)
|
col.separator(factor=0.5)
|
||||||
|
|
||||||
def draw_texture_row(self, layout, material, prop_name, icon):
|
status_row = col.row()
|
||||||
row = layout.row()
|
status_row.alignment = 'CENTER'
|
||||||
row.prop(material, prop_name, icon=icon)
|
is_ready = self.is_material_ready(item.mat)
|
||||||
if getattr(material, prop_name):
|
|
||||||
row.label(text="", icon='CHECKMARK')
|
if item.mat.include_in_atlas:
|
||||||
|
status_text = t("TextureAtlas.material_ready") if is_ready else t("TextureAtlas.material_not_ready")
|
||||||
|
status_icon = 'CHECKMARK' if is_ready else 'ERROR'
|
||||||
else:
|
else:
|
||||||
row.label(text="", icon='X')
|
status_text = t("TextureAtlas.material_not_included")
|
||||||
|
status_icon = 'INFO'
|
||||||
|
|
||||||
|
status_row.label(text=status_text, icon=status_icon)
|
||||||
|
|
||||||
|
def draw_texture_row(self, layout, material, prop_name, icon, label_text):
|
||||||
|
row = layout.row(align=True)
|
||||||
|
icon_row = row.row()
|
||||||
|
icon_row.scale_x = 0.5
|
||||||
|
icon_row.label(text="", icon=icon)
|
||||||
|
|
||||||
|
# Texture selector
|
||||||
|
row.prop(material, prop_name, text=label_text)
|
||||||
|
status_row = row.row()
|
||||||
|
status_row.scale_x = 0.5
|
||||||
|
if getattr(material, prop_name):
|
||||||
|
status_row.label(text="", icon='CHECKMARK')
|
||||||
|
else:
|
||||||
|
status_row.label(text="", icon='X')
|
||||||
|
|
||||||
def is_material_ready(self, material):
|
def is_material_ready(self, material):
|
||||||
return bool(material.texture_atlas_albedo or
|
return bool(material.texture_atlas_albedo or
|
||||||
@@ -135,12 +190,21 @@ class AvatarToolKit_UL_MaterialTextureAtlasProperties(UIList):
|
|||||||
|
|
||||||
def calculate_atlas_size(self, context):
|
def calculate_atlas_size(self, context):
|
||||||
total_size = 0
|
total_size = 0
|
||||||
|
selected_count = 0
|
||||||
|
|
||||||
for mat in context.scene.avatar_toolkit.materials:
|
for mat in context.scene.avatar_toolkit.materials:
|
||||||
if mat.mat.include_in_atlas:
|
if mat.mat.include_in_atlas:
|
||||||
|
selected_count += 1
|
||||||
if mat.mat.texture_atlas_albedo:
|
if mat.mat.texture_atlas_albedo:
|
||||||
img = bpy.data.images[mat.mat.texture_atlas_albedo]
|
img = bpy.data.images[mat.mat.texture_atlas_albedo]
|
||||||
total_size += img.size[0] * img.size[1]
|
total_size += img.size[0] * img.size[1]
|
||||||
return f"{int(sqrt(total_size))}x{int(sqrt(total_size))}"
|
|
||||||
|
if total_size == 0:
|
||||||
|
return f"0x0 ({t('TextureAtlas.no_materials_selected')})"
|
||||||
|
size = int(sqrt(total_size))
|
||||||
|
pot_size = 2 ** (size - 1).bit_length() # Next power of 2
|
||||||
|
|
||||||
|
return f"{pot_size}x{pot_size} ({selected_count} {t('TextureAtlas.materials')})"
|
||||||
|
|
||||||
class AvatarToolKit_PT_TextureAtlasPanel(Panel):
|
class AvatarToolKit_PT_TextureAtlasPanel(Panel):
|
||||||
bl_label = t("TextureAtlas.label")
|
bl_label = t("TextureAtlas.label")
|
||||||
@@ -156,16 +220,26 @@ class AvatarToolKit_PT_TextureAtlasPanel(Panel):
|
|||||||
armature = get_active_armature(context)
|
armature = get_active_armature(context)
|
||||||
|
|
||||||
if armature:
|
if armature:
|
||||||
layout.label(text=t("TextureAtlas.label"), icon='TEXTURE')
|
header_row = layout.row()
|
||||||
|
header_row.label(text=t("TextureAtlas.label"), icon='TEXTURE')
|
||||||
layout.separator(factor=0.5)
|
layout.separator(factor=0.5)
|
||||||
|
info_box = layout.box()
|
||||||
|
info_col = info_box.column()
|
||||||
|
info_col.scale_y = 0.9
|
||||||
|
info_col.label(text=t("TextureAtlas.description_1"), icon='INFO')
|
||||||
|
info_col.label(text=t("TextureAtlas.description_2"))
|
||||||
|
|
||||||
|
layout.separator(factor=0.5)
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
row = box.row()
|
row = box.row(align=True)
|
||||||
|
row.scale_y = 1.2
|
||||||
direction_icon = 'RIGHTARROW' if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown else 'DOWNARROW_HLT'
|
direction_icon = 'RIGHTARROW' if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown else 'DOWNARROW_HLT'
|
||||||
|
button_text = t("TextureAtlas.reload_list") if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown else t("TextureAtlas.loaded_list")
|
||||||
row.operator(AvatarToolKit_OT_ExpandSectionMaterials.bl_idname,
|
row.operator(AvatarToolKit_OT_ExpandSectionMaterials.bl_idname,
|
||||||
text=(t("TextureAtlas.reload_list") if not context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown else t("TextureAtlas.loaded_list")),
|
text=button_text,
|
||||||
icon=direction_icon)
|
icon=direction_icon)
|
||||||
|
|
||||||
|
# Material list expanded
|
||||||
if context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
if context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.template_list(AvatarToolKit_UL_MaterialTextureAtlasProperties.bl_idname,
|
row.template_list(AvatarToolKit_UL_MaterialTextureAtlasProperties.bl_idname,
|
||||||
@@ -181,8 +255,29 @@ class AvatarToolKit_PT_TextureAtlasPanel(Panel):
|
|||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.scale_y = 1.5
|
row.scale_y = 1.5
|
||||||
|
row.enabled = context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown
|
||||||
|
|
||||||
|
has_selected = False
|
||||||
|
if context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
||||||
|
for item in context.scene.avatar_toolkit.materials:
|
||||||
|
if item.mat.include_in_atlas:
|
||||||
|
has_selected = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if not has_selected and context.scene.avatar_toolkit.texture_atlas_Has_Mat_List_Shown:
|
||||||
|
row.operator(AvatarToolKit_OT_AtlasMaterials.bl_idname,
|
||||||
|
text=t("TextureAtlas.no_materials_selected"),
|
||||||
|
icon='ERROR')
|
||||||
|
else:
|
||||||
row.operator(AvatarToolKit_OT_AtlasMaterials.bl_idname,
|
row.operator(AvatarToolKit_OT_AtlasMaterials.bl_idname,
|
||||||
text=t("TextureAtlas.atlas_materials"),
|
text=t("TextureAtlas.atlas_materials"),
|
||||||
icon='NODE_TEXTURE')
|
icon='NODE_TEXTURE')
|
||||||
else:
|
else:
|
||||||
layout.label(text=t("Tools.select_armature"), icon='ERROR')
|
layout.label(text=t("Tools.select_armature"), icon='ERROR')
|
||||||
|
|
||||||
|
box = layout.box()
|
||||||
|
col = box.column()
|
||||||
|
col.scale_y = 0.9
|
||||||
|
col.label(text=t("TextureAtlas.select_armature_first"), icon='INFO')
|
||||||
|
col.label(text=t("TextureAtlas.how_to_use_1"))
|
||||||
|
col.label(text=t("TextureAtlas.how_to_use_2"))
|
||||||
|
|||||||
Reference in New Issue
Block a user