修复引用更改问题
This commit is contained in:
parent
30459c81cb
commit
6540870d7e
@ -22,10 +22,10 @@ from QMeta3D.QMeta3D_Buttons_Translation import QMeta3D_Button_translation
|
||||
from QMeta3D.QMeta3D_Keys_Translation import QMeta3D_Key_translation
|
||||
from QMeta3D.QMeta3D_Modifiers_Translation import QMeta3D_Modifier_translation
|
||||
|
||||
__all__ = ["QPanda3DWidget"]
|
||||
__all__ = ["QMeta3DWidget"]
|
||||
|
||||
|
||||
class QPanda3DSynchronizer(QTimer):
|
||||
class QMeta3DSynchronizer(QTimer):
|
||||
def __init__(self, qPanda3DWidget, FPS=60):
|
||||
QTimer.__init__(self)
|
||||
self.qPanda3DWidget = qPanda3DWidget
|
||||
@ -66,7 +66,7 @@ class QPanda3DSynchronizer(QTimer):
|
||||
def get_panda_key_modifiers(evt):
|
||||
panda_mods = []
|
||||
qt_mods = evt.modifiers()
|
||||
for qt_mod, panda_mod in QPanda3D_Modifier_translation.items():
|
||||
for qt_mod, panda_mod in QMeta3D_Modifier_translation.items():
|
||||
if (qt_mods & qt_mod) == qt_mod:
|
||||
panda_mods.append(panda_mod)
|
||||
return panda_mods
|
||||
@ -83,7 +83,7 @@ def get_panda_key_modifiers_prefix(evt):
|
||||
return prefix
|
||||
|
||||
|
||||
class QPanda3DWidget(QWidget):
|
||||
class QMeta3DWidget(QWidget):
|
||||
"""
|
||||
An interactive panda3D QWidget
|
||||
Parent : Parent QT Widget
|
||||
@ -118,7 +118,7 @@ class QPanda3DWidget(QWidget):
|
||||
self.initial_film_size = QSizeF(size.x, size.y)
|
||||
self.initial_size = self.size()
|
||||
|
||||
self.synchronizer = QPanda3DSynchronizer(self, FPS)
|
||||
self.synchronizer = QMeta3DSynchronizer(self, FPS)
|
||||
self.synchronizer.start()
|
||||
|
||||
self.debug = debug
|
||||
@ -126,7 +126,7 @@ class QPanda3DWidget(QWidget):
|
||||
def mousePressEvent(self, evt):
|
||||
button = evt.button()
|
||||
try:
|
||||
b = "{}{}".format(get_panda_key_modifiers_prefix(evt), QPanda3D_Button_translation[button])
|
||||
b = "{}{}".format(get_panda_key_modifiers_prefix(evt), QMeta3D_Button_translation[button])
|
||||
if self.debug:
|
||||
print(b)
|
||||
messenger.send(b,[{"x":evt.x(),"y":evt.y()}])
|
||||
@ -147,7 +147,7 @@ class QPanda3DWidget(QWidget):
|
||||
def mouseReleaseEvent(self, evt):
|
||||
button = evt.button()
|
||||
try:
|
||||
b = "{}{}-up".format(get_panda_key_modifiers_prefix(evt), QPanda3D_Button_translation[button])
|
||||
b = "{}{}-up".format(get_panda_key_modifiers_prefix(evt), QMeta3D_Button_translation[button])
|
||||
if self.debug:
|
||||
print(b)
|
||||
messenger.send(b,[{"x":evt.x(),"y":evt.y()}])
|
||||
@ -166,7 +166,7 @@ class QPanda3DWidget(QWidget):
|
||||
def keyPressEvent(self, evt):
|
||||
key = evt.key()
|
||||
try:
|
||||
k = "{}{}".format(get_panda_key_modifiers_prefix(evt), QPanda3D_Key_translation[key])
|
||||
k = "{}{}".format(get_panda_key_modifiers_prefix(evt), QMeta3D_Key_translation[key])
|
||||
if self.debug:
|
||||
print(k)
|
||||
messenger.send(k)
|
||||
@ -176,7 +176,7 @@ class QPanda3DWidget(QWidget):
|
||||
def keyReleaseEvent(self, evt):
|
||||
key = evt.key()
|
||||
try:
|
||||
k = "{}{}-up".format(get_panda_key_modifiers_prefix(evt), QPanda3D_Key_translation[key])
|
||||
k = "{}{}-up".format(get_panda_key_modifiers_prefix(evt), QMeta3D_Key_translation[key])
|
||||
if self.debug:
|
||||
print(k)
|
||||
messenger.send(k)
|
||||
|
||||
@ -11,7 +11,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel, QPushButton, QHBoxLayout
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from panda3d.core import *
|
||||
from direct.task import Task
|
||||
@ -529,7 +529,7 @@ class GizmoDragTestWorld(Meta3DWorld):
|
||||
print(f"设置坐标轴颜色失败: {str(e)}")
|
||||
|
||||
|
||||
class CustomGizmoDragTestWidget(QPanda3DWidget):
|
||||
class CustomGizmoDragTestWidget(QMeta3DWidget):
|
||||
"""支持坐标轴拖拽测试的部件"""
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
|
||||
@ -16,7 +16,7 @@ from PyQt5.QtWidgets import (QApplication, QMainWindow, QMenuBar, QMenu, QAction
|
||||
QLabel, QLineEdit, QFormLayout, QDoubleSpinBox, QScrollArea, QTreeView, QInputDialog, QFileDialog, QMessageBox, QDialog, QGroupBox, QHBoxLayout, QPushButton, QDialogButtonBox)
|
||||
from PyQt5.QtCore import Qt, QDir, QUrl
|
||||
from PyQt5.QtGui import QDrag, QPainter, QPixmap
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.gui.OnscreenText import OnscreenText
|
||||
@ -270,7 +270,7 @@ class GUITestWorld(Meta3DWorld):
|
||||
"""GUI输入框提交事件处理"""
|
||||
print(f"✓ GUI输入框提交测试成功: {entry_id} = {text}")
|
||||
|
||||
class GUITestWidget(QPanda3DWidget):
|
||||
class GUITestWidget(QMeta3DWidget):
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
self.world = world
|
||||
|
||||
@ -12,7 +12,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.gui.OnscreenText import OnscreenText
|
||||
@ -186,7 +186,7 @@ class DebugGUIWorld(Meta3DWorld):
|
||||
"""按钮点击事件"""
|
||||
print("✓ 按钮被点击了!")
|
||||
|
||||
class DebugWidget(QPanda3DWidget):
|
||||
class DebugWidget(QMeta3DWidget):
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
self.world = world
|
||||
|
||||
@ -12,7 +12,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.gui.OnscreenText import OnscreenText
|
||||
@ -109,7 +109,7 @@ class QtGUITestWorld(Meta3DWorld):
|
||||
"""按钮点击事件"""
|
||||
print("✓ 按钮被点击了!")
|
||||
|
||||
class QtGUITestWidget(QPanda3DWidget):
|
||||
class QtGUITestWidget(QMeta3DWidget):
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
self.world = world
|
||||
|
||||
@ -13,7 +13,7 @@ import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QMouseEvent
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.gui.OnscreenText import OnscreenText
|
||||
@ -194,7 +194,7 @@ class QtGUIFixWorld(Meta3DWorld):
|
||||
print(f"Qt事件处理失败: {str(e)}")
|
||||
return False
|
||||
|
||||
class CustomQPanda3DWidget(QPanda3DWidget):
|
||||
class CustomQMeta3DWidget(QMeta3DWidget):
|
||||
"""自定义QPanda3DWidget,支持事件转发"""
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
@ -241,7 +241,7 @@ def main():
|
||||
world = QtGUIFixWorld()
|
||||
|
||||
# 创建自定义Panda3D部件
|
||||
pandaWidget = CustomQPanda3DWidget(world)
|
||||
pandaWidget = CustomQMeta3DWidget(world)
|
||||
layout.addWidget(pandaWidget)
|
||||
|
||||
mainWindow.setCentralWidget(centralWidget)
|
||||
|
||||
@ -11,7 +11,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.gui.DirectGui import *
|
||||
from direct.gui.OnscreenText import OnscreenText
|
||||
@ -139,7 +139,7 @@ def main():
|
||||
world = QtOnlyWorld()
|
||||
|
||||
# 创建Panda3D部件
|
||||
pandaWidget = QPanda3DWidget(world)
|
||||
pandaWidget = QMeta3DWidget(world)
|
||||
layout.addWidget(pandaWidget)
|
||||
|
||||
mainWindow.setCentralWidget(centralWidget)
|
||||
|
||||
@ -12,7 +12,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel, QPushButton
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from direct.showbase.ShowBase import ShowBase
|
||||
from direct.gui.DirectGui import *
|
||||
@ -168,7 +168,7 @@ def testQtEnvironment():
|
||||
world = QtTestWorld()
|
||||
|
||||
# 创建Panda3D部件
|
||||
pandaWidget = QPanda3DWidget(world)
|
||||
pandaWidget = QMeta3DWidget(world)
|
||||
layout.addWidget(pandaWidget)
|
||||
|
||||
mainWindow.setCentralWidget(centralWidget)
|
||||
|
||||
@ -11,9 +11,9 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel, QPushButton, QHBoxLayout
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
sys.path.append('..')
|
||||
from main import MyWorld, CustomPanda3DWidget
|
||||
from main import MyWorld, CustomMeta3DWidget
|
||||
|
||||
def main():
|
||||
print("启动简化坐标轴测试...")
|
||||
@ -42,7 +42,7 @@ def main():
|
||||
world = MyWorld()
|
||||
|
||||
# 创建部件
|
||||
pandaWidget = CustomPanda3DWidget(world)
|
||||
pandaWidget = CustomMeta3DWidget(world)
|
||||
layout.addWidget(pandaWidget)
|
||||
|
||||
mainWindow.setCentralWidget(centralWidget)
|
||||
|
||||
@ -11,7 +11,7 @@ warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel
|
||||
from PyQt5.QtCore import Qt
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from QMeta3D.Meta3DWorld import Meta3DWorld
|
||||
from panda3d.core import *
|
||||
from direct.task import Task
|
||||
@ -93,7 +93,7 @@ class SizeTestWorld(Meta3DWorld):
|
||||
# 每5秒检查一次
|
||||
return task.again
|
||||
|
||||
class CustomSizeTestWidget(QPanda3DWidget):
|
||||
class CustomSizeTestWidget(QMeta3DWidget):
|
||||
"""支持尺寸获取的测试部件"""
|
||||
def __init__(self, world, parent=None):
|
||||
super().__init__(world, parent)
|
||||
|
||||
4
main.py
4
main.py
@ -15,7 +15,7 @@ from PyQt5.QtWidgets import (QApplication, QMainWindow, QMenuBar, QMenu, QAction
|
||||
from PyQt5.QtCore import Qt, QDir, QUrl
|
||||
from PyQt5.QtGui import QDrag, QPainter, QPixmap
|
||||
from PyQt5.QtWidgets import QFileSystemModel
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from panda3d.core import loadPrcFileData
|
||||
loadPrcFileData("", "assertions 0")
|
||||
from core.world import CoreWorld
|
||||
@ -29,7 +29,7 @@ from gui.gui_manager import GUIManager
|
||||
from core.terrain_manager import TerrainManager
|
||||
from scene.scene_manager import SceneManager
|
||||
from project.project_manager import ProjectManager
|
||||
from ui.widgets import CustomPanda3DWidget, CustomFileView, CustomTreeWidget
|
||||
from ui.widgets import CustomMeta3DWidget, CustomFileView, CustomTreeWidget
|
||||
from ui.property_panel import PropertyPanelManager
|
||||
from ui.interface_manager import InterfaceManager
|
||||
from panda3d.core import (CardMaker, Vec4, Vec3, ColorAttrib, MaterialAttrib,
|
||||
|
||||
@ -6,11 +6,11 @@ UI模块
|
||||
- main_window.py: 主窗口设置
|
||||
"""
|
||||
|
||||
from .widgets import CustomPanda3DWidget, CustomFileView, CustomTreeWidget
|
||||
from .widgets import CustomMeta3DWidget, CustomFileView, CustomTreeWidget
|
||||
from .main_window import MainWindow, setup_main_window
|
||||
|
||||
__all__ = [
|
||||
'CustomPanda3DWidget',
|
||||
'CustomMeta3DWidget',
|
||||
'CustomFileView',
|
||||
'CustomTreeWidget',
|
||||
'MainWindow',
|
||||
|
||||
@ -21,7 +21,7 @@ from PyQt5.QtCore import Qt, QDir, QTimer, QSize, QPoint, QUrl, QRect
|
||||
from direct.showbase.ShowBaseGlobal import aspect2d
|
||||
from panda3d.core import OrthographicLens
|
||||
|
||||
from ui.widgets import (CustomPanda3DWidget, CustomFileView, CustomTreeWidget,
|
||||
from ui.widgets import (CustomMeta3DWidget, CustomFileView, CustomTreeWidget,
|
||||
CustomAssetsTreeWidget, CustomConsoleDockWidget,
|
||||
UniversalMessageDialog)
|
||||
from ui.icon_manager import get_icon_manager, get_icon
|
||||
@ -739,7 +739,7 @@ class MainWindow(QMainWindow):
|
||||
else:
|
||||
print("⚠️ 应用图标设置失败,使用默认图标")
|
||||
# 使用自定义的 Panda3D 部件作为中央部件
|
||||
self.pandaWidget = CustomPanda3DWidget(self.world)
|
||||
self.pandaWidget = CustomMeta3DWidget(self.world)
|
||||
self.setCentralWidget(self.pandaWidget)
|
||||
|
||||
# 创建内嵌工具栏
|
||||
|
||||
@ -20,7 +20,7 @@ from PyQt5.sip import wrapinstance
|
||||
from direct.showbase.ShowBaseGlobal import aspect2d
|
||||
from panda3d.core import ModelRoot, NodePath, CollisionNode
|
||||
|
||||
from QMeta3D.QMeta3DWidget import QPanda3DWidget
|
||||
from QMeta3D.QMeta3DWidget import QMeta3DWidget
|
||||
from scene import util
|
||||
from ui.icon_manager import get_icon_manager
|
||||
|
||||
@ -456,7 +456,7 @@ class NewProjectDialog(QDialog):
|
||||
|
||||
self.accept()
|
||||
|
||||
class CustomPanda3DWidget(QPanda3DWidget):
|
||||
class CustomMeta3DWidget(QMeta3DWidget):
|
||||
"""自定义Panda3D显示部件"""
|
||||
|
||||
def __init__(self, world, parent=None):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user