mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 21:47:42 +00:00
Attachment model support in blender addon
This commit is contained in:
@@ -1546,6 +1546,12 @@ Actor::Actor(Connection& conn)
|
||||
for (uint32_t i=0 ; i<subtypeCount ; ++i)
|
||||
subtypes.emplace_back(conn);
|
||||
|
||||
uint32_t attachmentCount;
|
||||
conn._readBuf(&attachmentCount, 4);
|
||||
attachments.reserve(attachmentCount);
|
||||
for (uint32_t i=0 ; i<attachmentCount ; ++i)
|
||||
attachments.emplace_back(conn);
|
||||
|
||||
uint32_t actionCount;
|
||||
conn._readBuf(&actionCount, 4);
|
||||
actions.reserve(actionCount);
|
||||
@@ -1677,6 +1683,29 @@ Actor::Subtype::Subtype(Connection& conn)
|
||||
}
|
||||
}
|
||||
|
||||
Actor::Attachment::Attachment(Connection& conn)
|
||||
{
|
||||
uint32_t bufSz;
|
||||
conn._readBuf(&bufSz, 4);
|
||||
name.assign(bufSz, ' ');
|
||||
conn._readBuf(&name[0], bufSz);
|
||||
|
||||
std::string meshPath;
|
||||
conn._readBuf(&bufSz, 4);
|
||||
if (bufSz)
|
||||
{
|
||||
meshPath.assign(bufSz, ' ');
|
||||
conn._readBuf(&meshPath[0], bufSz);
|
||||
SystemStringConv meshPathAbs(meshPath);
|
||||
|
||||
SystemString meshPathRel =
|
||||
conn.getBlendPath().getProject().getProjectRootPath().getProjectRelativeFromAbsolute(meshPathAbs.sys_str());
|
||||
mesh.assign(conn.getBlendPath().getProject().getProjectWorkingPath(), meshPathRel);
|
||||
}
|
||||
|
||||
conn._readBuf(&armature, 4);
|
||||
}
|
||||
|
||||
Action::Action(Connection& conn)
|
||||
{
|
||||
uint32_t bufSz;
|
||||
@@ -2234,6 +2263,37 @@ std::vector<std::string> DataStream::getSubtypeOverlayNames(std::string_view nam
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<std::string> DataStream::getAttachmentNames()
|
||||
{
|
||||
if (m_parent->getBlendType() != BlendType::Actor)
|
||||
BlenderLog.report(logvisor::Fatal, _S("%s is not an ACTOR blend"),
|
||||
m_parent->getBlendPath().getAbsolutePath().data());
|
||||
|
||||
m_parent->_writeStr("GETATTACHMENTNAMES");
|
||||
|
||||
char readBuf[256];
|
||||
m_parent->_readStr(readBuf, 256);
|
||||
if (strcmp(readBuf, "OK"))
|
||||
BlenderLog.report(logvisor::Fatal, "unable to get attachments of actor: %s", readBuf);
|
||||
|
||||
std::vector<std::string> ret;
|
||||
|
||||
uint32_t attCount;
|
||||
m_parent->_readBuf(&attCount, 4);
|
||||
ret.reserve(attCount);
|
||||
for (uint32_t i=0 ; i<attCount ; ++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::unordered_map<std::string, Matrix3f>
|
||||
DataStream::getBoneMatrices(std::string_view name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user