mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
parent
31a054c933
commit
504257f4d2
@ -7,6 +7,12 @@ from . import Particles
|
|||||||
from . import ForceGroup
|
from . import ForceGroup
|
||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info < (3, 0):
|
||||||
|
FileNotFoundError = IOError
|
||||||
|
|
||||||
|
|
||||||
class ParticleEffect(NodePath):
|
class ParticleEffect(NodePath):
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('ParticleEffect')
|
notify = DirectNotifyGlobal.directNotify.newCategory('ParticleEffect')
|
||||||
@ -200,9 +206,14 @@ class ParticleEffect(NodePath):
|
|||||||
f.write('self.addForceGroup(%s)\n' % target)
|
f.write('self.addForceGroup(%s)\n' % target)
|
||||||
|
|
||||||
def loadConfig(self, filename):
|
def loadConfig(self, filename):
|
||||||
data = vfs.readFile(filename, 1)
|
fn = Filename(filename)
|
||||||
data = data.replace(b'\r', b'')
|
vfs = VirtualFileSystem.getGlobalPtr()
|
||||||
try:
|
try:
|
||||||
|
if not vfs.resolveFilename(fn, getModelPath().value) and not fn.isRegularFile():
|
||||||
|
raise FileNotFoundError("could not find particle file: %s" % (filename))
|
||||||
|
|
||||||
|
data = vfs.readFile(fn, True)
|
||||||
|
data = data.replace(b'\r', b'')
|
||||||
exec(data)
|
exec(data)
|
||||||
except:
|
except:
|
||||||
self.notify.warning('loadConfig: failed to load particle file: '+ repr(filename))
|
self.notify.warning('loadConfig: failed to load particle file: '+ repr(filename))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user