Browse Source

Merge pull request #109 from Hoikas/export-scene

Fix #106
pull/112/head
Adam Johnson 6 years ago committed by GitHub
parent
commit
c4d26432ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      korman/exporter/convert.py
  2. 2
      korman/exporter/etlight.py
  3. 6
      korman/exporter/mesh.py

7
korman/exporter/convert.py

@ -112,12 +112,13 @@ class Exporter:
oven.bake_static_lighting(self._objects)
def _collect_objects(self):
scene = bpy.context.scene
self.report.progress_advance()
self.report.progress_range = len(bpy.data.objects)
self.report.progress_range = len(scene.objects)
inc_progress = self.report.progress_increment
# Grab a naive listing of enabled pages
age = bpy.context.scene.world.plasma_age
age = scene.world.plasma_age
pages_enabled = frozenset([page.name for page in age.pages if page.enabled])
all_pages = frozenset([page.name for page in age.pages])
@ -139,7 +140,7 @@ class Exporter:
# - Any arbitrary page can be disabled, so check our frozenset.
# - Also, someone might have specified an invalid page, so keep track of that.
error = explosions.UndefinedPageError()
for obj in bpy.data.objects:
for obj in scene.objects:
if obj.plasma_object.enabled:
page = obj.plasma_object.page
if not page and not default_inited:

2
korman/exporter/etlight.py

@ -167,7 +167,7 @@ class LightBaker(_MeshManager):
if user_lg is None:
if not lg or bool(lg.objects) is False:
source = [i for i in bpy.data.objects if i.type == "LAMP"]
source = [i for i in bpy.context.scene.objects if i.type == "LAMP"]
else:
source = lg.objects
dest = bpy.data.groups.new("_LIGHTMAPGEN_{}_{}".format(bo.name, mat_name))

6
korman/exporter/mesh.py

@ -128,15 +128,15 @@ class _MeshManager:
return props
def __enter__(self):
scene = bpy.context.scene
self._report.progress_advance()
self._report.progress_range = len(bpy.data.objects)
self._report.progress_range = len(scene.objects)
# 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
# take this into account. Thus, we temporarily apply modifiers to ALL meshes (even ones that
# are not exported) such that we can generate proper lighting.
scene = bpy.context.scene
for i in bpy.data.objects:
for i in scene.objects:
if i.type == "MESH" and i.is_modified(scene, "RENDER"):
# Remember, storing actual pointers to the Blender objects can cause bad things to
# happen because Blender's memory management SUCKS!

Loading…
Cancel
Save