initial DEAFBABE support

This commit is contained in:
Jack Andersen 2015-09-11 21:13:40 -10:00
parent 40c39ee83b
commit 73862a937f
15 changed files with 565 additions and 50 deletions

View File

@ -58,12 +58,14 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
" face = od_entry['bm'].faces.new(verts)\n"
" else: # Probably a double-sided surface\n"
" face = face.copy()\n"
" face.normal_flip()\n"
" for i in range(3):\n"
" face.verts[i].co = verts[i].co\n"
" ret_mesh = od_entry['bm']\n"
"\n"
" elif face is not None: # Same material, probably double-sided\n"
" face = face.copy()\n"
" face.normal_flip()\n"
" for i in range(3):\n"
" face.verts[i].co = verts[i].co\n"
"\n"
" else: \n"
" face = bm.faces.new(verts)\n"

View File

@ -686,11 +686,9 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
if (v+3 >= vertCount)
break;
bool peek = (v >= vertCount - 3);
/* Advance 3 Prim Verts */
for (int pv=0 ; pv<3 ; ++pv)
primVerts[pv] = dl.readVert(peek);
primVerts[pv] = dl.readVert();
}
}
else if (ptype == GX::TRIANGLEFAN)
@ -728,10 +726,12 @@ atUint32 ReadGeomSectionsToBlender(HECL::BlenderConnection::PyOutStream& os,
}
}
bool peek = (v >= vertCount - 3);
/* Break if done */
if (v+3 >= vertCount)
break;
/* Advance one prim vert */
primVerts[(c+2)%3] = dl.readVert(peek);
primVerts[(c+2)%3] = dl.readVert();
++c;
}
}

View File

@ -1,6 +1,5 @@
make_dnalist(liblist
CMDL
DeafBabe)
CMDL)
add_library(DNACommon
DNACommon.hpp DNACommon.cpp
${liblist}
@ -11,6 +10,5 @@ add_library(DNACommon
TXTR.hpp TXTR.cpp
ANCS.hpp
ANIM.hpp ANIM.cpp
DeafBabe.cpp
Tweaks/ITweakPlayer.hpp
Tweaks/ITweakPlayerControl.hpp)

View File

@ -1,31 +0,0 @@
#ifndef _DNACOMMON_DEAFBABE_HPP_
#define _DNACOMMON_DEAFBABE_HPP_
#include "DNACommon.hpp"
namespace Retro
{
namespace DNACommon
{
struct DeafBabe : BigDNA
{
Delete expl;
std::vector<atUint64> materials;
std::vector<atUint8> vertMats;
std::vector<atUint8> edgeMats;
std::vector<atUint8> polyMats;
std::vector<std::pair<atUint16, atUint16>> edgeVertConnections;
std::vector<std::pair<atUint16, atUint16>> triangleEdgeConnections;
void read(Athena::io::IStreamReader& reader)
{
}
void write(Athena::io::IStreamWriter& writer) const
{
}
};
}
}
#endif // _DNACOMMON_DEAFBABE_HPP_

View File

@ -9,6 +9,7 @@ make_dnalist(liblist
MAPA
CMDLMaterials
MREA
DeafBabe
Tweaks/CTweakParticle
Tweaks/CTweakPlayer
Tweaks/CTweakPlayerControl)
@ -22,4 +23,5 @@ add_library(DNAMP1
EVNT.cpp
CMDL.hpp
CMDLMaterials.cpp
MREA.cpp)
MREA.cpp
DeafBabe.cpp)

View File

