forked from Rowland/EG
2d_image加载大小不一致修复
This commit is contained in:
parent
f455d5134d
commit
bda62d0bae
@ -502,7 +502,7 @@ class GUIManager:
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
def createGUI2DImage(self, pos=(0, 0, 0), image_path=None, size=1):
|
||||
def createGUI2DImage(self, pos=(0, 0, 0), image_path=None, size=(1,1,1)):
|
||||
"""创建2D GUI图片"""
|
||||
try:
|
||||
from direct.gui.DirectGui import DirectButton
|
||||
|
||||
@ -1993,19 +1993,17 @@ class SceneManager:
|
||||
size=absolute_scale[0] if absolute_scale and len(absolute_scale) > 0 else 1.0
|
||||
)
|
||||
elif gui_type == "2d_image" and hasattr(gui_manager, 'createGUI2DImage'):
|
||||
scale_value = absolute_scale[0]
|
||||
print(f"2d_image{scale_value}")
|
||||
new_element = gui_manager.createGUI2DImage(
|
||||
pos=tuple(absolute_position),
|
||||
image_path=image_path,
|
||||
size=absolute_scale
|
||||
size=(0.8,0.8,0.8)
|
||||
)
|
||||
elif gui_type == "3d_text" and hasattr(gui_manager, 'createGUI3DText'):
|
||||
size = absolute_scale[0] if absolute_scale and len(absolute_scale) > 0 else 0.5
|
||||
new_element = gui_manager.createGUI3DText(
|
||||
pos=tuple(absolute_position),
|
||||
text=text,
|
||||
size=size
|
||||
size=absolute_scale
|
||||
)
|
||||
elif gui_type == "3d_image" and hasattr(gui_manager, 'createGUI3DImage'):
|
||||
# 处理3D图像
|
||||
|
||||
@ -3169,7 +3169,6 @@ class PropertyPanelManager:
|
||||
print("❌ 未找到视频纹理")
|
||||
return
|
||||
|
||||
# 检查当前播放状态
|
||||
if not hasattr(self, '_video_playing'):
|
||||
self._video_playing = {}
|
||||
|
||||
@ -3177,7 +3176,6 @@ class PropertyPanelManager:
|
||||
is_playing = self._video_playing.get(video_id, False)
|
||||
|
||||
if is_playing:
|
||||
# 暂停视频
|
||||
if hasattr(movie_texture, 'stop'):
|
||||
movie_texture.stop()
|
||||
if hasattr(self, '_spherical_video_controls') and 'play_button' in self._spherical_video_controls:
|
||||
@ -3185,15 +3183,12 @@ class PropertyPanelManager:
|
||||
play_button.setText("▶️ 播放")
|
||||
print("⏸️ 球形视频已暂停")
|
||||
else:
|
||||
# 播放视频
|
||||
if hasattr(movie_texture, 'play'):
|
||||
movie_texture.play()
|
||||
if hasattr(self, '_spherical_video_controls') and 'play_button' in self._spherical_video_controls:
|
||||
play_button = self._spherical_video_controls['play_button']
|
||||
play_button.setText("⏸️ 暂停")
|
||||
print("▶️ 球形视频开始播放")
|
||||
|
||||
# 更新播放状态
|
||||
self._video_playing[video_id] = not is_playing
|
||||
|
||||
except Exception as e:
|
||||
@ -3217,12 +3212,10 @@ class PropertyPanelManager:
|
||||
if hasattr(movie_texture, 'setTime'):
|
||||
movie_texture.setTime(0.0)
|
||||
|
||||
# 更新播放按钮
|
||||
if hasattr(self, '_spherical_video_controls') and 'play_button' in self._spherical_video_controls:
|
||||
play_button = self._spherical_video_controls['play_button']
|
||||
play_button.setText("▶️ 播放")
|
||||
|
||||
# 更新播放状态
|
||||
if hasattr(self, '_video_playing'):
|
||||
video_id = id(spherical_video)
|
||||
self._video_playing[video_id] = False
|
||||
@ -3420,7 +3413,6 @@ class PropertyPanelManager:
|
||||
video_control_group = QGroupBox("视频控制")
|
||||
video_control_layout = QHBoxLayout()
|
||||
|
||||
# 播放按钮
|
||||
play_btn = QPushButton("▶️ 播放")
|
||||
play_btn.clicked.connect(lambda: self.world.gui_manager.playVideo(video_screen))
|
||||
video_control_layout.addWidget(play_btn)
|
||||
@ -8632,7 +8624,6 @@ except Exception as e:
|
||||
original_world_pos = origin_model.getPos(self.world.render)
|
||||
original_world_hpr = origin_model.getHpr(self.world.render)
|
||||
original_world_scale = origin_model.getScale(self.world.render)
|
||||
|
||||
actor.setPos(origin_model.getPos())
|
||||
actor.setHpr(origin_model.getHpr())
|
||||
actor.setScale(origin_model.getScale())
|
||||
@ -8655,8 +8646,6 @@ except Exception as e:
|
||||
|
||||
taskMgr.add(maintainWorldPosition,f"maintain_anim_pos_{id(actor)}")
|
||||
|
||||
|
||||
|
||||
if hasattr(self, 'animation_combo'):
|
||||
# 获取原始动画名称(存储在 userData 中)
|
||||
current_index = self.animation_combo.currentIndex()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user