修复SUWood系统核心问题:对象创建安全模式、材质关联、UV坐标生成和崩溃保护

主要修改:
1. 修复对象创建进入安全模式问题
   - 优化创建计数器管理
   - 提高安全模式阈值并实现批次策略
   - 添加智能重置机制

2. 解决材质关联问题
   - 在对象创建时立即应用材质
   - 修复textured_surf方法的类型检查
   - 添加简单材质备用方案

3. 实现UV坐标自动生成
   - 在mesh创建时直接生成UV层
   - 支持四边形、三角形、多边形的UV映射
   - 避免后续复杂UV操作防止闪退

4. 增强崩溃保护
   - 添加分批删除机制
   - 实现状态验证和延迟处理
   - 降低创建阈值防止内存冲突

修改文件:
- blenderpython/suw_impl.py: 核心实现逻辑
- ruby/ruby/SUWImpl.rb: 对应的Ruby实现
- test/blender_suw_client.py: 测试客户端
This commit is contained in:
libtxixi 2025-07-06 10:49:54 +08:00
parent 38ee282a60
commit c7544e6a2f
3 changed files with 2226 additions and 601 deletions

File diff suppressed because it is too large Load Diff

View File

@ -995,7 +995,7 @@ module SUWood
oid = data.fetch("oid")
if typ == "wall"
zones = get_zones(data)
zones = get_zones(data)
zone = zones.fetch(oid, nil)
wall = data.fetch("wall")
zone.entities.each{|entity|

View File

@ -59,9 +59,10 @@ try:
start_time = time.time()
try:
if hasattr(suw_impl, actual_cmd_type):
print(f"🔍 查找到命令方法: {actual_cmd_type}")
print(
f"🔍 [{time.strftime('%H:%M:%S')}] 查找到命令方法: {actual_cmd_type}")
method = getattr(suw_impl, actual_cmd_type)
print(f"开始执行命令...")
print(f"[{time.strftime('%H:%M:%S')}] 开始执行命令...")
result = method(actual_data)
@ -70,7 +71,8 @@ try:
f"✅ [{time.strftime('%H:%M:%S')}] 命令 '{actual_cmd_type}' 执行成功!")
print(f"⏱️ 执行耗时: {elapsed_time:.3f}")
if result is not None:
print(f"📋 执行结果: {result}")
print(
f"📋 [{time.strftime('%H:%M:%S')}] 执行结果: {result}")
else:
print(f"📋 执行结果: 无返回值")