Huge compile performance refactor

This commit is contained in:
Jack Andersen 2017-12-28 22:08:12 -10:00
parent 3f2c480891
commit 8301adc3d6
418 changed files with 1645 additions and 2402 deletions

View File

@ -9,6 +9,10 @@ os:
build:
verbosity: detailed
branches:
only:
- master
configuration:
- Debug

3
.gitmodules vendored
View File

@ -25,3 +25,6 @@
[submodule "sanitizers-cmake"]
path = sanitizers-cmake
url = git://github.com/arsenm/sanitizers-cmake.git
[submodule "cotire"]
path = cotire
url = https://github.com/sakra/cotire.git

View File

@ -20,8 +20,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE)
set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake" "${CMAKE_SOURCE_DIR}/cotire/CMake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
include(cotire)
set(URDE_VECTOR_ISA "sse2" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)")

View File

@ -6,9 +6,7 @@ extern "C" uint32_t ASSET_NAME_MP32_SZ;
extern "C" uint8_t ASSET_NAME_MP64[];
extern "C" uint32_t ASSET_NAME_MP64_SZ;
namespace DataSpec
{
namespace AssetNameMap
namespace DataSpec::AssetNameMap
{
logvisor::Module Log("AssetNameMap");
@ -84,4 +82,3 @@ const std::string* TranslateIdToName(const UniqueID32& id)
}
}
}

View File

@ -5,13 +5,10 @@
#include <string>
#include "DNACommon/DNACommon.hpp"
namespace DataSpec
{
namespace AssetNameMap
namespace DataSpec::AssetNameMap
{
void InitAssetNameMap();
const std::string* TranslateIdToName(const UniqueID32&);
const std::string* TranslateIdToName(const UniqueID64&);
}
}
#endif // _DATASPEC_ASSETNAMEMAP_HPP_

View File

@ -1,22 +1,20 @@
#include <stdint.h>
#include "hecl/Blender/BlenderConnection.hpp"
#include <cstdint>
#include "hecl/Blender/Connection.hpp"
#include "BlenderSupport.hpp"
extern "C" uint8_t RETRO_MASTER_SHADER[];
extern "C" size_t RETRO_MASTER_SHADER_SZ;
namespace DataSpec
{
namespace Blender
namespace DataSpec::Blender
{
bool BuildMasterShader(const hecl::ProjectPath& path)
{
hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
if (!conn.createBlend(path, hecl::BlenderConnection::BlendType::None))
hecl::blender::Connection& conn = hecl::blender::Connection::SharedConnection();
if (!conn.createBlend(path, hecl::blender::BlendType::None))
return false;
{
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os << RETRO_MASTER_SHADER;
os << "make_master_shader_library()\n";
}
@ -24,4 +22,3 @@ bool BuildMasterShader(const hecl::ProjectPath& path)
}
}
}

View File

@ -3,14 +3,11 @@
#include <hecl/hecl.hpp>
namespace DataSpec
{
namespace Blender
namespace DataSpec::Blender
{
bool BuildMasterShader(const hecl::ProjectPath& path);
}
}
#endif // _RETRO_BLENDER_SUPPORT_HPP_

View File

@ -39,16 +39,16 @@ include(DNAMP2/CMakeLists.txt)
include(DNAMP3/CMakeLists.txt)
# Embed master shader script
bintoc(RetroMasterShader.c Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
bintoc(RetroMasterShader.cpp Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
# Download asset name databases
add_custom_command(OUTPUT AssetNameMap32.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake)
bintoc(AssetNameMap32.c ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
bintoc(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
add_custom_command(OUTPUT AssetNameMap64.bin COMMAND ${CMAKE_COMMAND} ARGS -P
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake)
bintoc(AssetNameMap64.c ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
bintoc(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
# Each game's DataSpec implementation
add_library(RetroDataSpec
@ -66,9 +66,12 @@ add_library(RetroDataSpec
Blender/RetroMasterShader.py
AssetNameMap.hpp
AssetNameMap.cpp
AssetNameMap32.bin AssetNameMap32.c
AssetNameMap64.bin AssetNameMap64.c
RetroMasterShader.c)
AssetNameMap32.bin AssetNameMap32.cpp
AssetNameMap64.bin AssetNameMap64.cpp
RetroMasterShader.cpp)
if(COMMAND add_sanitizers)
add_sanitizers(RetroDataSpec)
endif()
if(COMMAND cotire)
cotire(RetroDataSpec)
endif()

214
DataSpec/DNACommon/ANCS.cpp Normal file
View File

@ -0,0 +1,214 @@
#include "ANCS.hpp"
#include "DataSpec/DNAMP1/DNAMP1.hpp"
#include "DataSpec/DNAMP1/ANCS.hpp"
#include "DataSpec/DNAMP2/DNAMP2.hpp"
#include "DataSpec/DNAMP2/ANCS.hpp"
#include "DataSpec/DNAMP3/DNAMP3.hpp"
#include "DataSpec/DNAMP3/CHAR.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAANCS
{
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
bool ReadANCSToBlender(hecl::blender::Connection& conn,
const ANCSDNA& ancs,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged,
bool force)
{
/* Extract character CMDL/CSKR first */
std::vector<CharacterResInfo<typename PAKRouter::IDType>> chResInfo;
ancs.getCharacterResInfo(chResInfo);
for (const auto& info : chResInfo)
{
const nod::Node* node;
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone())
{
if (!conn.createBlend(cmdlPath, hecl::blender::BlendType::Mesh))
return false;
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str());
typename ANCSDNA::CSKRType cskr;
pakRouter.lookupAndReadDNA(info.cskr, cskr);
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(info.cinf, cinf);
using RigPair = std::pair<typename ANCSDNA::CSKRType*, typename ANCSDNA::CINFType*>;
RigPair rigPair(&cskr, &cinf);
PAKEntryReadStream rs = cmdlE->beginReadStream(*node);
DNACMDL::ReadCMDLToBlender<PAKRouter, MaterialSet, RigPair, SurfaceHeader, CMDLVersion>
(conn, rs, pakRouter, *cmdlE, dataspec, rigPair);
conn.saveBlend();
}
}
}
std::string bestName = pakRouter.getBestEntryName(entry);
hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str());
/* Establish ANCS blend */
if (!conn.createBlend(outPath, hecl::blender::BlendType::Actor))
return false;
std::string firstName;
typename ANCSDNA::CINFType firstCinf;
{
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"from mathutils import Vector\n"
"bpy.context.scene.name = '%s'\n"
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
"\n"
"# Using 'Blender Game'\n"
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
"\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'LAMP' and ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n"
"actor_data = bpy.context.scene.hecl_sact_data\n",
pakRouter.getBestEntryName(entry).c_str());
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
for (const auto& info : chResInfo)
{
/* Provide data to add-on */
os.format("actor_subtype = actor_data.subtypes.add()\n"
"actor_subtype.name = '%s'\n\n",
info.name.c_str());
/* Build CINF if needed */
if (cinfsDone.find(info.cinf) == cinfsDone.end())
{
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(info.cinf, cinf);
cinf.sendCINFToBlender(os, info.cinf);
if (cinfsDone.empty())
{
firstName = ANCSDNA::CINFType::GetCINFArmatureName(info.cinf);
firstCinf = cinf;
}
cinfsDone.insert(info.cinf);
}
else
os.format("arm_obj = bpy.data.objects['CINF_%s']\n", info.cinf.toString().c_str());
os << "actor_subtype.linked_armature = arm_obj.name\n";
/* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n"
" bpy.context.scene.objects.link(obj)\n"
"obj.parent = arm_obj\n"
"obj.parent_type = 'ARMATURE'\n"
"actor_subtype.linked_mesh = obj.name\n\n";
}
/* Link overlays */
for (const auto& overlay : info.overlays)
{
os << "overlay = actor_subtype.overlays.add()\n";
os.format("overlay.name = '%s'\n", overlay.first.toString().c_str());
/* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n"
" bpy.context.scene.objects.link(obj)\n"
"obj.parent = arm_obj\n"
"obj.parent_type = 'ARMATURE'\n"
"overlay.linked_mesh = obj.name\n\n";
}
}
}
}
{
hecl::blender::DataStream ds = conn.beginData();
std::unordered_map<std::string,
hecl::blender::Matrix3f> matrices = ds.getBoneMatrices(firstName);
ds.close();
DNAANIM::RigInverter<typename ANCSDNA::CINFType> inverter(firstCinf, matrices);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy\n"
"actor_data = bpy.context.scene.hecl_sact_data\n";
/* Get animation primitives */
std::map<atUint32, AnimationResInfo<typename PAKRouter::IDType>> animResInfo;
ancs.getAnimationResInfo(animResInfo);
for (const auto& id : animResInfo)
{
typename ANCSDNA::ANIMType anim;
if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true))
{
os.format("act = bpy.data.actions.new('%s')\n"
"act.use_fake_user = True\n", id.second.name.c_str());
anim.sendANIMToBlender(os, inverter, id.second.additive);
}
os.format("actor_action = actor_data.actions.add()\n"
"actor_action.name = '%s'\n", id.second.name.c_str());
}
}
conn.saveBlend();
return true;
}
template bool ReadANCSToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::ANCS, DNAMP1::MaterialSet, DNACMDL::SurfaceHeader_1, 2>
(hecl::blender::Connection& conn,
const DNAMP1::ANCS& ancs,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged,
bool force);
template bool ReadANCSToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::ANCS, DNAMP2::MaterialSet, DNACMDL::SurfaceHeader_2, 4>
(hecl::blender::Connection& conn,
const DNAMP2::ANCS& ancs,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged,
bool force);
template bool ReadANCSToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::CHAR, DNAMP3::MaterialSet, DNACMDL::SurfaceHeader_3, 4>
(hecl::blender::Connection& conn,
const DNAMP3::CHAR& ancs,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const typename PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged,
bool force);
}

View File

@ -3,16 +3,15 @@
#include <unordered_set>
#include "DNACommon.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CMDL.hpp"
#include "RigInverter.hpp"
namespace DataSpec
{
namespace DNAANCS
namespace DataSpec::DNAANCS
{
using Actor = hecl::BlenderConnection::DataStream::Actor;
using Actor = hecl::blender::Actor;
using Armature = hecl::blender::Armature;
using Action = hecl::blender::Action;
template <typename IDTYPE>
struct CharacterResInfo
@ -34,179 +33,15 @@ struct AnimationResInfo
};
template <class PAKRouter, class ANCSDNA, class MaterialSet, class SurfaceHeader, atUint32 CMDLVersion>
bool ReadANCSToBlender(hecl::BlenderConnection& conn,
bool ReadANCSToBlender(hecl::blender::Connection& conn,
const ANCSDNA& ancs,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
const SpecBase& dataspec,
std::function<void(const hecl::SystemChar*)> fileChanged,
bool force=false)
{
/* Extract character CMDL/CSKR first */
std::vector<CharacterResInfo<typename PAKRouter::IDType>> chResInfo;
ancs.getCharacterResInfo(chResInfo);
for (const auto& info : chResInfo)
{
const nod::Node* node;
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, &node, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
if (force || cmdlPath.isNone())
{
if (!conn.createBlend(cmdlPath, hecl::BlenderConnection::BlendType::Mesh))
return false;
bool force=false);
std::string bestName = pakRouter.getBestEntryName(*cmdlE);
hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str());
typename ANCSDNA::CSKRType cskr;
pakRouter.lookupAndReadDNA(info.cskr, cskr);
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(info.cinf, cinf);
using RigPair = std::pair<typename ANCSDNA::CSKRType*, typename ANCSDNA::CINFType*>;
RigPair rigPair(&cskr, &cinf);
PAKEntryReadStream rs = cmdlE->beginReadStream(*node);
DNACMDL::ReadCMDLToBlender<PAKRouter, MaterialSet, RigPair, SurfaceHeader, CMDLVersion>
(conn, rs, pakRouter, *cmdlE, dataspec, rigPair);
conn.saveBlend();
}
}
}
std::string bestName = pakRouter.getBestEntryName(entry);
hecl::SystemStringConv bestNameView(bestName);
fileChanged(bestNameView.c_str());
/* Establish ANCS blend */
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Actor))
return false;
std::string firstName;
typename ANCSDNA::CINFType firstCinf;
{
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"from mathutils import Vector\n"
"bpy.context.scene.name = '%s'\n"
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
"\n"
"# Using 'Blender Game'\n"
"bpy.context.scene.render.engine = 'BLENDER_GAME'\n"
"\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'LAMP' and ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n"
"actor_data = bpy.context.scene.hecl_sact_data\n",
pakRouter.getBestEntryName(entry).c_str());
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
for (const auto& info : chResInfo)
{
/* Provide data to add-on */
os.format("actor_subtype = actor_data.subtypes.add()\n"
"actor_subtype.name = '%s'\n\n",
info.name.c_str());
/* Build CINF if needed */
if (cinfsDone.find(info.cinf) == cinfsDone.end())
{
typename ANCSDNA::CINFType cinf;
pakRouter.lookupAndReadDNA(info.cinf, cinf);
cinf.sendCINFToBlender(os, info.cinf);
if (cinfsDone.empty())
{
firstName = ANCSDNA::CINFType::GetCINFArmatureName(info.cinf);
firstCinf = cinf;
}
cinfsDone.insert(info.cinf);
}
else
os.format("arm_obj = bpy.data.objects['CINF_%s']\n", info.cinf.toString().c_str());
os << "actor_subtype.linked_armature = arm_obj.name\n";
/* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(info.cmdl, nullptr, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n"
" bpy.context.scene.objects.link(obj)\n"
"obj.parent = arm_obj\n"
"obj.parent_type = 'ARMATURE'\n"
"actor_subtype.linked_mesh = obj.name\n\n";
}
/* Link overlays */
for (const auto& overlay : info.overlays)
{
os << "overlay = actor_subtype.overlays.add()\n";
os.format("overlay.name = '%s'\n", overlay.first.toString().c_str());
/* Link CMDL */
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, true);
if (cmdlE)
{
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
os.linkBlend(cmdlPath.getAbsolutePathUTF8().data(),
pakRouter.getBestEntryName(*cmdlE).data(), true);
/* Attach CMDL to CINF */
os << "if obj.name not in bpy.context.scene.objects:\n"
" bpy.context.scene.objects.link(obj)\n"
"obj.parent = arm_obj\n"
"obj.parent_type = 'ARMATURE'\n"
"overlay.linked_mesh = obj.name\n\n";
}
}
}
}
{
hecl::BlenderConnection::DataStream ds = conn.beginData();
std::unordered_map<std::string,
hecl::BlenderConnection::DataStream::Matrix3f> matrices = ds.getBoneMatrices(firstName);
ds.close();
DNAANIM::RigInverter<typename ANCSDNA::CINFType> inverter(firstCinf, matrices);
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy\n"
"actor_data = bpy.context.scene.hecl_sact_data\n";
/* Get animation primitives */
std::map<atUint32, AnimationResInfo<typename PAKRouter::IDType>> animResInfo;
ancs.getAnimationResInfo(animResInfo);
for (const auto& id : animResInfo)
{
typename ANCSDNA::ANIMType anim;
if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true))
{
os.format("act = bpy.data.actions.new('%s')\n"
"act.use_fake_user = True\n", id.second.name.c_str());
anim.sendANIMToBlender(os, inverter, id.second.additive);
}
os.format("actor_action = actor_data.actions.add()\n"
"actor_action.name = '%s'\n", id.second.name.c_str());
}
}
conn.saveBlend();
return true;
}
}
}
#endif // _DNACOMMON_ANCS_HPP_

