From 9c4116319bada11b459e4d34145d056f3ccb35e2 Mon Sep 17 00:00:00 2001 From: Hector <2055590199@qq.com> Date: Fri, 26 Sep 2025 17:50:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=89=93=E5=8C=85=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/main_template.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/main_template.py b/templates/main_template.py index cd97fddc..cb1ec1a1 100644 --- a/templates/main_template.py +++ b/templates/main_template.py @@ -323,7 +323,7 @@ class MainApp(ShowBase): pos=tuple(absolute_position), text=text, size=absolute_scale[0] if absolute_scale and len(absolute_scale) > 0 else 1.0, - command=self.resetWomenModel + #command=self.resetWomenModel ) elif gui_type == "label": new_element = self.createGUILabel( @@ -352,7 +352,7 @@ class MainApp(ShowBase): new_element = self.createGUI2DVideoScreen( pos=tuple(absolute_position), video_path=video_path, - size=scale_value * 0.2 + size=absolute_scale ) except Exception as e: print(f"重建GUI元素失败 {name}: {e}") @@ -548,8 +548,15 @@ class MainApp(ShowBase): from panda3d.core import TransparencyAttrib, Texture, TextureStage import os + if isinstance(size,(list,tuple)) and len(size) >= 2: + width_scale = size[0]*0.2 + height_scale = size[2]*0.2 + else: + width_scale = size*0.1 if isinstance(size,(int,float)) else 0.2 + height_scale = width_scale + video_screen = DirectFrame( - frameSize=(-size, size, -size, size), + frameSize=(-width_scale, width_scale, -height_scale, height_scale), frameColor=(1, 1, 1, 1), pos=pos, parent=None, @@ -567,6 +574,8 @@ class MainApp(ShowBase): if movie_texture: video_screen["frameTexture"] = movie_texture + return video_screen + def _loadMovieTexture(self, video_path): from panda3d.core import Texture, MovieTexture import os