metaforce/DataSpec/DNAMP3/CINF.hpp

46 lines
1.4 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
namespace Retro
{
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;
2015-09-24 00:59:36 +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"
"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);
for (const Bone& bone : bones)
2015-09-26 03:12:08 +00:00
if (bone.parentId != 97 && bone.parentId != 147)
2015-08-13 07:29:00 +00:00
os.format("arm_bone_table[%u].parent = arm_bone_table[%u]\n", bone.id, bone.parentId);
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
}
};
}
}
#endif // _DNAMP3_CINF_HPP_