metaforce/DataSpec/DNAMP3/CINF.hpp

56 lines
1.7 KiB
C++
Raw Normal View History

2015-08-13 07:29:00 +00:00
#ifndef _DNAMP3_CINF_HPP_
#define _DNAMP3_CINF_HPP_
#include "BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
2015-09-26 03:12:08 +00:00
#include "../DNAMP2/CINF.hpp"
2015-08-13 07:29:00 +00:00
2016-02-13 09:02:47 +00:00
namespace DataSpec
2015-08-13 07:29:00 +00:00
{
namespace DNAMP3
{
2015-09-26 03:12:08 +00:00
struct CINF : DNAMP2::CINF
2015-08-13 07:29:00 +00:00
{
2015-09-26 03:12:08 +00:00
Delete expl;
2016-03-04 23:04:53 +00:00
void sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID64& cinfId) const
2015-08-13 07:29:00 +00:00
{
2015-09-24 00:59:36 +00:00
os.format("arm = bpy.data.armatures.new('CINF_%016" PRIX64 "')\n"
2015-08-13 07:29:00 +00:00
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
"bpy.context.scene.objects.link(arm_obj)\n"
"bpy.context.scene.objects.active = arm_obj\n"
"bpy.ops.object.mode_set(mode='EDIT')\n"
"arm_bone_table = {}\n",
2015-09-24 00:59:36 +00:00
cinfId.toUint64());
2015-08-13 07:29:00 +00:00
for (const Bone& bone : bones)
os.format("bone = arm.edit_bones.new('%s')\n"
"bone.head = (%f,%f,%f)\n"
"bone.tail = bone.head\n"
"bone.tail[1] += 0.5\n"
2015-09-28 00:42:47 +00:00
"bone.use_inherit_scale = False\n"
2015-08-13 07:29:00 +00:00
"arm_bone_table[%u] = bone\n", getBoneNameFromId(bone.id)->c_str(),
bone.origin.vec[0], bone.origin.vec[1], bone.origin.vec[2], bone.id);
2015-09-28 05:19:31 +00:00
if (bones.size())
{
atUint32 nullId = bones[0].parentId;
for (const Bone& bone : bones)
if (bone.parentId != nullId)
os.format("arm_bone_table[%u].parent = arm_bone_table[%u]\n", bone.id, bone.parentId);
}
2015-08-13 07:29:00 +00:00
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
}
2016-04-08 03:37:14 +00:00
static std::string GetCINFArmatureName(const UniqueID64& cinfId)
{
return hecl::Format("CINF_%016" PRIX64, cinfId.toUint64());
}
2015-08-13 07:29:00 +00:00
};
}
}
#endif // _DNAMP3_CINF_HPP_