@ -0,0 +1,67 @@
#include "DeafBabe.hpp"
namespace Retro
{
namespace DNAMP1
{
void DeafBabe::BlenderInit(HECL::BlenderConnection::PyOutStream& os)
{
os << "TYPE_COLORS = {'Ground':(1.0, 0.43, 0.15),\n"
" 'Stone':(0.28, 0.28, 0.28),\n"
" 'Hard Stone':(0.1, 0.1, 0.1),\n"
" 'Metal':(0.5, 0.5, 0.5),\n"
" 'Leaves':(0.61, 0.03, 0.05)}\n"
"\n"
"# Diffuse Color Maker\n"
"def make_color(index, mat_type, name):\n"
" new_mat = bpy.data.materials.new(name)\n"
" if mat_type in TYPE_COLORS:\n"
" new_mat.diffuse_color = TYPE_COLORS[mat_type]\n"
" else:\n"
" new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n"
" return new_mat\n"
"\n"
"bpy.types.Material.retro_collision_type = bpy.props.IntProperty(name='Retro: Collsion Type')\n"
"bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough')\n"
"\n"
"material_dict = {}\n"
"material_index = []\n"
"def select_material(data):\n"
"\n"
" type_id = data & 0xff\n"
" mat_type = str(type_id)\n"
" if type_id == 1:\n"
" mat_type = 'Ground'\n"
" elif type_id == 3:\n"
" mat_type = 'Stone'\n"
" elif type_id == 4:\n"
" mat_type = 'Hard Stone'\n"
" elif type_id == 5:\n"
" mat_type = 'Metal'\n"
" elif type_id == 9:\n"
" mat_type = 'Leaves'\n"
"\n"
" if ((data >> 18) & 1):\n"
" mat_name = mat_type + ' Fire Through'\n"
" else:\n"
" mat_name = mat_type\n"
"\n"
" if mat_name in material_index:\n"
" return material_index.index(mat_name)\n"
" elif mat_name in material_dict:\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
" else:\n"
" mat = make_color(len(material_dict), mat_type, mat_name)\n"
" mat.retro_collision_type = type_id\n"
" mat.retro_projectile_passthrough = ((data >> 18) & 1)\n"
" material_dict[mat_name] = mat\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
"\n"
"\n";
}
}
}

View File

