suwoodblender/blenderpython/__init__.py

105 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
BlenderPython - SUWood Python翻译包
原Ruby代码翻译为Python版本适配Blender环境
主要模块:
- suw_constants: 常量定义
- suw_client: TCP客户端通信
- suw_observer: 事件观察者
- suw_impl: 核心实现(待翻译)
- suw_menu: 菜单系统(待翻译)
- 各种工具模块(待翻译)
"""
__version__ = "1.0.0"
__author__ = "Ruby to Python Translator"
__description__ = "SUWood Ruby代码的Python翻译版本"
# 导入主要模块
try:
from . import suw_constants
from . import suw_client
from . import suw_observer
from . import suw_load
# 尝试导入其他模块(如果存在)
try:
from . import suw_impl
except ImportError:
print("⚠️ suw_impl 模块待翻译")
try:
from . import suw_menu
except ImportError:
print("⚠️ suw_menu 模块待翻译")
print("✅ BlenderPython SUWood 包加载成功")
except ImportError as e:
print(f"❌ 包加载错误: {e}")
# 包级别的便捷函数
def get_version():
"""获取版本信息"""
return __version__
def get_modules():
"""获取已加载的模块列表"""
import sys
package_name = __name__
modules = []
for module_name in sys.modules:
if module_name.startswith(package_name + '.'):
modules.append(module_name.split('.')[-1])
return modules
def check_dependencies():
"""检查依赖项"""
dependencies = {
"bpy": "Blender Python API",
"socket": "网络通信",
"json": "JSON处理",
"threading": "多线程支持"
}
available = {}
for dep, desc in dependencies.items():
try:
__import__(dep)
available[dep] = True
except ImportError:
available[dep] = False
return available
if __name__ == "__main__":
print(f"🚀 BlenderPython SUWood v{__version__}")
print("=" * 50)
# 显示模块信息
modules = get_modules()
print(f"📦 已加载模块: {modules}")
# 检查依赖
deps = check_dependencies()
print("\n🔍 依赖检查:")
for dep, available in deps.items():
status = "" if available else ""
print(f" {status} {dep}")
print("\n📚 待翻译的Ruby文件:")
pending_files = [
"SUWImpl.rb (核心实现2019行)",
"SUWMenu.rb (菜单系统)",
"SUWUnitPointTool.rb (点工具)",
"SUWUnitFaceTool.rb (面工具)",
"SUWUnitContTool.rb (轮廓工具)",
"SUWZoneDiv1Tool.rb (区域分割工具)"
]
for file in pending_files:
print(f"{file}")