mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
ParticlePanel: fixed an issue that prevented saving with Python 3
Since in Python 3 `str == bytes` no longer holds true, I modified the source to write a text file, which it actually is, instead of a binary file. Closes #553 Fixes #543
This commit is contained in:
parent
3875cc8259
commit
33d11dba27
@ -163,7 +163,7 @@ class ParticleEffect(NodePath):
|
|||||||
|
|
||||||
def saveConfig(self, filename):
|
def saveConfig(self, filename):
|
||||||
filename = Filename(filename)
|
filename = Filename(filename)
|
||||||
f = open(filename.toOsSpecific(), 'wb')
|
with open(filename.toOsSpecific(), 'w') as f:
|
||||||
# Add a blank line
|
# Add a blank line
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
|
|
||||||
@ -199,9 +199,6 @@ class ParticleEffect(NodePath):
|
|||||||
fg.printParams(f, target)
|
fg.printParams(f, target)
|
||||||
f.write('self.addForceGroup(%s)\n' % target)
|
f.write('self.addForceGroup(%s)\n' % target)
|
||||||
|
|
||||||
# Close the file
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def loadConfig(self, filename):
|
def loadConfig(self, filename):
|
||||||
data = vfs.readFile(filename, 1)
|
data = vfs.readFile(filename, 1)
|
||||||
data = data.replace(b'\r', b'')
|
data = data.replace(b'\r', b'')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user