direct: Move particlePath definition to Python (see #1014)

This commit is contained in:
rdb 2025-10-15 13:47:46 +02:00
parent e415457c05
commit 14c4a9ad38
4 changed files with 14 additions and 19 deletions

View File

@ -1,6 +1,7 @@
"""PANDA3D Particle Panel""" """PANDA3D Particle Panel"""
# Import Tkinter, Pmw, and the floater code from this directory tree. # 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 from direct.tkwidgets.AppShell import AppShell
import os, Pmw import os, Pmw
from direct.tkwidgets.Dial import AngleDial from direct.tkwidgets.Dial import AngleDial
@ -17,6 +18,10 @@ from tkinter.filedialog import *
from tkinter.simpledialog import askstring from tkinter.simpledialog import askstring
particlePath = ConfigVariableSearchPath("particle-path",
"The directories to search for particle files to be loaded.")
class ParticlePanel(AppShell): class ParticlePanel(AppShell):
# Override class variables # Override class variables
appname = 'Particle Panel' appname = 'Particle Panel'
@ -1041,7 +1046,7 @@ class ParticlePanel(AppShell):
def loadParticleEffectFromFile(self): def loadParticleEffectFromFile(self):
# Find path to particle directory # Find path to particle directory
pPath = getParticlePath() pPath = particlePath
if pPath.getNumDirectories() > 0: if pPath.getNumDirectories() > 0:
if repr(pPath.getDirectory(0)) == '.': if repr(pPath.getDirectory(0)) == '.':
path = '.' path = '.'
@ -1070,7 +1075,7 @@ class ParticlePanel(AppShell):
def saveParticleEffectToFile(self): def saveParticleEffectToFile(self):
# Find path to particle directory # Find path to particle directory
pPath = getParticlePath() pPath = particlePath
if pPath.getNumDirectories() > 0: if pPath.getNumDirectories() > 0:
if repr(pPath.getDirectory(0)) == '.': if repr(pPath.getDirectory(0)) == '.':
path = '.' path = '.'

View File

@ -45,15 +45,6 @@ ConfigureDef(config_showbase);
ConfigureFn(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 // Throw the "NewFrame" event in the C++ world. Some of the lerp code depends
// on receiving this. // on receiving this.
void void

View File

@ -22,8 +22,6 @@
#include "animControl.h" #include "animControl.h"
#include "pointerTo.h" #include "pointerTo.h"
#include "dconfig.h" #include "dconfig.h"
#include "dSearchPath.h"
#include "configVariableSearchPath.h"
#include "nodePath.h" #include "nodePath.h"
ConfigureDecl(config_showbase, EXPCL_DIRECT_SHOWBASE, EXPTP_DIRECT_SHOWBASE); ConfigureDecl(config_showbase, EXPCL_DIRECT_SHOWBASE, EXPTP_DIRECT_SHOWBASE);
@ -34,8 +32,6 @@ class GraphicsEngine;
BEGIN_PUBLISH BEGIN_PUBLISH
EXPCL_DIRECT_SHOWBASE ConfigVariableSearchPath &get_particle_path();
EXPCL_DIRECT_SHOWBASE void throw_new_frame(); EXPCL_DIRECT_SHOWBASE void throw_new_frame();
EXPCL_DIRECT_SHOWBASE void init_app_for_gui(); EXPCL_DIRECT_SHOWBASE void init_app_for_gui();

View File

@ -3,7 +3,7 @@
__all__ = ['ParticlePanel'] __all__ = ['ParticlePanel']
# Import Tkinter, Pmw, and the floater code from this directory tree. # 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 ( from panda3d.physics import (
BaseParticleEmitter, BaseParticleEmitter,
BaseParticleRenderer, BaseParticleRenderer,
@ -36,7 +36,6 @@ from panda3d.physics import (
SpriteParticleRenderer, SpriteParticleRenderer,
TangentRingEmitter, TangentRingEmitter,
) )
from panda3d.direct import getParticlePath
from direct.tkwidgets.AppShell import AppShell from direct.tkwidgets.AppShell import AppShell
from direct.tkwidgets import Dial from direct.tkwidgets import Dial
from direct.tkwidgets import Floater from direct.tkwidgets import Floater
@ -53,6 +52,10 @@ import os
import tkinter as tk import tkinter as tk
particlePath = ConfigVariableSearchPath("particle-path",
"The directories to search for particle files to be loaded.")
class ParticlePanel(AppShell): class ParticlePanel(AppShell):
# Override class variables # Override class variables
appname = 'Particle Panel' appname = 'Particle Panel'
@ -1275,7 +1278,7 @@ class ParticlePanel(AppShell):
def loadParticleEffectFromFile(self): def loadParticleEffectFromFile(self):
# Find path to particle directory # Find path to particle directory
pPath = getParticlePath() pPath = particlePath
if pPath.getNumDirectories() > 0: if pPath.getNumDirectories() > 0:
if repr(pPath.getDirectory(0)) == '.': if repr(pPath.getDirectory(0)) == '.':
path = '.' path = '.'
@ -1303,7 +1306,7 @@ class ParticlePanel(AppShell):
def saveParticleEffectToFile(self): def saveParticleEffectToFile(self):
# Find path to particle directory # Find path to particle directory
pPath = getParticlePath() pPath = particlePath
if pPath.getNumDirectories() > 0: if pPath.getNumDirectories() > 0:
if repr(pPath.getDirectory(0)) == '.': if repr(pPath.getDirectory(0)) == '.':
path = '.' path = '.'