Browse Source

Merge 7532f5eb49 into 8f20586876

pull/197/merge
Darryl Pogue 4 years ago committed by GitHub
parent
commit
5ff89f3065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 51
      korman/exporter/mesh.py
  2. 13
      korman/properties/modifiers/avatar.py
  3. 3
      korman/ui/modifiers/avatar.py

51
korman/exporter/mesh.py

@ -270,6 +270,10 @@ class MeshConverter(_MeshManager):
dspan.composeGeometry(True, True) dspan.composeGeometry(True, True)
inc_progress() inc_progress()
def _is_shared_mesh(self, bo):
cm = bo.plasma_modifiers.clothing_mesh
return cm.enabled
def _export_geometry(self, bo, mesh, materials, geospans): def _export_geometry(self, bo, mesh, materials, geospans):
# Recall that materials is a mapping of exported materials to blender material indices. # Recall that materials is a mapping of exported materials to blender material indices.
# Therefore, geodata maps blender material indices to working geometry data. # Therefore, geodata maps blender material indices to working geometry data.
@ -491,7 +495,7 @@ class MeshConverter(_MeshManager):
drawables = self._export_mesh(bo) drawables = self._export_mesh(bo)
# Create the DrawInterface # Create the DrawInterface
if drawables: if drawables and not self._is_shared_mesh(bo):
diface = self._mgr.find_create_object(plDrawInterface, bl=bo) diface = self._mgr.find_create_object(plDrawInterface, bl=bo)
for dspan_key, idx in drawables: for dspan_key, idx in drawables:
diface.addDrawable(dspan_key, idx) diface.addDrawable(dspan_key, idx)
@ -517,24 +521,33 @@ class MeshConverter(_MeshManager):
# Step 2: Export Blender mesh data to Plasma GeometrySpans # Step 2: Export Blender mesh data to Plasma GeometrySpans
self._export_geometry(bo, mesh, materials, geospans) self._export_geometry(bo, mesh, materials, geospans)
# Step 3: Add plGeometrySpans to the appropriate DSpan and create indices if self._is_shared_mesh(bo):
_diindices = {} # Step 3: Add plGeometrySpans to a plSharedMesh object
for geospan, pass_index in geospans: shared = self._mgr.find_create_object(plSharedMesh, bl=bo)
dspan = self._find_create_dspan(bo, geospan.material.object, pass_index) shared.flags |= plSharedMesh.kDontSaveMorphState
self._report.msg("Exported hsGMaterial '{}' geometry into '{}'", for geospan, pass_index in geospans:
geospan.material.name, dspan.key.name, indent=1) geospan.props |= (plGeometrySpan.kRequiresBlending | plGeometrySpan.kPropForceShadow)
idx = dspan.addSourceSpan(geospan) shared.addSpan(geospan)
diidx = _diindices.setdefault(dspan, []) return shared
diidx.append(idx) else:
# Step 3: Add plGeometrySpans to the appropriate DSpan and create indices
# Step 3.1: Harvest Span indices and create the DIIndices _diindices = {}
drawables = [] for geospan, pass_index in geospans:
for dspan, indices in _diindices.items(): dspan = self._find_create_dspan(bo, geospan.material.object, pass_index)
dii = plDISpanIndex() self._report.msg("Exported hsGMaterial '{}' geometry into '{}'",
dii.indices = indices geospan.material.name, dspan.key.name, indent=1)
idx = dspan.addDIIndex(dii) idx = dspan.addSourceSpan(geospan)
drawables.append((dspan.key, idx)) diidx = _diindices.setdefault(dspan, [])
return drawables diidx.append(idx)
# Step 3.1: Harvest Span indices and create the DIIndices
drawables = []
for dspan, indices in _diindices.items():
dii = plDISpanIndex()
dii.indices = indices
idx = dspan.addDIIndex(dii)
drawables.append((dspan.key, idx))
return drawables
def _export_material_spans(self, bo, mesh, materials): def _export_material_spans(self, bo, mesh, materials):
"""Exports all Materials and creates plGeometrySpans""" """Exports all Materials and creates plGeometrySpans"""

13
korman/properties/modifiers/avatar.py

@ -24,6 +24,19 @@ from ...helpers import find_modifier
from ... import idprops from ... import idprops
class PlasmaClothingMeshModifier(PlasmaModifierProperties):
pl_id = "clothing_mesh"
bl_category = "Avatar"
bl_label = "Clothing Mesh"
bl_description = "Mesh for a Clothing Item"
bl_icon = "MOD_CLOTH"
def export(self, exporter, bo, so):
# This is handled in the mesh exporter code
pass
class PlasmaLadderModifier(PlasmaModifierProperties): class PlasmaLadderModifier(PlasmaModifierProperties):
pl_id = "laddermod" pl_id = "laddermod"

3
korman/ui/modifiers/avatar.py

@ -17,6 +17,9 @@ import bpy
from ...helpers import find_modifier from ...helpers import find_modifier
def clothing_mesh(modifier, layout, context):
pass
def laddermod(modifier, layout, context): def laddermod(modifier, layout, context):
layout.label(text="Avatar climbs facing negative Y.") layout.label(text="Avatar climbs facing negative Y.")

Loading…
Cancel
Save