@ -0,0 +1,224 @@
#ifndef _DNAMP1_DEAFBABE_HPP_
#define _DNAMP1_DEAFBABE_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "BlenderConnection.hpp"
namespace Retro
{
namespace DNAMP1
{
template<class DEAFBABE>
void DeafBabeSendToBlender(HECL::BlenderConnection::PyOutStream& os, const DEAFBABE& db)
{
os << "material_index = []\n"
"col_bm = bmesh.new()\n";
for (const atVec3f& vert : db.verts)
os.format("col_bm.verts.new((%f,%f,%f))\n",
vert.vec[0],
vert.vec[1],
vert.vec[2]);
os << "col_bm.verts.ensure_lookup_table()\n";
int triIdx = 0;
#define TEST 0
#if TEST == 0
for (const typename DEAFBABE::Triangle& tri : db.triangleEdgeConnections)
{
const typename DEAFBABE::Material& triMat = db.materials[db.triMats[triIdx++]];
const typename DEAFBABE::Edge& edge0 = db.edgeVertConnections[tri.edges[0]];
const typename DEAFBABE::Edge& edge1 = db.edgeVertConnections[tri.edges[1]];
const typename DEAFBABE::Edge& edge2 = db.edgeVertConnections[tri.edges[2]];
if (!edge0.verts[0] && !edge1.verts[0] && !edge2.verts[0])
break;
os << "tri_verts = []\n";
os.format("tri_verts.append(col_bm.verts[%u])\n", edge0.findCommon(edge1));
os.format("tri_verts.append(col_bm.verts[%u])\n", edge1.findCommon(edge2));
os.format("tri_verts.append(col_bm.verts[%u])\n", edge2.findCommon(edge0));
os.format("face = col_bm.faces.get(tri_verts)\n"
"if face is None:\n"
" face = col_bm.faces.new(tri_verts)\n"
"else:\n"
" face = face.copy()\n"
" for i in range(3):\n"
" face.verts[i].co = tri_verts[i].co\n"
" col_bm.verts.ensure_lookup_table()\n"
"face.material_index = select_material(0x%08X)\n"
"face.smooth = False\n"
"\n",
triMat.material);
}
#elif TEST == 1
for (const typename DEAFBABE::Triangle& tri : db.triangleEdgeConnections2)
{
if (tri.edges[0] != 65535)
{
const typename DEAFBABE::Edge& edge0 = db.edgeVertConnections[tri.edges[0]];
os.format("edge_verts = [col_bm.verts[%u], col_bm.verts[%u]]\n",
edge0.verts[0], edge0.verts[1]);
os << "edge = col_bm.edges.get(edge_verts)\n"
"if edge is None:\n"
" edge = col_bm.edges.new(edge_verts)\n"
"\n";
}
if (tri.edges[1] != 65535)
{
const typename DEAFBABE::Edge& edge1 = db.edgeVertConnections[tri.edges[1]];
os.format("edge_verts = [col_bm.verts[%u], col_bm.verts[%u]]\n",
edge1.verts[0], edge1.verts[1]);
os << "edge = col_bm.edges.get(edge_verts)\n"
"if edge is None:\n"
" edge = col_bm.edges.new(edge_verts)\n"
"\n";
}
if (tri.edges[2] != 65535)
{
const typename DEAFBABE::Edge& edge2 = db.edgeVertConnections[tri.edges[2]];
os.format("edge_verts = [col_bm.verts[%u], col_bm.verts[%u]]\n",
edge2.verts[0], edge2.verts[1]);
os << "edge = col_bm.edges.get(edge_verts)\n"
"if edge is None:\n"
" edge = col_bm.edges.new(edge_verts)\n"
"\n";
}
}
#elif TEST == 2
int max = 0;
for (const typename DEAFBABE::Triangle& tri : db.triangleEdgeConnections2)
{
for (int e=0 ; e<3 ; ++e)
{
if (tri.edges[e] == 65535)
continue;
const typename DEAFBABE::Edge& edge = db.edgeVertConnections.at(tri.edges[e]);
if (edge.verts[0] > max)
max = edge.verts[0];
if (edge.verts[1] > max)
max = edge.verts[1];
}
}
printf("MAX: %d\n", max);
#endif
os << "col_mesh = bpy.data.meshes.new('CMESH')\n"
"col_bm.to_mesh(col_mesh)\n"
"col_mesh_obj = bpy.data.objects.new(col_mesh.name, col_mesh)\n"
"\n"
"for mat_name in material_index:\n"
" mat = material_dict[mat_name]\n"
" col_mesh.materials.append(mat)\n"
"\n"
"bpy.context.scene.objects.link(col_mesh_obj)\n"
"col_mesh_obj.layers[1] = True\n"
"col_mesh_obj.layers[0] = False\n"
"col_mesh_obj.draw_type = 'SOLID'\n"
"col_mesh_obj.game.physics_type = 'STATIC'\n"
"\n";
}
struct DeafBabe : BigDNA
{
DECL_DNA
enum BspNodeType : atUint32
{
BspNodeInvalid,
BspNodeBranch,
BspNodeLeaf
};
struct Material : BigDNA
{
DECL_DNA
Value<atUint32> material;
bool fireThrough() const {return material >> 18 & 0x1;}
void setFireThrough(bool v) {material &= 0x40000; material |= v << 18;}
enum Type
{
Mat0,
MatGround,
Mat2,
MatStone,
MatHardStone,
MatMetal,
Mat6,
Mat7,
Mat8,
MatLeaves
};
Type type() const {return Type(material & 0xff);}
void setType(Type t) {material &= 0xff; material |= t;}
};
struct Edge : BigDNA
{
DECL_DNA
Value<atUint16> verts[2];
atUint16 findCommon(const Edge& other) const
{
if (verts[0] == other.verts[0] || verts[0] == other.verts[1])
return verts[0];
if (verts[1] == other.verts[0] || verts[1] == other.verts[1])
return verts[1];
return -1;
}
};
struct Triangle : BigDNA
{
DECL_DNA
Value<atUint16> edges[3];
};
Value<atUint32> unk1;
Value<atUint32> length;
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec3f> aabb[2];
Value<BspNodeType> rootNodeType;
Value<atUint32> bspSize;
Buffer<DNA_COUNT(bspSize)> bspTree;
Value<atUint32> materialCount;
Vector<Material, DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
std::vector<Triangle> triangleEdgeConnections2;
static void BlenderInit(HECL::BlenderConnection::PyOutStream& os);
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
}
};
}
}
#endif // _DNAMP1_DEAFBABE_HPP_

View File

