|
|
@ -386,37 +386,31 @@ class MaterialConverter: |
|
|
|
pl_env = plDynamicCamMap |
|
|
|
pl_env = plDynamicCamMap |
|
|
|
else: |
|
|
|
else: |
|
|
|
pl_env = plDynamicEnvMap |
|
|
|
pl_env = plDynamicEnvMap |
|
|
|
pl_env = self._export_dynamic_env(bo, hsgmat, layer, texture, pl_env) |
|
|
|
pl_env = self.export_dynamic_env(bo, hsgmat, layer, texture, pl_env) |
|
|
|
else: |
|
|
|
else: |
|
|
|
# We should really export a CubicEnvMap here, but we have a good setup for DynamicEnvMaps |
|
|
|
# We should really export a CubicEnvMap here, but we have a good setup for DynamicEnvMaps |
|
|
|
# that create themselves when the explorer links in, so really... who cares about CEMs? |
|
|
|
# that create themselves when the explorer links in, so really... who cares about CEMs? |
|
|
|
self._exporter().report.warn("IMAGE EnvironmentMaps are not supported. '{}' will not be exported!".format(layer.key.name)) |
|
|
|
self._exporter().report.warn("IMAGE EnvironmentMaps are not supported. '{}' will not be exported!".format(layer.key.name)) |
|
|
|
pl_env = None |
|
|
|
pl_env = None |
|
|
|
layer.state.shadeFlags |= hsGMatState.kShadeEnvironMap |
|
|
|
layer.state.shadeFlags |= hsGMatState.kShadeEnvironMap |
|
|
|
layer.texture = pl_env |
|
|
|
layer.texture = pl_env.key |
|
|
|
|
|
|
|
|
|
|
|
def _export_dynamic_env(self, bo, hsgmat, layer, texture, pl_class): |
|
|
|
def export_dynamic_env(self, bo, hsgmat, layer, texture, pl_class): |
|
|
|
# To protect the user from themselves, let's check to make sure that a DEM/DCM matching this |
|
|
|
# To protect the user from themselves, let's check to make sure that a DEM/DCM matching this |
|
|
|
# viewpoint object has not already been exported... |
|
|
|
# viewpoint object has not already been exported... |
|
|
|
bl_env = texture.environment_map |
|
|
|
bl_env = texture.environment_map |
|
|
|
viewpt = bl_env.viewpoint_object |
|
|
|
viewpt = bl_env.viewpoint_object |
|
|
|
|
|
|
|
if viewpt is None: |
|
|
|
|
|
|
|
viewpt = bo |
|
|
|
name = "{}_DynEnvMap".format(viewpt.name) |
|
|
|
name = "{}_DynEnvMap".format(viewpt.name) |
|
|
|
pl_env = self._mgr.find_key(pl_class, bl=bo, name=name) |
|
|
|
pl_env = self._mgr.find_object(pl_class, bl=bo, name=name) |
|
|
|
if pl_env is not None: |
|
|
|
if pl_env is not None: |
|
|
|
print(" EnvMap for viewpoint {} already exported... NOTE: Your settings here will be overridden by the previous object!".format(viewpt.name)) |
|
|
|
print(" EnvMap for viewpoint {} already exported... NOTE: Your settings here will be overridden by the previous object!".format(viewpt.name)) |
|
|
|
pl_env_obj = pl_env.object |
|
|
|
if isinstance(pl_env, plDynamicCamMap): |
|
|
|
if isinstance(pl_env_obj, plDynamicCamMap): |
|
|
|
pl_env.addTargetNode(self._mgr.find_key(plSceneObject, bl=bo)) |
|
|
|
pl_env_obj.addTargetNode(self._mgr.find_key(plSceneObject, bl=bo)) |
|
|
|
pl_env.addMatLayer(layer.key) |
|
|
|
pl_env_obj.addMatLayer(layer.key) |
|
|
|
|
|
|
|
return pl_env |
|
|
|
return pl_env |
|
|
|
|
|
|
|
|
|
|
|
# It matters not whether or not the viewpoint object is a Plasma Object, it is exported as at |
|
|
|
|
|
|
|
# least a SceneObject and CoordInterface so that we can touch it... |
|
|
|
|
|
|
|
# NOTE: that harvest_actor makes sure everyone alread knows we're going to have a CI |
|
|
|
|
|
|
|
root = self._mgr.find_create_key(plSceneObject, bl=bo, name=viewpt.name) |
|
|
|
|
|
|
|
self._exporter()._export_coordinate_interface(root.object, bl=bo, name=viewpt.name) |
|
|
|
|
|
|
|
# FIXME: DynamicCamMap Camera |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Ensure POT |
|
|
|
# Ensure POT |
|
|
|
oRes = bl_env.resolution |
|
|
|
oRes = bl_env.resolution |
|
|
|
eRes = helpers.ensure_power_of_two(oRes) |
|
|
|
eRes = helpers.ensure_power_of_two(oRes) |
|
|
@ -429,7 +423,6 @@ class MaterialConverter: |
|
|
|
pl_env.yon = bl_env.clip_end |
|
|
|
pl_env.yon = bl_env.clip_end |
|
|
|
pl_env.refreshRate = 0.01 if bl_env.source == "ANIMATED" else 0.0 |
|
|
|
pl_env.refreshRate = 0.01 if bl_env.source == "ANIMATED" else 0.0 |
|
|
|
pl_env.incCharacters = True |
|
|
|
pl_env.incCharacters = True |
|
|
|
pl_env.rootNode = root # FIXME: DCM camera |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Perhaps the DEM/DCM fog should be separately configurable at some point? |
|
|
|
# Perhaps the DEM/DCM fog should be separately configurable at some point? |
|
|
|
pl_fog = bpy.context.scene.world.plasma_fni |
|
|
|
pl_fog = bpy.context.scene.world.plasma_fni |
|
|
@ -439,6 +432,13 @@ class MaterialConverter: |
|
|
|
if isinstance(pl_env, plDynamicCamMap): |
|
|
|
if isinstance(pl_env, plDynamicCamMap): |
|
|
|
faces = (pl_env,) |
|
|
|
faces = (pl_env,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# It matters not whether or not the viewpoint object is a Plasma Object, it is exported as at |
|
|
|
|
|
|
|
# least a SceneObject and CoordInterface so that we can touch it... |
|
|
|
|
|
|
|
# NOTE: that harvest_actor makes sure everyone alread knows we're going to have a CI |
|
|
|
|
|
|
|
root = self._mgr.find_create_key(plSceneObject, bl=viewpt) |
|
|
|
|
|
|
|
pl_env.rootNode = root # FIXME: DCM camera |
|
|
|
|
|
|
|
# FIXME: DynamicCamMap Camera |
|
|
|
|
|
|
|
|
|
|
|
pl_env.addTargetNode(self._mgr.find_key(plSceneObject, bl=bo)) |
|
|
|
pl_env.addTargetNode(self._mgr.find_key(plSceneObject, bl=bo)) |
|
|
|
pl_env.addMatLayer(layer.key) |
|
|
|
pl_env.addMatLayer(layer.key) |
|
|
|
|
|
|
|
|
|
|
@ -458,6 +458,11 @@ class MaterialConverter: |
|
|
|
else: |
|
|
|
else: |
|
|
|
faces = pl_env.faces + (pl_env,) |
|
|
|
faces = pl_env.faces + (pl_env,) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# DEMs can do just a position vector. We actually prefer this because the WaveSet exporter |
|
|
|
|
|
|
|
# will probably want to steal it for diabolical purposes... |
|
|
|
|
|
|
|
pl_env.position = hsVector3(*viewpt.location) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if layer is not None: |
|
|
|
layer.UVWSrc = plLayerInterface.kUVWReflect |
|
|
|
layer.UVWSrc = plLayerInterface.kUVWReflect |
|
|
|
layer.state.miscFlags |= hsGMatState.kMiscUseRefractionXform |
|
|
|
layer.state.miscFlags |= hsGMatState.kMiscUseRefractionXform |
|
|
|
|
|
|
|
|
|
|
@ -475,7 +480,7 @@ class MaterialConverter: |
|
|
|
i.viewportBottom = eRes |
|
|
|
i.viewportBottom = eRes |
|
|
|
i.ZDepth = 24 |
|
|
|
i.ZDepth = 24 |
|
|
|
|
|
|
|
|
|
|
|
return pl_env.key |
|
|
|
return pl_env |
|
|
|
|
|
|
|
|
|
|
|
def _export_texture_type_image(self, bo, hsgmat, layer, slot): |
|
|
|
def _export_texture_type_image(self, bo, hsgmat, layer, slot): |
|
|
|
"""Exports a Blender ImageTexture to a plLayer""" |
|
|
|
"""Exports a Blender ImageTexture to a plLayer""" |
|
|
|