View File

@ -3,9 +3,7 @@
#define DUMP_KEYS 0
namespace DataSpec
{
namespace DNAANIM
namespace DataSpec::DNAANIM
{
size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& channels)
@ -520,4 +518,3 @@ BitstreamWriter::write(const std::vector<std::vector<Value>>& chanKeys,
}
}
}

View File

@ -4,9 +4,7 @@
#include "DNACommon.hpp"
#include <cmath>
namespace DataSpec
{
namespace DNAANIM
namespace DataSpec::DNAANIM
{
union Value
@ -99,7 +97,6 @@ public:
size_t& sizeOut);
};
}
}
#endif // _DNACOMMON_ANIMBITSTREAM_HPP_

View File

@ -1,4 +1,5 @@
#include "AROTBuilder.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{

View File

@ -12,7 +12,7 @@ namespace DataSpec
struct AROTBuilder
{
using ColMesh = hecl::BlenderConnection::DataStream::ColMesh;
using ColMesh = hecl::blender::ColMesh;
struct BitmapPool
{

View File

@ -1,8 +1,6 @@
#include "ATBL.hpp"
namespace DataSpec
{
namespace DNAAudio
namespace DataSpec::DNAAudio
{
bool ATBL::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
@ -60,4 +58,3 @@ bool ATBL::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
}
}
}

View File

@ -4,9 +4,7 @@
#include "DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNAAudio
namespace DataSpec::DNAAudio
{
class ATBL
@ -16,7 +14,6 @@ public:
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNACOMMON_ATBL_HPP_

View File

@ -2,12 +2,13 @@
#include "DataSpec/DNAMP1/MREA.hpp"
#include "DataSpec/DNAMP3/MREA.hpp"
#include "zeus/CTransform.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
template<class BabeDeadLight>
void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
const BabeDeadLight& light, unsigned s, unsigned l)
{
switch (light.lightType)
@ -92,14 +93,14 @@ void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
}
template void ReadBabeDeadLightToBlender<DNAMP1::MREA::BabeDeadLight>
(hecl::BlenderConnection::PyOutStream& os, const DNAMP1::MREA::BabeDeadLight& light, unsigned s, unsigned l);
(hecl::blender::PyOutStream& os, const DNAMP1::MREA::BabeDeadLight& light, unsigned s, unsigned l);
template void ReadBabeDeadLightToBlender<DNAMP3::MREA::BabeDeadLight>
(hecl::BlenderConnection::PyOutStream& os, const DNAMP3::MREA::BabeDeadLight& light, unsigned s, unsigned l);
(hecl::blender::PyOutStream& os, const DNAMP3::MREA::BabeDeadLight& light, unsigned s, unsigned l);
template<class BabeDeadLight>
void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::BlenderConnection::DataStream::Light& lightIn)
void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender::Light& lightIn)
{
using InterType = hecl::BlenderConnection::DataStream::Light::Type;
using InterType = hecl::blender::Light::Type;
switch (lightIn.type)
{
case InterType::Ambient:
@ -147,8 +148,8 @@ void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::BlenderC
}
template void WriteBabeDeadLightFromBlender<DNAMP1::MREA::BabeDeadLight>
(DNAMP1::MREA::BabeDeadLight& lightOut, const hecl::BlenderConnection::DataStream::Light& lightIn);
(DNAMP1::MREA::BabeDeadLight& lightOut, const hecl::blender::Light& lightIn);
template void WriteBabeDeadLightFromBlender<DNAMP3::MREA::BabeDeadLight>
(DNAMP3::MREA::BabeDeadLight& lightOut, const hecl::BlenderConnection::DataStream::Light& lightIn);
(DNAMP3::MREA::BabeDeadLight& lightOut, const hecl::blender::Light& lightIn);
}

View File

@ -1,19 +1,19 @@
#ifndef _DNACOMMON_BABEDEAD_HPP_
#define _DNACOMMON_BABEDEAD_HPP_
#include "hecl/Blender/BlenderConnection.hpp"
#include "zeus/Math.hpp"
#include "hecl/hecl.hpp"
#include <cfloat>
namespace DataSpec
{
template<class BabeDeadLight>
void ReadBabeDeadLightToBlender(hecl::BlenderConnection::PyOutStream& os,
void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os,
const BabeDeadLight& light, unsigned s, unsigned l);
template<class BabeDeadLight>
void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::BlenderConnection::DataStream::Light& lightIn);
void WriteBabeDeadLightFromBlender(BabeDeadLight& lightOut, const hecl::blender::Light& lightIn);
}

View File