@ -1,10 +1,83 @@
#include "MREA.hpp"
#include "DeafBabe.hpp"
namespace Retro
{
namespace DNAMP1
{
void MREA::ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs)
{
atUint32 bdMagic = rs.readUint32Big();
if (bdMagic != 0xBABEDEAD)
Log.report(LogVisor::FatalError, "invalid BABEDEAD magic");
for (atUint32 s=0 ; s<2 ; ++s)
{
atUint32 lightCount = rs.readUint32Big();
for (atUint32 l=0 ; l<lightCount ; ++l)
{
BabeDeadLight light;
light.read(rs);
switch (light.lightType)
{
case BabeDeadLight::LightLocalAmbient:
os.format("bpy.context.scene.world.horizon_color = (%f,%f,%f)\n",
light.color.vec[0], light.color.vec[1], light.color.vec[2]);
continue;
case BabeDeadLight::LightDirectional:
os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'SUN')\n"
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
"lamp_obj.rotation_mode = 'QUATERNION'\n"
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
"\n", s, l,
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2]);
break;
case BabeDeadLight::LightCustom:
os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'POINT')\n"
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
"\n", s, l);
break;
case BabeDeadLight::LightSpot:
os.format("lamp = bpy.data.lamps.new('LAMP_%01u_%03u', 'SPOT')\n"
"lamp.spot_size = %f\n"
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
"lamp_obj.rotation_mode = 'QUATERNION'\n"
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
"\n", s, l,
light.spotCutoff * M_PI / 180.f,
light.direction.vec[0], light.direction.vec[1], light.direction.vec[2]);
break;
default: continue;
}
os.format("lamp.retro_layer = %u\n"
"lamp.use_nodes = True\n"
"falloff_node = lamp.node_tree.nodes.new('ShaderNodeLightFalloff')\n"
"falloff_node.inputs[0].default_value = %f\n"
"lamp.node_tree.nodes['Emission'].inputs[0].default_value = (%f,%f,%f,1.0)\n"
"lamp_obj.hide_render = True\n"
"lamp_obj.location = (%f,%f,%f)\n"
"bpy.context.scene.objects.link(lamp_obj)\n"
"\n", s, light.q,
light.color.vec[0], light.color.vec[1], light.color.vec[2],
light.position.vec[0], light.position.vec[1], light.position.vec[2]);
switch (light.falloff)
{
case BabeDeadLight::FalloffConstant:
os << "lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n";
case BabeDeadLight::FalloffLinear:
os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n";
case BabeDeadLight::FalloffQuadratic:
os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n";
default: break;
}
}
}
}
bool MREA::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
@ -29,6 +102,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"bpy.context.scene.hecl_type = 'AREA'\n",
@ -39,6 +113,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
"for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n"
"bpy.types.Object.retro_disable_thermal_visor = bpy.props.BoolProperty(name='Retro: Disable in Thermal Visor')\n"
"bpy.types.Object.retro_disable_xray_visor = bpy.props.BoolProperty(name='Retro: Disable in X-Ray Visor')\n"
@ -81,10 +156,34 @@ bool MREA::Extract(const SpecBase& dataSpec,
mHeader.visorFlags.thermalLevelStr());
}
/* Skip AROT */
rs.seek(head.secSizes[curSec++], Athena::Current);
/* Skip SCLY (for now) */
rs.seek(head.secSizes[curSec++], Athena::Current);
/* Read collision meshes */
DeafBabe collision;
secStart = rs.position();
collision.read(rs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
/* Skip unknown section */
rs.seek(head.secSizes[curSec++], Athena::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = rs.position();
ReadBabeDeadToBlender_1_2(os, rs);
rs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
/* Origins to center of mass */
os << "bpy.ops.object.select_by_type(type='MESH')\n"
os << "bpy.context.scene.layers[1] = True\n"
"bpy.ops.object.select_by_type(type='MESH')\n"
"bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS')\n"
"bpy.ops.object.select_all(action='DESELECT')\n";
"bpy.ops.object.select_all(action='DESELECT')\n"
"bpy.context.scene.layers[1] = False\n";
/* Center view */
os << "bpy.context.user_preferences.view.smooth_view = 0\n"

View File

@ -69,6 +69,38 @@ struct MREA
Value<atVec3f> aabb[2];
};
struct BabeDeadLight : BigDNA
{
DECL_DNA
enum LightType : atUint32
{
LightLocalAmbient,
LightDirectional,
LightCustom,
LightSpot
};
enum Falloff : atUint32
{
FalloffConstant,
FalloffLinear,
FalloffQuadratic
};
Value<LightType> lightType;
Value<atVec3f> color;
Value<atVec3f> position;
Value<atVec3f> direction;
Value<float> q;
Value<float> spotCutoff;
Value<float> unk5;
Value<atUint8> unk6;
Value<float> unk7;
Value<Falloff> falloff;
Value<float> unk9;
};
static void ReadBabeDeadToBlender_1_2(HECL::BlenderConnection::PyOutStream& os,
Athena::io::IStreamReader& rs);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,

View File

@ -5,7 +5,8 @@ make_dnalist(liblist
CMDLMaterials
CINF
CSKR
MREA)
MREA
DeafBabe)
add_library(DNAMP2
DNAMP2.hpp DNAMP2.cpp
${liblist}

View File

@ -0,0 +1,83 @@
#ifndef _DNAMP2_DEAFBABE_HPP_
#define _DNAMP2_DEAFBABE_HPP_
#include "../DNACommon/DNACommon.hpp"
#include "BlenderConnection.hpp"
#include "../DNAMP1/DeafBabe.hpp"
namespace Retro
{
namespace DNAMP2
{
struct DeafBabe : BigDNA
{
DECL_DNA
using BspNodeType = DNAMP1::DeafBabe::BspNodeType;
struct Material : BigDNA
{
DECL_DNA
Value<atUint64> material;
bool fireThrough() const {return material >> 18 & 0x1;}
void setFireThrough(bool v) {material &= 0x40000; material |= v << 18;}
enum Type
{
Mat0,
MatGround,
Mat2,
MatStone,
MatHardStone,
MatMetal,
Mat6,
Mat7,
Mat8,
MatLeaves
};
Type type() const {return Type(material & 0xff);}
void setType(Type t) {material &= 0xff; material |= t;}
};
using Edge = DNAMP1::DeafBabe::Edge;
using Triangle = DNAMP1::DeafBabe::Triangle;
Value<atUint32> unk1;
Value<atUint32> length;
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec3f> aabb[2];
Value<BspNodeType> rootNodeType;
Value<atUint32> bspSize;
Buffer<DNA_COUNT(bspSize)> bspTree;
Value<atUint32> materialCount;
Vector<Material, DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> triangleEdges2Count;
Vector<Triangle, DNA_COUNT(triangleEdges2Count / 3)> triangleEdgeConnections2;
Value<atUint32> vertCount;
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
static void BlenderInit(HECL::BlenderConnection::PyOutStream& os)
{
DNAMP1::DeafBabe::BlenderInit(os);
}
void sendToBlender(HECL::BlenderConnection::PyOutStream& os) const
{
DNAMP1::DeafBabeSendToBlender(os, *this);
}
};
}
}
#endif // _DNAMP2_DEAFBABE_HPP_

View File

@ -1,6 +1,8 @@
#include <Athena/FileWriter.hpp>
#include <lzo/lzo1x.h>
#include "MREA.hpp"
#include "../DNAMP1/MREA.hpp"
#include "DeafBabe.hpp"
namespace Retro
{
@ -190,6 +192,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"bpy.context.scene.hecl_type = 'AREA'\n",
@ -200,6 +203,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
"for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n"
"bpy.types.Object.retro_disable_thermal_visor = bpy.props.BoolProperty(name='Retro: Disable in Thermal Visor')\n"
"bpy.types.Object.retro_disable_xray_visor = bpy.props.BoolProperty(name='Retro: Disable in X-Ray Visor')\n"
@ -246,10 +250,44 @@ bool MREA::Extract(const SpecBase& dataSpec,
drs.seek(head.secSizes[curSec++], Athena::Current);
}
/* Skip AROT */
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Skip BVH */
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Skip Bitmap */
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Skip SCLY (for now) */
for (atUint32 l=0 ; l<head.sclyLayerCount ; ++l)
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Skip SCGN (for now) */
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Read collision meshes */
DeafBabe collision;
secStart = drs.position();
collision.read(drs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
/* Skip unknown section */
drs.seek(head.secSizes[curSec++], Athena::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = drs.position();
DNAMP1::MREA::ReadBabeDeadToBlender_1_2(os, drs);
drs.seek(secStart + head.secSizes[curSec++], Athena::Begin);
/* Origins to center of mass */
os << "bpy.ops.object.select_by_type(type='MESH')\n"
os << "bpy.context.scene.layers[1] = True\n"
"bpy.ops.object.select_by_type(type='MESH')\n"
"bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS')\n"
"bpy.ops.object.select_all(action='DESELECT')\n";
"bpy.ops.object.select_all(action='DESELECT')\n"
"bpy.context.scene.layers[1] = False\n";
/* Center view */
os << "bpy.context.user_preferences.view.smooth_view = 0\n"

View File

@ -1,5 +1,5 @@
#ifndef __DNAMP1_MREA_HPP__
#define __DNAMP1_MREA_HPP__
#ifndef __DNAMP2_MREA_HPP__
#define __DNAMP2_MREA_HPP__
#include "../DNACommon/DNACommon.hpp"
#include "CMDLMaterials.hpp"

2
hecl

@ -1 +1 @@
Subproject commit 9f36501c44c67e54b0aae4e557211f6b4f2217b3
Subproject commit c2844bf9a47a1b1da4fd6c2e0828f3179c095ecf