From 14c4a9ad38cd78c7da3dee23f922b1d35b2eca6b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 15 Oct 2025 13:47:46 +0200 Subject: [PATCH] direct: Move particlePath definition to Python (see #1014) --- contrib/src/sceneeditor/seParticlePanel.py | 9 +++++++-- direct/src/showbase/showBase.cxx | 9 --------- direct/src/showbase/showBase.h | 4 ---- direct/src/tkpanels/ParticlePanel.py | 11 +++++++---- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/contrib/src/sceneeditor/seParticlePanel.py b/contrib/src/sceneeditor/seParticlePanel.py index 6ea49cc3b1..3791c62381 100644 --- a/contrib/src/sceneeditor/seParticlePanel.py +++ b/contrib/src/sceneeditor/seParticlePanel.py @@ -1,6 +1,7 @@ """PANDA3D Particle Panel""" # Import Tkinter, Pmw, and the floater code from this directory tree. +from panda3d.core import ConfigVariableSearchPath, Point2, Point3, Vec3, Vec4 from direct.tkwidgets.AppShell import AppShell import os, Pmw from direct.tkwidgets.Dial import AngleDial @@ -17,6 +18,10 @@ from tkinter.filedialog import * from tkinter.simpledialog import askstring +particlePath = ConfigVariableSearchPath("particle-path", + "The directories to search for particle files to be loaded.") + + class ParticlePanel(AppShell): # Override class variables appname = 'Particle Panel' @@ -1041,7 +1046,7 @@ class ParticlePanel(AppShell): def loadParticleEffectFromFile(self): # Find path to particle directory - pPath = getParticlePath() + pPath = particlePath if pPath.getNumDirectories() > 0: if repr(pPath.getDirectory(0)) == '.': path = '.' @@ -1070,7 +1075,7 @@ class ParticlePanel(AppShell): def saveParticleEffectToFile(self): # Find path to particle directory - pPath = getParticlePath() + pPath = particlePath if pPath.getNumDirectories() > 0: if repr(pPath.getDirectory(0)) == '.': path = '.' diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index c4aa38b7d5..43a8a16f8e 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -45,15 +45,6 @@ ConfigureDef(config_showbase); ConfigureFn(config_showbase) { } -ConfigVariableSearchPath particle_path -("particle-path", - PRC_DESC("The directories to search for particle files to be loaded.")); - -ConfigVariableSearchPath & -get_particle_path() { - return particle_path; -} - // Throw the "NewFrame" event in the C++ world. Some of the lerp code depends // on receiving this. void diff --git a/direct/src/showbase/showBase.h b/direct/src/showbase/showBase.h index a578c5159c..25cf5fdf14 100644 --- a/direct/src/showbase/showBase.h +++ b/direct/src/showbase/showBase.h @@ -22,8 +22,6 @@ #include "animControl.h" #include "pointerTo.h" #include "dconfig.h" -#include "dSearchPath.h" -#include "configVariableSearchPath.h" #include "nodePath.h" ConfigureDecl(config_showbase, EXPCL_DIRECT_SHOWBASE, EXPTP_DIRECT_SHOWBASE); @@ -34,8 +32,6 @@ class GraphicsEngine; BEGIN_PUBLISH -EXPCL_DIRECT_SHOWBASE ConfigVariableSearchPath &get_particle_path(); - EXPCL_DIRECT_SHOWBASE void throw_new_frame(); EXPCL_DIRECT_SHOWBASE void init_app_for_gui(); diff --git a/direct/src/tkpanels/ParticlePanel.py b/direct/src/tkpanels/ParticlePanel.py index f64cbad8c9..f17e9f022f 100644 --- a/direct/src/tkpanels/ParticlePanel.py +++ b/direct/src/tkpanels/ParticlePanel.py @@ -3,7 +3,7 @@ __all__ = ['ParticlePanel'] # Import Tkinter, Pmw, and the floater code from this directory tree. -from panda3d.core import ColorBlendAttrib, Filename, Point2, Point3, Vec3, Vec4, getModelPath +from panda3d.core import ColorBlendAttrib, ConfigVariableSearchPath, Filename, Point2, Point3, Vec3, Vec4, getModelPath from panda3d.physics import ( BaseParticleEmitter, BaseParticleRenderer, @@ -36,7 +36,6 @@ from panda3d.physics import ( SpriteParticleRenderer, TangentRingEmitter, ) -from panda3d.direct import getParticlePath from direct.tkwidgets.AppShell import AppShell from direct.tkwidgets import Dial from direct.tkwidgets import Floater @@ -53,6 +52,10 @@ import os import tkinter as tk +particlePath = ConfigVariableSearchPath("particle-path", + "The directories to search for particle files to be loaded.") + + class ParticlePanel(AppShell): # Override class variables appname = 'Particle Panel' @@ -1275,7 +1278,7 @@ class ParticlePanel(AppShell): def loadParticleEffectFromFile(self): # Find path to particle directory - pPath = getParticlePath() + pPath = particlePath if pPath.getNumDirectories() > 0: if repr(pPath.getDirectory(0)) == '.': path = '.' @@ -1303,7 +1306,7 @@ class ParticlePanel(AppShell): def saveParticleEffectToFile(self): # Find path to particle directory - pPath = getParticlePath() + pPath = particlePath if pPath.getNumDirectories() > 0: if repr(pPath.getDirectory(0)) == '.': path = '.'