@ -7,10 +7,9 @@
#include "../DNAMP3/CMDLMaterials.hpp"
#include "../DNAMP3/CSKR.hpp"
#include "zeus/CAABox.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNACMDL
namespace DataSpec::DNACMDL
{
template <class MaterialSet>
@ -68,7 +67,7 @@ void GetVertexAttributes(const MaterialSet& matSet,
}
template <class PAKRouter, class MaterialSet>
void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os,
const MaterialSet& matSet,
const PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -112,7 +111,7 @@ void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
}
template <class PAKRouter, class MaterialSet>
void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
void ReadMaterialSetToBlender_3(hecl::blender::PyOutStream& os,
const MaterialSet& matSet,
const PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -127,7 +126,7 @@ void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
}
template void ReadMaterialSetToBlender_3<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet>
(hecl::BlenderConnection::PyOutStream& os,
(hecl::blender::PyOutStream& os,
const DNAMP3::MaterialSet& matSet,
const PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
@ -161,7 +160,7 @@ public:
}
template<class RigPair>
void sendAdditionalVertsToBlender(hecl::BlenderConnection::PyOutStream& os,
void sendAdditionalVertsToBlender(hecl::blender::PyOutStream& os,
const RigPair& rp) const
{
atUint32 nextVert = 1;
@ -420,7 +419,7 @@ public:
}
};
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
void InitGeomBlenderContext(hecl::blender::PyOutStream& os,
const hecl::ProjectPath& masterShaderPath,
bool solidShading)
{
@ -522,7 +521,7 @@ void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
"\n", masterShaderPath.getAbsolutePathUTF8().data());
}
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
void FinishBlenderMesh(hecl::blender::PyOutStream& os,
unsigned matSetCount, int meshIdx)
{
if (meshIdx < 0)
@ -599,7 +598,7 @@ void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
}
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader>
atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
athena::io::IStreamReader& reader,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -1082,7 +1081,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
}
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader, atUint32 Version>
bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
bool ReadCMDLToBlender(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -1105,7 +1104,7 @@ bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
}
/* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"\n"
@ -1130,7 +1129,7 @@ bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
template bool ReadCMDLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSet,
std::pair<DNAMP1::CSKR*,DNAMP1::CINF*>, DNACMDL::SurfaceHeader_1, 2>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
const PAKRouter<DNAMP1::PAKBridge>::EntryType& entry,
@ -1139,7 +1138,7 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MaterialSet,
std::pair<DNAMP2::CSKR*,DNAMP2::CINF*>, DNACMDL::SurfaceHeader_2, 4>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
@ -1148,7 +1147,7 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
std::pair<DNAMP3::CSKR*,DNAMP3::CINF*>, DNACMDL::SurfaceHeader_3, 4>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
@ -1157,7 +1156,7 @@ template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSe
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
std::pair<DNAMP3::CSKR*,DNAMP3::CINF*>, DNACMDL::SurfaceHeader_3, 5>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry,
@ -1236,7 +1235,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
matSets.reserve(mesh.materialSets.size());
{
hecl::Frontend::Frontend FE;
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
for (const std::vector<Material>& mset : mesh.materialSets)
{
matSets.emplace_back();
MaterialSet& targetMSet = matSets.back();
@ -1246,7 +1245,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
size_t endOff = 0;
atUint32 nextGroupIdx = 0;
for (const Mesh::Material& mat : mset)
for (const Material& mat : mset)
{
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
@ -1279,7 +1278,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
}
texPaths.reserve(mset.size()*4);
for (const Mesh::Material& mat : mset)
for (const Material& mat : mset)
{
for (const hecl::ProjectPath& path : mat.texs)
{
@ -1474,7 +1473,7 @@ template bool WriteCMDL<DNAMP1::MaterialSet, DNACMDL::SurfaceHeader_1, 2>
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath,
const Mesh& mesh, hecl::PoolSkinIndex& poolSkinIndex)
const Mesh& mesh, hecl::blender::PoolSkinIndex& poolSkinIndex)
{
Header head;
head.magic = 0xDEADBABE;
@ -1494,13 +1493,13 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
matSets.reserve(mesh.materialSets.size());
{
hecl::Frontend::Frontend FE;
for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
for (const std::vector<Material>& mset : mesh.materialSets)
{
matSets.emplace_back();
MaterialSet& targetMSet = matSets.back();
std::vector<hecl::ProjectPath> texPaths;
texPaths.reserve(mset.size()*4);
for (const Mesh::Material& mat : mset)
for (const Material& mat : mset)
{
for (const hecl::ProjectPath& path : mat.texs)
{
@ -1519,7 +1518,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
}
size_t endOff = 0;
for (const Mesh::Material& mat : mset)
for (const Material& mat : mset)
{
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
@ -1537,7 +1536,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
}
}
hecl::HMDLBuffers bufs = mesh.getHMDLBuffers(false, poolSkinIndex);
hecl::blender::HMDLBuffers bufs = mesh.getHMDLBuffers(false, poolSkinIndex);
/* Metadata */
size_t secSz = bufs.m_meta.binarySize(0);
@ -1575,7 +1574,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
/* Surfaces */
size_t endOff = 0;
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
for (const hecl::blender::HMDLBuffers::Surface& surf : bufs.m_surfaces)
{
head.secSizes.push_back(64);
paddingSizes.push_back(0);
@ -1619,7 +1618,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
++padIt;
/* Surfaces */
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
for (const hecl::blender::HMDLBuffers::Surface& surf : bufs.m_surfaces)
{
const Mesh::Surface& osurf = surf.m_origSurf;
@ -1645,7 +1644,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
template bool WriteHMDLCMDL<DNAMP1::HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>
(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh,
hecl::PoolSkinIndex& poolSkinIndex);
hecl::blender::PoolSkinIndex& poolSkinIndex);
template <class MaterialSet, class SurfaceHeader, class MeshHeader>
bool WriteMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::ProjectPath& inPath,
@ -1663,12 +1662,12 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
{
struct MaterialPool
{
std::vector<const Mesh::Material*> materials;
size_t addMaterial(const Mesh::Material& mat, bool& newMat)
std::vector<const Material*> materials;
size_t addMaterial(const Material& mat, bool& newMat)
{
size_t ret = 0;
newMat = false;
for (const Mesh::Material* testMat : materials)
for (const Material* testMat : materials)
{
if (mat == *testMat)
return ret;
@ -1696,7 +1695,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
std::vector<size_t> meshToGlobalMats;
meshToGlobalMats.reserve(mesh.materialSets[0].size());
for (const Mesh::Material& mat : mesh.materialSets[0])
for (const Material& mat : mesh.materialSets[0])
{
bool newMat;
size_t idx = matPool.addMaterial(mat, newMat);
@ -1763,13 +1762,13 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
meshHeader.write(w);
}
hecl::PoolSkinIndex poolSkinIndex;
hecl::HMDLBuffers bufs = mesh.getHMDLBuffers(true, poolSkinIndex);
hecl::blender::PoolSkinIndex poolSkinIndex;
hecl::blender::HMDLBuffers bufs = mesh.getHMDLBuffers(true, poolSkinIndex);
std::vector<size_t> surfEndOffs;
surfEndOffs.reserve(bufs.m_surfaces.size());
size_t endOff = 0;
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
for (const hecl::blender::HMDLBuffers::Surface& surf : bufs.m_surfaces)
{
endOff += 96;
surfEndOffs.push_back(endOff);
@ -1806,7 +1805,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
}
/* Surfaces */
for (const hecl::HMDLBuffers::Surface& surf : bufs.m_surfaces)
for (const hecl::blender::HMDLBuffers::Surface& surf : bufs.m_surfaces)
{
const Mesh::Surface& osurf = surf.m_origSurf;
@ -2059,4 +2058,3 @@ size_t SurfaceHeader_3::binarySize(size_t __isz) const
}
}
}

View File

@ -1,21 +1,19 @@
#ifndef _DNACOMMON_CMDL_HPP_
#define _DNACOMMON_CMDL_HPP_
#include <athena/FileWriter.hpp>
#include <hecl/Frontend.hpp>
#include <hecl/Backend/GX.hpp>
#include "athena/FileWriter.hpp"
#include "hecl/Frontend.hpp"
#include "hecl/Backend/GX.hpp"
#include "PAK.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "GX.hpp"
#include "TXTR.hpp"
#include "zeus/CAABox.hpp"
namespace DataSpec
{
namespace DNACMDL
namespace DataSpec::DNACMDL
{
using Mesh = hecl::BlenderConnection::DataStream::Mesh;
using Mesh = hecl::blender::Mesh;
using Material = hecl::blender::Material;
struct Header : BigDNA
{
@ -117,27 +115,27 @@ void GetVertexAttributes(const MaterialSet& matSet,
std::vector<VertexAttributes>& attributesOut);
template <class PAKRouter, class MaterialSet>
void ReadMaterialSetToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os,
const MaterialSet& matSet,
const PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
unsigned setIdx);
template <class PAKRouter, class MaterialSet>
void ReadMaterialSetToBlender_3(hecl::BlenderConnection::PyOutStream& os,
void ReadMaterialSetToBlender_3(hecl::blender::PyOutStream& os,
const MaterialSet& matSet,
const PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
unsigned setIdx);
void InitGeomBlenderContext(hecl::BlenderConnection::PyOutStream& os,
void InitGeomBlenderContext(hecl::blender::PyOutStream& os,
const hecl::ProjectPath& masterShaderPath,
bool solidShading);
void FinishBlenderMesh(hecl::BlenderConnection::PyOutStream& os,
void FinishBlenderMesh(hecl::blender::PyOutStream& os,
unsigned matSetCount, int meshIdx);
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader>
atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os,
athena::io::IStreamReader& reader,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -152,7 +150,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::BlenderConnection::PyOutStream& os,
atUint32 surfaceCount=0);
template <class PAKRouter, class MaterialSet, class RigPair, class SurfaceHeader, atUint32 Version>
bool ReadCMDLToBlender(hecl::BlenderConnection& conn,
bool ReadCMDLToBlender(hecl::blender::Connection& conn,
athena::io::IStreamReader& reader,
PAKRouter& pakRouter,
const typename PAKRouter::EntryType& entry,
@ -170,7 +168,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
template <class MaterialSet, class SurfaceHeader, atUint32 Version>
bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath,
const Mesh& mesh, hecl::PoolSkinIndex& poolSkinIndex);
const Mesh& mesh, hecl::blender::PoolSkinIndex& poolSkinIndex);
template <class MaterialSet, class SurfaceHeader, class MeshHeader>
bool WriteMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::ProjectPath& inPath,
@ -181,6 +179,5 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
const std::vector<Mesh>& meshes, zeus::CAABox& fullAABB, std::vector<zeus::CAABox>& meshAABBs);
}
}
#endif // _DNACOMMON_CMDL_HPP_

View File

@ -18,7 +18,7 @@ set(DNACOMMON_SOURCES
MAPU.cpp
STRG.hpp STRG.cpp
TXTR.hpp TXTR.cpp
ANCS.hpp
ANCS.hpp ANCS.cpp
ANIM.hpp ANIM.cpp
PART.hpp PART.cpp
SWHC.hpp SWHC.cpp

View File

@ -1,8 +1,6 @@
#include "CRSC.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
static const std::vector<FourCC> GeneratorTypes =
{
@ -328,5 +326,4 @@ bool WriteCRSM(const CRSM<IDType>& crsm, const hecl::ProjectPath& outPath)
template bool WriteCRSM<UniqueID32>(const CRSM<UniqueID32>& crsm, const hecl::ProjectPath& outPath);
template bool WriteCRSM<UniqueID64>(const CRSM<UniqueID64>& crsm, const hecl::ProjectPath& outPath);
}
}

View File

@ -6,9 +6,7 @@
#include "athena/FileWriter.hpp"
#include "optional.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
struct CRSM : BigYAML
@ -38,5 +36,4 @@ bool ExtractCRSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteCRSM(const CRSM<IDType>& crsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_CRSC_HPP__

View File

@ -3,9 +3,7 @@
#include "athena/FileWriter.hpp"
#include "DGRP.hpp"
namespace DataSpec
{
namespace DNADGRP
namespace DataSpec::DNADGRP
{
template <class IDType>
void DGRP<IDType>::read(athena::io::IStreamReader& __dna_reader)
@ -139,4 +137,3 @@ bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath)
template bool WriteDGRP<UniqueID32>(const DGRP<UniqueID32>& dgrp, const hecl::ProjectPath& outPath);
template bool WriteDGRP<UniqueID64>(const DGRP<UniqueID64>& dgrp, const hecl::ProjectPath& outPath);
}
}

View File

@ -4,9 +4,7 @@
#include "DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNADGRP
namespace DataSpec::DNADGRP
{
template <class IDType>
struct DGRP : BigYAML
@ -29,5 +27,4 @@ bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_DGRP_HPP__

View File

@ -8,7 +8,7 @@ namespace DataSpec
logvisor::Module LogDNACommon("urde::DNACommon");
ThreadLocalPtr<SpecBase> g_curSpec;
ThreadLocalPtr<PAKRouterBase> g_PakRouter;
ThreadLocalPtr<hecl::BlenderToken> g_ThreadBlenderToken;
ThreadLocalPtr<hecl::blender::Token> g_ThreadBlenderToken;
ThreadLocalPtr<hecl::Database::Project> UniqueIDBridge::s_Project;
UniqueID32 UniqueID32::kInvalidId;

View File

@ -1,24 +1,24 @@
#ifndef __DNA_COMMON_HPP__
#define __DNA_COMMON_HPP__
#include <stdio.h>
#include <athena/DNAYaml.hpp>
#include <athena/FileReader.hpp>
#include <athena/FileWriter.hpp>
#include <nod/DiscBase.hpp>
#include "hecl/hecl.hpp"
#include <cstdio>
#include "logvisor/logvisor.hpp"
#include "athena/DNAYaml.hpp"
#include "hecl/Database.hpp"
#include "../SpecBase.hpp"
#include "boo/ThreadLocalPtr.hpp"
#include "zeus/CColor.hpp"
namespace hecl { class BlenderToken; }
namespace DataSpec
{
struct SpecBase;
extern logvisor::Module LogDNACommon;
extern ThreadLocalPtr<SpecBase> g_curSpec;
extern ThreadLocalPtr<class PAKRouterBase> g_PakRouter;
extern ThreadLocalPtr<hecl::BlenderToken> g_ThreadBlenderToken;
extern ThreadLocalPtr<hecl::blender::Token> g_ThreadBlenderToken;
/* This comes up a great deal */
typedef athena::io::DNA<athena::BigEndian> BigDNA;

View File

@ -1,8 +1,6 @@
#include "DPSC.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
void DPSM<IDType>::read(athena::io::YAMLDocReader& r)
@ -412,4 +410,3 @@ template bool WriteDPSM<UniqueID64>(const DPSM<UniqueID64>& dpsm, const hecl::Pr
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -60,7 +58,6 @@ bool ExtractDPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteDPSM(const DPSM<IDType>& dpsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_DPSC_HPP__

View File

@ -3,13 +3,14 @@
#include "DataSpec/DNAMP1/DeafBabe.hpp"
#include "DataSpec/DNAMP2/DeafBabe.hpp"
#include "DataSpec/DNAMP1/DCLN.hpp"
#include <inttypes.h>
#include "hecl/Blender/Connection.hpp"
#include <cinttypes>
namespace DataSpec
{
template<class DEAFBABE>
void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFBABE& db, bool isDcln, atInt32 idx)
void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, bool isDcln, atInt32 idx)
{
os << "material_index = []\n"
"col_bm = bmesh.new()\n";
@ -96,13 +97,13 @@ void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFB
"\n";
}
template void DeafBabeSendToBlender<DNAMP1::DeafBabe>(hecl::BlenderConnection::PyOutStream& os, const DNAMP1::DeafBabe& db, bool isDcln, atInt32 idx);
template void DeafBabeSendToBlender<DNAMP2::DeafBabe>(hecl::BlenderConnection::PyOutStream& os, const DNAMP2::DeafBabe& db, bool isDcln, atInt32 idx);
template void DeafBabeSendToBlender<DNAMP1::DCLN::Collision>(hecl::BlenderConnection::PyOutStream& os, const DNAMP1::DCLN::Collision& db, bool isDcln, atInt32 idx);
template void DeafBabeSendToBlender<DNAMP1::DeafBabe>(hecl::blender::PyOutStream& os, const DNAMP1::DeafBabe& db, bool isDcln, atInt32 idx);
template void DeafBabeSendToBlender<DNAMP2::DeafBabe>(hecl::blender::PyOutStream& os, const DNAMP2::DeafBabe& db, bool isDcln, atInt32 idx);
template void DeafBabeSendToBlender<DNAMP1::DCLN::Collision>(hecl::blender::PyOutStream& os, const DNAMP1::DCLN::Collision& db, bool isDcln, atInt32 idx);
template<class DEAFBABE>
static void PopulateAreaFields(DEAFBABE& db,
const hecl::BlenderConnection::DataStream::ColMesh& colMesh,
const hecl::blender::ColMesh& colMesh,
const zeus::CAABox& fullAABB,
std::enable_if_t<std::is_same<DEAFBABE, DNAMP1::DeafBabe>::value ||
std::is_same<DEAFBABE, DNAMP2::DeafBabe>::value, int>* = 0)
@ -122,7 +123,7 @@ static void PopulateAreaFields(DEAFBABE& db,
template<class DEAFBABE>
static void PopulateAreaFields(DEAFBABE& db,
const hecl::BlenderConnection::DataStream::ColMesh& colMesh,
const hecl::blender::ColMesh& colMesh,
const zeus::CAABox& fullAABB,
std::enable_if_t<std::is_same<DEAFBABE, DNAMP1::DCLN::Collision>::value, int>* = 0)
{
@ -149,9 +150,9 @@ public:
};
template<class DEAFBABE>
void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh)
void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::blender::ColMesh& colMesh)
{
using BlendMat = hecl::BlenderConnection::DataStream::ColMesh::Material;
using BlendMat = hecl::blender::ColMesh::Material;
auto MakeMat = [](const BlendMat& mat, bool flipFace) -> typename DEAFBABE::Material
{
@ -255,8 +256,8 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataS
PopulateAreaFields(db, colMesh, fullAABB);
}
template void DeafBabeBuildFromBlender<DNAMP1::DeafBabe>(DNAMP1::DeafBabe& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh);
template void DeafBabeBuildFromBlender<DNAMP2::DeafBabe>(DNAMP2::DeafBabe& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh);
template void DeafBabeBuildFromBlender<DNAMP1::DCLN::Collision>(DNAMP1::DCLN::Collision& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh);
template void DeafBabeBuildFromBlender<DNAMP1::DeafBabe>(DNAMP1::DeafBabe& db, const hecl::blender::ColMesh& colMesh);
template void DeafBabeBuildFromBlender<DNAMP2::DeafBabe>(DNAMP2::DeafBabe& db, const hecl::blender::ColMesh& colMesh);
template void DeafBabeBuildFromBlender<DNAMP1::DCLN::Collision>(DNAMP1::DCLN::Collision& db, const hecl::blender::ColMesh& colMesh);
}

View File

@ -2,7 +2,6 @@
#define _DNACOMMON_DEAFBABE_HPP_
#include "DNACommon.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
namespace DataSpec
{
@ -15,10 +14,10 @@ enum class BspNodeType : atUint32
};
template<class DEAFBABE>
void DeafBabeSendToBlender(hecl::BlenderConnection::PyOutStream& os, const DEAFBABE& db, bool isDcln = false, atInt32 idx = -1);
void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, bool isDcln = false, atInt32 idx = -1);
template<class DEAFBABE>
void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh);
void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::blender::ColMesh& colMesh);
}

View File

@ -3,9 +3,7 @@
#include "DNACommon.hpp"
namespace DataSpec
{
namespace DNACommon
namespace DataSpec::DNACommon
{
struct EGMC : public BigDNA
{
@ -22,5 +20,4 @@ struct EGMC : public BigDNA
Vector<Object, DNA_COUNT(count)> objects;
};
}
}
#endif // _DNACOMMON_EGMC_HPP_

View File

@ -1,8 +1,6 @@
#include "ELSC.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
void ELSM<IDType>::read(athena::io::YAMLDocReader& r)
@ -428,4 +426,3 @@ template bool WriteELSM<UniqueID32>(const ELSM<UniqueID32>& gpsm, const hecl::Pr
template bool WriteELSM<UniqueID64>(const ELSM<UniqueID64>& gpsm, const hecl::ProjectPath& outPath);
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
struct ELSM : BigYAML
@ -50,6 +48,5 @@ bool ExtractELSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteELSM(const ELSM<IDType>& elsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_ELSC_HPP__

View File

@ -1,8 +1,6 @@
#include "FONT.hpp"
namespace DataSpec
{
namespace DNAFont
namespace DataSpec::DNAFont
{
logvisor::Module LogModule("urde::DNAFont");
@ -572,4 +570,3 @@ template bool WriteFONT<UniqueID32>(const FONT<UniqueID32>& font, const hecl::Pr
template bool WriteFONT<UniqueID64>(const FONT<UniqueID64>& font, const hecl::ProjectPath& outPath);
}
}

View File

@ -4,9 +4,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAFont
namespace DataSpec::DNAFont
{
struct GlyphRect : BigYAML
{
@ -122,7 +120,6 @@ bool ExtractFONT(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteFONT(const FONT<IDType>& font, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_FONT_HPP__

View File

@ -4,9 +4,7 @@
#include "FSM2.hpp"
namespace DataSpec
{
namespace DNAFSM2
namespace DataSpec::DNAFSM2
{
logvisor::Module LogDNAFSM2("urde::DNAFSM2");
@ -1014,4 +1012,3 @@ template bool WriteFSM2<UniqueID32>(const FSM2<UniqueID32>& fsm2, const hecl::Pr
template bool WriteFSM2<UniqueID64>(const FSM2<UniqueID64>& fsm2, const hecl::ProjectPath& outPath);
}
}

View File

@ -5,9 +5,7 @@
#include "DNACommon.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAFSM2
namespace DataSpec::DNAFSM2
{
struct IFSM : BigYAML
{
@ -158,6 +156,5 @@ bool ExtractFSM2(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteFSM2(const FSM2<IDType>& fsm2, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_FSM2_HPP__

View File

@ -7,10 +7,9 @@
#include "../DNAMP3/MAPA.hpp"
#include "zeus/CTransform.hpp"
#include "zeus/CAABox.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMAPA
namespace DataSpec::DNAMAPA
{
static logvisor::Module Log("DNAMAPA");
@ -109,7 +108,7 @@ static const char* RetroMapObjVisModes[] =
};
template <typename PAKRouter>
bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
bool ReadMAPAToBlender(hecl::blender::Connection& conn,
const MAPA& mapa,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -119,9 +118,9 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
if (!force && outPath.isFile())
return true;
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::MapArea))
if (!conn.createBlend(outPath, hecl::blender::BlendType::MapArea))
return false;
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy, bmesh\n"
"from mathutils import Matrix\n"
@ -347,7 +346,7 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
}
template bool ReadMAPAToBlender<PAKRouter<DNAMP1::PAKBridge>>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const MAPA& mapa,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
@ -355,7 +354,7 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP1::PAKBridge>>
bool force);
template bool ReadMAPAToBlender<PAKRouter<DNAMP2::PAKBridge>>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const MAPA& mapa,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
@ -363,7 +362,7 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP2::PAKBridge>>
bool force);
template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const MAPA& mapa,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
@ -371,7 +370,7 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>
bool force);
template <typename MAPAType>
bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl::ProjectPath& out)
bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out)
{
if (mapaIn.verts.size() >= 256)
{
@ -385,7 +384,7 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
mapa.version = MAPAType::Version();
zeus::CAABox aabb;
for (const hecl::BlenderConnection::DataStream::Vector3f& vert : mapaIn.verts)
for (const hecl::blender::Vector3f& vert : mapaIn.verts)
aabb.accumulateBounds(vert.val);
mapa.header = std::make_unique<typename MAPAType::Header>();
@ -399,7 +398,7 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
header.surfCount = mapaIn.surfaces.size();
mapa.mappableObjects.reserve(mapaIn.pois.size());
for (const hecl::BlenderConnection::DataStream::MapArea::POI& poi : mapaIn.pois)
for (const hecl::blender::MapArea::POI& poi : mapaIn.pois)
{
mapa.mappableObjects.push_back(std::make_unique<typename MAPAType::MappableObject>());
typename MAPAType::MappableObject& mobj =
@ -413,7 +412,7 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
}
mapa.vertices.reserve(mapaIn.verts.size());
for (const hecl::BlenderConnection::DataStream::Vector3f& vert : mapaIn.verts)
for (const hecl::blender::Vector3f& vert : mapaIn.verts)
mapa.vertices.push_back(vert.val);
size_t offsetCur = 0;
@ -424,7 +423,7 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
mapa.surfaceHeaders.reserve(mapaIn.surfaces.size());
mapa.surfaces.reserve(mapaIn.surfaces.size());
for (const hecl::BlenderConnection::DataStream::MapArea::Surface& surfIn : mapaIn.surfaces)
for (const hecl::blender::MapArea::Surface& surfIn : mapaIn.surfaces)
{
mapa.surfaceHeaders.emplace_back();
DNAMAPA::MAPA::SurfaceHeader& surfHead = mapa.surfaceHeaders.back();
@ -475,9 +474,8 @@ bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapaIn, const hecl
return true;
}
template bool Cook<DNAMP1::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
template bool Cook<DNAMP2::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
template bool Cook<DNAMP3::MAPA>(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
template bool Cook<DNAMP1::MAPA>(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out);
template bool Cook<DNAMP2::MAPA>(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out);
template bool Cook<DNAMP3::MAPA>(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out);
}
}

View File

@ -5,9 +5,7 @@
#include "GX.hpp"
namespace DataSpec
{
namespace DNAMAPA
namespace DataSpec::DNAMAPA
{
struct MAPA : BigDNA
{
@ -185,7 +183,7 @@ struct MAPA : BigDNA
};
template <typename PAKRouter>
bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
bool ReadMAPAToBlender(hecl::blender::Connection& conn,
const MAPA& mapa,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -193,9 +191,8 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
bool force);
template <typename MAPAType>
bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out);
bool Cook(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out);
}
}
#endif // __DNACOMMON_MAPA_HPP__

View File

@ -3,14 +3,13 @@
#include "../DNAMP2/DNAMP2.hpp"
#include "../DNAMP3/DNAMP3.hpp"
#include "zeus/CTransform.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMAPU
namespace DataSpec::DNAMAPU
{
template <typename PAKRouter>
bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
bool ReadMAPUToBlender(hecl::blender::Connection& conn,
const MAPU& mapu,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -20,9 +19,9 @@ bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
if (!force && outPath.isFile())
return true;
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::MapUniverse))
if (!conn.createBlend(outPath, hecl::blender::BlendType::MapUniverse))
return false;
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy\n"
"from mathutils import Matrix\n"
@ -96,7 +95,7 @@ bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
}
template bool ReadMAPUToBlender<PAKRouter<DNAMP1::PAKBridge>>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const MAPU& mapu,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
@ -104,14 +103,14 @@ template bool ReadMAPUToBlender<PAKRouter<DNAMP1::PAKBridge>>
bool force);
template bool ReadMAPUToBlender<PAKRouter<DNAMP2::PAKBridge>>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const MAPU& mapu,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
const PAKRouter<DNAMP2::PAKBridge>::EntryType& entry,
bool force);
bool MAPU::Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapuIn, const hecl::ProjectPath& out)
bool MAPU::Cook(const hecl::blender::MapUniverse& mapuIn, const hecl::ProjectPath& out)
{
MAPU mapu;
@ -121,7 +120,7 @@ bool MAPU::Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapuIn,
mapu.worldCount = mapuIn.worlds.size();
mapu.worlds.reserve(mapuIn.worlds.size());
for (const hecl::BlenderConnection::DataStream::MapUniverse::World& wld : mapuIn.worlds)
for (const hecl::blender::MapUniverse::World& wld : mapuIn.worlds)
{
mapu.worlds.emplace_back();
MAPU::World& wldOut = mapu.worlds.back();
@ -132,7 +131,7 @@ bool MAPU::Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapuIn,
wldOut.transform.xf[2] = wld.xf.val[2];
wldOut.hexCount = wld.hexagons.size();
wldOut.hexTransforms.reserve(wld.hexagons.size());
for (const hecl::BlenderConnection::DataStream::Matrix4f& mtx : wld.hexagons)
for (const hecl::blender::Matrix4f& mtx : wld.hexagons)
{
wldOut.hexTransforms.emplace_back();
MAPU::Transform& xf = wldOut.hexTransforms.back();
@ -153,4 +152,3 @@ bool MAPU::Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapuIn,
}
}
}

View File

@ -3,9 +3,7 @@
#include "DNACommon.hpp"
namespace DataSpec
{
namespace DNAMAPU
namespace DataSpec::DNAMAPU
{
struct MAPU : BigDNA
{
@ -31,11 +29,11 @@ struct MAPU : BigDNA
};
Vector<World, DNA_COUNT(worldCount)> worlds;
static bool Cook(const hecl::BlenderConnection::DataStream::MapUniverse& mapu, const hecl::ProjectPath& out);
static bool Cook(const hecl::blender::MapUniverse& mapu, const hecl::ProjectPath& out);
};
template <typename PAKRouter>
bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
bool ReadMAPUToBlender(hecl::blender::Connection& conn,
const MAPU& mapu,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -43,6 +41,5 @@ bool ReadMAPUToBlender(hecl::BlenderConnection& conn,
bool force);
}
}
#endif // __DNACOMMON_MAPU_HPP__

View File

@ -2,14 +2,13 @@
#include "../DNAMP1/MLVL.hpp"
#include "../DNAMP2/MLVL.hpp"
#include "../DNAMP3/MLVL.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMLVL
namespace DataSpec::DNAMLVL
{
template <class PAKRouter, typename MLVL>
bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
bool ReadMLVLToBlender(hecl::blender::Connection& conn,
const MLVL& mlvl,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -22,9 +21,9 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
return true;
/* Create World Blend */
if (!conn.createBlend(blendPath, hecl::BlenderConnection::BlendType::World))
if (!conn.createBlend(blendPath, hecl::blender::BlendType::World))
return false;
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Matrix\n"
@ -102,7 +101,7 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
}
template bool ReadMLVLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MLVL>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const DNAMP1::MLVL& mlvl,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP1::PAKBridge>& pakRouter,
@ -111,7 +110,7 @@ template bool ReadMLVLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MLVL>
std::function<void(const hecl::SystemChar*)> fileChanged);
template bool ReadMLVLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MLVL>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const DNAMP2::MLVL& mlvl,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP2::PAKBridge>& pakRouter,
@ -120,7 +119,7 @@ template bool ReadMLVLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MLVL>
std::function<void(const hecl::SystemChar*)> fileChanged);
template bool ReadMLVLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MLVL>
(hecl::BlenderConnection& conn,
(hecl::blender::Connection& conn,
const DNAMP3::MLVL& mlvl,
const hecl::ProjectPath& outPath,
PAKRouter<DNAMP3::PAKBridge>& pakRouter,
@ -129,4 +128,3 @@ template bool ReadMLVLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MLVL>
std::function<void(const hecl::SystemChar*)> fileChanged);
}
}

View File

@ -2,16 +2,13 @@
#define __DNACOMMON_MLVL_HPP__
#include "DNACommon.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "zeus/CVector3f.hpp"
namespace DataSpec
{
namespace DNAMLVL
namespace DataSpec::DNAMLVL
{
template <class PAKRouter, typename MLVL>
bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
bool ReadMLVLToBlender(hecl::blender::Connection& conn,
const MLVL& mlvl,
const hecl::ProjectPath& outPath,
PAKRouter& pakRouter,
@ -20,6 +17,5 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
std::function<void(const hecl::SystemChar*)> fileChanged);
}
}
#endif // __DNACOMMON_MLVL_HPP__

View File

@ -3,11 +3,12 @@
#include "zeus/CTransform.hpp"
#include "DataSpec/DNAMP1/DCLN.hpp"
#include "gmm/gmm.h"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
using ColMesh = hecl::BlenderConnection::DataStream::ColMesh;
using ColMesh = hecl::blender::ColMesh;
struct FittedOBB
{

View File

@ -8,7 +8,7 @@ namespace DataSpec
struct OBBTreeBuilder
{
using ColMesh = hecl::BlenderConnection::DataStream::ColMesh;
using ColMesh = hecl::blender::ColMesh;
template <typename Node>
static std::unique_ptr<Node> buildCol(const ColMesh& mesh);
};

View File

@ -393,7 +393,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
return overrideSearch->second.getCookedPath(
*m_dataSpec.overrideDataSpec(overrideSearch->second,
m_dataSpec.getDataSpecEntry(),
hecl::SharedBlenderToken));
hecl::blender::SharedBlenderToken));
}
const PAKType* pak = m_pak.get();
@ -512,7 +512,7 @@ std::string PAKRouter<BRIDGETYPE>::getBestEntryName(const IDType& entry, bool st
}
template <class BRIDGETYPE>
bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool force, hecl::BlenderToken& btok,
bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*, float)> progress)
{
enterPAKBridge(pakBridge);

View File

@ -84,7 +84,7 @@ struct ResExtractor
{
std::function<bool(PAKEntryReadStream&, const hecl::ProjectPath&)> func_a;
std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::BlenderToken&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::blender::Token&,
std::function<void(const hecl::SystemChar*)>)> func_b;
std::array<const hecl::SystemChar*, 6> fileExts = {};
unsigned weight = 0;
@ -100,7 +100,7 @@ struct ResExtractor
: func_a(std::move(func)), fileExts(std::move(fileExtsIn)), weight(weightin), func_name(std::move(nfunc)) {}
ResExtractor(std::function<bool(const SpecBase&, PAKEntryReadStream&, const hecl::ProjectPath&, PAKRouter<PAKBRIDGE>&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::BlenderToken&,
const typename PAKBRIDGE::PAKType::Entry&, bool, hecl::blender::Token&,
std::function<void(const hecl::SystemChar*)>)> func,
std::array<const hecl::SystemChar*, 6>&& fileExtsIn, unsigned weightin=0,
std::function<void(const SpecBase&, PAKEntryReadStream&, PAKRouter<PAKBRIDGE>&,
@ -203,7 +203,7 @@ public:
std::string getBestEntryName(const EntryType& entry, bool stdOverride=true) const;
std::string getBestEntryName(const IDType& entry, bool stdOverride=true) const;
bool extractResources(const BRIDGETYPE& pakBridge, bool force, hecl::BlenderToken& btok,
bool extractResources(const BRIDGETYPE& pakBridge, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*, float)> progress);
const typename BRIDGETYPE::PAKType::Entry* lookupEntry(const IDType& entry,

View File

@ -1,8 +1,6 @@
#include "PART.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -1397,4 +1395,3 @@ template bool WriteGPSM<UniqueID32>(const GPSM<UniqueID32>& gpsm, const hecl::Pr
template bool WriteGPSM<UniqueID64>(const GPSM<UniqueID64>& gpsm, const hecl::ProjectPath& outPath);
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -122,7 +120,6 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteGPSM(const GPSM<IDType>& gpsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_PART_HPP__

View File

@ -1,8 +1,6 @@
#include "ParticleCommon.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
logvisor::Module LogModule("urde::DNAParticle");
@ -949,4 +947,3 @@ void EmitterElementFactory::write(athena::io::IStreamWriter& w) const
}
}
}

View File

@ -3,9 +3,7 @@
#include "DNACommon.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
extern logvisor::Module LogModule;
@ -1511,7 +1509,6 @@ struct ChildResourceFactory : BigYAML
operator bool() const {return id.operator bool();}
};
}
}
#endif // __COMMON_PARTICLECOMMON_HPP__

