Files
KKBP_Importer/extras/linkhair.py
小煜 5d9e09e9c3 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
2025-12-06 15:26:19 +08:00

27 lines
1.2 KiB
Python

#This script takes a source hair material and copies all of it's attributes to all target hair materials on the same object
# so you don't have to manually change every single hair material yourself
import bpy
from ..interface.dictionary_en import t
class link_hair(bpy.types.Operator):
bl_idname = "kkbp.linkhair"
bl_label = "Link hair"
bl_description = t('link_hair_tt')
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
#get the currently selected hair material
object = bpy.context.object
source_material = object.active_material
for type in ['light', 'dark']:
if source_material.node_tree.nodes.get(type):
for target_material in [s.material for s in object.material_slots if s.material.get('hair')]:
if target_material.node_tree.nodes.get(type):
#copy all of the hair settings for this node group to the target material
for index, input in enumerate(target_material.node_tree.nodes[type].inputs):
input.default_value = source_material.node_tree.nodes[type].inputs[index].default_value
return {'FINISHED'}