Merge branch 'main' into Texture-Atlasing

This commit is contained in:
Onan Chew
2024-07-22 17:12:37 -04:00
committed by GitHub
13 changed files with 201 additions and 563 deletions
+22 -17
View File
@@ -1,10 +1,12 @@
import bpy
from ..functions.translations import t, get_languages_list, update_ui
from ..core.register import register_property
from typing import Tuple
from bpy.types import Scene, PropertyGroup, Object, Material, TextureNode, Context, SceneObjects
from bpy.props import BoolProperty, EnumProperty, FloatProperty, IntProperty, CollectionProperty, StringProperty, FloatVectorProperty, PointerProperty
from bpy.utils import register_class
class material_list_bool:
#For the love that is holy do not ever touch these. If this was java I would make these private
#They should only be accessed via context.scene.texture_atlas_Has_Mat_List_Shown
@@ -47,9 +49,14 @@ class material_list_bool:
class SceneMatClass(PropertyGroup):
mat: PointerProperty(type=Material)
def register_properties():
def register() -> None:
register_property((Scene, "language", bpy.props.EnumProperty(
name=t("Settings.language.label"),
description=t("Settings.language.desc"),
items=get_languages_list,
update=update_ui
)))
register_class(SceneMatClass)
#happy with how compressed this get_texture_node_list method is - @989onan
@@ -65,23 +72,21 @@ def register_properties():
Material.texture_atlas_albedo = EnumProperty(name="Albedo", description="The texture that will be used for the albedo map atlas", default=0, items=get_texture_node_list)
Material.texture_atlas_normal = EnumProperty(name="Normal", description="The texture that will be used for the normal map atlas", default=0, items=get_texture_node_list)
Material.texture_atlas_emission = EnumProperty(name="Emission", description="The texture that will be used for the emission map atlas", default=0, items=get_texture_node_list)
Material.texture_atlas_ambient_occlusion = EnumProperty(name="Ambient Occlusion", description="The texture that will be used for the ambient occlusion map atlas", default=0, items=get_texture_node_list)
Material.texture_atlas_height = EnumProperty(name="Height", description="The texture that will be used for the height map atlas", default=0, items=get_texture_node_list)
Material.texture_atlas_roughness = EnumProperty(name="Roughness", description="The texture that will be used for the roughness map atlas", default=0, items=get_texture_node_list)
register_property(Material, "texture_atlas_albedo", EnumProperty(name="Albedo", description="The texture that will be used for the albedo map atlas", default=0, items=get_texture_node_list))
register_property(Material, "texture_atlas_normal", EnumProperty(name="Normal", description="The texture that will be used for the normal map atlas", default=0, items=get_texture_node_list))
register_property(Material, "texture_atlas_emission", EnumProperty(name="Emission", description="The texture that will be used for the emission map atlas", default=0, items=get_texture_node_list))
register_property(Material, "texture_atlas_ambient_occlusion", EnumProperty(name="Ambient Occlusion", description="The texture that will be used for the ambient occlusion map atlas", default=0, items=get_texture_node_list))
register_property(Material, "texture_atlas_height", EnumProperty(name="Height", description="The texture that will be used for the height map atlas", default=0, items=get_texture_node_list))
register_property(Material, "texture_atlas_roughness", EnumProperty(name="Roughness", description="The texture that will be used for the roughness map atlas", default=0, items=get_texture_node_list))
Scene.texture_atlas_material_index = IntProperty(default=-1, get=(lambda self : -1), set=(lambda self,context : None))
register_property(Scene, "texture_atlas_material_index", IntProperty(default=-1, get=(lambda self : -1), set=(lambda self,context : None)))
Scene.materials = CollectionProperty(type=SceneMatClass)
register_property(Scene, "materials", CollectionProperty(type=SceneMatClass))
Scene.texture_atlas_Has_Mat_List_Shown = BoolProperty(default=False, get=material_list_bool.get_bool, set=material_list_bool.set_bool)
register_property(Scene, "texture_atlas_Has_Mat_List_Shown", BoolProperty(default=False, get=material_list_bool.get_bool, set=material_list_bool.set_bool))
#Scene.texture_atlas_properties = PointerProperty(type=Texture_Atlas_PropertyGroup)
def unregister() -> None:
pass