diff --git a/hecl/blender/BlenderConnection.cpp b/hecl/blender/BlenderConnection.cpp index 15f8c7ebb..623b0c958 100644 --- a/hecl/blender/BlenderConnection.cpp +++ b/hecl/blender/BlenderConnection.cpp @@ -1096,6 +1096,37 @@ std::vector BlenderConnection::DataStream::getArmatureNames() return ret; } +std::vector BlenderConnection::DataStream::getSubtypeNames() +{ + if (m_parent->m_loadedType != BlendType::Actor) + BlenderLog.report(logvisor::Fatal, _S("%s is not an ACTOR blend"), + m_parent->m_loadedBlend.getAbsolutePath().c_str()); + + m_parent->_writeLine("GETSUBTYPENAMES"); + + char readBuf[256]; + m_parent->_readLine(readBuf, 256); + if (strcmp(readBuf, "OK")) + BlenderLog.report(logvisor::Fatal, "unable to get subtypes of actor: %s", readBuf); + + std::vector ret; + + uint32_t subCount; + m_parent->_readBuf(&subCount, 4); + ret.reserve(subCount); + for (uint32_t i=0 ; i_readBuf(&bufSz, 4); + name.assign(bufSz, ' '); + m_parent->_readBuf(&name[0], bufSz); + } + + return ret; +} + std::vector BlenderConnection::DataStream::getActionNames() { if (m_parent->m_loadedType != BlendType::Actor) diff --git a/hecl/blender/BlenderConnection.hpp b/hecl/blender/BlenderConnection.hpp index 860a4307c..f77eb23f8 100644 --- a/hecl/blender/BlenderConnection.hpp +++ b/hecl/blender/BlenderConnection.hpp @@ -610,6 +610,7 @@ public: Actor compileActor(); std::vector getArmatureNames(); + std::vector getSubtypeNames(); std::vector getActionNames(); struct Matrix3f diff --git a/hecl/blender/hecl/sact/__init__.py b/hecl/blender/hecl/sact/__init__.py index d4f0ab1bd..6f718a9d6 100644 --- a/hecl/blender/hecl/sact/__init__.py +++ b/hecl/blender/hecl/sact/__init__.py @@ -310,6 +310,14 @@ def get_armature_names(writebuf): writebuf(struct.pack('I', len(arm.name))) writebuf(arm.name.encode()) +# Access actor's contained subtype names +def get_subtype_names(writebuf): + writebuf(struct.pack('I', len(sact_data.subtypes))) + for sub_idx in range(len(sact_data.subtypes)): + subtype = sact_data.subtypes[sub_idx] + writebuf(struct.pack('I', len(subtype.name))) + writebuf(subtype.name.encode()) + # Access actor's contained action names def get_action_names(writebuf): writebuf(struct.pack('I', len(sact_data.actions))) diff --git a/hecl/blender/hecl_blendershell.py b/hecl/blender/hecl_blendershell.py index e965a7e4d..dc5e4e891 100644 --- a/hecl/blender/hecl_blendershell.py +++ b/hecl/blender/hecl_blendershell.py @@ -191,6 +191,10 @@ def dataout_loop(): writepipeline(b'OK') hecl.sact.get_armature_names(writepipebuf) + elif cmdargs[0] == 'GETSUBTYPENAMES': + writepipeline(b'OK') + hecl.sact.get_subtype_names(writepipebuf) + elif cmdargs[0] == 'GETACTIONNAMES': writepipeline(b'OK') hecl.sact.get_action_names(writepipebuf)