View File

@ -2,10 +2,9 @@
#include "DataSpec/DNAMP1/CINF.hpp"
#include "DataSpec/DNAMP2/CINF.hpp"
#include "DataSpec/DNAMP3/CINF.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAANIM
namespace DataSpec::DNAANIM
{
template <class CINFType>
@ -100,7 +99,7 @@ RigInverter<CINFType>::RigInverter(const CINFType& cinf)
template <class CINFType>
RigInverter<CINFType>::RigInverter(const CINFType& cinf,
const std::unordered_map<std::string,
hecl::BlenderConnection::DataStream::Matrix3f>& matrices)
hecl::blender::Matrix3f>& matrices)
: m_cinf(cinf)
{
m_bones.reserve(cinf.bones.size());
@ -179,4 +178,3 @@ template class RigInverter<DNAMP2::CINF>;
template class RigInverter<DNAMP3::CINF>;
}
}

View File

@ -4,11 +4,9 @@
#include "zeus/CVector3f.hpp"
#include "zeus/CMatrix3f.hpp"
#include "zeus/CQuaternion.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "hecl/hecl.hpp"
namespace DataSpec
{
namespace DNAANIM
namespace DataSpec::DNAANIM
{
/** One-shot process to invert CINF armature into connected rig,
@ -32,8 +30,7 @@ private:
public:
RigInverter(const CINFType& cinf);
RigInverter(const CINFType& cinf,
const std::unordered_map<std::string,
hecl::BlenderConnection::DataStream::Matrix3f>& matrices);
const std::unordered_map<std::string, hecl::blender::Matrix3f>& matrices);
const CINFType& getCINF() const {return m_cinf;}
const std::vector<Bone>& getBones() const {return m_bones;}
@ -44,7 +41,6 @@ public:
zeus::CVector3f restorePosition(atUint32 boneId, const zeus::CVector3f& origPos, bool subDelta) const;
};
}
}
#endif // __COMMON_RIGINVERTER_HPP__

View File

@ -3,9 +3,7 @@
#include "DNACommon.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace SAVWCommon
namespace DataSpec::SAVWCommon
{
enum class EScanCategory
{
@ -51,7 +49,6 @@ static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath
return true;
}
}
}
#endif // __COMMON_SAVWCOMMON_HPP__

View File

@ -1,8 +1,6 @@
#include "SWHC.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -530,4 +528,3 @@ template bool WriteSWSH<UniqueID32>(const SWSH<UniqueID32>& swsh, const hecl::Pr
template bool WriteSWSH<UniqueID64>(const SWSH<UniqueID64>& swsh, const hecl::ProjectPath& outPath);
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -65,5 +63,4 @@ bool ExtractSWSH(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteSWSH(const SWSH<IDType>& gpsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_SWHC_HPP__

View File

@ -1,8 +1,6 @@
#include "WPSC.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
@ -667,4 +665,3 @@ template bool WriteWPSM<UniqueID32>(const WPSM<UniqueID32>& wpsm, const hecl::Pr
template bool WriteWPSM<UniqueID64>(const WPSM<UniqueID64>& wpsm, const hecl::ProjectPath& outPath);
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAParticle
namespace DataSpec::DNAParticle
{
template <class IDType>
struct WPSM : BigYAML
@ -69,7 +67,6 @@ bool ExtractWPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteWPSM(const WPSM<IDType>& wpsm, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_WPSC_HPP__

View File

@ -5,9 +5,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct AFSM : public BigYAML
{
@ -165,6 +163,5 @@ struct AFSM : public BigYAML
}
};
}
}
#endif // _RETRO_AFSM_HPP_

View File

@ -1,8 +1,6 @@
#include "AGSC.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
using namespace std::literals;
@ -103,4 +101,3 @@ bool AGSC::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
}
}
}

View File

@ -4,9 +4,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
class AGSC
@ -22,7 +20,6 @@ public:
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNAMP1_AGSC_HPP_

View File

@ -1,4 +1,5 @@
#include "ANCS.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
@ -1018,7 +1019,7 @@ bool ANCS::Extract(const SpecBase& dataSpec,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
hecl::ProjectPath yamlPath = outPath.getWithExtension(_S(".yaml"), true);
@ -1041,7 +1042,7 @@ bool ANCS::Extract(const SpecBase& dataSpec,
if (force || blendType == hecl::ProjectPath::Type::None)
{
hecl::BlenderConnection& conn = btok.getBlenderConnection();
hecl::blender::Connection& conn = btok.getBlenderConnection();
DNAANCS::ReadANCSToBlender<PAKRouter<PAKBridge>, ANCS, MaterialSet, DNACMDL::SurfaceHeader_1, 2>
(conn, ancs, blendPath, pakRouter, entry, dataSpec, fileChanged, force);
}
@ -1123,7 +1124,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
{
if (sub.armature >= 0)
{
const DNAANCS::Actor::Armature& arm = actor.armatures[sub.armature];
const DNAANCS::Armature& arm = actor.armatures[sub.armature];
hecl::SystemStringConv armSysName(arm.name);
ch.cinf = inPath.ensureAuxInfo(hecl::SystemString(armSysName.sys_str()) + _S(".CINF"));
ch.cmdl = sub.mesh;
@ -1152,7 +1153,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
/* Gather ANIM resources */
ancs.animationSet.animResources.reserve(actor.actions.size());
for (const DNAANCS::Actor::Action& act : actor.actions)
for (const DNAANCS::Action& act : actor.actions)
{
hecl::SystemStringConv sysStr(act.name);
hecl::ProjectPath pathOut = inPath.ensureAuxInfo(hecl::SystemString(sysStr.sys_str()) + _S(".ANIM"));
@ -1183,7 +1184,7 @@ bool ANCS::CookCINF(const hecl::ProjectPath& outPath,
hecl::SystemString armName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5);
for (const DNAANCS::Actor::Armature& arm : actor.armatures)
for (const DNAANCS::Armature& arm : actor.armatures)
{
hecl::SystemStringConv sysStr(arm.name);
if (sysStr.sys_str() == armName)
@ -1220,7 +1221,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
/* Build bone ID map */
std::unordered_map<std::string, atInt32> boneIdMap;
for (const DNAANCS::Actor::Armature& arm : actor.armatures)
for (const DNAANCS::Armature& arm : actor.armatures)
{
CINF cinf(arm, boneIdMap);
}
@ -1350,13 +1351,13 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath,
bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor,
hecl::BlenderConnection::DataStream& ds,
hecl::blender::DataStream& ds,
bool pc)
{
hecl::SystemString actName(inPath.getAuxInfo().begin(),
inPath.getAuxInfo().end() - 5);
hecl::SystemUTF8Conv actNameView(actName);
DNAANCS::Actor::Action action = ds.compileActionChannelsOnly(actNameView.str());
DNAANCS::Action action = ds.compileActionChannelsOnly(actNameView.str());
if (!actor.armatures.size())
Log.report(logvisor::Fatal, _S("0 armatures in %s"),
@ -1366,7 +1367,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath,
std::unordered_map<std::string, atInt32> boneIdMap;
std::experimental::optional<CINF> rigCinf;
std::experimental::optional<DNAANIM::RigInverter<CINF>> rigInv;
for (const DNAANCS::Actor::Armature& arm : actor.armatures)
for (const DNAANCS::Armature& arm : actor.armatures)
{
if (!rigInv)
{

View File

@ -5,16 +5,13 @@
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/ANCS.hpp"
#include "CMDLMaterials.hpp"
#include "hecl/Blender/BlenderConnection.hpp"
#include "CINF.hpp"
#include "CSKR.hpp"
#include "ANIM.hpp"
#include "EVNT.hpp"
#include "athena/FileReader.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct ANCS : BigYAML
@ -552,7 +549,7 @@ struct ANCS : BigYAML
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
@ -571,11 +568,10 @@ struct ANCS : BigYAML
static bool CookANIM(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor,
hecl::BlenderConnection::DataStream& ds,
hecl::blender::DataStream& ds,
bool pc);
};
}
}
#endif // _DNAMP1_ANCS_HPP_

View File

@ -1,14 +1,13 @@
#include "ANIM.hpp"
#include "zeus/CVector3f.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
using ANIMOutStream = hecl::BlenderConnection::PyOutStream::ANIMOutStream;
using ANIMOutStream = hecl::blender::ANIMOutStream;
void ANIM::IANIM::sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const
void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig) const
{
os.format("act.hecl_fps = round(%f)\n"
"act.hecl_looping = %s\n",
@ -606,4 +605,3 @@ ANIM::ANIM(const BlenderAction& act,
}
}
}

View File

@ -1,15 +1,12 @@
#ifndef _DNAMP1_ANIM_HPP_
#define _DNAMP1_ANIM_HPP_
#include "hecl/Blender/BlenderConnection.hpp"
#include "DNAMP1.hpp"
#include "../DNACommon/ANIM.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
#include "CINF.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct ANIM : BigDNA
@ -30,7 +27,7 @@ struct ANIM : BigDNA
UniqueID32 evnt;
bool looping = false;
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig) const;
void sendANIMToBlender(hecl::blender::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig) const;
};
struct ANIM0 : IANIM
@ -231,7 +228,7 @@ struct ANIM : BigDNA
return m_anim->binarySize(__isz + 4);
}
void sendANIMToBlender(hecl::BlenderConnection::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const
{
m_anim->sendANIMToBlender(os, rig);
}
@ -243,7 +240,7 @@ struct ANIM : BigDNA
return m_anim->looping;
}
using BlenderAction = hecl::BlenderConnection::DataStream::Actor::Action;
using BlenderAction = hecl::blender::Action;
ANIM() = default;
ANIM(const BlenderAction& act,
@ -252,7 +249,6 @@ struct ANIM : BigDNA
bool pc);
};
}
}
#endif // _DNAMP1_ANIM_HPP_

