- 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
20 lines
690 B
Python
20 lines
690 B
Python
import os
|
|
from typing import Union
|
|
|
|
import bpy
|
|
|
|
|
|
def get_image(tex: bpy.types.Texture) -> bpy.types.Image:
|
|
return tex.image if tex and hasattr(tex, 'image') and tex.image else None
|
|
|
|
|
|
def get_packed_file(image: Union[bpy.types.Image, None]) -> Union[bpy.types.PackedFile, None]:
|
|
if image and not image.packed_file and _get_image_path(image):
|
|
image.pack()
|
|
return image.packed_file if image and image.packed_file else None
|
|
|
|
|
|
def _get_image_path(img: Union[bpy.types.Image, None]) -> Union[str, None]:
|
|
path = os.path.abspath(bpy.path.abspath(img.filepath)) if img else ''
|
|
return path if os.path.isfile(path) and not path.lower().endswith(('.spa', '.sph')) else None
|