Skip to content

Commit

Permalink
add: /issues/24#issuecomment-1433381106
Browse files Browse the repository at this point in the history
  • Loading branch information
KirilStrezikozin committed Feb 16, 2023
1 parent e7f374f commit e66198e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
16 changes: 16 additions & 0 deletions properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ class BM_SceneProps_TextureSet(bpy.types.PropertyGroup):

global_textureset_index : bpy.props.IntProperty()

syncer_use : bpy.props.BoolProperty(
name="",
description="Enable one object to dictate maps, channel packs, and bake settings for all others in the current texture set",
default=False)

syncer_object_name : bpy.props.EnumProperty(
name="Sync with",
description="Choose an object from the ones in the current texture set",
items=BM_TEXSET_OBJECT_PROPS_syncer_Items,
update=BM_TEXSET_OBJECT_PROPS_syncer_Sync)

syncer_use_dictate_bake_output : bpy.props.BoolProperty(
name="Sync Bake Output Settings",
description="Channel packs and maps settings are synced with enabling 'Sync with', check this option to sync bake settings as well",
default=True)

uvp_use_uv_repack : bpy.props.BoolProperty(
name="UV Repack",
description="Enable UV Repacking for Texture Set Objects.\nWarning: if Objects have materials that depend on UV Layout, enabling this option might change the result of these materials",
Expand Down
9 changes: 9 additions & 0 deletions ui_panel_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,15 @@ def draw(self, context):
texset_column.use_property_split = True
texset_column.use_property_decorate = False

texset_syncer_column = texset_column.column(align=True)
texset_column_syncer_row = texset_syncer_column.row(align=True)
texset_column_syncer_row.prop(texset, 'syncer_use', text="")
texset_column_syncer_row.prop(texset, 'syncer_object_name')
if texset.syncer_use:
texset_syncer_column.prop(texset, 'syncer_use_dictate_bake_output')
texset_syncer_column.active = texset.syncer_use
texset_column.separator(factor=1.0)

texset_column.prop(texset, 'uvp_use_uv_repack')
if texset.uvp_use_uv_repack:
texset_column.prop(texset, 'uvp_use_islands_rotate')
Expand Down
16 changes: 16 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,22 @@ def BM_ITEM_PROPS_nm_uni_container_is_global_Update(self, context):
###############################################################
### Texture Sets Funcs ###
###############################################################
def BM_TEXSET_OBJECT_PROPS_syncer_Items(self, context):
items = []
for texset_item in self.global_textureset_table_of_objects:
source_object = context.scene.bm_table_of_objects[texset_item.global_source_object_index]
if not source_object.nm_is_universal_container:
items.append((texset_item.global_source_object_index, texset_item.global_object_name_include, "Object in the current texset"))

This comment has been minimized.

Copy link
@KirilStrezikozin

KirilStrezikozin Feb 16, 2023

Author Owner

only values of str type allowed. need to fix

elif source_object.nm_uni_container_is_global:
items.append((texset_item.global_source_object_index, texset_item.global_object_name_include, "Global Container in the current texset"))
else:
items += [(subitem.global_source_object_index, subitem.global_object_name, "Subobject in the current texset") for subitem in texset_item.global_object_name_subitems]
return items

def BM_TEXSET_OBJECT_PROPS_syncer_Sync(self, context):
pass


def BM_TEXSET_OBJECT_PROPS_global_object_name_Items(self, context):
new_items = []

Expand Down

0 comments on commit e66198e

Please sign in to comment.