View File

@ -1,8 +1,7 @@
#include "CINF.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
atUint32 CINF::getInternalBoneIdxFromId(atUint32 id) const
@ -37,7 +36,7 @@ const std::string* CINF::getBoneNameFromId(atUint32 id) const
return nullptr;
}
void CINF::sendVertexGroupsToBlender(hecl::BlenderConnection::PyOutStream& os) const
void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const
{
for (atUint32 bid : boneIds)
{
@ -52,7 +51,7 @@ void CINF::sendVertexGroupsToBlender(hecl::BlenderConnection::PyOutStream& os) c
}
}
void CINF::sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const
{
DNAANIM::RigInverter<CINF> inverter(*this);
@ -92,7 +91,7 @@ std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId)
return hecl::Format("CINF_%08X", cinfId.toUint32());
}
int CINF::RecursiveAddArmatureBone(const Armature& armature, const Armature::Bone* bone, int parent, int& curId,
int CINF::RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap)
{
int selId;
@ -114,7 +113,7 @@ int CINF::RecursiveAddArmatureBone(const Armature& armature, const Armature::Bon
boneOut.linkedCount = bone->children.size() + 1;
boneOut.linked.reserve(boneOut.linkedCount);
const Armature::Bone* child;
const BlenderBone* child;
boneOut.linked.push_back(parent);
for (size_t i=0 ; (child = armature.getChild(bone, i)) ; ++i)
boneOut.linked.push_back(RecursiveAddArmatureBone(armature, child, boneOut.id, curId, idMap, nameMap));
@ -129,13 +128,13 @@ CINF::CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& i
std::map<std::string, int> nameMap;
const Armature::Bone* bone = armature.getRoot();
const BlenderBone* bone = armature.getRoot();
if (bone)
{
if (bone->children.size())
{
int curId = 4;
const Armature::Bone* child;
const BlenderBone* child;
for (size_t i=0 ; (child = armature.getChild(bone, i)) ; ++i)
RecursiveAddArmatureBone(armature, child, 3, curId, idMap, nameMap);
}
@ -179,4 +178,3 @@ CINF::CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& i
}
}
}

