mirror of https://github.com/AxioDL/metaforce.git
Updates for new ANIM extract
This commit is contained in:
parent
f7826ad7ec
commit
761be432be
|
@ -609,13 +609,35 @@ public:
|
|||
Bone(BlenderConnection& conn);
|
||||
};
|
||||
std::vector<Bone> bones;
|
||||
Bone* lookupBone(const char* name)
|
||||
const Bone* lookupBone(const char* name) const
|
||||
{
|
||||
for (Bone& b : bones)
|
||||
for (const Bone& b : bones)
|
||||
if (!b.name.compare(name))
|
||||
return &b;
|
||||
return nullptr;
|
||||
}
|
||||
const Bone* getParent(const Bone* bone) const
|
||||
{
|
||||
if (bone->parent < 0)
|
||||
return nullptr;
|
||||
return &bones[bone->parent];
|
||||
}
|
||||
const Bone* getChild(const Bone* bone, size_t child) const
|
||||
{
|
||||
if (child >= bone->children.size())
|
||||
return nullptr;
|
||||
int32_t cIdx = bone->children[child];
|
||||
if (cIdx < 0)
|
||||
return nullptr;
|
||||
return &bones[cIdx];
|
||||
}
|
||||
const Bone* getRoot() const
|
||||
{
|
||||
for (const Bone& b : bones)
|
||||
if (b.parent < 0)
|
||||
return &b;
|
||||
return nullptr;
|
||||
}
|
||||
Armature(BlenderConnection& conn);
|
||||
};
|
||||
std::vector<Armature> armatures;
|
||||
|
@ -674,6 +696,68 @@ public:
|
|||
|
||||
return Actor(*m_parent);
|
||||
}
|
||||
|
||||
std::vector<std::string> getArmatureNames()
|
||||
{
|
||||
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("GETARMATURENAMES");
|
||||
|
||||
char readBuf[256];
|
||||
m_parent->_readLine(readBuf, 256);
|
||||
if (strcmp(readBuf, "OK"))
|
||||
BlenderLog.report(logvisor::Fatal, "unable to get armatures of actor: %s", readBuf);
|
||||
|
||||
std::vector<std::string> ret;
|
||||
|
||||
uint32_t armCount;
|
||||
m_parent->_readBuf(&armCount, 4);
|
||||
ret.reserve(armCount);
|
||||
for (uint32_t i=0 ; i<armCount ; ++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> getActionNames()
|
||||
{
|
||||
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("GETACTIONNAMES");
|
||||
|
||||
char readBuf[256];
|
||||
m_parent->_readLine(readBuf, 256);
|
||||
if (strcmp(readBuf, "OK"))
|
||||
BlenderLog.report(logvisor::Fatal, "unable to get actions of actor: %s", readBuf);
|
||||
|
||||
std::vector<std::string> ret;
|
||||
|
||||
uint32_t actCount;
|
||||
m_parent->_readBuf(&actCount, 4);
|
||||
ret.reserve(actCount);
|
||||
for (uint32_t i=0 ; i<actCount ; ++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;
|
||||
}
|
||||
};
|
||||
DataStream beginData()
|
||||
{
|
||||
|
|
|
@ -303,6 +303,20 @@ def cook(writebuf):
|
|||
mesh = bpy.data.objects[subtype.linked_mesh]
|
||||
write_action_aabb(writebuf, arm, mesh)
|
||||
|
||||
# Access actor's contained armature names
|
||||
def get_armature_names(writebuf):
|
||||
writebuf(struct.pack('I', len(bpy.data.armatures)))
|
||||
for arm in bpy.data.armatures:
|
||||
writebuf(struct.pack('I', len(arm.name)))
|
||||
writebuf(arm.name.encode())
|
||||
|
||||
# Access actor's contained action names
|
||||
def get_action_names(writebuf):
|
||||
writebuf(struct.pack('I', len(sact_data.actions)))
|
||||
for action_idx in range(len(sact_data.actions)):
|
||||
action = sact_data.actions[action_idx]
|
||||
writebuf(struct.pack('I', len(action.name)))
|
||||
writebuf(action.name.encode())
|
||||
|
||||
|
||||
# Panel draw
|
||||
|
|
|
@ -114,7 +114,8 @@ def animin_loop(globals):
|
|||
crv.keyframe_points.add(count=key_info[1])
|
||||
|
||||
if crv_type[0] == 1:
|
||||
trans_head = globals['bone_trans_head'][key_info[0]]
|
||||
#trans_head = globals['bone_trans_head'][key_info[0]]
|
||||
trans_head = 0
|
||||
for k in range(key_info[1]):
|
||||
key_data = struct.unpack('if', os.read(readfd, 8))
|
||||
pt = crv.keyframe_points[k]
|
||||
|
@ -188,6 +189,14 @@ def dataout_loop():
|
|||
writepipeline(b'OK')
|
||||
hecl.sact.cook(writepipebuf)
|
||||
|
||||
elif cmdargs[0] == 'GETARMATURENAMES':
|
||||
writepipeline(b'OK')
|
||||
hecl.sact.get_armature_names(writepipebuf)
|
||||
|
||||
elif cmdargs[0] == 'GETACTIONNAMES':
|
||||
writepipeline(b'OK')
|
||||
hecl.sact.get_action_names(writepipebuf)
|
||||
|
||||
|
||||
# Command loop
|
||||
while True:
|
||||
|
|
|
@ -25,4 +25,5 @@ endif()
|
|||
target_link_libraries(hecl
|
||||
${DATA_SPEC_LIBS}
|
||||
hecl-database hecl-backend hecl-frontend hecl-blender hecl-common athena-core nod
|
||||
logvisor athena-libyaml ${PNG_LIB} squish xxhash boo ${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS})
|
||||
logvisor athena-libyaml ${PNG_LIB} squish xxhash zeus boo
|
||||
${ZLIB_LIBRARIES} ${LZO_LIB} ${PLAT_LIBS} ${BOO_SYS_LIBS})
|
||||
|
|
|
@ -245,7 +245,7 @@ void ToolPrintProgress(const hecl::SystemChar* message, const hecl::SystemChar*
|
|||
else
|
||||
hecl::Printf(_S(" "));
|
||||
|
||||
int width = hecl::ConsoleWidth();
|
||||
int width = std::max(80, hecl::ConsoleWidth());
|
||||
int half;
|
||||
if (blocks)
|
||||
half = width / 2 - 2;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8b2f1a8591982e57a036ec00ab0fbda3f9d65e40
|
||||
Subproject commit d2fb800b926c9d4ef76e54242c54f3fe369f7c3d
|
|
@ -82,7 +82,11 @@ void ClientProcess::Worker::proc()
|
|||
ClientProcess::ClientProcess(int verbosityLevel)
|
||||
: m_verbosity(verbosityLevel)
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
int cpuCount = GetCPUCount();
|
||||
#else
|
||||
constexpr int cpuCount = 1;
|
||||
#endif
|
||||
m_workers.reserve(cpuCount);
|
||||
for (int i=0 ; i<cpuCount ; ++i)
|
||||
m_workers.emplace_back(*this);
|
||||
|
|
Loading…
Reference in New Issue