mirror of https://github.com/AxioDL/metaforce.git
Add getSubtypeNames to BlenderConnection
This commit is contained in:
parent
4da14b5d9b
commit
e8336578d1
|
@ -1096,6 +1096,37 @@ std::vector<std::string> BlenderConnection::DataStream::getArmatureNames()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> 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<std::string> ret;
|
||||||
|
|
||||||
|
uint32_t subCount;
|
||||||
|
m_parent->_readBuf(&subCount, 4);
|
||||||
|
ret.reserve(subCount);
|
||||||
|
for (uint32_t i=0 ; i<subCount ; ++i)
|
||||||
|
{
|
||||||
|
ret.emplace_back();
|
||||||
|
std::string& name = ret.back();
|
||||||
|
uint32_t bufSz;
|
||||||
|
m_parent->_readBuf(&bufSz, 4);
|
||||||
|
name.assign(bufSz, ' ');
|
||||||
|
m_parent->_readBuf(&name[0], bufSz);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> BlenderConnection::DataStream::getActionNames()
|
std::vector<std::string> BlenderConnection::DataStream::getActionNames()
|
||||||
{
|
{
|
||||||
if (m_parent->m_loadedType != BlendType::Actor)
|
if (m_parent->m_loadedType != BlendType::Actor)
|
||||||
|
|
|
@ -610,6 +610,7 @@ public:
|
||||||
|
|
||||||
Actor compileActor();
|
Actor compileActor();
|
||||||
std::vector<std::string> getArmatureNames();
|
std::vector<std::string> getArmatureNames();
|
||||||
|
std::vector<std::string> getSubtypeNames();
|
||||||
std::vector<std::string> getActionNames();
|
std::vector<std::string> getActionNames();
|
||||||
|
|
||||||
struct Matrix3f
|
struct Matrix3f
|
||||||
|
|
|
@ -310,6 +310,14 @@ def get_armature_names(writebuf):
|
||||||
writebuf(struct.pack('I', len(arm.name)))
|
writebuf(struct.pack('I', len(arm.name)))
|
||||||
writebuf(arm.name.encode())
|
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
|
# Access actor's contained action names
|
||||||
def get_action_names(writebuf):
|
def get_action_names(writebuf):
|
||||||
writebuf(struct.pack('I', len(sact_data.actions)))
|
writebuf(struct.pack('I', len(sact_data.actions)))
|
||||||
|
|
|
@ -191,6 +191,10 @@ def dataout_loop():
|
||||||
writepipeline(b'OK')
|
writepipeline(b'OK')
|
||||||
hecl.sact.get_armature_names(writepipebuf)
|
hecl.sact.get_armature_names(writepipebuf)
|
||||||
|
|
||||||
|
elif cmdargs[0] == 'GETSUBTYPENAMES':
|
||||||
|
writepipeline(b'OK')
|
||||||
|
hecl.sact.get_subtype_names(writepipebuf)
|
||||||
|
|
||||||
elif cmdargs[0] == 'GETACTIONNAMES':
|
elif cmdargs[0] == 'GETACTIONNAMES':
|
||||||
writepipeline(b'OK')
|
writepipeline(b'OK')
|
||||||
hecl.sact.get_action_names(writepipebuf)
|
hecl.sact.get_action_names(writepipebuf)
|
||||||
|
|
Loading…
Reference in New Issue