View File

@ -1,13 +1,10 @@
#ifndef _DNAMP1_CINF_HPP_
#define _DNAMP1_CINF_HPP_
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/RigInverter.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct CINF : BigDNA
@ -40,20 +37,20 @@ struct CINF : BigDNA
atUint32 getInternalBoneIdxFromId(atUint32 id) const;
atUint32 getBoneIdxFromId(atUint32 id) const;
const std::string* getBoneNameFromId(atUint32 id) const;
void sendVertexGroupsToBlender(hecl::BlenderConnection::PyOutStream& os) const;
void sendCINFToBlender(hecl::BlenderConnection::PyOutStream& os, const UniqueID32& cinfId) const;
void sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const;
void sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const;
static std::string GetCINFArmatureName(const UniqueID32& cinfId);
CINF() = default;
using Armature = hecl::BlenderConnection::DataStream::Actor::Armature;
using Armature = hecl::blender::Armature;
using BlenderBone = hecl::blender::Bone;
int RecursiveAddArmatureBone(const Armature& armature, const Armature::Bone* bone, int parent, int& curId,
int RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap);
CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap);
};
}
}
#endif // _DNAMP1_CINF_HPP_

145
DataSpec/DNAMP1/CMDL.cpp Normal file
View File

@ -0,0 +1,145 @@
#include "CMDL.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
bool CMDL::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
/* Check for RigPair */
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
CINF cinf;
CSKR cskr;
std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr);
if (rp)
{
pakRouter.lookupAndReadDNA(rp->first, cskr);
pakRouter.lookupAndReadDNA(rp->second, cinf);
loadRp.first = &cskr;
loadRp.second = &cinf;
}
/* Do extract */
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend();
#if 0
/* Cook and re-extract test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1);
ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
athena::io::FileReader reader(tempOut.getAbsolutePath());
hecl::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true);
if (!conn.createBlend(tempBlend, hecl::blender::Connection::TypeMesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
(conn, reader, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
#elif 0
/* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
#endif
return true;
}
bool CMDL::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
if (mesh.skins.size())
{
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, skinMesh))
return false;
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.skins.size());
for (const std::vector<DNACMDL::Mesh::SkinBind> skin : skinMesh.skins)
{
writer.writeUint32Big(skin.size());
for (const DNACMDL::Mesh::SkinBind& bind : skin)
{
writer.writeUint32Big(bind.boneIdx);
writer.writeFloatBig(bind.weight);
}
writer.writeUint32Big(*vertCountIt++);
}
writer.writeUint32Big(skinMesh.pos.size());
writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName);
}
else if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, mesh))
return false;
return true;
}
bool CMDL::HMDLCook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
hecl::blender::PoolSkinIndex poolSkinIndex;
if (mesh.skins.size())
{
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
/* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{
writer.writeUint32Big(sb.m_boneIdxs.size());
for (uint32_t bind : sb.m_boneIdxs)
writer.writeUint32Big(bind);
}
writer.writeUint32Big(mesh.boneNames.size());
for (const std::string& boneName : mesh.boneNames)
writer.writeString(boneName);
/* CVirtualBone structure just like original (for CPU skinning) */
writer.writeUint32Big(mesh.skins.size());
for (auto& s : mesh.skins)
{
writer.writeUint32Big(s.size());
for (auto& b : s)
{
writer.writeUint32Big(b.boneIdx);
writer.writeFloatBig(b.weight);
}
}
/* Write indirection table mapping pool verts to CVirtualBones */
writer.writeUint32Big(poolSkinIndex.m_poolSz);
for (uint32_t i=0 ; i<poolSkinIndex.m_poolSz ; ++i)
writer.writeUint32Big(poolSkinIndex.m_poolToSkinIndex[i]);
}
else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
return true;
}
}

View File

@ -10,9 +10,7 @@
#include <athena/FileReader.hpp>
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct CMDL
@ -23,56 +21,8 @@ struct CMDL
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
/* Check for RigPair */
const PAKRouter<PAKBridge>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
CINF cinf;
CSKR cskr;
std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr);
if (rp)
{
pakRouter.lookupAndReadDNA(rp->first, cskr);
pakRouter.lookupAndReadDNA(rp->second, cinf);
loadRp.first = &cskr;
loadRp.second = &cinf;
}
/* Do extract */
hecl::BlenderConnection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend();
#if 0
/* Cook and re-extract test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::TopologyTriStrips, -1);
ds.close();
DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
athena::io::FileReader reader(tempOut.getAbsolutePath());
hecl::ProjectPath tempBlend = outPath.getWithExtension(_S(".recook.blend"), true);
if (!conn.createBlend(tempBlend, hecl::BlenderConnection::TypeMesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
(conn, reader, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
#elif 0
/* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
hecl::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
#endif
return true;
}
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
@ -84,87 +34,13 @@ struct CMDL
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
if (mesh.skins.size())
{
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, skinMesh))
return false;
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.skins.size());
for (const std::vector<DNACMDL::Mesh::SkinBind> skin : skinMesh.skins)
{
writer.writeUint32Big(skin.size());
for (const DNACMDL::Mesh::SkinBind& bind : skin)
{
writer.writeUint32Big(bind.boneIdx);
writer.writeFloatBig(bind.weight);
}
writer.writeUint32Big(*vertCountIt++);
}
writer.writeUint32Big(skinMesh.pos.size());
writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName);
}
else if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, mesh))
return false;
return true;
}
const DNACMDL::Mesh& mesh);
static bool HMDLCook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
hecl::PoolSkinIndex poolSkinIndex;
if (mesh.skins.size())
{
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
/* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_S(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{
writer.writeUint32Big(sb.m_boneIdxs.size());
for (uint32_t bind : sb.m_boneIdxs)
writer.writeUint32Big(bind);
}
writer.writeUint32Big(mesh.boneNames.size());
for (const std::string& boneName : mesh.boneNames)
writer.writeString(boneName);
/* CVirtualBone structure just like original (for CPU skinning) */
writer.writeUint32Big(mesh.skins.size());
for (auto& s : mesh.skins)
{
writer.writeUint32Big(s.size());
for (auto& b : s)
{
writer.writeUint32Big(b.boneIdx);
writer.writeFloatBig(b.weight);
}
}
/* Write indirection table mapping pool verts to CVirtualBones */
writer.writeUint32Big(poolSkinIndex.m_poolSz);
for (uint32_t i=0 ; i<poolSkinIndex.m_poolSz ; ++i)
writer.writeUint32Big(poolSkinIndex.m_poolToSkinIndex[i]);
}
else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
return true;
}
const DNACMDL::Mesh& mesh);
};
}
}
#endif // _DNAMP1_CMDL_HPP_

