addRender #7
@ -14,7 +14,7 @@ from direct.actor.Actor import Actor
|
|||||||
from direct.gui import DirectGui
|
from direct.gui import DirectGui
|
||||||
from idna import check_label
|
from idna import check_label
|
||||||
from jinja2.compiler import has_safe_repr
|
from jinja2.compiler import has_safe_repr
|
||||||
from panda3d.core import Vec3, Vec4, transpose, TransparencyAttrib, PartGroup, ColorAttrib, NodePath
|
from panda3d.core import Vec3, Vec4, transpose, TransparencyAttrib, PartGroup, ColorAttrib, NodePath, Point3
|
||||||
from scene import util
|
from scene import util
|
||||||
from direct.gui.DirectGui import DirectLabel, DirectFrame
|
from direct.gui.DirectGui import DirectLabel, DirectFrame
|
||||||
from panda3d.core import TextNode
|
from panda3d.core import TextNode
|
||||||
@ -179,6 +179,9 @@ class PropertyPanelManager:
|
|||||||
|
|
||||||
self._propertyLayout.addStretch()
|
self._propertyLayout.addStretch()
|
||||||
|
|
||||||
|
# 重置碰撞相关标志,确保下次选择时正常显示
|
||||||
|
self._just_added_collision = False
|
||||||
|
|
||||||
# 强制更新布局
|
# 强制更新布局
|
||||||
if self._propertyLayout:
|
if self._propertyLayout:
|
||||||
self._propertyLayout.update()
|
self._propertyLayout.update()
|
||||||
@ -564,6 +567,19 @@ class PropertyPanelManager:
|
|||||||
if hasattr(self, '_current_info_panel'):
|
if hasattr(self, '_current_info_panel'):
|
||||||
del self._current_info_panel
|
del self._current_info_panel
|
||||||
|
|
||||||
|
# 清理碰撞相关控件引用
|
||||||
|
collision_controls = [
|
||||||
|
'collision_status_text', 'collision_shape_combo', 'collision_shape_label',
|
||||||
|
'collision_visibility_button', 'collision_button', 'collision_layout', 'collision_group',
|
||||||
|
'collision_pos_x', 'collision_pos_y', 'collision_pos_z',
|
||||||
|
'collision_radius', 'collision_width', 'collision_length', 'collision_height',
|
||||||
|
'collision_capsule_radius', 'collision_capsule_height',
|
||||||
|
'collision_normal_x', 'collision_normal_y', 'collision_normal_z'
|
||||||
|
]
|
||||||
|
for name in collision_controls:
|
||||||
|
if hasattr(self, name):
|
||||||
|
delattr(self, name)
|
||||||
|
|
||||||
# 清理其他可能的控件引用
|
# 清理其他可能的控件引用
|
||||||
other_controls = ['scale_x', 'scale_y', 'scale_z', 'pos_x', 'pos_y', 'pos_z']
|
other_controls = ['scale_x', 'scale_y', 'scale_z', 'pos_x', 'pos_y', 'pos_z']
|
||||||
for name in other_controls:
|
for name in other_controls:
|
||||||
@ -8762,7 +8778,7 @@ except Exception as e:
|
|||||||
# 清理之前的参数控件
|
# 清理之前的参数控件
|
||||||
self._clearCollisionParameterControls()
|
self._clearCollisionParameterControls()
|
||||||
|
|
||||||
# 隐藏显示/隐藏按钮
|
# 隐藏显示/隐藏按钮(如果存在)
|
||||||
if hasattr(self, 'collision_visibility_button'):
|
if hasattr(self, 'collision_visibility_button'):
|
||||||
self.collision_visibility_button.setVisible(False)
|
self.collision_visibility_button.setVisible(False)
|
||||||
|
|
||||||
@ -8775,6 +8791,8 @@ except Exception as e:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"创建碰撞面板失败: {e}")
|
print(f"创建碰撞面板失败: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def _addCollisionParameterControls(self, model, layout, start_row, shape_type):
|
def _addCollisionParameterControls(self, model, layout, start_row, shape_type):
|
||||||
"""添加碰撞参数调整控件"""
|
"""添加碰撞参数调整控件"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user