Browse Source

Fix #2

It appears that we were storing PyHSPlasma objects in class attributes, so
they were being held after the plResManager went away--therefore their
keys were nuked. We should probably be holding keys and not objects, but
this fix works regardless.
pull/6/head
Adam Johnson 11 years ago
parent
commit
2fb944c9ce
  1. 4
      korman/exporter/convert.py
  2. 6
      korman/exporter/manager.py
  3. 3
      korman/exporter/material.py
  4. 6
      korman/exporter/mesh.py

4
korman/exporter/convert.py

@ -24,11 +24,9 @@ from . import mesh
from . import utils from . import utils
class Exporter: class Exporter:
# These are objects that we need to export as plSceneObjects
_objects = []
def __init__(self, op): def __init__(self, op):
self._op = op # Blender export operator self._op = op # Blender export operator
self._objects = []
@property @property
def age_name(self): def age_name(self):

6
korman/exporter/manager.py

@ -43,13 +43,13 @@ _pool_types = (
class ExportManager: class ExportManager:
"""Friendly resource-managing helper class.""" """Friendly resource-managing helper class."""
_nodes = {}
_pages = {}
def __init__(self, version): def __init__(self, version):
self.mgr = plResManager() self.mgr = plResManager()
self.mgr.setVer(version) self.mgr.setVer(version)
self._nodes = {}
self._pages = {}
# cheap inheritance # cheap inheritance
for i in dir(self.mgr): for i in dir(self.mgr):
if not hasattr(self, i): if not hasattr(self, i):

3
korman/exporter/material.py

@ -22,10 +22,9 @@ from . import explosions
from . import utils from . import utils
class MaterialConverter: class MaterialConverter:
_hsbitmaps = {}
def __init__(self, exporter): def __init__(self, exporter):
self._exporter = weakref.ref(exporter) self._exporter = weakref.ref(exporter)
self._hsbitmaps = {}
def export_material(self, bo, bm): def export_material(self, bo, bm):
"""Exports a Blender Material as an hsGMaterial""" """Exports a Blender Material as an hsGMaterial"""

6
korman/exporter/mesh.py

@ -85,13 +85,13 @@ class _DrawableCriteria:
class MeshConverter: class MeshConverter:
_dspans = {}
_mesh_geospans = {}
def __init__(self, exporter): def __init__(self, exporter):
self._exporter = weakref.ref(exporter) self._exporter = weakref.ref(exporter)
self.material = material.MaterialConverter(exporter) self.material = material.MaterialConverter(exporter)
self._dspans = {}
self._mesh_geospans = {}
def _create_geospan(self, bo, mesh, bm, hsgmat): def _create_geospan(self, bo, mesh, bm, hsgmat):
"""Initializes a plGeometrySpan from a Blender Object and an hsGMaterial""" """Initializes a plGeometrySpan from a Blender Object and an hsGMaterial"""
geospan = plGeometrySpan() geospan = plGeometrySpan()

Loading…
Cancel
Save