View File

@ -1,11 +1,10 @@
#include "CMDLMaterials.hpp"
#include "../DNAMP2/CMDLMaterials.hpp"
#include "hecl/Blender/Connection.hpp"
using Stream = hecl::BlenderConnection::PyOutStream;
using Stream = hecl::blender::PyOutStream;
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
using Material = MaterialSet::Material;
@ -1152,7 +1151,7 @@ MaterialSet::Material::Material(const hecl::Backend::GX& gx,
HMDLMaterialSet::Material::Material(hecl::Frontend::Frontend& FE,
const std::string& diagName,
const hecl::BlenderConnection::DataStream::Mesh::Material& mat,
const hecl::blender::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<hecl::ProjectPath>& texPaths)
{
@ -1297,12 +1296,9 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str());
}
}
}
namespace DataSpec
{
namespace DNAMP2
namespace DataSpec::DNAMP2
{
void MaterialSet::ConstructMaterial(Stream& out,
@ -1312,4 +1308,3 @@ void MaterialSet::ConstructMaterial(Stream& out,
{DataSpec::DNAMP1::_ConstructMaterial(out, material, groupIdx, matIdx);}
}
}

View File

@ -1,15 +1,12 @@
#ifndef _DNAMP1_CMDL_MATERIALS_HPP_
#define _DNAMP1_CMDL_MATERIALS_HPP_
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/GX.hpp"
#include "../DNACommon/CMDL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MaterialSet : BigDNA
@ -365,15 +362,15 @@ struct MaterialSet : BigDNA
};
Vector<UVAnimation, DNA_COUNT(uvAnimsCount)> uvAnims;
static void AddTexture(hecl::BlenderConnection::PyOutStream& out,
static void AddTexture(hecl::blender::PyOutStream& out,
GX::TexGenSrc type, int mtxIdx, uint32_t texIdx);
static void AddTextureAnim(hecl::BlenderConnection::PyOutStream& out,
static void AddTextureAnim(hecl::blender::PyOutStream& out,
MaterialSet::Material::UVAnimation::Mode type,
unsigned idx, const float* vals);
static void AddKcolor(hecl::BlenderConnection::PyOutStream& out,
static void AddKcolor(hecl::blender::PyOutStream& out,
const GX::Color& col, unsigned idx);
static void AddDynamicColor(hecl::BlenderConnection::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(hecl::BlenderConnection::PyOutStream& out, unsigned idx);
static void AddDynamicColor(hecl::blender::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(hecl::blender::PyOutStream& out, unsigned idx);
Material() = default;
Material(const hecl::Backend::GX& gx,
@ -388,12 +385,12 @@ struct MaterialSet : BigDNA
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
static void RegisterMaterialProps(hecl::BlenderConnection::PyOutStream& out);
static void ConstructMaterial(hecl::BlenderConnection::PyOutStream& out,
static void RegisterMaterialProps(hecl::blender::PyOutStream& out);
static void ConstructMaterial(hecl::blender::PyOutStream& out,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
void readToBlender(hecl::BlenderConnection::PyOutStream& os,
void readToBlender(hecl::blender::PyOutStream& os,
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
unsigned setIdx)
@ -473,14 +470,13 @@ struct HMDLMaterialSet : BigDNA
Material() = default;
Material(hecl::Frontend::Frontend& FE,
const std::string& diagName,
const hecl::BlenderConnection::DataStream::Mesh::Material& mat,
const hecl::blender::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<hecl::ProjectPath>& texPaths);
};
Vector<Material, DNA_COUNT(head.materialCount)> materials;
};
}
}
#endif // _DNAMP1_CMDL_MATERIALS_HPP_

View File

@ -44,12 +44,14 @@ set(DNAMP1_SOURCES
STRG.hpp STRG.cpp
AGSC.cpp
CSNG.cpp
CSKR.cpp
ANCS.cpp
ANIM.cpp
CINF.cpp
EVNT.cpp
CMDL.hpp
CMDL.hpp CMDL.cpp
CMDLMaterials.cpp
DCLN.cpp
MAPA.hpp
MAPU.hpp
MREA.cpp

21
DataSpec/DNAMP1/CSKR.cpp Normal file
View File

@ -0,0 +1,21 @@
#include "CSKR.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const
{
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules)
{
if (idx >= accum && idx < accum + rule.vertCount)
for (const SkinningRule::Weight& weight : rule.weights)
os.format("vert[dvert_lay][%u] = %f\n",
cinf.getBoneIdxFromId(weight.boneId),
weight.weight);
accum += rule.vertCount;
}
}
}

View File

@ -1,13 +1,10 @@
#ifndef _DNAMP1_CSKR_HPP_
#define _DNAMP1_CSKR_HPP_
#include "hecl/Blender/BlenderConnection.hpp"
#include "../DNACommon/DNACommon.hpp"
#include "CINF.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct CSKR : BigDNA
@ -34,22 +31,9 @@ struct CSKR : BigDNA
return nullptr;
}
void weightVertex(hecl::BlenderConnection::PyOutStream& os, const CINF& cinf, atUint32 idx) const
{
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules)
{
if (idx >= accum && idx < accum + rule.vertCount)
for (const SkinningRule::Weight& weight : rule.weights)
os.format("vert[dvert_lay][%u] = %f\n",
cinf.getBoneIdxFromId(weight.boneId),
weight.weight);
accum += rule.vertCount;
}
}
void weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const;
};
}
}
#endif // _DNAMP1_CSKR_HPP_

View File

@ -1,9 +1,7 @@
#include "CSNG.hpp"
#include "amuse/SongConverter.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
@ -87,4 +85,3 @@ bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
}
}
}

View File

@ -4,9 +4,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
class CSNG
@ -25,7 +23,6 @@ public:
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
}
#endif // _DNAMP1_CSNG_HPP_

106
DataSpec/DNAMP1/DCLN.cpp Normal file
View File

@ -0,0 +1,106 @@
#include "DCLN.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
#if DCLN_DUMP_OBB
void DCLN::Collision::NodesendToBlender(hecl::blender::PyOutStream& os) const
{
os.format("obj = bpy.data.objects.new('%s', None)\n"
"obj.empty_draw_type = 'CUBE'\n"
"bpy.context.scene.objects.link(obj)\n"
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"obj.rotation_mode = 'QUATERNION'\n"
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = (%f,%f,%f)\n", isLeaf ? "leaf" : "branch",
xf[0].vec[0], xf[0].vec[1], xf[0].vec[2], xf[0].vec[3],
xf[1].vec[0], xf[1].vec[1], xf[1].vec[2], xf[1].vec[3],
xf[2].vec[0], xf[2].vec[1], xf[2].vec[2], xf[2].vec[3],
halfExtent.vec[0], halfExtent.vec[1], halfExtent.vec[2]);
if (isLeaf)
os << "obj.show_name = True\n";
if (!isLeaf)
{
left->sendToBlender(os);
right->sendToBlender(os);
}
}
#endif
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName)
{
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
entryName.data());
DeafBabe::BlenderInit(os);
atInt32 idx = 0;
for (const Collision& col : collision)
{
DeafBabeSendToBlender(os, col, true, idx++);
#if DCLN_DUMP_OBB
col.root.sendToBlender(os);
#endif
}
os.centerView();
os.close();
}
bool DCLN::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
DCLN dcln;
dcln.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::ColMesh))
return false;
dcln.sendToBlender(conn, pakRouter.getBestEntryName(entry, false));
return conn.saveBlend();
}
bool DCLN::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const std::vector<Mesh>& meshes,
hecl::blender::Connection* conn)
{
DCLN dcln;
dcln.colCount = atUint32(meshes.size());
for (const Mesh& mesh : meshes)
{
dcln.collision.emplace_back();
Collision& colOut = dcln.collision.back();
DeafBabeBuildFromBlender(colOut, mesh);
colOut.root = std::move(*OBBTreeBuilder::buildCol<Collision::Node>(mesh));
colOut.memSize = atUint32(colOut.root.getMemoryUsage());
}
athena::io::FileWriter w(outPath.getAbsolutePath());
dcln.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeUByte(0xff);
return true;
}
}

View File

