|
|
@ -18,6 +18,7 @@ from PyHSPlasma import * |
|
|
|
from math import fabs |
|
|
|
from math import fabs |
|
|
|
import weakref |
|
|
|
import weakref |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from ..exporter.logger import ExportProgressLogger |
|
|
|
from . import explosions |
|
|
|
from . import explosions |
|
|
|
from .. import helpers |
|
|
|
from .. import helpers |
|
|
|
from . import material |
|
|
|
from . import material |
|
|
@ -113,14 +114,18 @@ class _GeoData: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _MeshManager: |
|
|
|
class _MeshManager: |
|
|
|
def __init__(self, exporter): |
|
|
|
def __init__(self, report=None): |
|
|
|
self._exporter = weakref.ref(exporter) |
|
|
|
if report is not None: |
|
|
|
|
|
|
|
self._report = report |
|
|
|
self._mesh_overrides = {} |
|
|
|
self._mesh_overrides = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def add_progress_presteps(report): |
|
|
|
|
|
|
|
report.progress_add_step("Applying Blender Mods") |
|
|
|
|
|
|
|
|
|
|
|
def __enter__(self): |
|
|
|
def __enter__(self): |
|
|
|
report = self._exporter().report |
|
|
|
self._report.progress_advance() |
|
|
|
report.progress_advance() |
|
|
|
self._report.progress_range = len(bpy.data.objects) |
|
|
|
report.progress_range = len(bpy.data.objects) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Some modifiers like "Array" will procedurally generate new geometry that will impact |
|
|
|
# Some modifiers like "Array" will procedurally generate new geometry that will impact |
|
|
|
# lightmap generation. The Blender Internal renderer does not seem to be smart enough to |
|
|
|
# lightmap generation. The Blender Internal renderer does not seem to be smart enough to |
|
|
@ -133,7 +138,7 @@ class _MeshManager: |
|
|
|
# happen because Blender's memory management SUCKS! |
|
|
|
# happen because Blender's memory management SUCKS! |
|
|
|
self._mesh_overrides[i.name] = i.data.name |
|
|
|
self._mesh_overrides[i.name] = i.data.name |
|
|
|
i.data = i.to_mesh(scene, True, "RENDER", calc_tessface=False) |
|
|
|
i.data = i.to_mesh(scene, True, "RENDER", calc_tessface=False) |
|
|
|
report.progress_increment() |
|
|
|
self._report.progress_increment() |
|
|
|
return self |
|
|
|
return self |
|
|
|
|
|
|
|
|
|
|
|
def __exit__(self, type, value, traceback): |
|
|
|
def __exit__(self, type, value, traceback): |
|
|
@ -146,12 +151,15 @@ class _MeshManager: |
|
|
|
|
|
|
|
|
|
|
|
class MeshConverter(_MeshManager): |
|
|
|
class MeshConverter(_MeshManager): |
|
|
|
def __init__(self, exporter): |
|
|
|
def __init__(self, exporter): |
|
|
|
super().__init__(exporter) |
|
|
|
self._exporter = weakref.ref(exporter) |
|
|
|
self.material = material.MaterialConverter(exporter) |
|
|
|
self.material = material.MaterialConverter(exporter) |
|
|
|
|
|
|
|
|
|
|
|
self._dspans = {} |
|
|
|
self._dspans = {} |
|
|
|
self._mesh_geospans = {} |
|
|
|
self._mesh_geospans = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# _report is a property on this subclass |
|
|
|
|
|
|
|
super().__init__() |
|
|
|
|
|
|
|
|
|
|
|
def _calc_num_uvchans(self, bo, mesh): |
|
|
|
def _calc_num_uvchans(self, bo, mesh): |
|
|
|
max_user_texs = plGeometrySpan.kUVCountMask |
|
|
|
max_user_texs = plGeometrySpan.kUVCountMask |
|
|
|
num_user_texs = len(mesh.tessface_uv_textures) |
|
|
|
num_user_texs = len(mesh.tessface_uv_textures) |
|
|
|