Add DCLN blend type

This commit is contained in:
Jack Andersen 2017-10-16 19:51:13 -10:00
parent 83fdb9ab7c
commit ebad51dc2e
6 changed files with 49 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from mathutils import Vector
hecl_typeS = [ hecl_typeS = [
('NONE', "None", "Active scene not using HECL", None), ('NONE', "None", "Active scene not using HECL", None),
('MESH', "Mesh", "Active scene represents an HMDL Mesh", hmdl.draw), ('MESH', "Mesh", "Active scene represents an HMDL Mesh", hmdl.draw),
('CMESH', "Collision Mesh", "Active scene represents a Collision Mesh", None),
('ACTOR', "Actor", "Active scene represents a HECL Actor", sact.draw), ('ACTOR', "Actor", "Active scene represents a HECL Actor", sact.draw),
('AREA', "Area", "Active scene represents a HECL Area", srea.draw), ('AREA', "Area", "Active scene represents a HECL Area", srea.draw),
('WORLD', "World", "Active scene represents a HECL World", swld.draw), ('WORLD', "World", "Active scene represents a HECL World", swld.draw),

View File

@ -235,6 +235,19 @@ def dataout_loop():
writepipestr(b'OK') writepipestr(b'OK')
hecl.hmdl.cookcol(writepipebuf, bpy.data.objects[meshName]) hecl.hmdl.cookcol(writepipebuf, bpy.data.objects[meshName])
elif cmdargs[0] == 'MESHCOMPILECOLLISIONALL':
writepipestr(b'OK')
colCount = 0
for obj in bpy.context.scene.objects:
if obj.type == 'MESH' and not obj.library:
colCount += 1
writepipebuf(struct.pack('I', colCount))
for obj in bpy.context.scene.objects:
if obj.type == 'MESH' and not obj.library:
hecl.hmdl.cookcol(writepipebuf, obj)
elif cmdargs[0] == 'MESHCOMPILEALL': elif cmdargs[0] == 'MESHCOMPILEALL':
maxSkinBanks = int(cmdargs[2]) maxSkinBanks = int(cmdargs[2])
maxOctantLength = float(cmdargs[3]) maxOctantLength = float(cmdargs[3])

2
hecl/extern/boo vendored

@ -1 +1 @@
Subproject commit ed9b7914eeff6d0db2c90b34fcc3673778250ed7 Subproject commit 7eb2b19619117c8f923d8b098e2a2d710cd3363a

View File

@ -55,6 +55,7 @@ public:
{ {
None, None,
Mesh, Mesh,
ColMesh,
Actor, Actor,
Area, Area,
World, World,
@ -791,6 +792,9 @@ public:
/** Compile collision mesh by name (AREA blends only) */ /** Compile collision mesh by name (AREA blends only) */
ColMesh compileColMesh(const std::string& name); ColMesh compileColMesh(const std::string& name);
/** Compile all meshes as collision meshes (CMESH blends only) */
std::vector<ColMesh> compileColMeshes();
/** Compile all meshes into one (AREA blends only) */ /** Compile all meshes into one (AREA blends only) */
Mesh compileAllMeshes(HMDLTopology topology, int skinSlotCount=10, float maxOctantLength=5.0, Mesh compileAllMeshes(HMDLTopology topology, int skinSlotCount=10, float maxOctantLength=5.0,
Mesh::SurfProgFunc surfProg=[](int){}); Mesh::SurfProgFunc surfProg=[](int){});

View File

@ -502,6 +502,7 @@ public:
std::string toString() const {return std::string(fcc, 4);} std::string toString() const {return std::string(fcc, 4);}
uint32_t toUint32() const {return num;} uint32_t toUint32() const {return num;}
operator uint32_t() const {return num;} operator uint32_t() const {return num;}
const char* getChars() const {return fcc;}
}; };
#define FOURCC(chars) FourCC(SBIG(chars)) #define FOURCC(chars) FourCC(SBIG(chars))

View File

@ -582,6 +582,7 @@ static const char* BlendTypeStrs[] =
{ {
"NONE", "NONE",
"MESH", "MESH",
"CMESH",
"ACTOR", "ACTOR",
"AREA", "AREA",
"WORLD", "WORLD",
@ -1484,6 +1485,34 @@ BlenderConnection::DataStream::compileColMesh(const std::string& name)
return ColMesh(*m_parent); return ColMesh(*m_parent);
} }
std::vector<BlenderConnection::DataStream::ColMesh>
BlenderConnection::DataStream::compileColMeshes()
{
if (m_parent->m_loadedType != BlendType::ColMesh)
BlenderLog.report(logvisor::Fatal, _S("%s is not a CMESH blend"),
m_parent->m_loadedBlend.getAbsolutePath().c_str());
char req[128];
snprintf(req, 128, "MESHCOMPILECOLLISIONALL");
m_parent->_writeStr(req);
char readBuf[256];
m_parent->_readStr(readBuf, 256);
if (strcmp(readBuf, "OK"))
BlenderLog.report(logvisor::Fatal, "unable to cook collision meshes: %s", readBuf);
uint32_t meshCount;
m_parent->_readBuf(&meshCount, 4);
std::vector<BlenderConnection::DataStream::ColMesh> ret;
ret.reserve(meshCount);
for (uint32_t i=0 ; i<meshCount ; ++i)
ret.emplace_back(*m_parent);
return ret;
}
BlenderConnection::DataStream::Mesh BlenderConnection::DataStream::Mesh
BlenderConnection::DataStream::compileAllMeshes(HMDLTopology topology, BlenderConnection::DataStream::compileAllMeshes(HMDLTopology topology,
int skinSlotCount, int skinSlotCount,