@ -10,14 +10,12 @@
#define DCLN_DUMP_OBB 0
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct DCLN : BigDNA
{
using Mesh = hecl::BlenderConnection::DataStream::ColMesh;
using Mesh = hecl::blender::ColMesh;
DECL_DNA
Value<atUint32> colCount;
@ -130,29 +128,7 @@ struct DCLN : BigDNA
}
#if DCLN_DUMP_OBB
void sendToBlender(hecl::BlenderConnection::PyOutStream& os) const
{
os.format("obj = bpy.data.objects.new('%s', None)\n"
"obj.empty_draw_type = 'CUBE'\n"
"bpy.context.scene.objects.link(obj)\n"
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"obj.rotation_mode = 'QUATERNION'\n"
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = (%f,%f,%f)\n", isLeaf ? "leaf" : "branch",
xf[0].vec[0], xf[0].vec[1], xf[0].vec[2], xf[0].vec[3],
xf[1].vec[0], xf[1].vec[1], xf[1].vec[2], xf[1].vec[3],
xf[2].vec[0], xf[2].vec[1], xf[2].vec[2], xf[2].vec[3],
halfExtent.vec[0], halfExtent.vec[1], halfExtent.vec[2]);
if (isLeaf)
os << "obj.show_name = True\n";
if (!isLeaf)
{
left->sendToBlender(os);
right->sendToBlender(os);
}
}
sendToBlender(hecl::blender::PyOutStream& os) const;
#endif
};
Node root;
@ -162,40 +138,13 @@ struct DCLN : BigDNA
}
/* Dummy MP2 member */
void insertNoClimb(hecl::BlenderConnection::PyOutStream&) const {}
void insertNoClimb(hecl::blender::PyOutStream&) const {}
};
Vector<Collision, DNA_COUNT(colCount)> collision;
void sendToBlender(hecl::BlenderConnection& conn, std::string_view entryName)
{
/* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
entryName.data());
DeafBabe::BlenderInit(os);
atInt32 idx = 0;
for (const Collision& col : collision)
{
DeafBabeSendToBlender(os, col, true, idx++);
#if DCLN_DUMP_OBB
col.root.sendToBlender(os);
#endif
}
os.centerView();
os.close();
}
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
@ -203,45 +152,14 @@ struct DCLN : BigDNA
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
DCLN dcln;
dcln.read(rs);
hecl::BlenderConnection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::ColMesh))
return false;
dcln.sendToBlender(conn, pakRouter.getBestEntryName(entry, false));
return conn.saveBlend();
}
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const std::vector<Mesh>& meshes,
hecl::BlenderConnection* conn = nullptr)
{
DCLN dcln;
dcln.colCount = atUint32(meshes.size());
for (const Mesh& mesh : meshes)
{
dcln.collision.emplace_back();
Collision& colOut = dcln.collision.back();
DeafBabeBuildFromBlender(colOut, mesh);
colOut.root = std::move(*OBBTreeBuilder::buildCol<Collision::Node>(mesh));
colOut.memSize = atUint32(colOut.root.getMemoryUsage());
}
athena::io::FileWriter w(outPath.getAbsolutePath());
dcln.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeUByte(0xff);
return true;
}
hecl::blender::Connection* conn = nullptr);
};
}
}
#endif // __DNAMP1_DCLN_HPP__

View File

@ -1,4 +1,4 @@
#include <stdio.h>
#include <cstdio>
#define NOD_ATHENA 1
#include "DNAMP1.hpp"
@ -46,9 +46,7 @@
#include "MazeSeeds.hpp"
#include "SnowForces.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
logvisor::Module Log("urde::DNAMP1");
@ -432,4 +430,3 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
}
}
}

View File

@ -5,9 +5,7 @@
#include "PAK.hpp"
#include "zeus/CMatrix4f.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
extern logvisor::Module Log;
@ -44,7 +42,6 @@ public:
std::unordered_map<UniqueID32, hecl::ProjectPath>& pathOverrides) const;
};
}
}
#endif // __DNAMP1_HPP__

View File

@ -1,11 +1,10 @@
#include "DeafBabe.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
void DeafBabe::BlenderInit(hecl::blender::PyOutStream& os)
{
os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n"
" 'Stone':(1.0, 0.43, 0.15),\n"
@ -232,4 +231,3 @@ void DeafBabe::BlenderInit(hecl::BlenderConnection::PyOutStream& os)
}
}
}

View File

@ -3,9 +3,7 @@
#include "../DNACommon/DeafBabe.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct DeafBabe : BigDNA
@ -143,16 +141,15 @@ struct DeafBabe : BigDNA
Vector<atVec3f, DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
void insertNoClimb(hecl::BlenderConnection::PyOutStream&) const {}
void insertNoClimb(hecl::blender::PyOutStream&) const {}
static void BlenderInit(hecl::BlenderConnection::PyOutStream& os);
void sendToBlender(hecl::BlenderConnection::PyOutStream& os) const
static void BlenderInit(hecl::blender::PyOutStream& os);
void sendToBlender(hecl::blender::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
}
};
}
}
#endif // _DNAMP1_DEAFBABE_HPP_

View File

@ -1,8 +1,6 @@
#include "EVNT.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void EVNT::read(athena::io::IStreamReader& reader)
@ -96,4 +94,3 @@ size_t EVNT::binarySize(size_t __isz) const
}
}
}

View File

@ -4,9 +4,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct EVNT : BigYAML
@ -107,7 +105,6 @@ struct EVNT : BigYAML
}
};
}
}
#endif // __DNAMP1_EVNT_HPP__

View File

@ -1,9 +1,8 @@
#include "FRME.hpp"
#include "../DNACommon/TXTR.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void FRME::read(athena::io::IStreamReader& __dna_reader)
{
@ -317,23 +316,23 @@ bool FRME::Extract(const SpecBase &dataSpec,
PAKRouter<PAKBridge> &pakRouter,
const PAK::Entry &entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void (const hecl::SystemChar *)> fileChanged)
{
FRME frme;
frme.read(rs);
hecl::BlenderConnection& conn = btok.getBlenderConnection();
hecl::blender::Connection& conn = btok.getBlenderConnection();
#if 0
if (!force && outPath.isFile())
return true;
#endif
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Frame))
if (!conn.createBlend(outPath, hecl::blender::BlendType::Frame))
return false;
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os << "import bpy, math, bmesh\n"
"from mathutils import Matrix, Quaternion\n"
@ -718,4 +717,3 @@ bool FRME::Extract(const SpecBase &dataSpec,
}
}
}

View File

@ -5,9 +5,7 @@
#include "DNAMP1.hpp"
#include <athena/FileWriter.hpp>
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct FRME : BigDNA
{
@ -299,11 +297,10 @@ struct FRME : BigDNA
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
};
}
}
#endif // _DNAMP1_FRME_HPP_

View File

@ -4,9 +4,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "../DNACommon/PAK.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct HINT : BigYAML
{
@ -58,5 +56,4 @@ struct HINT : BigYAML
}
};
}
}
#endif // _DNAMP1_HINT_HPP_

View File

@ -7,9 +7,7 @@
#include "../DNACommon/MAPA.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MAPA : DNAMAPA::MAPA
@ -20,16 +18,16 @@ struct MAPA : DNAMAPA::MAPA
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MAPA mapa;
mapa.read(rs);
hecl::BlenderConnection& conn = btok.getBlenderConnection();
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
static bool Cook(const hecl::BlenderConnection::DataStream::MapArea& mapa, const hecl::ProjectPath& out)
static bool Cook(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out)
{
return DNAMAPA::Cook<MAPA>(mapa, out);
}
@ -39,6 +37,5 @@ struct MAPA : DNAMAPA::MAPA
using MappableObject = DNAMAPA::MAPA::MappableObjectMP1_2;
};
}
}
#endif

View File

@ -7,9 +7,7 @@
#include "../DNACommon/MAPU.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MAPU : DNAMAPU::MAPU
@ -20,16 +18,15 @@ struct MAPU : DNAMAPU::MAPU
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MAPU mapu;
mapu.read(rs);
hecl::BlenderConnection& conn = btok.getBlenderConnection();
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPU::ReadMAPUToBlender(conn, mapu, outPath, pakRouter, entry, force);
}
};
}
}
#endif

View File

@ -7,14 +7,13 @@
#include "ScriptObjects/DoorArea.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/World/ScriptObjectSupport.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::BlenderToken& btok,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MLVL mlvl;
@ -57,12 +56,12 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
mlvl.toYAMLStream(writer, static_cast<YAMLWriteMemberFn>(&MLVL::writeMeta));
hecl::BlenderConnection& conn = btok.getBlenderConnection();
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged);
}
bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const World& wld,
hecl::BlenderToken& btok)
hecl::blender::Token& btok)
{
MLVL mlvl = {};
athena::io::FileReader reader(inPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
@ -351,7 +350,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
bool MLVL::CookMAPW(const hecl::ProjectPath& outPath,
const World& wld,
hecl::BlenderToken& btok)
hecl::blender::Token& btok)
{
std::vector<urde::SObjectTag> mapaTags;
mapaTags.reserve(wld.areas.size());
@ -521,4 +520,3 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
}
}
}

View File

@ -5,9 +5,7 @@
#include "../DNACommon/MLVL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MLVL : BigYAML
@ -146,25 +144,24 @@ struct MLVL : BigYAML
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
using World = hecl::BlenderConnection::DataStream::World;
using World = hecl::blender::World;
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const World& wld,
hecl::BlenderToken& btok);
hecl::blender::Token& btok);
static bool CookMAPW(const hecl::ProjectPath& outPath,
const World& wld,
hecl::BlenderToken& btok);
hecl::blender::Token& btok);
static bool CookSAVW(const hecl::ProjectPath& outPath,
const World& wld);
};
}
}
#endif // __DNAMP1_MLVL_HPP__

View File

@ -1,5 +1,5 @@
#include <hecl/ClientProcess.hpp>
#include <athena/MemoryReader.hpp>
#include "hecl/ClientProcess.hpp"
#include "athena/MemoryReader.hpp"
#include "MREA.hpp"
#include "SCLY.hpp"
#include "PATH.hpp"
@ -9,15 +9,14 @@
#include "zeus/CAABox.hpp"
#include "DataSpec/DNACommon/AROTBuilder.hpp"
#include "ScriptObjects/ScriptTypes.hpp"
#include "hecl/Blender/Connection.hpp"
extern hecl::SystemString ExeDir;
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void MREA::ReadBabeDeadToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
void MREA::ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os,
athena::io::IStreamReader& rs)
{
atUint32 bdMagic = rs.readUint32Big();
@ -60,7 +59,7 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs,
}
/* Collision octree dumper */
static void OutputOctreeNode(hecl::BlenderConnection::PyOutStream& os, athena::io::MemoryReader& r,
static void OutputOctreeNode(hecl::blender::PyOutStream& os, athena::io::MemoryReader& r,
BspNodeType type, const zeus::CAABox& aabb)
{
if (type == BspNodeType::Branch)
@ -140,7 +139,7 @@ static void OutputOctreeNode(hecl::BlenderConnection::PyOutStream& os, athena::i
static const uint32_t AROTChildCounts[] = { 0, 2, 2, 4, 2, 4, 4, 8 };
/* AROT octree dumper */
static void OutputOctreeNode(hecl::BlenderConnection::PyOutStream& os, athena::io::MemoryReader& r,
static void OutputOctreeNode(hecl::blender::PyOutStream& os, athena::io::MemoryReader& r,
const zeus::CAABox& aabb)
{
r.readUint16Big();
@ -191,7 +190,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)>)
{
using RigPair = std::pair<CSKR*, CINF*>;
@ -205,12 +204,12 @@ bool MREA::Extract(const SpecBase& dataSpec,
head.read(rs);
rs.seekAlign32();
hecl::BlenderConnection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::BlenderConnection::BlendType::Area))
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::Area))
return false;
/* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@ -414,7 +413,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
const std::vector<DNACMDL::Mesh>& meshes,
const ColMesh& cMesh,
const std::vector<Light>& lights,
hecl::BlenderToken& btok)
hecl::blender::Token& btok)
{
/* Discover area layers */
hecl::ProjectPath areaDirPath = inPath.getParentPath();
@ -489,12 +488,12 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
arotBuilder.build(secs, fullAabb, meshAabbs, meshes);
#if 0
hecl::BlenderConnection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::BlenderConnection::BlendType::Area))
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::blender::Connection::BlendType::Area))
return false;
/* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@ -556,12 +555,12 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
DeafBabeBuildFromBlender(collision, cMesh);
#if 0
hecl::BlenderConnection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::BlenderConnection::BlendType::Area))
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(inPath.getWithExtension(_S(".octree.blend"), true), hecl::blender::Connection::BlendType::Area))
return false;
/* Open Py Stream and read sections */
hecl::BlenderConnection::PyOutStream os = conn.beginPythonOut(true);
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector\n"
@ -704,7 +703,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
w.writeUint32Big(mesh.pos.size());
for (const auto& v : mesh.pos)
{
atVec3f xfPos = hecl::BlenderConnection::DataStream::MtxVecMul4RM(mesh.sceneXf, v);
atVec3f xfPos = hecl::blender::MtxVecMul4RM(mesh.sceneXf, v);
w.writeVec3fBig(xfPos);
}
@ -714,7 +713,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
w.writeUint32Big(surf.verts.size());
for (const DNACMDL::Mesh::Surface::Vert& vert : surf.verts)
w.writeUint32Big(vert.iPos);
const DNACMDL::Mesh::Material& mat = mesh.materialSets[0][surf.materialIdx];
const DNACMDL::Material& mat = mesh.materialSets[0][surf.materialIdx];
w.writeBool(mat.transparent);
}
}
@ -829,4 +828,3 @@ bool MREA::CookPath(const hecl::ProjectPath& outPath,
}
}
}

View File

@ -5,9 +5,7 @@
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MREA
@ -101,7 +99,7 @@ struct MREA
Value<float> unk9;
};
static void ReadBabeDeadToBlender_1_2(hecl::BlenderConnection::PyOutStream& os,
static void ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os,
athena::io::IStreamReader& rs);
static void AddCMDLRigPairs(PAKEntryReadStream& rs,
@ -114,7 +112,7 @@ struct MREA
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
hecl::BlenderToken& btok,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)>);
static void Name(const SpecBase& dataSpec,
@ -122,8 +120,8 @@ struct MREA
PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry);
using ColMesh = hecl::BlenderConnection::DataStream::ColMesh;
using Light = hecl::BlenderConnection::DataStream::Light;
using ColMesh = hecl::blender::ColMesh;
using Light = hecl::blender::Light;
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
@ -136,13 +134,12 @@ struct MREA
const std::vector<DNACMDL::Mesh>& meshes,
const ColMesh& cMesh,
const std::vector<Light>& lights,
hecl::BlenderToken& btok);
hecl::blender::Token& btok);
static bool CookPath(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath);
};
}
}
#endif

View File

@ -5,9 +5,7 @@
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct MazeSeeds : BigYAML
{
@ -15,6 +13,5 @@ struct MazeSeeds : BigYAML
Value<atUint32> seeds[300];
};
}
}
#endif // __DNAMP1_MAZESEEDS_HPP__

View File

@ -3,9 +3,7 @@
#include "DNAMP1.hpp"
#include "PAK.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void PAK::read(athena::io::IStreamReader& reader)
@ -180,4 +178,3 @@ std::string PAK::bestEntryName(const Entry& entry, bool& named) const
}
}
}

View File

@ -6,9 +6,7 @@
#include <nod/DiscBase.hpp>
#include "../DNACommon/PAK.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct PAK : BigDNA
@ -59,7 +57,6 @@ struct PAK : BigDNA
using IDType = UniqueID32;
};
}
}
#endif // __DNAMP1_PAK_HPP__

View File

@ -4,9 +4,7 @@
#include "../DNACommon/SAVWCommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
struct Scan : BigYAML
{
@ -34,6 +32,5 @@ struct SAVW : BigYAML
Vector<Scan, DNA_COUNT(scanCount)> scans;
};
}
}
#endif // __DNAMP1_SAVW_HPP__

View File

@ -5,9 +5,7 @@
#include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
static const std::vector<std::string> PaneNames =
{
@ -209,6 +207,5 @@ struct SCAN : BigYAML
}
};
}
}
#endif

View File

@ -1,9 +1,7 @@
#include "SCLY.hpp"
#include "ScriptObjects/ScriptTypes.hpp"
namespace DataSpec
{
namespace DNAMP1
namespace DataSpec::DNAMP1
{
void SCLY::read(athena::io::IStreamReader& rs)
@ -221,4 +219,3 @@ const char* SCLY::ScriptLayer::DNAType()
}
}
}

Some files were not shown because too many files have changed in this diff Show More