feat: Add KoikatsuBlenderPipeline addon with import/export functionality
- Add core addon files (__init__.py, KKPanel.py, preferences.py, common.py) - Add import pipeline with armature, mesh, and material modification modules - Add export pipeline with material baking and FBX preparation utilities - Add material combiner tool for texture atlas generation and optimization - Add extras utilities for animation, rigging, and asset management - Add bone orientation data from better_fbx for accurate skeletal structure - Add comprehensive documentation and wiki with multi-language support (EN, JP, ZH) - Add animation library retargeting lists for ARP and Rokoko motion capture - Add Rigify integration scripts for advanced rigging workflows - Add shader file (KK Shader V8.0.blend) for material rendering - Add manifest and license files for addon distribution - Add changelog documenting version history and improvements - Initialize complete Blender addon project for Koikatsu character import/export
This commit is contained in:
27
extras/matcombswitch.py
Normal file
27
extras/matcombswitch.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import bpy
|
||||
from ..interface.dictionary_en import t
|
||||
from .. import common as c
|
||||
|
||||
class mat_comb_switch(bpy.types.Operator):
|
||||
bl_idname = "kkbp.matcombswitch"
|
||||
bl_label = "Material combiner switch"
|
||||
bl_description = t('mat_comb_switch_tt')
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
#toggle textures for the combiner script
|
||||
for obj in [o for o in bpy.data.collections[c.get_name() + '.001'].all_objects if not o.hide_get() and o.type == 'MESH']:
|
||||
for mat in [mat_slot.material for mat_slot in obj.material_slots if mat_slot.material.get('simple')]:
|
||||
nodes = mat.node_tree.nodes
|
||||
#find the image node
|
||||
image_node = None
|
||||
for node in nodes:
|
||||
if node.type == 'TEX_IMAGE':
|
||||
image_node = node
|
||||
if image_node:
|
||||
#toggle light / dark state
|
||||
image_node.image = nodes['textures'].node_tree.nodes['dark' if image_node.image == nodes['textures'].node_tree.nodes['light'].image else 'light'].image
|
||||
context.view_layer.objects.active = obj
|
||||
bpy.ops.object.material_slot_remove_unused()
|
||||
|
||||
return {'FINISHED'}
|
||||
Reference in New Issue
Block a user