From 47658f599bde0e645c4d6972481af5483c0fb5b3 Mon Sep 17 00:00:00 2001 From: Hector <2055590199@qq.com> Date: Thu, 30 Oct 2025 16:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B1=9E=E6=80=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E6=9B=B4=E6=96=B0=E6=97=B6=E6=9C=BA=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=80=89=E6=8B=A9=E6=A1=86=E4=B8=80=E4=BA=9B=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RenderPipelineFile/config/pipeline.yaml | 6 +- RenderPipelineFile/config/plugins.yaml | 20 ++--- RenderPipelineFile/rpplugins/dof/dof_stage.py | 26 ------ RenderPipelineFile/rpplugins/dof/plugin.py | 26 ------ core/selection.py | 39 +-------- ui/property_panel.py | 82 +++++++++++++++++-- 6 files changed, 90 insertions(+), 109 deletions(-) diff --git a/RenderPipelineFile/config/pipeline.yaml b/RenderPipelineFile/config/pipeline.yaml index d1ac6e71..d060d12a 100644 --- a/RenderPipelineFile/config/pipeline.yaml +++ b/RenderPipelineFile/config/pipeline.yaml @@ -1,5 +1,3 @@ - - # This file stores internal settings of the pipeline. It does not contain the # plugin settings, but just the basic settings of the internal pipeline components. pipeline: @@ -77,8 +75,8 @@ shadows: # getting updated fast enough. However, this also affects the performance # quite a bit, since for every shadow map a part of the scene has # to get re-rendered. - max_updates: 8 + max_updates: 16 # Sets the maximum distance until which shadows are updated. If a shadow # source is further away, it will no longer recieve updates - max_update_distance: 150.0 + max_update_distance: 300.0 \ No newline at end of file diff --git a/RenderPipelineFile/config/plugins.yaml b/RenderPipelineFile/config/plugins.yaml index 5eaed062..717e6e6d 100644 --- a/RenderPipelineFile/config/plugins.yaml +++ b/RenderPipelineFile/config/plugins.yaml @@ -16,16 +16,16 @@ enabled: - sky_ao - smaa - ssr - # - clouds - # - dof - # - fxaa - # - volumetrics - # - vxgi + - clouds + #- dof + #- fxaa + #- volumetrics + #- vxgi overrides: ao: - blur_quality: MEDIUM + blur_quality: LOW blur_normal_factor: 2.97 blur_depth_factor: 0.88158 occlusion_strength: 2.19 @@ -87,10 +87,10 @@ overrides: sharpen_twice: False dof: - focal_point: 1000.0 - focal_size: 994.0 - blur_strength: 0.0 - near_blur_strength: 0.4286 + focal_point: 5 + focal_size: 1 + blur_strength: 1 + near_blur_strength: 1 env_probes: probe_resolution: 128 diff --git a/RenderPipelineFile/rpplugins/dof/dof_stage.py b/RenderPipelineFile/rpplugins/dof/dof_stage.py index b88da33a..fef2631f 100644 --- a/RenderPipelineFile/rpplugins/dof/dof_stage.py +++ b/RenderPipelineFile/rpplugins/dof/dof_stage.py @@ -1,29 +1,3 @@ -""" - -RenderPipeline - -Copyright (c) 2014-2016 tobspr - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -""" - from rpcore.render_stage import RenderStage diff --git a/RenderPipelineFile/rpplugins/dof/plugin.py b/RenderPipelineFile/rpplugins/dof/plugin.py index 6c3b3e4d..7dd00bc8 100644 --- a/RenderPipelineFile/rpplugins/dof/plugin.py +++ b/RenderPipelineFile/rpplugins/dof/plugin.py @@ -1,29 +1,3 @@ -""" - -RenderPipeline - -Copyright (c) 2014-2016 tobspr - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -""" - from rpcore.pluginbase.base_plugin import BasePlugin from .dof_stage import DoFStage diff --git a/core/selection.py b/core/selection.py index 5d70c9d8..54042e41 100644 --- a/core/selection.py +++ b/core/selection.py @@ -648,7 +648,7 @@ class SelectionSystem: import time current_time = time.time() - if current_time - self._last_gizmo_update < 0.05: # 每0.05秒更新一次 + if current_time - self._last_gizmo_update < 0.5: # 每0.05秒更新一次 return task.cont self._last_gizmo_update = current_time @@ -1625,8 +1625,6 @@ class SelectionSystem: # 应用新缩放值 self.gizmoTarget.setScale(new_scale) - # 安全地更新属性面板 - #self._safeUpdatePropertyPanel() self.world.property_panel.refreshModelValues(self.gizmoTarget) return elif is_rotate_tool: @@ -1646,7 +1644,6 @@ class SelectionSystem: start_hpr.y + rotation_amount, start_hpr.z + rotation_amount) self.gizmoTarget.setHpr(new_hpr) - #self._safeUpdatePropertyPanel() self.world.property_panel.refreshModelValues(self.gizmoTarget) return @@ -1811,7 +1808,6 @@ class SelectionSystem: # 实时更新属性面板 self.world.property_panel.refreshModelValues(self.gizmoTarget) - #self._safeUpdatePropertyPanel() # 每次拖拽都输出调试信息(但限制频率) if not hasattr(self, '_last_drag_debug_time'): @@ -1845,39 +1841,6 @@ class SelectionSystem: except: return False - def _safeUpdatePropertyPanel(self): - """安全地更新属性面板""" - try: - # 检查属性面板是否存在且有效 - if (hasattr(self.world, 'property_panel') and - self.world.property_panel is not None): - - # 检查目标节点是否有效 - if (self.gizmoTarget is not None and - not self.gizmoTarget.isEmpty()): - - # 检查是否有refreshModelValues方法 - if hasattr(self.world.property_panel, 'refreshModelValues'): - self.world.property_panel.refreshModelValues(self.gizmoTarget) - # 如果是GUI元素,可能需要特殊的处理 - elif (hasattr(self.gizmoTarget, 'getTag') and - self.gizmoTarget.getTag("is_gui_element") == "1" and - hasattr(self.world.property_panel, 'updateGUIPropertyPanel')): - # 对于GUI元素,可能需要重新构建整个面板 - if (hasattr(self.world, 'treeWidget') and - self.world.treeWidget is not None): - current_item = self.world.treeWidget.currentItem() - if current_item is not None: - self.world.property_panel.updatePropertyPanel(current_item) - except RuntimeError as e: - if "wrapped C/C++ object" in str(e): - # 忽略控件已被删除的错误 - print("警告: 属性面板控件已被删除,跳过更新") - else: - print(f"更新属性面板时出错: {e}") - except Exception as e: - print(f"更新属性面板失败: {e}") - def stopGizmoDrag(self): """停止坐标轴拖拽""" print(f"停止坐标轴拖拽 - 轴: {self.dragGizmoAxis}") diff --git a/ui/property_panel.py b/ui/property_panel.py index 4893a719..65a5e874 100644 --- a/ui/property_panel.py +++ b/ui/property_panel.py @@ -8,7 +8,7 @@ from PyQt5.QtGui import QColor from PyQt5.QtWidgets import (QLabel, QLineEdit, QDoubleSpinBox, QPushButton, QTreeWidget, QTreeWidgetItem, QMenu, QCheckBox, QComboBox, QHBoxLayout, QWidget, QVBoxLayout, QGroupBox, QGridLayout, QSpinBox, QFileDialog, QMessageBox, QSizePolicy) -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QTimer from deploy_libs.unicodedata import normalize from direct.actor.Actor import Actor from direct.gui import DirectGui @@ -30,6 +30,8 @@ class PropertyPanelManager: self._propertyLayout = None self._actor_cache = {} self._spherical_video_controls = {} + self._transform_monitor_timer = None + self._last_transform_values = {} self.column_minimum_width = 85 @@ -614,6 +616,9 @@ class PropertyPanelManager: def clearPropertyPanel(self): """清空属性面板""" + # 停止变换监控 + self.stopTransformMonitoring() + if self._propertyLayout: while self._propertyLayout.count(): item = self._propertyLayout.takeAt(0) @@ -710,6 +715,8 @@ class PropertyPanelManager: self.updateLightPropertyPanel(model) elif model: self._updateModelPropertyPanel(model) + # 启动变换监控 + self.startTransformMonitoring(model) self._propertyLayout.addStretch() @@ -1086,6 +1093,9 @@ class PropertyPanelManager: def _cleanupAllReferences(self): """清理所有控件引用""" + # 停止变换监控 + self.stopTransformMonitoring() + # 清理变换控件引用 self._cleanupTransformControls() @@ -1199,6 +1209,67 @@ class PropertyPanelManager: except Exception as e: print(f"刷新模型值显示失败: {e}") + def startTransformMonitoring(self, nodePath): + """开始监控节点的变换变化""" + # 如果已有监控器在运行,先停止它 + self.stopTransformMonitoring() + + # 保存初始变换值 + self._saveCurrentTransformValues(nodePath) + + # 创建并启动定时器 + self._transform_monitor_timer = QTimer() + self._transform_monitor_timer.timeout.connect(lambda: self._checkTransformChanges(nodePath)) + self._transform_monitor_timer.start(100) # 每100毫秒检查一次 + + def stopTransformMonitoring(self): + """停止监控节点的变换变化""" + if self._transform_monitor_timer: + self._transform_monitor_timer.stop() + self._transform_monitor_timer.deleteLater() + self._transform_monitor_timer = None + + # 清除保存的变换值 + self._last_transform_values.clear() + + def _saveCurrentTransformValues(self, nodePath): + """保存当前节点的变换值""" + try: + pos = nodePath.getPos() + hpr = nodePath.getHpr() + scale = nodePath.getScale() + + self._last_transform_values = { + 'pos': (pos.getX(), pos.getY(), pos.getZ()), + 'hpr': (hpr.getX(), hpr.getY(), hpr.getZ()), + 'scale': (scale.getX(), scale.getY(), scale.getZ()) + } + except Exception as e: + print(f"保存变换值失败: {e}") + + def _checkTransformChanges(self, nodePath): + """检查节点变换是否发生变化""" + try: + # 获取当前变换值 + pos = nodePath.getPos() + hpr = nodePath.getHpr() + scale = nodePath.getScale() + + current_values = { + 'pos': (pos.getX(), pos.getY(), pos.getZ()), + 'hpr': (hpr.getX(), hpr.getY(), hpr.getZ()), + 'scale': (scale.getX(), scale.getY(), scale.getZ()) + } + + # 比较变换值是否发生变化 + if current_values != self._last_transform_values: + # 变换已更改,刷新属性面板 + self.refreshModelValues(nodePath) + # 更新保存的变换值 + self._last_transform_values = current_values + except Exception as e: + print(f"检查变换变化失败: {e}") + def _refreshGUIElementValues(self, gui_element): """刷新GUI元素值显示""" try: @@ -8753,12 +8824,12 @@ class PropertyPanelManager: if hasattr(setting_handle, 'curves') and setting_handle.curves: # 清除现有的控制点,设置单一值 setting_handle.curves[0].set_single_value(normalized_value) - print(f"✅ 更新Day Time设置: {plugin_name}.{setting_name} = {value} (归一化: {normalized_value:.3f})") + #print(f"✅ 更新Day Time设置: {plugin_name}.{setting_name} = {value} (归一化: {normalized_value:.3f})") # 保存设置到配置文件 try: plugin_mgr.save_daytime_overrides("/$$rpconfig/daytime.yaml") - print("✅ Day Time设置已保存到配置文件") + #print("✅ Day Time设置已保存到配置文件") except Exception as e: print(f"⚠️ 保存配置文件失败: {e}") @@ -8766,7 +8837,7 @@ class PropertyPanelManager: try: from RenderPipelineFile.rpcore.util.network_communication import NetworkCommunication NetworkCommunication.send_async(NetworkCommunication.DAYTIME_PORT, "loadconf") - print("✅ 已通知Day Time Editor重新加载配置") + #print("✅ 已通知Day Time Editor重新加载配置") except Exception as e: print(f"⚠️ 通知Day Time Editor失败: {e}") @@ -9069,7 +9140,8 @@ class PropertyPanelManager: # 检查是否是 FBX 文件,如果是,使用专门的 FBX 动画加载器 if filepath.lower().endswith('.fbx'): - return self._createFBXActor(origin_model, filepath) + pass + #return self._createFBXActor(origin_model, filepath) # 其他格式使用标准 Actor 加载 try: