mirror of
https://github.com/panda3d/panda3d.git
synced 2025-12-17 20:59:36 -06:00
direct: Move particlePath definition to Python (see #1014)
This commit is contained in:
@@ -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 = '.'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 = '.'
|
||||
|
||||
Reference in New Issue
Block a user