mirror of https://github.com/AxioDL/metaforce.git
Massive fmtlib refactor
This commit is contained in:
parent
e38a3ece89
commit
7a3da1f7a6
|
@ -1,2 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Python" name="Python facet">
|
||||
<configuration sdkName="" />
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
|
@ -10,6 +10,7 @@
|
|||
<mapping directory="$PROJECT_DIR$/hecl" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl-gui" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl/extern/athena" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl/extern/athena/extern/fmt" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl/extern/athena/extern/lzokay" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl/extern/boo" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hecl/extern/boo/glslang" vcs="Git" />
|
||||
|
@ -22,6 +23,7 @@
|
|||
<mapping directory="$PROJECT_DIR$/kabufuda" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/nod" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/nod/logvisor" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/nod/logvisor/fmt" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/rapidjson" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/rapidjson/thirdparty/gtest" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/sanitizers-cmake" vcs="Git" />
|
||||
|
|
|
@ -101,7 +101,7 @@ if(MSVC)
|
|||
else()
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
|
||||
# For libstdc++ shipped with GCC 9.1, this is required to summarize std::string
|
||||
add_compile_definitions(_GLIBCXX_DEBUG=1)
|
||||
#add_compile_definitions(_GLIBCXX_DEBUG=1)
|
||||
endif()
|
||||
|
||||
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
|
||||
|
|
|
@ -32,7 +32,7 @@ void LoadAssetMap(athena::io::MemoryReader& ar) {
|
|||
ar.readBytesToBuf(&magic, 4);
|
||||
if (magic != FOURCC('AIDM'))
|
||||
Log.report(logvisor::Warning,
|
||||
_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files."));
|
||||
fmt(_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files.")));
|
||||
else {
|
||||
uint32_t assetCount = ar.readUint32Big();
|
||||
g_AssetNameMap.reserve(assetCount);
|
||||
|
@ -50,7 +50,7 @@ void InitAssetNameMap() {
|
|||
if (g_AssetNameMapInit)
|
||||
return;
|
||||
|
||||
Log.report(logvisor::Info, "Initializing asset name database...");
|
||||
Log.report(logvisor::Info, fmt("Initializing asset name database..."));
|
||||
|
||||
/* First load the 32bit map for MP1/2 */
|
||||
{
|
||||
|
|
|
@ -94,10 +94,10 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
{
|
||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"import bpy\n"
|
||||
"from mathutils import Vector\n"
|
||||
"bpy.context.scene.name = '%s'\n"
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
|
@ -105,16 +105,16 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"actor_data = bpy.context.scene.hecl_sact_data\n"
|
||||
"arm_obj = None\n",
|
||||
pakRouter.getBestEntryName(entry).c_str());
|
||||
"arm_obj = None\n"),
|
||||
pakRouter.getBestEntryName(entry));
|
||||
|
||||
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
|
||||
for (const auto& info : chResInfo) {
|
||||
/* Provide data to add-on */
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"actor_subtype = actor_data.subtypes.add()\n"
|
||||
"actor_subtype.name = '%s'\n\n",
|
||||
info.name.c_str());
|
||||
"actor_subtype.name = '{}'\n\n"),
|
||||
info.name);
|
||||
|
||||
/* Build CINF if needed */
|
||||
if (cinfsDone.find(info.cinf) == cinfsDone.end()) {
|
||||
|
@ -127,7 +127,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
}
|
||||
cinfsDone.insert(info.cinf);
|
||||
} else
|
||||
os.format("arm_obj = bpy.data.objects['CINF_%s']\n", info.cinf.toString().c_str());
|
||||
os.format(fmt("arm_obj = bpy.data.objects['CINF_{}']\n"), info.cinf);
|
||||
os << "actor_subtype.linked_armature = arm_obj.name\n";
|
||||
|
||||
/* Link CMDL */
|
||||
|
@ -147,7 +147,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
/* Link overlays */
|
||||
for (const auto& overlay : info.overlays) {
|
||||
os << "overlay = actor_subtype.overlays.add()\n";
|
||||
os.format("overlay.name = '%s'\n", overlay.first.c_str());
|
||||
os.format(fmt("overlay.name = '{}'\n"), overlay.first);
|
||||
|
||||
/* Link CMDL */
|
||||
const typename PAKRouter::EntryType* cmdlE = pakRouter.lookupEntry(overlay.second.first, nullptr, true, false);
|
||||
|
@ -168,12 +168,12 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
/* Link attachments */
|
||||
for (auto it = attRange.first; it != attRange.second; ++it) {
|
||||
os << "attachment = actor_data.attachments.add()\n";
|
||||
os.format("attachment.name = '%s'\n", it->second.second.c_str());
|
||||
os.format(fmt("attachment.name = '{}'\n"), it->second.second);
|
||||
|
||||
auto cinfid = it->second.first.first;
|
||||
auto cmdlid = it->second.first.second;
|
||||
|
||||
if (cinfid) {
|
||||
if (cinfid.isValid()) {
|
||||
/* Build CINF if needed */
|
||||
if (cinfsDone.find(cinfid) == cinfsDone.end()) {
|
||||
typename ANCSDNA::CINFType cinf;
|
||||
|
@ -185,7 +185,7 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
}
|
||||
cinfsDone.insert(cinfid);
|
||||
} else
|
||||
os.format("arm_obj = bpy.data.objects['CINF_%s']\n", cinfid.toString().c_str());
|
||||
os.format(fmt("arm_obj = bpy.data.objects['CINF_{}']\n"), cinfid);
|
||||
os << "attachment.linked_armature = arm_obj.name\n";
|
||||
}
|
||||
|
||||
|
@ -221,17 +221,17 @@ bool ReadANCSToBlender(hecl::blender::Connection& conn, const ANCSDNA& ancs, con
|
|||
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());
|
||||
os.format(fmt(
|
||||
"act = bpy.data.actions.new('{}')\n"
|
||||
"act.use_fake_user = True\n"),
|
||||
id.second.name);
|
||||
anim.sendANIMToBlender(os, inverter, id.second.additive);
|
||||
}
|
||||
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"actor_action = actor_data.actions.add()\n"
|
||||
"actor_action.name = '%s'\n",
|
||||
id.second.name.c_str());
|
||||
"actor_action.name = '{}'\n"),
|
||||
id.second.name);
|
||||
|
||||
/* Extract EVNT if present */
|
||||
anim.extractEVNT(id.second, outPath, pakRouter, force);
|
||||
|
|
|
@ -34,7 +34,7 @@ size_t ComputeBitstreamSize(size_t keyFrameCount, const std::vector<Channel>& ch
|
|||
return (bitsPerKeyFrame * keyFrameCount + 31) / 32 * 4;
|
||||
}
|
||||
|
||||
static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div) {
|
||||
static QuantizedRot QuantizeRotation(const Value& quat, atUint32 div) {
|
||||
float q = float(div) / (M_PIF / 2.0f);
|
||||
zeus::simd_floats f(quat.simd);
|
||||
assert(std::abs(f[1]) <= 1.f && "Out of range quat X component");
|
||||
|
@ -48,7 +48,7 @@ static inline QuantizedRot QuantizeRotation(const Value& quat, atUint32 div) {
|
|||
(f[0] < 0.f)};
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div) {
|
||||
static Value DequantizeRotation(const QuantizedRot& v, atUint32 div) {
|
||||
float q = (M_PIF / 2.0f) / float(div);
|
||||
athena::simd_floats f = {
|
||||
0.0f,
|
||||
|
@ -63,7 +63,7 @@ static inline Value DequantizeRotation(const QuantizedRot& v, atUint32 div) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
static inline Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div) {
|
||||
static Value DequantizeRotation_3(const QuantizedRot& v, atUint32 div) {
|
||||
float q = 1.0f / float(div);
|
||||
athena::simd_floats f = {
|
||||
0.0f,
|
||||
|
|
|
@ -134,7 +134,7 @@ void AROTBuilder::Node::nodeCount(size_t& sz, size_t& idxRefs, BitmapPool& bmpPo
|
|||
sz += 1;
|
||||
poolIdx = bmpPool.addIndices(childIndices);
|
||||
if (poolIdx > 65535)
|
||||
Log.report(logvisor::Fatal, "AROT bitmap exceeds 16-bit node addressing; area too complex");
|
||||
Log.report(logvisor::Fatal, fmt("AROT bitmap exceeds 16-bit node addressing; area too complex"));
|
||||
|
||||
uint32_t childCount = AROTChildCounts[compSubdivs];
|
||||
nodeOff = curOff;
|
||||
|
@ -174,7 +174,7 @@ void AROTBuilder::Node::writeNodes(athena::io::MemoryWriter& w, int nodeIdx) {
|
|||
if (childNodes.size()) {
|
||||
int curIdx = nodeIdx + 1;
|
||||
if (curIdx > 65535)
|
||||
Log.report(logvisor::Fatal, "AROT node exceeds 16-bit node addressing; area too complex");
|
||||
Log.report(logvisor::Fatal, fmt("AROT node exceeds 16-bit node addressing; area too complex"));
|
||||
|
||||
int childIndices[8];
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ bool ATBL::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
|||
uint16_t idx = rs.readUint16Big();
|
||||
if (idx == 0xffff)
|
||||
continue;
|
||||
char iStr[16];
|
||||
snprintf(iStr, 16, "0x%04X", int(i));
|
||||
w.writeUint16(iStr, idx);
|
||||
w.writeUint16(fmt::format(fmt("0x{:04X}"), i).c_str(), idx);
|
||||
}
|
||||
|
||||
athena::io::FileWriter fw(outPath.getAbsolutePath());
|
||||
|
|
|
@ -11,46 +11,46 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
|||
switch (light.lightType) {
|
||||
case BabeDeadLight::LightType::LocalAmbient:
|
||||
case BabeDeadLight::LightType::LocalAmbient2:
|
||||
os.format(
|
||||
"bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
||||
"bg_node.inputs[1].default_value = %f\n",
|
||||
os.format(fmt(
|
||||
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
||||
"bg_node.inputs[1].default_value = {}\n"),
|
||||
light.color.simd[0], light.color.simd[1], light.color.simd[2], light.q / 8.f);
|
||||
return;
|
||||
case BabeDeadLight::LightType::Directional:
|
||||
os.format(
|
||||
"lamp = bpy.data.lights.new('LAMP_%01u_%03u', 'SUN')\n"
|
||||
"lamp.color = (%f,%f,%f)\n"
|
||||
os.format(fmt(
|
||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SUN')\n"
|
||||
"lamp.color = ({},{},{})\n"
|
||||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||
"lamp_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"lamp.use_shadow = %s\n"
|
||||
"\n",
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n"
|
||||
"lamp.use_shadow = {}\n"
|
||||
"\n"),
|
||||
s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], light.direction.simd[0],
|
||||
light.direction.simd[1], light.direction.simd[2], light.castShadows ? "True" : "False");
|
||||
return;
|
||||
case BabeDeadLight::LightType::Custom:
|
||||
os.format(
|
||||
"lamp = bpy.data.lights.new('LAMP_%01u_%03u', 'POINT')\n"
|
||||
"lamp.color = (%f,%f,%f)\n"
|
||||
os.format(fmt(
|
||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'POINT')\n"
|
||||
"lamp.color = ({},{},{})\n"
|
||||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||
"lamp.shadow_soft_size = 1.0\n"
|
||||
"lamp.use_shadow = %s\n"
|
||||
"\n",
|
||||
"lamp.use_shadow = {}\n"
|
||||
"\n"),
|
||||
s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.castShadows ? "True" : "False");
|
||||
break;
|
||||
case BabeDeadLight::LightType::Spot:
|
||||
case BabeDeadLight::LightType::Spot2:
|
||||
os.format(
|
||||
"lamp = bpy.data.lights.new('LAMP_%01u_%03u', 'SPOT')\n"
|
||||
"lamp.color = (%f,%f,%f)\n"
|
||||
"lamp.spot_size = %.6g\n"
|
||||
os.format(fmt(
|
||||
"lamp = bpy.data.lights.new('LAMP_{:01d}_{:03d}', 'SPOT')\n"
|
||||
"lamp.color = ({},{},{})\n"
|
||||
"lamp.spot_size = {:.6g}\n"
|
||||
"lamp_obj = bpy.data.objects.new(lamp.name, lamp)\n"
|
||||
"lamp_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector((%f,%f,%f)))\n"
|
||||
"lamp_obj.rotation_quaternion = Vector((0,0,-1)).rotation_difference(Vector(({},{},{})))\n"
|
||||
"lamp.shadow_soft_size = 0.5\n"
|
||||
"lamp.use_shadow = %s\n"
|
||||
"\n",
|
||||
"lamp.use_shadow = {}\n"
|
||||
"\n"),
|
||||
s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2], zeus::degToRad(light.spotCutoff),
|
||||
light.direction.simd[0], light.direction.simd[1], light.direction.simd[2],
|
||||
light.castShadows ? "True" : "False");
|
||||
|
@ -59,22 +59,22 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
|||
return;
|
||||
}
|
||||
|
||||
os.format(
|
||||
"lamp.retro_layer = %u\n"
|
||||
"lamp.retro_origtype = %u\n"
|
||||
os.format(fmt(
|
||||
"lamp.retro_layer = {}\n"
|
||||
"lamp.retro_origtype = {}\n"
|
||||
"lamp.falloff_type = 'INVERSE_COEFFICIENTS'\n"
|
||||
"lamp.constant_coefficient = 0\n"
|
||||
"lamp.use_nodes = True\n"
|
||||
"falloff_node = lamp.node_tree.nodes.new('ShaderNodeLightFalloff')\n"
|
||||
"lamp.energy = 0.0\n"
|
||||
"falloff_node.inputs[0].default_value = %f\n"
|
||||
"falloff_node.inputs[0].default_value = {}\n"
|
||||
"hue_sat_node = lamp.node_tree.nodes.new('ShaderNodeHueSaturation')\n"
|
||||
"hue_sat_node.inputs[1].default_value = 1.25\n"
|
||||
"hue_sat_node.inputs[4].default_value = (%f,%f,%f,1.0)\n"
|
||||
"hue_sat_node.inputs[4].default_value = ({},{},{},1.0)\n"
|
||||
"lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n"
|
||||
"lamp_obj.location = (%f,%f,%f)\n"
|
||||
"lamp_obj.location = ({},{},{})\n"
|
||||
"bpy.context.scene.collection.objects.link(lamp_obj)\n"
|
||||
"\n",
|
||||
"\n"),
|
||||
s, unsigned(light.lightType), light.q / 8.f, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.position.simd[0], light.position.simd[1], light.position.simd[2]);
|
||||
|
||||
|
@ -83,17 +83,17 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
|||
os << "falloff_node.inputs[0].default_value *= 150.0\n"
|
||||
"lamp.node_tree.links.new(falloff_node.outputs[2], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
if (light.q > FLT_EPSILON)
|
||||
os.format("lamp.constant_coefficient = 2.0 / %f\n", light.q);
|
||||
os.format(fmt("lamp.constant_coefficient = 2.0 / {}\n"), light.q);
|
||||
break;
|
||||
case BabeDeadLight::Falloff::Linear:
|
||||
os << "lamp.node_tree.links.new(falloff_node.outputs[1], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
if (light.q > FLT_EPSILON)
|
||||
os.format("lamp.linear_coefficient = 250 / %f\n", light.q);
|
||||
os.format(fmt("lamp.linear_coefficient = 250 / {}\n"), light.q);
|
||||
break;
|
||||
case BabeDeadLight::Falloff::Quadratic:
|
||||
os << "lamp.node_tree.links.new(falloff_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[1])\n";
|
||||
if (light.q > FLT_EPSILON)
|
||||
os.format("lamp.quadratic_coefficient = 25000 / %f\n", light.q);
|
||||
os.format(fmt("lamp.quadratic_coefficient = 25000 / {}\n"), light.q);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -79,15 +79,15 @@ void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os, const Material
|
|||
}
|
||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||
hecl::SystemUTF8Conv resPathView(resPath);
|
||||
os.format(
|
||||
"if '%s' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
os.format(fmt(
|
||||
"if '{}' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['{}']\n"
|
||||
"else:\n"
|
||||
" image = bpy.data.images.load('''//%s''')\n"
|
||||
" image.name = '%s'\n"
|
||||
" image = bpy.data.images.load('''//{}''')\n"
|
||||
" image.name = '{}'\n"
|
||||
"texmap_list.append(image)\n"
|
||||
"\n",
|
||||
texName.c_str(), texName.c_str(), resPathView.c_str(), texName.c_str());
|
||||
"\n"),
|
||||
texName, texName, resPathView, texName);
|
||||
}
|
||||
|
||||
unsigned m = 0;
|
||||
|
@ -143,10 +143,10 @@ public:
|
|||
for (const std::pair<atUint16, std::vector<std::pair<atInt16, atUint16>>>& ev : m_extraVerts) {
|
||||
for (const std::pair<atInt16, atUint16>& se : ev.second) {
|
||||
if (se.second == nextVert) {
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"bm.verts.ensure_lookup_table()\n"
|
||||
"orig_vert = bm.verts[%u]\n"
|
||||
"vert = bm.verts.new(orig_vert.co)\n",
|
||||
"orig_vert = bm.verts[{}]\n"
|
||||
"vert = bm.verts.new(orig_vert.co)\n"),
|
||||
ev.first + baseVert);
|
||||
rp.first->weightVertex(os, *rp.second, se.first);
|
||||
++nextVert;
|
||||
|
@ -461,12 +461,12 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP
|
|||
"\n";
|
||||
|
||||
/* Link master shader library */
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"# Master shader library\n"
|
||||
"with bpy.data.libraries.load('%s', link=True, relative=True) as (data_from, data_to):\n"
|
||||
"with bpy.data.libraries.load('{}', link=True, relative=True) as (data_from, data_to):\n"
|
||||
" data_to.node_groups = data_from.node_groups\n"
|
||||
"\n",
|
||||
masterShaderPath.getAbsolutePathUTF8().data());
|
||||
"\n"),
|
||||
masterShaderPath.getAbsolutePathUTF8());
|
||||
}
|
||||
|
||||
void FinishBlenderMesh(hecl::blender::PyOutStream& os, unsigned matSetCount, int meshIdx) {
|
||||
|
@ -480,13 +480,13 @@ void FinishBlenderMesh(hecl::blender::PyOutStream& os, unsigned matSetCount, int
|
|||
"obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
||||
"obj.show_transparent = True\n"
|
||||
"coll.objects.link(obj)\n";
|
||||
os.format("mesh.hecl_material_count = %u\n", matSetCount);
|
||||
os.format(fmt("mesh.hecl_material_count = {}\n"), matSetCount);
|
||||
} else {
|
||||
os.format("mesh = bpy.data.meshes.new(bpy.context.scene.name + '_%03d')\n", meshIdx);
|
||||
os.format(fmt("mesh = bpy.data.meshes.new(bpy.context.scene.name + '_{:03d}')\n"), meshIdx);
|
||||
os << "obj = bpy.data.objects.new(mesh.name, mesh)\n"
|
||||
"obj.show_transparent = True\n"
|
||||
"coll.objects.link(obj)\n";
|
||||
os.format("mesh.hecl_material_count = %u\n", matSetCount);
|
||||
os.format(fmt("mesh.hecl_material_count = {}\n"), matSetCount);
|
||||
}
|
||||
|
||||
os << "mesh.use_auto_smooth = True\n"
|
||||
|
@ -692,7 +692,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
for (size_t i = 0; i <= maxIdxs.pos; ++i) {
|
||||
positions.push_back(reader.readVec3fBig());
|
||||
const atVec3f& pos = positions.back();
|
||||
os.format("vert = bm.verts.new((%f,%f,%f))\n", pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
if (rp.first) {
|
||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||
rp.first->weightVertex(os, *rp.second, skinIndices[i]);
|
||||
|
@ -702,10 +702,10 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
}
|
||||
if (rp.first && SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||
vertCount += extraTracker.sendAdditionalVertsToBlender(os, rp, 0);
|
||||
os.format("two_face_vert = %u\n", vertCount);
|
||||
os.format(fmt("two_face_vert = {}\n"), vertCount);
|
||||
for (size_t i = 0; i <= maxIdxs.pos; ++i) {
|
||||
const atVec3f& pos = positions[i];
|
||||
os.format("vert = bm.verts.new((%f,%f,%f))\n", pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
os.format(fmt("vert = bm.verts.new(({},{},{}))\n"), pos.simd[0], pos.simd[1], pos.simd[2]);
|
||||
if (rp.first) {
|
||||
if (SurfaceHeader::UseMatrixSkinning() && !skinIndices.empty())
|
||||
rp.first->weightVertex(os, *rp.second, skinIndices[i]);
|
||||
|
@ -726,13 +726,13 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
float x = reader.readInt16Big() / 16384.0f;
|
||||
float y = reader.readInt16Big() / 16384.0f;
|
||||
float z = reader.readInt16Big() / 16384.0f;
|
||||
os.format("norm_list.append((%f,%f,%f))\n", x, y, z);
|
||||
os.format(fmt("norm_list.append(({},{},{}))\n"), x, y, z);
|
||||
}
|
||||
} else {
|
||||
size_t normCount = secSizes[s] / 12;
|
||||
for (size_t i = 0; i < normCount; ++i) {
|
||||
const atVec3f norm = reader.readVec3fBig();
|
||||
os.format("norm_list.append((%f,%f,%f))\n", norm.simd[0], norm.simd[1], norm.simd[2]);
|
||||
os.format(fmt("norm_list.append(({},{},{}))\n"), norm.simd[0], norm.simd[1], norm.simd[2]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -747,7 +747,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
size_t uvCount = secSizes[s] / 8;
|
||||
for (size_t i = 0; i < uvCount; ++i) {
|
||||
const atVec2f uv = reader.readVec2fBig();
|
||||
os.format("uv_list.append((%f,%f))\n", uv.simd[0], uv.simd[1]);
|
||||
os.format(fmt("uv_list.append(({},{}))\n"), uv.simd[0], uv.simd[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
for (size_t i = 0; i < uvCount; ++i) {
|
||||
float x = reader.readInt16Big() / 32768.0f;
|
||||
float y = reader.readInt16Big() / 32768.0f;
|
||||
os.format("suv_list.append((%f,%f))\n", x, y);
|
||||
os.format(fmt("suv_list.append(({},{}))\n"), x, y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -790,10 +790,10 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
if (SurfaceHeader::UseMatrixSkinning() && rp.first)
|
||||
bankIn = rp.first->getMatrixBank(sHead.skinMatrixBankIdx());
|
||||
|
||||
os.format("materials[%u].pass_index = %u\n", sHead.matIdx, surfIdx++);
|
||||
os.format(fmt("materials[{}].pass_index = {}\n"), sHead.matIdx, surfIdx++);
|
||||
if (matUVCount > createdUVLayers) {
|
||||
for (unsigned l = createdUVLayers; l < matUVCount; ++l)
|
||||
os.format("bm.loops.layers.uv.new('UV_%u')\n", l);
|
||||
os.format(fmt("bm.loops.layers.uv.new('UV_{}')\n"), l);
|
||||
createdUVLayers = matUVCount;
|
||||
}
|
||||
|
||||
|
@ -815,67 +815,67 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
atUint8 flip = 0;
|
||||
for (int v = 0; v < vertCount - 2; ++v) {
|
||||
if (flip) {
|
||||
os.format(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, (%u,%u,%u), norm_list, (%u,%u,%u), %u, od_list, "
|
||||
"two_face_vert)\n",
|
||||
os.format(fmt(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||
"two_face_vert)\n"),
|
||||
primVerts[c % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[c % 3].norm,
|
||||
primVerts[(c + 2) % 3].norm, primVerts[(c + 1) % 3].norm, sHead.matIdx);
|
||||
if (matUVCount) {
|
||||
os << "if last_face is not None:\n";
|
||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||
if (j == 0 && matShortUVs)
|
||||
os.format(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[%u], suv_list[%u], "
|
||||
"suv_list[%u])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
os.format(fmt(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||
"suv_list[{}])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[0]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_tri[2]\n",
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j],
|
||||
primVerts[c % 3].pos, j, primVerts[(c + 2) % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
||||
else
|
||||
os.format(
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n",
|
||||
os.format(fmt(
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"),
|
||||
primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j], primVerts[(c + 2) % 3].pos, j,
|
||||
primVerts[(c + 2) % 3].uvs[j], primVerts[(c + 1) % 3].pos, j, primVerts[(c + 1) % 3].uvs[j]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
os.format(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, (%u,%u,%u), norm_list, (%u,%u,%u), %u, od_list, "
|
||||
"two_face_vert)\n",
|
||||
os.format(fmt(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||
"two_face_vert)\n"),
|
||||
primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, primVerts[(c + 2) % 3].pos, primVerts[c % 3].norm,
|
||||
primVerts[(c + 1) % 3].norm, primVerts[(c + 2) % 3].norm, sHead.matIdx);
|
||||
if (matUVCount) {
|
||||
os << "if last_face is not None:\n";
|
||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||
if (j == 0 && matShortUVs)
|
||||
os.format(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[%u], suv_list[%u], "
|
||||
"suv_list[%u])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
os.format(fmt(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||
"suv_list[{}])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[0]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_tri[2]\n",
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].uvs[j],
|
||||
primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j, primVerts[(c + 2) % 3].pos, j);
|
||||
else
|
||||
os.format(
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n",
|
||||
os.format(fmt(
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"),
|
||||
primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].pos, j,
|
||||
primVerts[(c + 1) % 3].uvs[j], primVerts[(c + 2) % 3].pos, j, primVerts[(c + 2) % 3].uvs[j]);
|
||||
}
|
||||
|
@ -892,34 +892,34 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
} else if (ptype == GX::TRIANGLES) {
|
||||
for (int v = 0; v < vertCount; v += 3) {
|
||||
|
||||
os.format(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, (%u,%u,%u), norm_list, (%u,%u,%u), %u, od_list, "
|
||||
"two_face_vert)\n",
|
||||
os.format(fmt(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||
"two_face_vert)\n"),
|
||||
primVerts[0].pos, primVerts[1].pos, primVerts[2].pos, primVerts[0].norm, primVerts[1].norm,
|
||||
primVerts[2].norm, sHead.matIdx);
|
||||
if (matUVCount) {
|
||||
os << "if last_face is not None:\n";
|
||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||
if (j == 0 && matShortUVs)
|
||||
os.format(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[%u], suv_list[%u], "
|
||||
"suv_list[%u])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
os.format(fmt(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||
"suv_list[{}])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[0]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_tri[2]\n",
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
primVerts[0].uvs[j], primVerts[1].uvs[j], primVerts[2].uvs[j], primVerts[0].pos, j,
|
||||
primVerts[1].pos, j, primVerts[2].pos, j);
|
||||
else
|
||||
os.format(
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n",
|
||||
os.format(fmt(
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"),
|
||||
primVerts[0].pos, j, primVerts[0].uvs[j], primVerts[1].pos, j, primVerts[1].uvs[j],
|
||||
primVerts[2].pos, j, primVerts[2].uvs[j]);
|
||||
}
|
||||
|
@ -936,34 +936,34 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
} else if (ptype == GX::TRIANGLEFAN) {
|
||||
++c;
|
||||
for (int v = 0; v < vertCount - 2; ++v) {
|
||||
os.format(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, (%u,%u,%u), norm_list, (%u,%u,%u), %u, od_list, "
|
||||
"two_face_vert)\n",
|
||||
os.format(fmt(
|
||||
"last_face, last_mesh = add_triangle(bm, bm.verts, ({},{},{}), norm_list, ({},{},{}), {}, od_list, "
|
||||
"two_face_vert)\n"),
|
||||
firstPrimVert.pos, primVerts[c % 3].pos, primVerts[(c + 1) % 3].pos, firstPrimVert.norm,
|
||||
primVerts[c % 3].norm, primVerts[(c + 1) % 3].norm, sHead.matIdx);
|
||||
if (matUVCount) {
|
||||
os << "if last_face is not None:\n";
|
||||
for (unsigned j = 0; j < matUVCount; ++j) {
|
||||
if (j == 0 && matShortUVs)
|
||||
os.format(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[%u], suv_list[%u], "
|
||||
"suv_list[%u])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
os.format(fmt(
|
||||
" uv_tri = expand_lightmap_triangle(lightmap_tri_tracker, suv_list[{}], suv_list[{}], "
|
||||
"suv_list[{}])\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[0]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_tri[2]\n",
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
firstPrimVert.uvs[j], primVerts[c % 3].uvs[j], primVerts[(c + 1) % 3].uvs[j], firstPrimVert.pos,
|
||||
j, primVerts[c % 3].pos, j, primVerts[(c + 1) % 3].pos, j);
|
||||
else
|
||||
os.format(
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, %u)[last_mesh.loops.layers.uv[%u]].uv = "
|
||||
"uv_list[%u]\n",
|
||||
os.format(fmt(
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_list[{}]\n"),
|
||||
firstPrimVert.pos, j, firstPrimVert.uvs[j], primVerts[c % 3].pos, j, primVerts[c % 3].uvs[j],
|
||||
primVerts[(c + 1) % 3].pos, j, primVerts[(c + 1) % 3].uvs[j]);
|
||||
}
|
||||
|
@ -1004,24 +1004,24 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade
|
|||
head.read(reader);
|
||||
|
||||
if (head.magic != 0xDEADBABE) {
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL magic");
|
||||
LogDNACommon.report(logvisor::Error, fmt("invalid CMDL magic"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (head.version != Version) {
|
||||
LogDNACommon.report(logvisor::Error, "invalid CMDL version");
|
||||
LogDNACommon.report(logvisor::Error, fmt("invalid CMDL version"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open Py Stream and read sections */
|
||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"import bpy\n"
|
||||
"import bmesh\n"
|
||||
"\n"
|
||||
"bpy.context.scene.name = '%s'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n",
|
||||
pakRouter.getBestEntryName(entry).c_str());
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"),
|
||||
pakRouter.getBestEntryName(entry));
|
||||
InitGeomBlenderContext(os, dataspec.getMasterShaderPath());
|
||||
MaterialSet::RegisterMaterialProps(os);
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ void NameCMDL(athena::io::IStreamReader& reader, PAKRouter& pakRouter, typename
|
|||
const SpecBase& dataspec) {
|
||||
Header head;
|
||||
head.read(reader);
|
||||
std::string bestName = hecl::Format("CMDL_%s", entry.id.toString().c_str());
|
||||
std::string bestName = fmt::format(fmt("CMDL_{}"), entry.id);
|
||||
|
||||
/* Pre-read pass to determine maximum used vert indices */
|
||||
atUint32 matSecCount = 0;
|
||||
|
@ -1139,7 +1139,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
|||
|
||||
size_t endOff = 0;
|
||||
for (const Material& mat : mset) {
|
||||
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
|
||||
std::string diagName = fmt::format(fmt("{}:{}"), inPath.getLastComponentUTF8(), mat.name);
|
||||
hecl::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
|
||||
setBackends.emplace_back();
|
||||
hecl::Backend::GX& matGX = setBackends.back();
|
||||
|
@ -1232,7 +1232,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
|||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||
size_t vertSz = matSets.at(0).materials.at(surf.materialIdx).getVAFlags().vertDLSize();
|
||||
if (surf.verts.size() > 65536)
|
||||
LogDNACommon.report(logvisor::Fatal, "GX DisplayList overflow");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("GX DisplayList overflow"));
|
||||
size_t secSz = 64;
|
||||
for (auto it = surf.verts.cbegin(); it != surf.verts.cend();) {
|
||||
atUint16 vertCount = 0;
|
||||
|
@ -1326,7 +1326,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
|
|||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||
prim = GX::TRIANGLESTRIP;
|
||||
else
|
||||
LogDNACommon.report(logvisor::Fatal, "unrecognized mesh output mode");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("unrecognized mesh output mode"));
|
||||
auto surfSizeIt = head.secSizes.begin() + firstSurfSec;
|
||||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||
const typename MaterialSet::Material::VAFlags& vaFlags = matSets.at(0).materials.at(surf.materialIdx).getVAFlags();
|
||||
|
@ -1774,7 +1774,7 @@ bool WriteMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::Proje
|
|||
else if (mesh.topology == hecl::HMDLTopology::TriStrips)
|
||||
prim = GX::TRIANGLESTRIP;
|
||||
else
|
||||
LogDNACommon.report(logvisor::Fatal, "unrecognized mesh output mode");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("unrecognized mesh output mode"));
|
||||
auto surfEndOffIt = surfEndOffs.begin();
|
||||
size_t lastEndOff = 0;
|
||||
for (const Mesh::Surface& surf : mesh.surfaces) {
|
||||
|
|
|
@ -49,7 +49,7 @@ template <class IDType>
|
|||
void CRSM<IDType>::_read(athena::io::YAMLDocReader& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -134,15 +134,15 @@ void CRSM<IDType>::_binarySize(size_t& __isz) const {
|
|||
|
||||
template <class IDType>
|
||||
void CRSM<IDType>::_read(athena::io::IStreamReader& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('CRSM')) {
|
||||
LogModule.report(logvisor::Warning, "non CRSM provided to CRSM parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non CRSM provided to CRSM parser"));
|
||||
return;
|
||||
}
|
||||
|
||||
while (clsId != SBIG('_END')) {
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
auto gen = std::find_if(GeneratorTypes.begin(), GeneratorTypes.end(),
|
||||
[&clsId](const FourCC& other) -> bool { return clsId == other; });
|
||||
if (gen != GeneratorTypes.end()) {
|
||||
|
@ -153,8 +153,8 @@ void CRSM<IDType>::_read(athena::io::IStreamReader& r) {
|
|||
auto sfx = std::find_if(SFXTypes.begin(), SFXTypes.end(),
|
||||
[&clsId](const FourCC& other) -> bool { return clsId == other; });
|
||||
if (sfx != SFXTypes.end()) {
|
||||
uint32_t fcc;
|
||||
r.readBytesToBuf(&fcc, 4);
|
||||
DNAFourCC fcc;
|
||||
fcc.read(r);
|
||||
if (fcc != SBIG('NONE'))
|
||||
x10_sfx[clsId] = r.readInt32Big();
|
||||
else
|
||||
|
@ -179,7 +179,7 @@ void CRSM<IDType>::_read(athena::io::IStreamReader& r) {
|
|||
continue;
|
||||
}
|
||||
if (clsId != SBIG('_END'))
|
||||
LogModule.report(logvisor::Fatal, "Unknown CRSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown CRSM class {} @{}"), clsId, r.position());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) DGRP : Bi
|
|||
Value<IDType> id;
|
||||
|
||||
bool validate() const {
|
||||
if (!id.operator bool())
|
||||
if (!id.isValid())
|
||||
return false;
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
|
||||
return path && !path.isNone();
|
||||
|
|
|
@ -28,24 +28,26 @@ hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool si
|
|||
hecl::Database::Project* project = s_Project.get();
|
||||
if (!project) {
|
||||
if (pakRouter) {
|
||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id)
|
||||
LogDNACommon.report(logvisor::Warning, "unable to translate %s to path", id.toString().c_str());
|
||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
||||
LogDNACommon.report(logvisor::Warning, fmt("unable to translate {} to path"), id);
|
||||
return {};
|
||||
}
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"g_PakRouter or s_Project must be set to non-null before "
|
||||
"calling UniqueIDBridge::TranslatePakIdToPath");
|
||||
fmt("g_PakRouter or s_Project must be set to non-null before "
|
||||
"calling UniqueIDBridge::TranslatePakIdToPath"));
|
||||
return {};
|
||||
}
|
||||
|
||||
const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64());
|
||||
if (!search) {
|
||||
if (IDRestorer<IDType>* restorer = GetIDRestorer<IDType>())
|
||||
if (IDType newId = restorer->originalToNew(id))
|
||||
if (IDRestorer<IDType>* restorer = GetIDRestorer<IDType>()) {
|
||||
IDType newId = restorer->originalToNew(id);
|
||||
if (newId.isValid())
|
||||
if (const hecl::ProjectPath* newSearch = project->lookupBridgePath(newId.toUint64()))
|
||||
return *newSearch;
|
||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id)
|
||||
LogDNACommon.report(logvisor::Warning, "unable to translate %s to path", id.toString().c_str());
|
||||
}
|
||||
if (hecl::VerbosityLevel >= 1 && !silenceWarnings && id.isValid())
|
||||
LogDNACommon.report(logvisor::Warning, fmt("unable to translate {} to path"), id);
|
||||
return {};
|
||||
}
|
||||
return *search;
|
||||
|
@ -60,7 +62,7 @@ hecl::ProjectPath UniqueIDBridge::MakePathFromString(std::string_view str) {
|
|||
return {};
|
||||
hecl::Database::Project* project = s_Project.get();
|
||||
if (!project)
|
||||
LogDNACommon.report(logvisor::Fatal, "UniqueIDBridge::setGlobalProject must be called before MakePathFromString");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("UniqueIDBridge::setGlobalProject must be called before MakePathFromString"));
|
||||
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
||||
project->addBridgePathToCache(IDType(path).toUint64(), path);
|
||||
return path;
|
||||
|
@ -81,9 +83,11 @@ void UniqueIDBridge::SetThreadProject(hecl::Database::Project& project) { s_Proj
|
|||
void UniqueID32::assign(uint32_t id, bool noOriginal) {
|
||||
m_id = id ? id : 0xffffffff;
|
||||
if (!noOriginal)
|
||||
if (IDRestorer<UniqueID32>* restorer = UniqueIDBridge::GetIDRestorer<UniqueID32>())
|
||||
if (UniqueID32 origId = restorer->newToOriginal(*this))
|
||||
if (IDRestorer<UniqueID32>* restorer = UniqueIDBridge::GetIDRestorer<UniqueID32>()) {
|
||||
UniqueID32 origId = restorer->newToOriginal(*this);
|
||||
if (origId.isValid())
|
||||
*this = origId;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -100,7 +104,7 @@ void UniqueID32::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
|
|||
}
|
||||
template <>
|
||||
void UniqueID32::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer) {
|
||||
if (!operator bool())
|
||||
if (!isValid())
|
||||
return;
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||
if (!path)
|
||||
|
@ -115,9 +119,7 @@ void UniqueID32::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|||
}
|
||||
|
||||
std::string UniqueID32::toString() const {
|
||||
char buf[9];
|
||||
snprintf(buf, 9, "%08X", m_id);
|
||||
return std::string(buf);
|
||||
return fmt::format(fmt("{}"), *this);
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -126,7 +128,7 @@ void UniqueID32Zero::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
|||
}
|
||||
template <>
|
||||
void UniqueID32Zero::Enumerate<BigDNA::Write>(typename Write::StreamT& writer) {
|
||||
writer.writeUint32Big(*this ? m_id : 0);
|
||||
writer.writeUint32Big(isValid() ? m_id : 0);
|
||||
}
|
||||
template <>
|
||||
void UniqueID32Zero::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader) {
|
||||
|
@ -173,7 +175,7 @@ void AuxiliaryID32::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& read
|
|||
}
|
||||
template <>
|
||||
void AuxiliaryID32::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer) {
|
||||
if (!operator bool())
|
||||
if (!isValid())
|
||||
return;
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath<UniqueID32>(*this, true);
|
||||
if (!path)
|
||||
|
@ -190,9 +192,11 @@ void AuxiliaryID32::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& wr
|
|||
void UniqueID64::assign(uint64_t id, bool noOriginal) {
|
||||
m_id = id ? id : 0xffffffffffffffff;
|
||||
if (!noOriginal)
|
||||
if (IDRestorer<UniqueID64>* restorer = UniqueIDBridge::GetIDRestorer<UniqueID64>())
|
||||
if (UniqueID64 origId = restorer->newToOriginal(*this))
|
||||
if (IDRestorer<UniqueID64>* restorer = UniqueIDBridge::GetIDRestorer<UniqueID64>()) {
|
||||
UniqueID64 origId = restorer->newToOriginal(*this);
|
||||
if (origId.isValid())
|
||||
*this = origId;
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
|
@ -209,7 +213,7 @@ void UniqueID64::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
|
|||
}
|
||||
template <>
|
||||
void UniqueID64::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer) {
|
||||
if (!operator bool())
|
||||
if (!isValid())
|
||||
return;
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||
if (!path)
|
||||
|
@ -224,9 +228,7 @@ void UniqueID64::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|||
}
|
||||
|
||||
std::string UniqueID64::toString() const {
|
||||
char buf[17];
|
||||
snprintf(buf, 17, "%016" PRIX64, m_id);
|
||||
return std::string(buf);
|
||||
return fmt::format(fmt("{}"), *this);
|
||||
}
|
||||
|
||||
/** PAK 128-bit Unique ID */
|
||||
|
@ -246,7 +248,7 @@ void UniqueID128::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader
|
|||
}
|
||||
template <>
|
||||
void UniqueID128::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer) {
|
||||
if (!operator bool())
|
||||
if (!isValid())
|
||||
return;
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(*this);
|
||||
if (!path)
|
||||
|
@ -261,9 +263,7 @@ void UniqueID128::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|||
}
|
||||
|
||||
std::string UniqueID128::toString() const {
|
||||
char buf[33];
|
||||
snprintf(buf, 33, "%016" PRIX64 "%016" PRIX64, m_id.id[0], m_id.id[1]);
|
||||
return std::string(buf);
|
||||
return fmt::format(fmt("{}"), *this);
|
||||
}
|
||||
|
||||
/** Word Bitmap reader/writer */
|
||||
|
|
|
@ -79,15 +79,15 @@ public:
|
|||
PAKRouterBase(const SpecBase& dataSpec) : m_dataSpec(dataSpec) {}
|
||||
hecl::Database::Project& getProject() const { return m_dataSpec.getProject(); }
|
||||
virtual hecl::ProjectPath getWorking(const UniqueID32&, bool silenceWarnings = false) const {
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter IDType mismatch; expected UniqueID32 specialization");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID32 specialization"));
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
virtual hecl::ProjectPath getWorking(const UniqueID64&, bool silenceWarnings = false) const {
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter IDType mismatch; expected UniqueID64 specialization");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID64 specialization"));
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
virtual hecl::ProjectPath getWorking(const UniqueID128&, bool silenceWarnings = false) const {
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter IDType mismatch; expected UniqueID128 specialization");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter IDType mismatch; expected UniqueID128 specialization"));
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
};
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
using value_type = uint32_t;
|
||||
static UniqueID32 kInvalidId;
|
||||
AT_DECL_EXPLICIT_DNA_YAML
|
||||
operator bool() const { return m_id != 0xffffffff && m_id != 0; }
|
||||
bool isValid() const { return m_id != 0xffffffff && m_id != 0; }
|
||||
void assign(uint32_t id, bool noOriginal = false);
|
||||
|
||||
UniqueID32& operator=(const hecl::ProjectPath& path) {
|
||||
|
@ -225,7 +225,7 @@ class UniqueID64 : public BigDNA {
|
|||
public:
|
||||
using value_type = uint64_t;
|
||||
AT_DECL_EXPLICIT_DNA_YAML
|
||||
operator bool() const { return m_id != 0xffffffffffffffff && m_id != 0; }
|
||||
bool isValid() const { return m_id != 0xffffffffffffffff && m_id != 0; }
|
||||
void assign(uint64_t id, bool noOriginal = false);
|
||||
|
||||
UniqueID64& operator=(const hecl::ProjectPath& path) {
|
||||
|
@ -292,7 +292,7 @@ public:
|
|||
m_id.id[0] = idin;
|
||||
m_id.id[1] = 0;
|
||||
}
|
||||
operator bool() const {
|
||||
bool isValid() const {
|
||||
return m_id.id[0] != 0xffffffffffffffff && m_id.id[0] != 0 && m_id.id[1] != 0xffffffffffffffff && m_id.id[1] != 0;
|
||||
}
|
||||
|
||||
|
@ -321,6 +321,9 @@ public:
|
|||
return (m_id.id[0] == other.m_id.id[0]) && (m_id.id[1] == other.m_id.id[1]);
|
||||
#endif
|
||||
}
|
||||
bool operator<(const UniqueID128& other) const {
|
||||
return m_id.id[0] < other.m_id.id[0] || (m_id.id[0] == other.m_id.id[0] && m_id.id[1] < other.m_id.id[1]);
|
||||
}
|
||||
void clear() {
|
||||
m_id.id[0] = 0xffffffffffffffff;
|
||||
m_id.id[1] = 0xffffffffffffffff;
|
||||
|
@ -449,3 +452,7 @@ struct hash<DataSpec::UniqueID128> {
|
|||
size_t operator()(const DataSpec::UniqueID128& id) const { return id.toHighUint64() ^ id.toLowUint64(); }
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
FMT_CUSTOM_FORMATTER(DataSpec::UniqueID32, fmt("{:08X}"), obj.toUint32())
|
||||
FMT_CUSTOM_FORMATTER(DataSpec::UniqueID64, fmt("{:016X}"), obj.toUint64())
|
||||
FMT_CUSTOM_FORMATTER(DataSpec::UniqueID128, fmt("{:016X}{:016X}"), obj.toHighUint64(), obj.toLowUint64())
|
||||
|
|
|
@ -16,7 +16,7 @@ template <class IDType>
|
|||
void DPSM<IDType>::_read(athena::io::YAMLDocReader& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,8 @@ void DPSM<IDType>::_write(athena::io::YAMLDocWriter& w) const {
|
|||
|
||||
template <class IDType>
|
||||
template <class Reader>
|
||||
void DPSM<IDType>::readQuadDecalInfo(Reader& r, uint32_t clsId, typename DPSM<IDType>::SQuadDescr& quad) {
|
||||
switch (clsId) {
|
||||
void DPSM<IDType>::readQuadDecalInfo(Reader& r, FourCC clsId, typename DPSM<IDType>::SQuadDescr& quad) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('1LFT'):
|
||||
case SBIG('2LFT'):
|
||||
quad.x0_LFT.read(r);
|
||||
|
@ -233,16 +233,16 @@ void DPSM<IDType>::getQuadDecalBinarySize(size_t& s, const typename DPSM<IDType>
|
|||
|
||||
template <class IDType>
|
||||
void DPSM<IDType>::_read(athena::io::IStreamReader& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('DPSM')) {
|
||||
LogModule.report(logvisor::Warning, "non DPSM provided to DPSM parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non DPSM provided to DPSM parser"));
|
||||
return;
|
||||
}
|
||||
bool loadFirstDesc = false;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
while (clsId != SBIG('_END')) {
|
||||
switch (clsId) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('1SZE'):
|
||||
case SBIG('1LFT'):
|
||||
case SBIG('1ROT'):
|
||||
|
@ -291,10 +291,10 @@ void DPSM<IDType>::_read(athena::io::IStreamReader& r) {
|
|||
x5c_25_DMOO = r.readBool();
|
||||
break;
|
||||
default:
|
||||
LogModule.report(logvisor::Fatal, "Unknown DPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown DPSM class {} @{}"), clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ struct DPSM : BigDNA {
|
|||
uint8_t dummy;
|
||||
};
|
||||
template <class Reader>
|
||||
void readQuadDecalInfo(Reader& r, uint32_t clsId, SQuadDescr& quad);
|
||||
void readQuadDecalInfo(Reader& r, FourCC clsId, SQuadDescr& quad);
|
||||
void writeQuadDecalInfo(athena::io::YAMLDocWriter& w, const SQuadDescr& quad, bool first) const;
|
||||
void getQuadDecalBinarySize(size_t& s, const SQuadDescr& desc) const;
|
||||
void writeQuadDecalInfo(athena::io::IStreamWriter& w, const SQuadDescr& quad, bool first) const;
|
||||
|
|
|
@ -14,7 +14,7 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
|||
"col_bm = bmesh.new()\n";
|
||||
for (const atVec3f& vert : db.verts) {
|
||||
zeus::simd_floats f(vert.simd);
|
||||
os.format("col_bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
os.format(fmt("col_bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
os << "col_bm.verts.ensure_lookup_table()\n";
|
||||
|
@ -41,11 +41,11 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
|||
}
|
||||
|
||||
os << "tri_verts = []\n";
|
||||
os.format("tri_verts.append(col_bm.verts[%u])\n", vindices[0]);
|
||||
os.format("tri_verts.append(col_bm.verts[%u])\n", vindices[1]);
|
||||
os.format("tri_verts.append(col_bm.verts[%u])\n", vindices[2]);
|
||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[0]);
|
||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[1]);
|
||||
os.format(fmt("tri_verts.append(col_bm.verts[{}])\n"), vindices[2]);
|
||||
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"face = col_bm.faces.get(tri_verts)\n"
|
||||
"if face is None:\n"
|
||||
" face = col_bm.faces.new(tri_verts)\n"
|
||||
|
@ -54,17 +54,17 @@ void DeafBabeSendToBlender(hecl::blender::PyOutStream& os, const DEAFBABE& db, b
|
|||
" for i in range(3):\n"
|
||||
" face.verts[i].co = tri_verts[i].co\n"
|
||||
" col_bm.verts.ensure_lookup_table()\n"
|
||||
"face.material_index = select_material(0x%016" PRIX64
|
||||
"face.material_index = select_material(0x{:016X}"
|
||||
")\n"
|
||||
"face.smooth = False\n"
|
||||
"\n",
|
||||
"\n"),
|
||||
atUint64(triMat.material));
|
||||
}
|
||||
|
||||
db.insertNoClimb(os);
|
||||
|
||||
if (isDcln)
|
||||
os.format("col_mesh = bpy.data.meshes.new('CMESH_%i')\n", idx);
|
||||
os.format(fmt("col_mesh = bpy.data.meshes.new('CMESH_{}')\n"), idx);
|
||||
else
|
||||
os << "col_mesh = bpy.data.meshes.new('CMESH')\n";
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ namespace DataSpec::DNAParticle {
|
|||
|
||||
template <class IDType>
|
||||
void ELSM<IDType>::_read(athena::io::IStreamReader& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('ELSM')) {
|
||||
LogModule.report(logvisor::Warning, "non ELSM provided to ELSM parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non ELSM provided to ELSM parser"));
|
||||
return;
|
||||
}
|
||||
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
while (clsId != SBIG('_END')) {
|
||||
switch (clsId) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('LIFE'):
|
||||
x0_LIFE.read(r);
|
||||
break;
|
||||
|
@ -75,10 +75,10 @@ void ELSM<IDType>::_read(athena::io::IStreamReader& r) {
|
|||
x70_ZERY.read(r);
|
||||
break;
|
||||
default:
|
||||
LogModule.report(logvisor::Fatal, "Unknown ELSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown ELSM class {} @{}"), clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ template <class IDType>
|
|||
void ELSM<IDType>::_read(athena::io::YAMLDocReader& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ logvisor::Module LogModule("urde::DNAFont");
|
|||
template <class IDType>
|
||||
void FONT<IDType>::_read(athena::io::IStreamReader& __dna_reader) {
|
||||
/* magic */
|
||||
atUint32 magic;
|
||||
__dna_reader.readBytesToBuf(&magic, 4);
|
||||
DNAFourCC magic;
|
||||
magic.read(__dna_reader);
|
||||
if (magic != SBIG('FONT')) {
|
||||
LogModule.report(logvisor::Fatal, "Invalid FONT magic '%s'", &magic);
|
||||
LogModule.report(logvisor::Fatal, fmt("Invalid FONT magic '{}'"), magic);
|
||||
return;
|
||||
}
|
||||
/* version */
|
||||
|
|
|
@ -12,7 +12,7 @@ template <class Op>
|
|||
void FSM2<IDType>::Enumerate(typename Op::StreamT& s) {
|
||||
Do<Op>({"header"}, header, s);
|
||||
if (header.magic != SBIG('FSM2')) {
|
||||
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 magic '%.4s' expected 'FSM2'", header.magic.toString().c_str());
|
||||
LogDNAFSM2.report(logvisor::Fatal, fmt("Invalid FSM2 magic '{}' expected 'FSM2'"), header.magic);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ void FSM2<IDType>::Enumerate(typename Op::StreamT& s) {
|
|||
detail.reset(new FSMV2);
|
||||
Do<Op>({"detail"}, static_cast<FSMV2&>(*detail), s);
|
||||
} else {
|
||||
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 version '%i'", header.version);
|
||||
LogDNAFSM2.report(logvisor::Fatal, fmt("Invalid FSM2 version '{}'"), header.version);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ void MAPA::Enumerate<BigDNA::Read>(typename Read::StreamT& __dna_reader) {
|
|||
/* magic */
|
||||
magic = __dna_reader.readUint32Big();
|
||||
if (magic != 0xDEADD00D) {
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA magic");
|
||||
LogDNACommon.report(logvisor::Error, fmt("invalid MAPA magic"));
|
||||
return;
|
||||
}
|
||||
/* version */
|
||||
|
@ -30,7 +30,7 @@ void MAPA::Enumerate<BigDNA::Read>(typename Read::StreamT& __dna_reader) {
|
|||
else if (version == 5)
|
||||
header.reset(new HeaderMP3);
|
||||
else {
|
||||
LogDNACommon.report(logvisor::Error, "invalid MAPA version");
|
||||
LogDNACommon.report(logvisor::Error, fmt("invalid MAPA version"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -142,10 +142,10 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
" edge.seam = True\n"
|
||||
"\n";
|
||||
|
||||
os.format(
|
||||
"bpy.context.scene.name = 'MAPA_%s'\n"
|
||||
"bpy.context.scene.retro_map_vis_mode = '%s'\n",
|
||||
entry.id.toString().c_str(), RetroMapVisModes[mapa.header->visMode()]);
|
||||
os.format(fmt(
|
||||
"bpy.context.scene.name = 'MAPA_{}'\n"
|
||||
"bpy.context.scene.retro_map_vis_mode = '{}'\n"),
|
||||
entry.id, RetroMapVisModes[mapa.header->visMode()]);
|
||||
|
||||
/* Add empties representing MappableObjects */
|
||||
int moIdx = 0;
|
||||
|
@ -155,18 +155,18 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
zeus::simd_floats mtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
moMP12->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||
os.format(
|
||||
"obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n"
|
||||
os.format(fmt(
|
||||
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
||||
"bpy.context.scene.collection.objects.link(obj)\n"
|
||||
"obj.retro_mappable_type = %d\n"
|
||||
"obj.retro_mapobj_vis_mode = '%s'\n"
|
||||
"obj.retro_mappable_sclyid = '0x%08X'\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"obj.retro_mappable_type = {}\n"
|
||||
"obj.retro_mapobj_vis_mode = '{}'\n"
|
||||
"obj.retro_mappable_sclyid = '0x{:08X}'\n"
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = mtxd[2]\n",
|
||||
"obj.scale = mtxd[2]\n"),
|
||||
moIdx, int(moMP12->type), RetroMapObjVisModes[moMP12->visMode], moMP12->sclyId, mtxF[0][0], mtxF[0][1],
|
||||
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
|
||||
mtxF[2][3]);
|
||||
|
@ -177,18 +177,18 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
zeus::simd_floats mtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
moMP3->transformMtx[i].simd.copy_to(mtxF[i]);
|
||||
os.format(
|
||||
"obj = bpy.data.objects.new('MAPOBJ_%02d', None)\n"
|
||||
os.format(fmt(
|
||||
"obj = bpy.data.objects.new('MAPOBJ_{:02d}', None)\n"
|
||||
"bpy.context.scene.collection.objects.link(obj)\n"
|
||||
"obj.retro_mappable_type = %d\n"
|
||||
"obj.retro_mapobj_vis_mode = '%s'\n"
|
||||
"obj.retro_mappable_sclyid = '0x%08X'\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"obj.retro_mappable_type = {}\n"
|
||||
"obj.retro_mapobj_vis_mode = '{}'\n"
|
||||
"obj.retro_mappable_sclyid = '0x{:08X}'\n"
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = mtxd[2]\n",
|
||||
"obj.scale = mtxd[2]\n"),
|
||||
moIdx, int(moMP3->type), RetroMapObjVisModes[moMP3->visMode], moMP3->sclyId, mtxF[0][0], mtxF[0][1],
|
||||
mtxF[0][2], mtxF[0][3], mtxF[1][0], mtxF[1][1], mtxF[1][2], mtxF[1][3], mtxF[2][0], mtxF[2][1], mtxF[2][2],
|
||||
mtxF[2][3]);
|
||||
|
@ -204,7 +204,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
/* Read in verts */
|
||||
for (const atVec3f& vert : mapa.vertices) {
|
||||
zeus::simd_floats f(vert.simd);
|
||||
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
os.format(fmt("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||
}
|
||||
os << "bm.verts.ensure_lookup_table()\n";
|
||||
|
||||
|
@ -221,10 +221,10 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
atUint8 flip = 0;
|
||||
for (size_t v = 0; v < prim.indexCount - 2; ++v) {
|
||||
if (flip) {
|
||||
os.format("add_triangle(bm, (%u,%u,%u))\n", primVerts[c % 3], primVerts[(c + 2) % 3],
|
||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 2) % 3],
|
||||
primVerts[(c + 1) % 3]);
|
||||
} else {
|
||||
os.format("add_triangle(bm, (%u,%u,%u))\n", primVerts[c % 3], primVerts[(c + 1) % 3],
|
||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[c % 3], primVerts[(c + 1) % 3],
|
||||
primVerts[(c + 2) % 3]);
|
||||
}
|
||||
flip ^= 1;
|
||||
|
@ -244,7 +244,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
}
|
||||
} else if (GX::Primitive(prim.type) == GX::TRIANGLES) {
|
||||
for (size_t v = 0; v < prim.indexCount; v += 3) {
|
||||
os.format("add_triangle(bm, (%u,%u,%u))\n", primVerts[0], primVerts[1], primVerts[2]);
|
||||
os.format(fmt("add_triangle(bm, ({},{},{}))\n"), primVerts[0], primVerts[1], primVerts[2]);
|
||||
|
||||
/* Break if done */
|
||||
if (v + 3 >= prim.indexCount)
|
||||
|
@ -260,7 +260,7 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
for (const typename MAPA::Surface::Border& border : surf.borders) {
|
||||
auto iit = border.indices.cbegin();
|
||||
for (size_t i = 0; i < border.indexCount - 1; ++i) {
|
||||
os.format("add_border(bm, (%u,%u))\n", *iit, *(iit + 1));
|
||||
os.format(fmt("add_border(bm, ({},{}))\n"), *iit, *(iit + 1));
|
||||
++iit;
|
||||
}
|
||||
}
|
||||
|
@ -274,13 +274,13 @@ bool ReadMAPAToBlender(hecl::blender::Connection& conn, const MAPA& mapa, const
|
|||
|
||||
const zeus::CMatrix4f* tmpMtx = pakRouter.lookupMAPATransform(entry.id);
|
||||
const zeus::CMatrix4f& mtx = tmpMtx ? *tmpMtx : zeus::skIdentityMatrix4f;
|
||||
os.format(
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
os.format(fmt(
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = mtxd[2]\n",
|
||||
"obj.scale = mtxd[2]\n"),
|
||||
mtx[0][0], mtx[1][0], mtx[2][0], mtx[3][0], mtx[0][1], mtx[1][1], mtx[2][1], mtx[3][1], mtx[0][2], mtx[1][2],
|
||||
mtx[2][2], mtx[3][2]);
|
||||
|
||||
|
@ -316,7 +316,7 @@ template bool ReadMAPAToBlender<PAKRouter<DNAMP3::PAKBridge>>(hecl::blender::Con
|
|||
template <typename MAPAType>
|
||||
bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out) {
|
||||
if (mapaIn.verts.size() >= 256) {
|
||||
Log.report(logvisor::Error, _SYS_STR("MAPA %s vertex range exceeded [%d/%d]"), out.getRelativePath().data(),
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("MAPA {} vertex range exceeded [{}/{}]")), out.getRelativePath(),
|
||||
mapaIn.verts.size(), 255);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -41,36 +41,36 @@ bool ReadMAPUToBlender(hecl::blender::Connection& conn, const MAPU& mapu, const
|
|||
for (int i = 0; i < 3; ++i)
|
||||
wldXf.xf[i].simd.copy_to(wldXfF[i]);
|
||||
zeus::simd_floats hexColorF(wld.hexColor.mSimd);
|
||||
os.format(
|
||||
"wldObj = bpy.data.objects.new('%s', None)\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
os.format(fmt(
|
||||
"wldObj = bpy.data.objects.new('{}', None)\n"
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"wldObj.rotation_mode = 'QUATERNION'\n"
|
||||
"wldObj.location = mtxd[0]\n"
|
||||
"wldObj.rotation_quaternion = mtxd[1]\n"
|
||||
"wldObj.scale = mtxd[2]\n"
|
||||
"wldObj.retro_mapworld_color = (%f, %f, %f, %f)\n"
|
||||
"wldObj.retro_mapworld_path = '''%s'''\n"
|
||||
"bpy.context.scene.collection.objects.link(wldObj)\n",
|
||||
wld.name.c_str(), wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3], wldXfF[1][0], wldXfF[1][1],
|
||||
"wldObj.retro_mapworld_color = ({}, {}, {}, {})\n"
|
||||
"wldObj.retro_mapworld_path = '''{}'''\n"
|
||||
"bpy.context.scene.collection.objects.link(wldObj)\n"),
|
||||
wld.name, wldXfF[0][0], wldXfF[0][1], wldXfF[0][2], wldXfF[0][3], wldXfF[1][0], wldXfF[1][1],
|
||||
wldXfF[1][2], wldXfF[1][3], wldXfF[2][0], wldXfF[2][1], wldXfF[2][2], wldXfF[2][3], hexColorF[0], hexColorF[1],
|
||||
hexColorF[2], hexColorF[3], path.getParentPath().getRelativePathUTF8().data());
|
||||
hexColorF[2], hexColorF[3], path.getParentPath().getRelativePathUTF8());
|
||||
int idx = 0;
|
||||
for (const MAPU::Transform& hexXf : wld.hexTransforms) {
|
||||
zeus::simd_floats hexXfF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
hexXf.xf[i].simd.copy_to(hexXfF[i]);
|
||||
os.format(
|
||||
"obj = bpy.data.objects.new('%s_%d', hexMesh)\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
os.format(fmt(
|
||||
"obj = bpy.data.objects.new('{}_{}', hexMesh)\n"
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(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 = mtxd[2]\n"
|
||||
"bpy.context.scene.collection.objects.link(obj)\n"
|
||||
"obj.parent = wldObj\n",
|
||||
wld.name.c_str(), idx++, hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3], hexXfF[1][0], hexXfF[1][1],
|
||||
"obj.parent = wldObj\n"),
|
||||
wld.name, idx++, hexXfF[0][0], hexXfF[0][1], hexXfF[0][2], hexXfF[0][3], hexXfF[1][0], hexXfF[1][1],
|
||||
hexXfF[1][2], hexXfF[1][3], hexXfF[2][0], hexXfF[2][1], hexXfF[2][2], hexXfF[2][3]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,19 +38,19 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
|||
zeus::simd_floats xfMtxF[3];
|
||||
for (int i = 0; i < 3; ++i)
|
||||
area.transformMtx[i].simd.copy_to(xfMtxF[i]);
|
||||
os.format(
|
||||
"box_mesh = bpy.data.meshes.new('''%s''')\n"
|
||||
os.format(fmt(
|
||||
"box_mesh = bpy.data.meshes.new('''{}''')\n"
|
||||
"bm.to_mesh(box_mesh)\n"
|
||||
"bm.free()\n"
|
||||
"box = bpy.data.objects.new(box_mesh.name, box_mesh)\n"
|
||||
"bpy.context.scene.collection.objects.link(box)\n"
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"box.rotation_mode = 'QUATERNION'\n"
|
||||
"box.location = mtxd[0]\n"
|
||||
"box.rotation_quaternion = mtxd[1]\n"
|
||||
"box.scale = mtxd[2]\n",
|
||||
areaDirName.str().data(), xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3], xfMtxF[1][0], xfMtxF[1][1],
|
||||
"box.scale = mtxd[2]\n"),
|
||||
areaDirName, xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], xfMtxF[0][3], xfMtxF[1][0], xfMtxF[1][1],
|
||||
xfMtxF[1][2], xfMtxF[1][3], xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], xfMtxF[2][3]);
|
||||
|
||||
/* Insert dock planes */
|
||||
|
@ -64,22 +64,22 @@ bool ReadMLVLToBlender(hecl::blender::Connection& conn, const MLVL& mlvl, const
|
|||
int idx = 0;
|
||||
for (const atVec3f& pv : dock.planeVerts) {
|
||||
const zeus::CVector3f pvRel = zeus::CVector3f(pv) - pvAvg;
|
||||
os.format(
|
||||
"bm.verts.new((%f,%f,%f))\n"
|
||||
"bm.verts.ensure_lookup_table()\n",
|
||||
os.format(fmt(
|
||||
"bm.verts.new(({},{},{}))\n"
|
||||
"bm.verts.ensure_lookup_table()\n"),
|
||||
pvRel[0], pvRel[1], pvRel[2]);
|
||||
if (idx)
|
||||
os << "bm.edges.new((bm.verts[-2], bm.verts[-1]))\n";
|
||||
++idx;
|
||||
}
|
||||
os << "bm.edges.new((bm.verts[-1], bm.verts[0]))\n";
|
||||
os.format("dockMesh = bpy.data.meshes.new('DOCK_%02d_%02d')\n", areaIdx, dockIdx);
|
||||
os.format(fmt("dockMesh = bpy.data.meshes.new('DOCK_{:02d}_{:02d}')\n"), areaIdx, dockIdx);
|
||||
os << "dockObj = bpy.data.objects.new(dockMesh.name, dockMesh)\n"
|
||||
"bpy.context.scene.collection.objects.link(dockObj)\n"
|
||||
"bm.to_mesh(dockMesh)\n"
|
||||
"bm.free()\n"
|
||||
"dockObj.parent = box\n";
|
||||
os.format("dockObj.location = (%f,%f,%f)\n", float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2]));
|
||||
os.format(fmt("dockObj.location = ({},{},{})\n"), float(pvAvg[0]), float(pvAvg[1]), float(pvAvg[2]));
|
||||
++dockIdx;
|
||||
}
|
||||
++areaIdx;
|
||||
|
|
|
@ -206,7 +206,7 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge) {
|
|||
++pit;
|
||||
++bridgeIdx;
|
||||
}
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()"));
|
||||
}
|
||||
|
||||
template <class BRIDGETYPE>
|
||||
|
@ -298,7 +298,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
|||
return sharedPath.ensureAuxInfo(auxInfo);
|
||||
}
|
||||
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("Unable to find entry {}"), entry->id);
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCooked(const EntryType* entry) const
|
|||
if (sharedSearch != m_sharedEntries.end()) {
|
||||
return hecl::ProjectPath(m_sharedCooked, getBestEntryName(*entry));
|
||||
}
|
||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("Unable to find entry {}"), entry->id);
|
||||
return hecl::ProjectPath();
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ hecl::SystemString PAKRouter<BRIDGETYPE>::getResourceRelativePath(const EntryTyp
|
|||
const PAKType* pak = m_pak.get();
|
||||
if (!pak)
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()");
|
||||
fmt("PAKRouter::enterPAKBridge() must be called before PAKRouter::getResourceRelativePath()"));
|
||||
const typename BRIDGETYPE::PAKType::Entry* be = lookupEntry(b);
|
||||
if (!be)
|
||||
return hecl::SystemString();
|
||||
|
@ -495,11 +495,11 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
|||
const nod::Node** nodeOut,
|
||||
bool silenceWarnings,
|
||||
bool currentPAK) const {
|
||||
if (!entry)
|
||||
if (!entry.isValid())
|
||||
return nullptr;
|
||||
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::lookupEntry()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::lookupEntry()"));
|
||||
|
||||
const PAKType* pak = m_pak.get();
|
||||
const nod::Node* node = m_node.get();
|
||||
|
@ -515,7 +515,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
|||
if (currentPAK) {
|
||||
#ifndef NDEBUG
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s in current PAK", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, fmt("unable to find PAK entry {} in current PAK"), entry);
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ const typename BRIDGETYPE::PAKType::Entry* PAKRouter<BRIDGETYPE>::lookupEntry(co
|
|||
|
||||
#ifndef NDEBUG
|
||||
if (!silenceWarnings)
|
||||
LogDNACommon.report(logvisor::Warning, "unable to find PAK entry %s", entry.toString().c_str());
|
||||
LogDNACommon.report(logvisor::Warning, fmt("unable to find PAK entry {}"), entry);
|
||||
#endif
|
||||
if (nodeOut)
|
||||
*nodeOut = nullptr;
|
||||
|
@ -565,7 +565,7 @@ const zeus::CMatrix4f* PAKRouter<BRIDGETYPE>::lookupMAPATransform(const IDType&
|
|||
template <class BRIDGETYPE>
|
||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaId, int layerIdx) const {
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||
for (const auto& level : bridge.m_levelDeps)
|
||||
|
@ -587,7 +587,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaI
|
|||
bool& activeOut) const {
|
||||
activeOut = false;
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerWorking()"));
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||
for (const auto& level : bridge.m_levelDeps)
|
||||
|
@ -609,7 +609,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerWorking(const IDType& areaI
|
|||
template <class BRIDGETYPE>
|
||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx) const {
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||
for (const auto& level : bridge.m_levelDeps)
|
||||
|
@ -630,7 +630,7 @@ template <class BRIDGETYPE>
|
|||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId, int layerIdx, bool& activeOut) const {
|
||||
activeOut = false;
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::getAreaLayerCooked()"));
|
||||
auto bridgePathIt = m_bridgePaths.cbegin();
|
||||
for (const BRIDGETYPE& bridge : *m_bridges) {
|
||||
for (const auto& level : bridge.m_levelDeps)
|
||||
|
@ -652,7 +652,7 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getAreaLayerCooked(const IDType& areaId
|
|||
template <class BRIDGETYPE>
|
||||
void PAKRouter<BRIDGETYPE>::enumerateResources(const std::function<bool(const EntryType*)>& func) {
|
||||
if (!m_bridges)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAKRouter::build() must be called before PAKRouter::enumerateResources()");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAKRouter::build() must be called before PAKRouter::enumerateResources()"));
|
||||
for (const auto& entryPair : m_uniqueEntries)
|
||||
if (!func(entryPair.second.second))
|
||||
return;
|
||||
|
@ -666,7 +666,7 @@ bool PAKRouter<BRIDGETYPE>::mreaHasDupeResources(const IDType& id) const {
|
|||
const PAKType* pak = m_pak.get();
|
||||
if (!pak)
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
"PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()");
|
||||
fmt("PAKRouter::enterPAKBridge() must be called before PAKRouter::mreaHasDupeResources()"));
|
||||
return pak->mreaHasDupeResources(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
PAKEntryReadStream(std::unique_ptr<atUint8[]>&& buf, atUint64 sz, atUint64 pos)
|
||||
: m_buf(std::move(buf)), m_sz(sz), m_pos(pos) {
|
||||
if (m_pos >= m_sz)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
|
||||
}
|
||||
void seek(atInt64 pos, athena::SeekOrigin origin) {
|
||||
if (origin == athena::Begin)
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
else if (origin == athena::End)
|
||||
m_pos = m_sz + pos;
|
||||
if (m_pos > m_sz)
|
||||
LogDNACommon.report(logvisor::Fatal, "PAK stream cursor overrun");
|
||||
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
|
||||
}
|
||||
atUint64 position() const { return m_pos; }
|
||||
atUint64 length() const { return m_sz; }
|
||||
|
|
|
@ -16,7 +16,7 @@ template <class IDType>
|
|||
void GPSM<IDType>::_read(typename ReadYaml::StreamT& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -793,15 +793,15 @@ void GPSM<IDType>::_binarySize(typename BinarySize::StreamT& s) const {
|
|||
|
||||
template <class IDType>
|
||||
void GPSM<IDType>::_read(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('GPSM')) {
|
||||
LogModule.report(logvisor::Warning, "non GPSM provided to GPSM parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non GPSM provided to GPSM parser"));
|
||||
return;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
while (clsId != SBIG('_END')) {
|
||||
switch (clsId) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('PMCL'):
|
||||
x78_PMCL.read(r);
|
||||
break;
|
||||
|
@ -1064,10 +1064,10 @@ void GPSM<IDType>::_read(typename Read::StreamT& r) {
|
|||
xd8_SELC.read(r);
|
||||
break;
|
||||
default:
|
||||
LogModule.report(logvisor::Fatal, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown GPSM class {} @{}"), clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ void RealElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT&
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('LFTW'):
|
||||
|
@ -285,9 +285,9 @@ void RealElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::Stre
|
|||
|
||||
template <>
|
||||
void RealElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('LFTW'):
|
||||
m_elem.reset(new struct RELifetimeTween);
|
||||
break;
|
||||
|
@ -393,7 +393,7 @@ void RealElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown RealElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -418,7 +418,7 @@ void IntElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT&
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('KEYE'):
|
||||
|
@ -497,9 +497,9 @@ void IntElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::Strea
|
|||
|
||||
template <>
|
||||
void IntElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('KEYE'):
|
||||
case SBIG('KEYP'):
|
||||
m_elem.reset(new struct IEKeyframeEmitter);
|
||||
|
@ -557,7 +557,7 @@ void IntElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown IntElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -582,7 +582,7 @@ void VectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::Stream
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('CONE'):
|
||||
|
@ -661,9 +661,9 @@ void VectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::St
|
|||
|
||||
template <>
|
||||
void VectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('CONE'):
|
||||
m_elem.reset(new struct VECone);
|
||||
break;
|
||||
|
@ -721,7 +721,7 @@ void VectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown VectorElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -746,7 +746,7 @@ void ColorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('KEYE'):
|
||||
|
@ -792,9 +792,9 @@ void ColorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::Str
|
|||
|
||||
template <>
|
||||
void ColorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('KEYE'):
|
||||
case SBIG('KEYP'):
|
||||
m_elem.reset(new struct CEKeyframeEmitter);
|
||||
|
@ -819,7 +819,7 @@ void ColorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown ColorElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -844,7 +844,7 @@ void ModVectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::Str
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('IMPL'):
|
||||
|
@ -907,9 +907,9 @@ void ModVectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize:
|
|||
|
||||
template <>
|
||||
void ModVectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('IMPL'):
|
||||
m_elem.reset(new struct MVEImplosion);
|
||||
break;
|
||||
|
@ -951,7 +951,7 @@ void ModVectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown ModVectorElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -976,7 +976,7 @@ void EmitterElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::Strea
|
|||
|
||||
const auto& elem = mapChildren[0];
|
||||
if (elem.first.size() < 4)
|
||||
LogModule.report(logvisor::Fatal, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("short FourCC in element '{}'"), elem.first);
|
||||
|
||||
switch (*reinterpret_cast<const uint32_t*>(elem.first.data())) {
|
||||
case SBIG('SETR'):
|
||||
|
@ -1015,9 +1015,9 @@ void EmitterElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::S
|
|||
|
||||
template <>
|
||||
void EmitterElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
switch (clsId) {
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('SETR'):
|
||||
m_elem.reset(new struct EESimpleEmitterTR);
|
||||
break;
|
||||
|
@ -1035,7 +1035,7 @@ void EmitterElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
|
|||
return;
|
||||
default:
|
||||
m_elem.reset();
|
||||
LogModule.report(logvisor::Fatal, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown EmitterElement class {} @{}"), clsId, r.position());
|
||||
return;
|
||||
}
|
||||
m_elem->read(r);
|
||||
|
@ -1480,14 +1480,14 @@ void ChildResourceFactory<IDType>::_read(typename ReadYaml::StreamT& r) {
|
|||
|
||||
template <class IDType>
|
||||
void ChildResourceFactory<IDType>::_write(typename WriteYaml::StreamT& w) const {
|
||||
if (id)
|
||||
if (id.isValid())
|
||||
if (auto rec = w.enterSubRecord("CNST"))
|
||||
id.write(w);
|
||||
}
|
||||
|
||||
template <class IDType>
|
||||
void ChildResourceFactory<IDType>::_binarySize(typename BinarySize::StreamT& s) const {
|
||||
if (id)
|
||||
if (id.isValid())
|
||||
id.binarySize(s);
|
||||
s += 4;
|
||||
}
|
||||
|
@ -1503,7 +1503,7 @@ void ChildResourceFactory<IDType>::_read(typename Read::StreamT& r) {
|
|||
|
||||
template <class IDType>
|
||||
void ChildResourceFactory<IDType>::_write(typename Write::StreamT& w) const {
|
||||
if (id) {
|
||||
if (id.isValid()) {
|
||||
w.writeBytes((atInt8*)"CNST", 4);
|
||||
id.write(w);
|
||||
} else
|
||||
|
|
|
@ -803,7 +803,7 @@ struct ChildResourceFactory : BigDNA {
|
|||
IDType id;
|
||||
AT_DECL_EXPLICIT_DNA_YAML
|
||||
AT_SUBDECL_DNA
|
||||
operator bool() const { return id.operator bool(); }
|
||||
operator bool() const { return id.isValid(); }
|
||||
};
|
||||
|
||||
} // namespace DataSpec::DNAParticle
|
||||
|
|
|
@ -10,7 +10,7 @@ void ISTRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
|
|||
std::unique_ptr<ISTRG> LoadSTRG(athena::io::IStreamReader& reader) {
|
||||
uint32_t magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321) {
|
||||
LogDNACommon.report(logvisor::Error, "invalid STRG magic");
|
||||
LogDNACommon.report(logvisor::Error, fmt("invalid STRG magic"));
|
||||
return std::unique_ptr<ISTRG>();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ template <class IDType>
|
|||
void SWSH<IDType>::_read(typename BigDNA::ReadYaml::StreamT& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -288,16 +288,16 @@ void SWSH<IDType>::_binarySize(typename BigDNA::BinarySize::StreamT& s) const {
|
|||
|
||||
template <class IDType>
|
||||
void SWSH<IDType>::_read(typename BigDNA::Read::StreamT& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('SWSH')) {
|
||||
LogModule.report(logvisor::Warning, "non SWSH provided to SWSH parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non SWSH provided to SWSH parser"));
|
||||
return;
|
||||
}
|
||||
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
while (clsId != SBIG('_END')) {
|
||||
switch (clsId) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('PSLT'):
|
||||
x0_PSLT.read(r);
|
||||
break;
|
||||
|
@ -394,10 +394,10 @@ void SWSH<IDType>::_read(typename BigDNA::Read::StreamT& r) {
|
|||
x45_26_CRND = r.readBool();
|
||||
break;
|
||||
default:
|
||||
LogModule.report(logvisor::Fatal, "Unknown SWSH class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown SWSH class {} @{}"), clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,35 +59,35 @@ static size_t ComputeMippedTexelCount(unsigned inWidth, unsigned inHeight) {
|
|||
}
|
||||
|
||||
/* GX uses this upsampling technique to extract full 8-bit range */
|
||||
static inline uint8_t Convert3To8(uint8_t v) {
|
||||
constexpr uint8_t Convert3To8(uint8_t v) {
|
||||
/* Swizzle bits: 00000123 -> 12312312 */
|
||||
return (v << 5) | (v << 2) | (v >> 1);
|
||||
}
|
||||
|
||||
static inline uint8_t Convert8To3(uint8_t v) { return v >> 5; }
|
||||
constexpr uint8_t Convert8To3(uint8_t v) { return v >> 5; }
|
||||
|
||||
static inline uint8_t Convert4To8(uint8_t v) {
|
||||
constexpr uint8_t Convert4To8(uint8_t v) {
|
||||
/* Swizzle bits: 00001234 -> 12341234 */
|
||||
return (v << 4) | v;
|
||||
}
|
||||
|
||||
static inline uint8_t Convert8To4(uint8_t v) { return v >> 4; }
|
||||
constexpr uint8_t Convert8To4(uint8_t v) { return v >> 4; }
|
||||
|
||||
static inline uint8_t Convert5To8(uint8_t v) {
|
||||
constexpr uint8_t Convert5To8(uint8_t v) {
|
||||
/* Swizzle bits: 00012345 -> 12345123 */
|
||||
return (v << 3) | (v >> 2);
|
||||
}
|
||||
|
||||
static inline uint8_t Convert8To5(uint8_t v) { return v >> 3; }
|
||||
constexpr uint8_t Convert8To5(uint8_t v) { return v >> 3; }
|
||||
|
||||
static inline uint8_t Convert6To8(uint8_t v) {
|
||||
constexpr uint8_t Convert6To8(uint8_t v) {
|
||||
/* Swizzle bits: 00123456 -> 12345612 */
|
||||
return (v << 2) | (v >> 4);
|
||||
}
|
||||
|
||||
static inline uint8_t Convert8To6(uint8_t v) { return v >> 2; }
|
||||
constexpr uint8_t Convert8To6(uint8_t v) { return v >> 2; }
|
||||
|
||||
static inline uint8_t Lookup4BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
static uint8_t Lookup4BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
int bwidth = (width + 7) / 8;
|
||||
int bx = x / 8;
|
||||
int by = y / 8;
|
||||
|
@ -98,7 +98,7 @@ static inline uint8_t Lookup4BPP(const uint8_t* texels, int width, int x, int y)
|
|||
return btexels[ry * 4 + rx / 2] >> ((rx & 1) ? 0 : 4) & 0xf;
|
||||
}
|
||||
|
||||
static inline void Set4BPP(uint8_t* texels, int width, int x, int y, uint8_t val) {
|
||||
static void Set4BPP(uint8_t* texels, int width, int x, int y, uint8_t val) {
|
||||
int bwidth = (width + 7) / 8;
|
||||
int bx = x / 8;
|
||||
int by = y / 8;
|
||||
|
@ -109,7 +109,7 @@ static inline void Set4BPP(uint8_t* texels, int width, int x, int y, uint8_t val
|
|||
btexels[ry * 4 + rx / 2] |= (val & 0xf) << ((rx & 1) ? 0 : 4);
|
||||
}
|
||||
|
||||
static inline uint8_t Lookup8BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
static uint8_t Lookup8BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
int bwidth = (width + 7) / 8;
|
||||
int bx = x / 8;
|
||||
int by = y / 4;
|
||||
|
@ -120,7 +120,7 @@ static inline uint8_t Lookup8BPP(const uint8_t* texels, int width, int x, int y)
|
|||
return btexels[ry * 8 + rx];
|
||||
}
|
||||
|
||||
static inline void Set8BPP(uint8_t* texels, int width, int x, int y, uint8_t val) {
|
||||
static void Set8BPP(uint8_t* texels, int width, int x, int y, uint8_t val) {
|
||||
int bwidth = (width + 7) / 8;
|
||||
int bx = x / 8;
|
||||
int by = y / 4;
|
||||
|
@ -131,7 +131,7 @@ static inline void Set8BPP(uint8_t* texels, int width, int x, int y, uint8_t val
|
|||
btexels[ry * 8 + rx] = val;
|
||||
}
|
||||
|
||||
static inline uint16_t Lookup16BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
static uint16_t Lookup16BPP(const uint8_t* texels, int width, int x, int y) {
|
||||
int bwidth = (width + 3) / 4;
|
||||
int bx = x / 4;
|
||||
int by = y / 4;
|
||||
|
@ -142,7 +142,7 @@ static inline uint16_t Lookup16BPP(const uint8_t* texels, int width, int x, int
|
|||
return btexels[ry * 4 + rx];
|
||||
}
|
||||
|
||||
static inline void Set16BPP(uint8_t* texels, int width, int x, int y, uint16_t val) {
|
||||
static void Set16BPP(uint8_t* texels, int width, int x, int y, uint16_t val) {
|
||||
int bwidth = (width + 3) / 4;
|
||||
int bx = x / 4;
|
||||
int by = y / 4;
|
||||
|
@ -153,7 +153,7 @@ static inline void Set16BPP(uint8_t* texels, int width, int x, int y, uint16_t v
|
|||
btexels[ry * 4 + rx] = val;
|
||||
}
|
||||
|
||||
static inline void LookupRGBA8(const uint8_t* texels, int width, int x, int y, uint8_t* r, uint8_t* g, uint8_t* b,
|
||||
static void LookupRGBA8(const uint8_t* texels, int width, int x, int y, uint8_t* r, uint8_t* g, uint8_t* b,
|
||||
uint8_t* a) {
|
||||
int bwidth = (width + 3) / 4;
|
||||
int bx = x / 4;
|
||||
|
@ -171,7 +171,7 @@ static inline void LookupRGBA8(const uint8_t* texels, int width, int x, int y, u
|
|||
*b = gb & 0xff;
|
||||
}
|
||||
|
||||
static inline void SetRGBA8(uint8_t* texels, int width, int x, int y, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
static void SetRGBA8(uint8_t* texels, int width, int x, int y, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
int bwidth = (width + 3) / 4;
|
||||
int bx = x / 4;
|
||||
int by = y / 4;
|
||||
|
@ -796,9 +796,9 @@ static void EncodeCMPR(const uint8_t* rgbaIn, uint8_t* texels, int width, int he
|
|||
}
|
||||
}
|
||||
|
||||
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, msg); }
|
||||
static void PNGErr(png_structp png, png_const_charp msg) { Log.report(logvisor::Error, fmt("{}"), msg); }
|
||||
|
||||
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, msg); }
|
||||
static void PNGWarn(png_structp png, png_const_charp msg) { Log.report(logvisor::Warning, fmt("{}"), msg); }
|
||||
|
||||
bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
||||
uint32_t format = rs.readUint32Big();
|
||||
|
@ -808,7 +808,7 @@ bool TXTR::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
|||
|
||||
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().data(), _SYS_STR("wb"));
|
||||
if (!fp) {
|
||||
Log.report(logvisor::Error, _SYS_STR("Unable to open '%s' for writing"), outPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
|
||||
|
@ -1013,7 +1013,7 @@ static int GetNumPaletteEntriesForGCN(png_structp png, png_infop info) {
|
|||
bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
||||
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
||||
if (!inf) {
|
||||
Log.report(logvisor::Error, _SYS_STR("Unable to open '%s' for reading"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1021,7 +1021,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
char header[8];
|
||||
fread(header, 1, 8, inf);
|
||||
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
||||
Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
return false;
|
||||
}
|
||||
|
@ -1029,20 +1029,20 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
/* Setup PNG reader */
|
||||
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!pngRead) {
|
||||
Log.report(logvisor::Error, "unable to initialize libpng");
|
||||
Log.report(logvisor::Error, fmt("unable to initialize libpng"));
|
||||
fclose(inf);
|
||||
return false;
|
||||
}
|
||||
png_infop info = png_create_info_struct(pngRead);
|
||||
if (!info) {
|
||||
Log.report(logvisor::Error, "unable to initialize libpng info");
|
||||
Log.report(logvisor::Error, fmt("unable to initialize libpng info"));
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(pngRead))) {
|
||||
Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1059,7 +1059,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
png_byte bitDepth = png_get_bit_depth(pngRead, info);
|
||||
|
||||
if (width < 4 || height < 4) {
|
||||
Log.report(logvisor::Error, "image must be 4x4 or larger");
|
||||
Log.report(logvisor::Error, fmt("image must be 4x4 or larger"));
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1085,7 +1085,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
}
|
||||
|
||||
if (bitDepth != 8) {
|
||||
Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1117,7 +1117,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
nComps = 1;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1138,7 +1138,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
bufOut.reset(new uint8_t[bufLen]);
|
||||
|
||||
if (setjmp(png_jmpbuf(pngRead))) {
|
||||
Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1318,7 +1318,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
/* Do write out */
|
||||
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
||||
if (outf.hasError()) {
|
||||
Log.report(logvisor::Error, _SYS_STR("Unable to open '%s' for writing"), outPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ bool TXTR::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
|
|||
bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
|
||||
FILE* inf = hecl::Fopen(inPath.getAbsolutePath().data(), _SYS_STR("rb"));
|
||||
if (!inf) {
|
||||
Log.report(logvisor::Error, _SYS_STR("Unable to open '%s' for reading"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for reading")), inPath.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1342,7 +1342,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
char header[8];
|
||||
fread(header, 1, 8, inf);
|
||||
if (png_sig_cmp((png_const_bytep)header, 0, 8)) {
|
||||
Log.report(logvisor::Error, _SYS_STR("invalid PNG signature in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("invalid PNG signature in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
return false;
|
||||
}
|
||||
|
@ -1350,20 +1350,20 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
/* Setup PNG reader */
|
||||
png_structp pngRead = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!pngRead) {
|
||||
Log.report(logvisor::Error, "unable to initialize libpng");
|
||||
Log.report(logvisor::Error, fmt("unable to initialize libpng"));
|
||||
fclose(inf);
|
||||
return false;
|
||||
}
|
||||
png_infop info = png_create_info_struct(pngRead);
|
||||
if (!info) {
|
||||
Log.report(logvisor::Error, "unable to initialize libpng info");
|
||||
Log.report(logvisor::Error, fmt("unable to initialize libpng info"));
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, nullptr, nullptr);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(pngRead))) {
|
||||
Log.report(logvisor::Error, _SYS_STR("unable to initialize libpng I/O for '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("unable to initialize libpng I/O for '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1399,7 +1399,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
}
|
||||
|
||||
if (bitDepth != 8) {
|
||||
Log.report(logvisor::Error, _SYS_STR("'%s' is not 8 bits-per-channel"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("'{}' is not 8 bits-per-channel")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1429,7 +1429,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
paletteBuf = ReadPalette(pngRead, info, paletteSize);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Error, _SYS_STR("unsupported color type in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("unsupported color type in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1448,7 +1448,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
bufOut.reset(new uint8_t[bufLen]);
|
||||
|
||||
if (setjmp(png_jmpbuf(pngRead))) {
|
||||
Log.report(logvisor::Error, _SYS_STR("unable to read image in '%s'"), inPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to read image in '{}'")), inPath.getAbsolutePath());
|
||||
fclose(inf);
|
||||
png_destroy_read_struct(&pngRead, &info, nullptr);
|
||||
return false;
|
||||
|
@ -1570,7 +1570,7 @@ bool TXTR::CookPC(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outP
|
|||
/* Do write out */
|
||||
athena::io::FileWriter outf(outPath.getAbsolutePath(), true, false);
|
||||
if (outf.hasError()) {
|
||||
Log.report(logvisor::Error, _SYS_STR("Unable to open '%s' for writing"), outPath.getAbsolutePath().data());
|
||||
Log.report(logvisor::Error, fmt(_SYS_STR("Unable to open '{}' for writing")), outPath.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1607,7 +1607,7 @@ std::string TXTR::CalculateDolphinName(DataSpec::PAKEntryReadStream& rs) {
|
|||
atUint16 width = rs.readUint16Big();
|
||||
atUint16 height = rs.readUint16Big();
|
||||
atUint32 mips = rs.readUint32Big();
|
||||
std::string res = hecl::Format("tex1_%dx%d%s", width, height, mips > 1 ? "_m" : "");
|
||||
std::string res = fmt::format(fmt("tex1_{}x{}{}"), width, height, mips > 1 ? "_m" : "");
|
||||
atUint64 palHash = 0;
|
||||
bool hasPalette = false;
|
||||
atUint32 textureSize = width * height;
|
||||
|
@ -1643,10 +1643,10 @@ std::string TXTR::CalculateDolphinName(DataSpec::PAKEntryReadStream& rs) {
|
|||
std::unique_ptr<u8[]> textureData(new u8[textureSize]);
|
||||
rs.readUBytesToBuf(textureData.get(), textureSize);
|
||||
atUint64 texHash = XXH64(textureData.get(), textureSize, 0);
|
||||
res += hecl::Format("_%016" PRIx64, texHash);
|
||||
res += fmt::format(fmt("_{:016X}"), texHash);
|
||||
if (hasPalette)
|
||||
res += hecl::Format("_%016" PRIx64, palHash);
|
||||
res += hecl::Format("_%d", format);
|
||||
res += fmt::format(fmt("_{:016X}"), palHash);
|
||||
res += fmt::format(fmt("_{}"), format);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ template <class IDType>
|
|||
void WPSM<IDType>::_read(athena::io::YAMLDocReader& r) {
|
||||
for (const auto& elem : r.getCurNode()->m_mapChildren) {
|
||||
if (elem.first.size() < 4) {
|
||||
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
|
||||
LogModule.report(logvisor::Warning, fmt("short FourCC in element '{}'"), elem.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -365,15 +365,15 @@ void WPSM<IDType>::_binarySize(size_t& __isz) const {
|
|||
|
||||
template <class IDType>
|
||||
void WPSM<IDType>::_read(athena::io::IStreamReader& r) {
|
||||
uint32_t clsId;
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
DNAFourCC clsId;
|
||||
clsId.read(r);
|
||||
if (clsId != SBIG('WPSM')) {
|
||||
LogModule.report(logvisor::Warning, "non WPSM provided to WPSM parser");
|
||||
LogModule.report(logvisor::Warning, fmt("non WPSM provided to WPSM parser"));
|
||||
return;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
while (clsId != SBIG('_END')) {
|
||||
switch (clsId) {
|
||||
switch (clsId.toUint32()) {
|
||||
case SBIG('IORN'):
|
||||
x0_IORN.read(r);
|
||||
break;
|
||||
|
@ -484,10 +484,10 @@ void WPSM<IDType>::_read(athena::io::IStreamReader& r) {
|
|||
xunk_SPS2.read(r);
|
||||
break;
|
||||
default:
|
||||
LogModule.report(logvisor::Fatal, "Unknown WPSM class %.4s @%" PRIi64, &clsId, r.position());
|
||||
LogModule.report(logvisor::Fatal, fmt("Unknown WPSM class {} @{}"), clsId, r.position());
|
||||
break;
|
||||
}
|
||||
r.readBytesToBuf(&clsId, 4);
|
||||
clsId.read(r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,8 @@ static const std::pair<std::string_view, const uint8_t*> Headers[] = {{"Atomic"s
|
|||
{"OmegaPirate"sv, OmegaPirate_H},
|
||||
{"OverWorld"sv, OverWorld_H},
|
||||
{"Parasite"sv, Parasite_H},
|
||||
{"PhazonGun"sv, PhazonGun_H},
|
||||
{"Phazon"sv, Phazon_H},
|
||||
{"PhazonGun"sv, PhazonGun_H},
|
||||
{"PuddleSpore"sv, PuddleSpore_H},
|
||||
{"PuddleToad"sv, PuddleToad_H},
|
||||
{"Puffer"sv, Puffer_H},
|
||||
|
|
|
@ -382,7 +382,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Write>(athena::io::ISt
|
|||
sectionCount = 6;
|
||||
else if (animIdxs.size())
|
||||
sectionCount = 5;
|
||||
else if (cmdlIce)
|
||||
else if (cmdlIce.isValid())
|
||||
sectionCount = 4;
|
||||
else if (effects.size())
|
||||
sectionCount = 3;
|
||||
|
@ -449,7 +449,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::BinarySize>(size_t& __
|
|||
sectionCount = 6;
|
||||
else if (animIdxs.size())
|
||||
sectionCount = 5;
|
||||
else if (cmdlIce)
|
||||
else if (cmdlIce.isValid())
|
||||
sectionCount = 4;
|
||||
else if (effects.size())
|
||||
sectionCount = 3;
|
||||
|
@ -559,7 +559,7 @@ void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::WriteYaml>(athena::io:
|
|||
sectionCount = 6;
|
||||
else if (animIdxs.size())
|
||||
sectionCount = 5;
|
||||
else if (cmdlIce)
|
||||
else if (cmdlIce.isValid())
|
||||
sectionCount = 4;
|
||||
else if (effects.size())
|
||||
sectionCount = 3;
|
||||
|
@ -986,19 +986,19 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
/* Search for yaml */
|
||||
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
|
||||
if (!yamlPath.isFile())
|
||||
Log.report(logvisor::Fatal, _SYS_STR("'%s' not found as file"), yamlPath.getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("'{}' not found as file")), yamlPath.getRelativePath());
|
||||
|
||||
athena::io::FileReader reader(yamlPath.getAbsolutePath());
|
||||
if (!reader.isOpen())
|
||||
Log.report(logvisor::Fatal, _SYS_STR("can't open '%s' for reading"), yamlPath.getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("can't open '{}' for reading")), yamlPath.getRelativePath());
|
||||
|
||||
if (!athena::io::ValidateFromYAMLStream<ANCS>(reader)) {
|
||||
Log.report(logvisor::Fatal, _SYS_STR("'%s' is not urde::DNAMP1::ANCS type"), yamlPath.getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not urde::DNAMP1::ANCS type")), yamlPath.getRelativePath());
|
||||
}
|
||||
|
||||
athena::io::YAMLDocReader yamlReader;
|
||||
if (!yamlReader.parse(&reader)) {
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to parse '%s'"), yamlPath.getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to parse '{}'")), yamlPath.getRelativePath());
|
||||
}
|
||||
ANCS ancs;
|
||||
ancs.read(yamlReader);
|
||||
|
@ -1132,7 +1132,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
|||
}
|
||||
}
|
||||
if (!subtype)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find subtype '{}'")), subName);
|
||||
}
|
||||
|
||||
const hecl::ProjectPath* modelPath = nullptr;
|
||||
|
@ -1145,7 +1145,7 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
|||
}
|
||||
}
|
||||
if (!attachment)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find attachment '{}'")), overName);
|
||||
modelPath = &attachment->mesh;
|
||||
} else if (overName.empty()) {
|
||||
modelPath = &subtype->mesh;
|
||||
|
@ -1157,15 +1157,15 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
|||
}
|
||||
}
|
||||
if (!modelPath)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
||||
|
||||
if (!modelPath->isFile())
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
||||
|
||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1).getWithExtension(_SYS_STR(".skinint"));
|
||||
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
|
||||
if (!modelCookFunc(*modelPath))
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
||||
|
||||
std::vector<std::pair<std::vector<std::pair<uint32_t, float>>, uint32_t>> skins;
|
||||
uint32_t posCount = 0;
|
||||
|
@ -1190,8 +1190,8 @@ bool ANCS::CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
|||
const std::string& name = boneNames[bIdx];
|
||||
auto search = boneIdMap.find(name);
|
||||
if (search == boneIdMap.cend())
|
||||
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s", name.c_str(),
|
||||
inPath.getRelativePathUTF8().data());
|
||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
||||
inPath.getRelativePathUTF8());
|
||||
virtualBone.first.emplace_back(search->second, weight);
|
||||
}
|
||||
virtualBone.second = skinIO.readUint32Big();
|
||||
|
@ -1250,7 +1250,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
|||
}
|
||||
}
|
||||
if (!subtype)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to find subtype '%s'"), subName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find subtype '{}'")), subName);
|
||||
}
|
||||
|
||||
const hecl::ProjectPath* modelPath = nullptr;
|
||||
|
@ -1263,7 +1263,7 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
|||
}
|
||||
}
|
||||
if (!attachment)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to find attachment '%s'"), overName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to find attachment '{}'")), overName);
|
||||
modelPath = &attachment->mesh;
|
||||
} else if (overName.empty()) {
|
||||
modelPath = &subtype->mesh;
|
||||
|
@ -1275,15 +1275,15 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
|||
}
|
||||
}
|
||||
if (!modelPath)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve model path of %s:%s"), subName.c_str(), overName.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve model path of {}:{}")), subName, overName);
|
||||
|
||||
if (!modelPath->isFile())
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to resolve '%s'"), modelPath->getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to resolve '{}'")), modelPath->getRelativePath());
|
||||
|
||||
hecl::ProjectPath skinIntPath = modelPath->getCookedPath(SpecEntMP1PC).getWithExtension(_SYS_STR(".skinint"));
|
||||
if (!skinIntPath.isFileOrGlob() || skinIntPath.getModtime() < modelPath->getModtime())
|
||||
if (!modelCookFunc(*modelPath))
|
||||
Log.report(logvisor::Fatal, _SYS_STR("unable to cook '%s'"), modelPath->getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("unable to cook '{}'")), modelPath->getRelativePath());
|
||||
|
||||
uint32_t bankCount = 0;
|
||||
std::vector<std::vector<uint32_t>> skinBanks;
|
||||
|
@ -1323,8 +1323,8 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
|||
const std::string& name = boneNames[bIdx];
|
||||
auto search = boneIdMap.find(name);
|
||||
if (search == boneIdMap.cend())
|
||||
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s", name.c_str(),
|
||||
inPath.getRelativePathUTF8().data());
|
||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
||||
inPath.getRelativePathUTF8());
|
||||
virtualBone.emplace_back(search->second, weight);
|
||||
}
|
||||
}
|
||||
|
@ -1344,8 +1344,8 @@ bool ANCS::CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath&
|
|||
const std::string& name = boneNames[bIdx];
|
||||
auto search = boneIdMap.find(name);
|
||||
if (search == boneIdMap.cend())
|
||||
Log.report(logvisor::Fatal, "unable to find bone '%s' in %s", name.c_str(),
|
||||
inPath.getRelativePathUTF8().data());
|
||||
Log.report(logvisor::Fatal, fmt("unable to find bone '{}' in {}"), name,
|
||||
inPath.getRelativePathUTF8());
|
||||
skinOut.writeUint32Big(search->second);
|
||||
}
|
||||
}
|
||||
|
@ -1372,7 +1372,7 @@ bool ANCS::CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& i
|
|||
DNAANCS::Action action = ds.compileActionChannelsOnly(actNameView.str());
|
||||
|
||||
if (!actor.armatures.size())
|
||||
Log.report(logvisor::Fatal, _SYS_STR("0 armatures in %s"), inPath.getRelativePath().data());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("0 armatures in {}")), inPath.getRelativePath());
|
||||
|
||||
/* Build bone ID map */
|
||||
std::unordered_map<std::string, atInt32> boneIdMap;
|
||||
|
|
|
@ -361,7 +361,7 @@ struct ANCS : BigDNA {
|
|||
chOut.cskr = ci.cskr;
|
||||
chOut.cinf = ci.cinf;
|
||||
|
||||
if (ci.cmdlIce)
|
||||
if (ci.cmdlIce.isValid())
|
||||
chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ namespace DataSpec::DNAMP1 {
|
|||
using ANIMOutStream = hecl::blender::ANIMOutStream;
|
||||
|
||||
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",
|
||||
os.format(fmt(
|
||||
"act.hecl_fps = round({})\n"
|
||||
"act.hecl_looping = {}\n"),
|
||||
(1.0f / mainInterval), looping ? "True" : "False");
|
||||
|
||||
auto kit = chanKeys.begin();
|
||||
|
@ -26,7 +26,7 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
|
|||
continue;
|
||||
}
|
||||
|
||||
os.format("bone_string = '%s'\n", bName->c_str());
|
||||
os.format(fmt("bone_string = '{}'\n"), *bName);
|
||||
os << "action_group = act.groups.new(bone_string)\n"
|
||||
"\n"
|
||||
"rotCurves = []\n"
|
||||
|
@ -111,7 +111,7 @@ UniqueID32 ANIM::GetEVNTId(athena::io::IStreamReader& reader) {
|
|||
reader.seek(4);
|
||||
return reader.readUint32Big();
|
||||
default:
|
||||
Log.report(logvisor::Error, "unrecognized ANIM version");
|
||||
Log.report(logvisor::Error, fmt("unrecognized ANIM version"));
|
||||
break;
|
||||
}
|
||||
return {};
|
||||
|
@ -134,7 +134,7 @@ void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
|||
m_anim->read(reader);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Error, "unrecognized ANIM version");
|
||||
Log.report(logvisor::Error, fmt("unrecognized ANIM version"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ ANIM::ANIM(const BlenderAction& act, const std::unordered_map<std::string, atInt
|
|||
for (const BlenderAction::Channel& chan : act.channels) {
|
||||
auto search = idMap.find(chan.boneName);
|
||||
if (search == idMap.cend()) {
|
||||
Log.report(logvisor::Warning, "unable to find id for bone '%s'", chan.boneName.c_str());
|
||||
Log.report(logvisor::Warning, fmt("unable to find id for bone '{}'"), chan.boneName);
|
||||
continue;
|
||||
}
|
||||
if (addedBones.find(search->second) != addedBones.cend())
|
||||
|
|
|
@ -191,7 +191,7 @@ struct ANIM : BigDNA {
|
|||
|
||||
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID32>& animInfo, const hecl::ProjectPath& outPath,
|
||||
PAKRouter<PAKBridge>& pakRouter, bool force) const {
|
||||
if (m_anim->evnt) {
|
||||
if (m_anim->evnt.isValid()) {
|
||||
hecl::SystemStringConv sysStr(animInfo.name);
|
||||
hecl::ProjectPath evntYamlPath = outPath.getWithExtension(
|
||||
(hecl::SystemString(_SYS_STR(".")) + sysStr.c_str() + _SYS_STR(".evnt.yaml")).c_str(), true);
|
||||
|
|
|
@ -34,7 +34,7 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
|
|||
for (atUint32 bid : boneIds) {
|
||||
for (const Name& name : names) {
|
||||
if (name.boneId == bid) {
|
||||
os.format("obj.vertex_groups.new(name='%s')\n", name.name.c_str());
|
||||
os.format(fmt("obj.vertex_groups.new(name='{}')\n"), name.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -44,40 +44,40 @@ void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
|
|||
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const {
|
||||
DNAANIM::RigInverter<CINF> inverter(*this);
|
||||
|
||||
os.format(
|
||||
"arm = bpy.data.armatures.new('CINF_%08X')\n"
|
||||
os.format(fmt(
|
||||
"arm = bpy.data.armatures.new('CINF_{}')\n"
|
||||
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
|
||||
"bpy.context.scene.collection.objects.link(arm_obj)\n"
|
||||
"bpy.context.view_layer.objects.active = arm_obj\n"
|
||||
"bpy.ops.object.mode_set(mode='EDIT')\n"
|
||||
"arm_bone_table = {}\n",
|
||||
cinfId.toUint32());
|
||||
"arm_bone_table = {{}}\n"),
|
||||
cinfId);
|
||||
|
||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
|
||||
zeus::simd_floats originF(bone.m_origBone.origin.simd);
|
||||
zeus::simd_floats tailF(bone.m_tail.mSimd);
|
||||
os.format(
|
||||
"bone = arm.edit_bones.new('%s')\n"
|
||||
"bone.head = (%f,%f,%f)\n"
|
||||
"bone.tail = (%f,%f,%f)\n"
|
||||
os.format(fmt(
|
||||
"bone = arm.edit_bones.new('{}')\n"
|
||||
"bone.head = ({},{},{})\n"
|
||||
"bone.tail = ({},{},{})\n"
|
||||
"bone.use_inherit_scale = False\n"
|
||||
"arm_bone_table[%u] = bone\n",
|
||||
getBoneNameFromId(bone.m_origBone.id)->c_str(), originF[0], originF[1], originF[2], tailF[0], tailF[1],
|
||||
"arm_bone_table[{}] = bone\n"),
|
||||
*getBoneNameFromId(bone.m_origBone.id), originF[0], originF[1], originF[2], tailF[0], tailF[1],
|
||||
tailF[2], bone.m_origBone.id);
|
||||
}
|
||||
|
||||
for (const Bone& bone : bones)
|
||||
if (bone.parentId != 2)
|
||||
os.format("arm_bone_table[%u].parent = arm_bone_table[%u]\n", bone.id, bone.parentId);
|
||||
os.format(fmt("arm_bone_table[{}].parent = arm_bone_table[{}]\n"), bone.id, bone.parentId);
|
||||
|
||||
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
|
||||
|
||||
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
|
||||
os.format("arm_obj.pose.bones['%s'].rotation_mode = 'QUATERNION'\n",
|
||||
getBoneNameFromId(bone.m_origBone.id)->c_str());
|
||||
os.format(fmt("arm_obj.pose.bones['{}'].rotation_mode = 'QUATERNION'\n"),
|
||||
*getBoneNameFromId(bone.m_origBone.id));
|
||||
}
|
||||
|
||||
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId) { return hecl::Format("CINF_%08X", cinfId.toUint32()); }
|
||||
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId) { return fmt::format(fmt("CINF_{}"), cinfId); }
|
||||
|
||||
int CINF::RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
|
||||
std::unordered_map<std::string, atInt32>& idMap,
|
||||
|
|
|
@ -22,27 +22,27 @@ void MaterialSet::RegisterMaterialProps(Stream& out) {
|
|||
}
|
||||
|
||||
void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t texIdx, bool diffuse) {
|
||||
char mtxLabel[64];
|
||||
std::string mtxLabel;
|
||||
if (mtxIdx == -1)
|
||||
strncpy(mtxLabel, "IDENTITY", 64);
|
||||
mtxLabel = "IDENTITY";
|
||||
else
|
||||
snprintf(mtxLabel, 64, "MTX_%u", mtxIdx);
|
||||
mtxLabel = fmt::format(fmt("MTX_{}"), mtxIdx);
|
||||
|
||||
char texLabel[64];
|
||||
std::string texLabel;
|
||||
if (diffuse)
|
||||
strncpy(texLabel, "Diffuse", 64);
|
||||
texLabel = "Diffuse";
|
||||
else
|
||||
strncpy(texLabel, "Texture", 64);
|
||||
texLabel = "Texture";
|
||||
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"# Texture\n"
|
||||
"tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n"
|
||||
"tex_node.label = '%s %u'\n"
|
||||
"texture_nodes.append(tex_node)\n",
|
||||
"tex_node.label = '{} {}'\n"
|
||||
"texture_nodes.append(tex_node)\n"),
|
||||
texLabel, texIdx);
|
||||
|
||||
if (texIdx != 0xff)
|
||||
out.format("tex_node.image = tex_maps[%u]\n", texIdx);
|
||||
out.format(fmt("tex_node.image = tex_maps[{}]\n"), texIdx);
|
||||
|
||||
if (type == GX::TG_POS)
|
||||
out << "tex_uv_node = new_nodetree.nodes.new('ShaderNodeTexCoord')\n"
|
||||
|
@ -52,14 +52,14 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
|||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['Normal'], tex_node.inputs['Vector']))\n";
|
||||
else if (type >= GX::TG_TEX0 && type <= GX::TG_TEX7) {
|
||||
uint8_t texIdx = type - GX::TG_TEX0;
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"tex_uv_node = new_nodetree.nodes.new('ShaderNodeUVMap')\n"
|
||||
"tex_links.append(new_nodetree.links.new(tex_uv_node.outputs['UV'], tex_node.inputs['Vector']))\n"
|
||||
"tex_uv_node.uv_map = 'UV_%u'\n",
|
||||
"tex_uv_node.uv_map = 'UV_{}'\n"),
|
||||
texIdx);
|
||||
}
|
||||
|
||||
out.format("tex_uv_node.label = '%s'\n", mtxLabel);
|
||||
out.format(fmt("tex_uv_node.label = '{}'\n"), mtxLabel);
|
||||
|
||||
out << "gridder.place_node(tex_uv_node, 0)\n"
|
||||
"gridder.place_node(tex_node, 0)\n"
|
||||
|
@ -72,9 +72,9 @@ void Material::AddTexture(Stream& out, GX::TexGenSrc type, int mtxIdx, uint32_t
|
|||
void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx, const float* vals) {
|
||||
switch (type) {
|
||||
case UVAnimation::Mode::MvInvNoTranslation:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -84,13 +84,13 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx);
|
||||
break;
|
||||
case UVAnimation::Mode::MvInv:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -100,13 +100,13 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx);
|
||||
break;
|
||||
case UVAnimation::Mode::Scroll:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -114,17 +114,17 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode2Node']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = (%f,%f,0)\n"
|
||||
" node.inputs[2].default_value = (%f,%f,0)\n"
|
||||
" node.inputs[1].default_value = ({},{},0)\n"
|
||||
" node.inputs[2].default_value = ({},{},0)\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||
break;
|
||||
case UVAnimation::Mode::Rotation:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -132,17 +132,17 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode3Node']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = %f\n"
|
||||
" node.inputs[2].default_value = %f\n"
|
||||
" node.inputs[1].default_value = {}\n"
|
||||
" node.inputs[2].default_value = {}\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1]);
|
||||
break;
|
||||
case UVAnimation::Mode::HStrip:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -150,19 +150,19 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode4Node']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = %f\n"
|
||||
" node.inputs[2].default_value = %f\n"
|
||||
" node.inputs[3].default_value = %f\n"
|
||||
" node.inputs[4].default_value = %f\n"
|
||||
" node.inputs[1].default_value = {}\n"
|
||||
" node.inputs[2].default_value = {}\n"
|
||||
" node.inputs[3].default_value = {}\n"
|
||||
" node.inputs[4].default_value = {}\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||
break;
|
||||
case UVAnimation::Mode::VStrip:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -170,19 +170,19 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode5Node']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = %f\n"
|
||||
" node.inputs[2].default_value = %f\n"
|
||||
" node.inputs[3].default_value = %f\n"
|
||||
" node.inputs[4].default_value = %f\n"
|
||||
" node.inputs[1].default_value = {}\n"
|
||||
" node.inputs[2].default_value = {}\n"
|
||||
" node.inputs[3].default_value = {}\n"
|
||||
" node.inputs[4].default_value = {}\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1], vals[2], vals[3]);
|
||||
break;
|
||||
case UVAnimation::Mode::Model:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -192,13 +192,13 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx);
|
||||
break;
|
||||
case UVAnimation::Mode::CylinderEnvironment:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -206,17 +206,17 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode7NodeN']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = %f\n"
|
||||
" node.inputs[2].default_value = %f\n"
|
||||
" node.inputs[1].default_value = {}\n"
|
||||
" node.inputs[2].default_value = {}\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1]);
|
||||
break;
|
||||
case UVAnimation::Mode::Eight:
|
||||
out.format(
|
||||
out.format(fmt(
|
||||
"for link in list(tex_links):\n"
|
||||
" if link.from_node.label == 'MTX_%u':\n"
|
||||
" if link.from_node.label == 'MTX_{}':\n"
|
||||
" tex_links.remove(link)\n"
|
||||
" soc_from = link.from_socket\n"
|
||||
" soc_to = link.to_socket\n"
|
||||
|
@ -224,18 +224,18 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
" node.node_tree = bpy.data.node_groups['RetroUVMode8Node']\n"
|
||||
" node.location[0] = link.from_node.location[0] + 50\n"
|
||||
" node.location[1] = link.from_node.location[1] - 50\n"
|
||||
" node.inputs[1].default_value = %f\n"
|
||||
" node.inputs[2].default_value = %f\n"
|
||||
" node.inputs[3].default_value = %f\n"
|
||||
" node.inputs[4].default_value = %f\n"
|
||||
" node.inputs[5].default_value = %f\n"
|
||||
" node.inputs[6].default_value = %f\n"
|
||||
" node.inputs[7].default_value = %f\n"
|
||||
" node.inputs[8].default_value = %f\n"
|
||||
" node.inputs[9].default_value = %f\n"
|
||||
" node.inputs[1].default_value = {}\n"
|
||||
" node.inputs[2].default_value = {}\n"
|
||||
" node.inputs[3].default_value = {}\n"
|
||||
" node.inputs[4].default_value = {}\n"
|
||||
" node.inputs[5].default_value = {}\n"
|
||||
" node.inputs[6].default_value = {}\n"
|
||||
" node.inputs[7].default_value = {}\n"
|
||||
" node.inputs[8].default_value = {}\n"
|
||||
" node.inputs[9].default_value = {}\n"
|
||||
" new_nodetree.links.remove(link)\n"
|
||||
" new_nodetree.links.new(soc_from, node.inputs[0])\n"
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n",
|
||||
" new_nodetree.links.new(node.outputs[0], soc_to)\n\n"),
|
||||
idx, vals[0], vals[1], vals[2], vals[3], vals[4], vals[5], vals[6], vals[7], vals[8]);
|
||||
break;
|
||||
default:
|
||||
|
@ -244,10 +244,10 @@ void Material::AddTextureAnim(Stream& out, UVAnimation::Mode type, unsigned idx,
|
|||
}
|
||||
|
||||
void Material::AddKcolor(Stream& out, const GX::Color& col, unsigned idx) {
|
||||
out.format(
|
||||
"kcolors[%d] = (%f, %f, %f, %f)\n"
|
||||
"kalphas[%d] = %f\n"
|
||||
"\n",
|
||||
out.format(fmt(
|
||||
"kcolors[{}] = ({}, {}, {}, {})\n"
|
||||
"kalphas[{}] = {}\n"
|
||||
"\n"),
|
||||
idx, (float)col.color[0] / (float)0xff, (float)col.color[1] / (float)0xff, (float)col.color[2] / (float)0xff,
|
||||
(float)col.color[3] / (float)0xff, idx, (float)col.color[3] / (float)0xff);
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ template <class MAT>
|
|||
static void _DescribeTEV(const MAT& mat) {
|
||||
for (uint32_t i = 0; i < mat.tevStageCount; ++i) {
|
||||
const auto& stage = mat.tevStages[i];
|
||||
fprintf(stderr, "A:%s B:%s C:%s D:%s -> %s | A:%s B:%s C:%s D:%s -> %s\n",
|
||||
fmt::print(stderr, fmt("A:{} B:{} C:{} D:{} -> {} | A:{} B:{} C:{} D:{} -> {}\n"),
|
||||
ToString(stage.colorInA()), ToString(stage.colorInB()),
|
||||
ToString(stage.colorInC()), ToString(stage.colorInD()), ToString(stage.colorOpOutReg()),
|
||||
ToString(stage.alphaInA()), ToString(stage.alphaInB()),
|
||||
|
@ -362,7 +362,7 @@ static void _DescribeTEV(const MAT& mat) {
|
|||
}
|
||||
bool hasInd = mat.flags.samusReflectionIndirectTexture();
|
||||
bool hasLm = mat.flags.lightmap();
|
||||
fprintf(stderr, "HasIndirect: %d HasLightmap: %d\n", hasInd, hasLm);
|
||||
fmt::print(stderr, fmt("HasIndirect: {} HasLightmap: {}\n"), hasInd, hasLm);
|
||||
}
|
||||
|
||||
struct TexLink {
|
||||
|
@ -451,7 +451,7 @@ template <class MAT>
|
|||
static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupIdx, unsigned matIdx) {
|
||||
unsigned i;
|
||||
|
||||
out.format("new_material = bpy.data.materials.new('MAT_%u_%u')\n", groupIdx, matIdx);
|
||||
out.format(fmt("new_material = bpy.data.materials.new('MAT_{}_{}')\n"), groupIdx, matIdx);
|
||||
out << "new_material.use_fake_user = True\n"
|
||||
"new_material.use_nodes = True\n"
|
||||
"new_nodetree = new_material.node_tree\n"
|
||||
|
@ -467,16 +467,16 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
|||
"\n";
|
||||
|
||||
/* Material Flags */
|
||||
out.format(
|
||||
"new_material.retro_depth_sort = %s\n"
|
||||
"new_material.retro_alpha_test = %s\n"
|
||||
"new_material.retro_samus_reflection = %s\n"
|
||||
"new_material.retro_depth_write = %s\n"
|
||||
"new_material.retro_samus_reflection_persp = %s\n"
|
||||
"new_material.retro_shadow_occluder = %s\n"
|
||||
"new_material.retro_samus_reflection_indirect = %s\n"
|
||||
"new_material.retro_lightmapped = %s\n"
|
||||
"new_material.diffuse_color = (1, 1, 1, %s)\n",
|
||||
out.format(fmt(
|
||||
"new_material.retro_depth_sort = {}\n"
|
||||
"new_material.retro_alpha_test = {}\n"
|
||||
"new_material.retro_samus_reflection = {}\n"
|
||||
"new_material.retro_depth_write = {}\n"
|
||||
"new_material.retro_samus_reflection_persp = {}\n"
|
||||
"new_material.retro_shadow_occluder = {}\n"
|
||||
"new_material.retro_samus_reflection_indirect = {}\n"
|
||||
"new_material.retro_lightmapped = {}\n"
|
||||
"new_material.diffuse_color = (1, 1, 1, {})\n"),
|
||||
material.flags.depthSorting() ? "True" : "False", material.flags.alphaTest() ? "True" : "False",
|
||||
material.flags.samusReflection() ? "True" : "False", material.flags.depthWrite() ? "True" : "False",
|
||||
material.flags.samusReflectionSurfaceEye() ? "True" : "False",
|
||||
|
@ -487,7 +487,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
|||
/* Texture Indices */
|
||||
out << "tex_maps = []\n";
|
||||
for (atUint32 idx : material.textureIdxs)
|
||||
out.format("tex_maps.append(texmap_list[%u])\n", idx);
|
||||
out.format(fmt("tex_maps.append(texmap_list[{}])\n"), idx);
|
||||
|
||||
/* KColor entries */
|
||||
if (material.flags.konstValuesEnabled()) {
|
||||
|
@ -648,7 +648,7 @@ static void _ConstructMaterial(Stream& out, const MAT& material, unsigned groupI
|
|||
_GenerateRootShader(out, "RetroShader", "Lightmap"_tex, "Diffuse"_tex, TexLink("Alpha", 1, true)); break;
|
||||
default:
|
||||
_DescribeTEV(material);
|
||||
Log.report(logvisor::Fatal, "Unable to resolve shader hash %08X\n", hash); break;
|
||||
Log.report(logvisor::Fatal, fmt("Unable to resolve shader hash {:08X}\n"), hash); break;
|
||||
}
|
||||
|
||||
/* Has Lightmap? */
|
||||
|
@ -996,7 +996,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
else if (!gameFunction.compare("RetroUVMode2Node")) {
|
||||
mode = Mode::Scroll;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode2 UV anim requires 2 vector arguments");
|
||||
Log.report(logvisor::Fatal, fmt("Mode2 UV anim requires 2 vector arguments"));
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[0].simd[1];
|
||||
vals[2] = gameArgs[1].simd[0];
|
||||
|
@ -1004,13 +1004,13 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
} else if (!gameFunction.compare("RetroUVMode3Node")) {
|
||||
mode = Mode::Rotation;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode3 UV anim requires 2 arguments");
|
||||
Log.report(logvisor::Fatal, fmt("Mode3 UV anim requires 2 arguments"));
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
} else if (!gameFunction.compare("RetroUVMode4Node")) {
|
||||
mode = Mode::HStrip;
|
||||
if (gameArgs.size() < 4)
|
||||
Log.report(logvisor::Fatal, "Mode4 UV anim requires 4 arguments");
|
||||
Log.report(logvisor::Fatal, fmt("Mode4 UV anim requires 4 arguments"));
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
vals[2] = gameArgs[2].simd[0];
|
||||
|
@ -1018,7 +1018,7 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
} else if (!gameFunction.compare("RetroUVMode5Node")) {
|
||||
mode = Mode::VStrip;
|
||||
if (gameArgs.size() < 4)
|
||||
Log.report(logvisor::Fatal, "Mode5 UV anim requires 4 arguments");
|
||||
Log.report(logvisor::Fatal, fmt("Mode5 UV anim requires 4 arguments"));
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
vals[2] = gameArgs[2].simd[0];
|
||||
|
@ -1028,11 +1028,11 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
|
|||
else if (!gameFunction.compare("RetroUVMode7NodeN")) {
|
||||
mode = Mode::CylinderEnvironment;
|
||||
if (gameArgs.size() < 2)
|
||||
Log.report(logvisor::Fatal, "Mode7 UV anim requires 2 arguments");
|
||||
Log.report(logvisor::Fatal, fmt("Mode7 UV anim requires 2 arguments"));
|
||||
vals[0] = gameArgs[0].simd[0];
|
||||
vals[1] = gameArgs[1].simd[0];
|
||||
} else
|
||||
Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str());
|
||||
Log.report(logvisor::Fatal, fmt("unsupported UV anim '{}'"), gameFunction);
|
||||
}
|
||||
|
||||
template <class Op>
|
||||
|
|
|
@ -506,9 +506,9 @@ struct MaterialSet : BigDNA {
|
|||
continue;
|
||||
}
|
||||
if (setIdx < 0)
|
||||
texEntry->name = hecl::Format("%s_%d_%d", prefix, matIdx, stageIdx);
|
||||
texEntry->name = fmt::format(fmt("{}_{}_{}"), prefix, matIdx, stageIdx);
|
||||
else
|
||||
texEntry->name = hecl::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
|
||||
texEntry->name = fmt::format(fmt("{}_{}_{}_{}"), prefix, setIdx, matIdx, stageIdx);
|
||||
|
||||
if (mat.flags.lightmap() && stageIdx == 0) {
|
||||
texEntry->name += "light";
|
||||
|
|
|
@ -8,7 +8,7 @@ void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint
|
|||
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);
|
||||
os.format(fmt("vert[dvert_lay][{}] = {}\n"), cinf.getBoneIdxFromId(weight.boneId), weight.weight);
|
||||
accum += rule.vertCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,8 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
|||
r.emplace(songsPath.getAbsolutePath());
|
||||
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
|
||||
r = std::nullopt;
|
||||
char id[16];
|
||||
snprintf(id, 16, "%04X", head.midiSetupId);
|
||||
ydw.writeString(id, hecl::Format("../MidiData/%s", midPath.getLastComponentUTF8().data()));
|
||||
ydw.writeString(fmt::format(fmt("{:04X}"), head.midiSetupId).c_str(),
|
||||
fmt::format(fmt("../MidiData/{}"), midPath.getLastComponentUTF8()));
|
||||
athena::io::FileWriter w(songsPath.getAbsolutePath());
|
||||
ydw.finish(&w);
|
||||
|
||||
|
|
|
@ -30,16 +30,16 @@ void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const
|
|||
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(
|
||||
os.format(fmt(
|
||||
"import bpy\n"
|
||||
"import bmesh\n"
|
||||
"from mathutils import Vector, Matrix\n"
|
||||
"\n"
|
||||
"bpy.context.scene.name = '%s'\n"
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"# Clear Scene\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n",
|
||||
entryName.data());
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"),
|
||||
entryName);
|
||||
|
||||
DeafBabe::BlenderInit(os);
|
||||
atInt32 idx = 0;
|
||||
|
|
|
@ -150,8 +150,7 @@ void PAKBridge::build() {
|
|||
std::string idStr = area.areaMREAId.toString();
|
||||
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||
}
|
||||
hecl::SystemChar num[16];
|
||||
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
|
||||
hecl::SystemString num = fmt::format(fmt(_SYS_STR("{:02d} ")), ai);
|
||||
areaDeps.name = num + areaDeps.name;
|
||||
|
||||
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
|
||||
|
@ -175,7 +174,7 @@ void PAKBridge::build() {
|
|||
layer.active = layerFlags.flags >> (l - 1) & 0x1;
|
||||
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
|
||||
|
||||
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l - 1);
|
||||
num = fmt::format(fmt(_SYS_STR("{:02d} ")), l - 1);
|
||||
layer.name = num + layer.name;
|
||||
|
||||
layer.resources.reserve(area.depLayers[l] - r);
|
||||
|
@ -208,37 +207,37 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
|||
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
|
||||
charAssoc.m_cmdlRigs[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[ci.cskr] =
|
||||
std::make_pair(entry.second.id, hecl::Format("%s.CSKR", ci.name.c_str()));
|
||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.CSKR"), ci.name));
|
||||
charAssoc.m_cskrCinfToCharacter[ci.cinf] =
|
||||
std::make_pair(entry.second.id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32()));
|
||||
std::make_pair(entry.second.id, fmt::format(fmt("CINF_{}.CINF"), ci.cinf));
|
||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
|
||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
|
||||
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
|
||||
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_model", entry.first.toUint32(), ci.name.c_str());
|
||||
cskrEnt->name = hecl::Format("ANCS_%08X_%s_skin", entry.first.toUint32(), ci.name.c_str());
|
||||
cinfEnt->name = hecl::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
|
||||
if (ci.cmdlIce && ci.cskrIce) {
|
||||
cmdlEnt->name = fmt::format(fmt("ANCS_{}_{}_model"), entry.first, ci.name);
|
||||
cskrEnt->name = fmt::format(fmt("ANCS_{}_{}_skin"), entry.first, ci.name);
|
||||
cinfEnt->name = fmt::format(fmt("ANCS_{}_{}_skel"), entry.first, ci.name);
|
||||
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
|
||||
charAssoc.m_cmdlRigs[ci.cmdlIce] = std::make_pair(ci.cskrIce, ci.cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[ci.cskrIce] =
|
||||
std::make_pair(entry.second.id, hecl::Format("%s.ICE.CSKR", ci.name.c_str()));
|
||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.ICE.CSKR"), ci.name));
|
||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
|
||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
|
||||
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_icemodel", entry.first.toUint32(), ci.name.c_str());
|
||||
cskrEnt->name = hecl::Format("ANCS_%08X_%s_iceskin", entry.first.toUint32(), ci.name.c_str());
|
||||
cmdlEnt->name = fmt::format(fmt("ANCS_{}_{}_icemodel"), entry.first, ci.name);
|
||||
cskrEnt->name = fmt::format(fmt("ANCS_{}_{}_iceskin"), entry.first, ci.name);
|
||||
}
|
||||
}
|
||||
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
|
||||
ancs.getAnimationResInfo(&pakRouter, animInfo);
|
||||
for (auto& ae : animInfo) {
|
||||
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId);
|
||||
animEnt->name = hecl::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str());
|
||||
animEnt->name = fmt::format(fmt("ANCS_{}_{}"), entry.first, ae.second.name);
|
||||
charAssoc.m_cskrCinfToCharacter[ae.second.animId] =
|
||||
std::make_pair(entry.second.id, hecl::Format("%s.ANIM", ae.second.name.c_str()));
|
||||
if (ae.second.evntId) {
|
||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.ANIM"), ae.second.name));
|
||||
if (ae.second.evntId.isValid()) {
|
||||
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.evntId);
|
||||
evntEnt->name = hecl::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str());
|
||||
evntEnt->name = fmt::format(fmt("ANCS_{}_{}_evnt"), entry.first, ae.second.name);
|
||||
charAssoc.m_cskrCinfToCharacter[ae.second.evntId] =
|
||||
std::make_pair(entry.second.id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str()));
|
||||
std::make_pair(entry.second.id, fmt::format(fmt("{}.evnt.yaml"), ae.second.name));
|
||||
}
|
||||
}
|
||||
} else if (entry.second.type == FOURCC('MREA')) {
|
||||
|
@ -254,7 +253,7 @@ void PAKBridge::addPATHToMREA(PAKRouter<PAKBridge>& pakRouter,
|
|||
if (entry.second.type == FOURCC('MREA')) {
|
||||
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
|
||||
UniqueID32 pathID = MREA::GetPATHId(rs);
|
||||
if (pathID)
|
||||
if (pathID.isValid())
|
||||
pathToMrea[pathID] = entry.first;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +273,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
|||
}
|
||||
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
|
||||
|
||||
if (mlvl.worldNameId)
|
||||
if (mlvl.worldNameId.isValid())
|
||||
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
|
||||
|
||||
for (const MLVL::Area& area : mlvl.areas) {
|
||||
|
@ -284,17 +283,17 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
|||
const PAK::Entry* areaEntry = pakRouter.lookupEntry(area.areaMREAId, &areaNode);
|
||||
PAKEntryReadStream rs = areaEntry->beginReadStream(*areaNode);
|
||||
UniqueID32 pathId = MREA::GetPATHId(rs);
|
||||
if (pathId)
|
||||
if (pathId.isValid())
|
||||
addTo[pathId] = zeus::CMatrix4f(area.transformMtx[0], area.transformMtx[1], area.transformMtx[2], BottomRow)
|
||||
.transposed();
|
||||
}
|
||||
|
||||
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
|
||||
if (area.areaNameId)
|
||||
if (area.areaNameId.isValid())
|
||||
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
|
||||
}
|
||||
|
||||
if (mlvl.worldMap) {
|
||||
if (mlvl.worldMap.isValid()) {
|
||||
const nod::Node* mapNode;
|
||||
const PAK::Entry* mapEntry = pakRouter.lookupEntry(mlvl.worldMap, &mapNode);
|
||||
if (mapEntry) {
|
||||
|
@ -319,7 +318,7 @@ void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
|
|||
}
|
||||
|
||||
ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry) {
|
||||
switch (entry.type) {
|
||||
switch (entry.type.toUint32()) {
|
||||
case SBIG('STRG'):
|
||||
return {STRG::Extract, {_SYS_STR(".yaml")}};
|
||||
case SBIG('SCAN'):
|
||||
|
|
|
@ -52,7 +52,7 @@ void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_read
|
|||
type.read(__dna_reader);
|
||||
/* header */
|
||||
header.read(__dna_reader);
|
||||
switch (type) {
|
||||
switch (type.toUint32()) {
|
||||
case SBIG('BWIG'):
|
||||
widgetInfo.reset(new BWIGInfo);
|
||||
break;
|
||||
|
@ -93,7 +93,7 @@ void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_read
|
|||
widgetInfo.reset(new SLGPInfo);
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Unsupported FRME widget type %.8X"), type.toUint32());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unsupported FRME widget type {}")), type);
|
||||
}
|
||||
|
||||
/* widgetInfo */
|
||||
|
@ -174,7 +174,7 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
|
|||
else if (projectionType == ProjectionType::Orthographic)
|
||||
projection.reset(new OrthographicProjection);
|
||||
else
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection mode! %i"), int(projectionType));
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Invalid CAMR projection mode! {}")), int(projectionType));
|
||||
|
||||
projection->read(__dna_reader);
|
||||
}
|
||||
|
@ -182,9 +182,9 @@ void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader&
|
|||
template <>
|
||||
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer) {
|
||||
if (!projection)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Invalid CAMR projection object!"));
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Invalid CAMR projection object!")));
|
||||
if (projection->type != projectionType)
|
||||
Log.report(logvisor::Fatal, _SYS_STR("CAMR projection type does not match actual projection type!"));
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("CAMR projection type does not match actual projection type!")));
|
||||
|
||||
__dna_writer.writeUint32Big(atUint32(projectionType));
|
||||
projection->write(__dna_writer);
|
||||
|
@ -308,14 +308,14 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
" bpy.context.scene.collection.objects.link(ob_new)\n"
|
||||
" return ob_new\n";
|
||||
|
||||
os.format(
|
||||
"bpy.context.scene.name = '%s'\n"
|
||||
os.format(fmt(
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.render.resolution_x = 640\n"
|
||||
"bpy.context.scene.render.resolution_y = 480\n"
|
||||
"bpy.context.scene.world.use_nodes = True\n"
|
||||
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
||||
"bg_node.inputs[1].default_value = 0.0\n",
|
||||
pakRouter.getBestEntryName(entry).c_str());
|
||||
"bg_node.inputs[1].default_value = 0.0\n"),
|
||||
pakRouter.getBestEntryName(entry));
|
||||
|
||||
int pIdx = 0;
|
||||
for (const FRME::Widget& w : frme.widgets) {
|
||||
|
@ -323,34 +323,34 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
"angle = Quaternion((1.0, 0.0, 0.0), 0)\n";
|
||||
if (w.type == SBIG('CAMR')) {
|
||||
using CAMRInfo = Widget::CAMRInfo;
|
||||
os.format(
|
||||
"cam = bpy.data.cameras.new(name='%s')\n"
|
||||
"binding = cam\n",
|
||||
w.header.name.c_str());
|
||||
os.format(fmt(
|
||||
"cam = bpy.data.cameras.new(name='{}')\n"
|
||||
"binding = cam\n"),
|
||||
w.header.name);
|
||||
if (CAMRInfo* info = static_cast<CAMRInfo*>(w.widgetInfo.get())) {
|
||||
if (info->projectionType == CAMRInfo::ProjectionType::Orthographic) {
|
||||
CAMRInfo::OrthographicProjection* proj =
|
||||
static_cast<CAMRInfo::OrthographicProjection*>(info->projection.get());
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"cam.type = 'ORTHO'\n"
|
||||
"cam.ortho_scale = %f\n"
|
||||
"cam.clip_start = %f\n"
|
||||
"cam.clip_end = %f\n",
|
||||
"cam.ortho_scale = {}\n"
|
||||
"cam.clip_start = {}\n"
|
||||
"cam.clip_end = {}\n"),
|
||||
std::fabs(proj->right - proj->left), proj->znear, proj->zfar);
|
||||
} else if (info->projectionType == CAMRInfo::ProjectionType::Perspective) {
|
||||
CAMRInfo::PerspectiveProjection* proj = static_cast<CAMRInfo::PerspectiveProjection*>(info->projection.get());
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"cam.type = 'PERSP'\n"
|
||||
"cam.lens_unit = 'FOV'\n"
|
||||
"cam.clip_start = %f\n"
|
||||
"cam.clip_end = %f\n"
|
||||
"bpy.context.scene.render.resolution_x = 480 * %f\n",
|
||||
"cam.clip_start = {}\n"
|
||||
"cam.clip_end = {}\n"
|
||||
"bpy.context.scene.render.resolution_x = 480 * {}\n"),
|
||||
proj->znear, proj->zfar, proj->aspect);
|
||||
if (proj->aspect > 1.f)
|
||||
os.format("cam.angle = math.atan2(%f, 1.0 / math.tan(math.radians(%f / 2.0))) * 2.0\n", proj->aspect,
|
||||
os.format(fmt("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"), proj->aspect,
|
||||
proj->fov);
|
||||
else
|
||||
os.format("cam.angle = math.radians(%f)\n", proj->fov);
|
||||
os.format(fmt("cam.angle = math.radians({})\n"), proj->fov);
|
||||
}
|
||||
}
|
||||
os << "angle = Quaternion((1.0, 0.0, 0.0), math.radians(90.0))\n";
|
||||
|
@ -360,9 +360,9 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
switch (info->type) {
|
||||
case LITEInfo::ELightType::LocalAmbient: {
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format(
|
||||
"bg_node.inputs[0].default_value = (%f,%f,%f,1.0)\n"
|
||||
"bg_node.inputs[1].default_value = %f\n",
|
||||
os.format(fmt(
|
||||
"bg_node.inputs[0].default_value = ({},{},{},1.0)\n"
|
||||
"bg_node.inputs[1].default_value = {}\n"),
|
||||
colorF[0], colorF[1], colorF[2], info->distQ / 8.0);
|
||||
break;
|
||||
}
|
||||
|
@ -372,23 +372,23 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
[[fallthrough]];
|
||||
default: {
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format(
|
||||
"lamp = bpy.data.lights.new(name='%s', type='POINT')\n"
|
||||
"lamp.color = (%f, %f, %f)\n"
|
||||
"lamp.hecl_falloff_constant = %f\n"
|
||||
"lamp.hecl_falloff_linear = %f\n"
|
||||
"lamp.hecl_falloff_quadratic = %f\n"
|
||||
"lamp.retro_light_angle_constant = %f\n"
|
||||
"lamp.retro_light_angle_linear = %f\n"
|
||||
"lamp.retro_light_angle_quadratic = %f\n"
|
||||
"lamp.retro_light_index = %d\n"
|
||||
"binding = lamp\n",
|
||||
w.header.name.c_str(), colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC,
|
||||
os.format(fmt(
|
||||
"lamp = bpy.data.lights.new(name='{}', type='POINT')\n"
|
||||
"lamp.color = ({}, {}, {})\n"
|
||||
"lamp.hecl_falloff_constant = {}\n"
|
||||
"lamp.hecl_falloff_linear = {}\n"
|
||||
"lamp.hecl_falloff_quadratic = {}\n"
|
||||
"lamp.retro_light_angle_constant = {}\n"
|
||||
"lamp.retro_light_angle_linear = {}\n"
|
||||
"lamp.retro_light_angle_quadratic = {}\n"
|
||||
"lamp.retro_light_index = {}\n"
|
||||
"binding = lamp\n"),
|
||||
w.header.name, colorF[0], colorF[1], colorF[2], info->distC, info->distL, info->distQ, info->angC,
|
||||
info->angL, info->angQ, info->loadedIdx);
|
||||
if (info->type == LITEInfo::ELightType::Spot)
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"lamp.type = 'SPOT'\n"
|
||||
"lamp.spot_size = %f\n",
|
||||
"lamp.spot_size = {}\n"),
|
||||
info->cutoff);
|
||||
else if (info->type == LITEInfo::ELightType::Directional)
|
||||
os << "lamp.type = 'SUN'\n";
|
||||
|
@ -400,7 +400,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
if (IMGPInfo* info = static_cast<IMGPInfo*>(w.widgetInfo.get())) {
|
||||
std::string texName;
|
||||
hecl::SystemString resPath;
|
||||
if (info->texture) {
|
||||
if (info->texture.isValid()) {
|
||||
texName = pakRouter.getBestEntryName(info->texture);
|
||||
const nod::Node* node;
|
||||
const PAKRouter<PAKBridge>::EntryType* texEntry = pakRouter.lookupEntry(info->texture, &node);
|
||||
|
@ -415,19 +415,19 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
|
||||
if (resPath.size()) {
|
||||
hecl::SystemUTF8Conv resPathView(resPath);
|
||||
os.format(
|
||||
"if '%s' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
os.format(fmt(
|
||||
"if '{}' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['{}']\n"
|
||||
"else:\n"
|
||||
" image = bpy.data.images.load('''//%s''')\n"
|
||||
" image.name = '%s'\n",
|
||||
texName.c_str(), texName.c_str(), resPathView.c_str(), texName.c_str());
|
||||
" image = bpy.data.images.load('''//{}''')\n"
|
||||
" image.name = '{}'\n"),
|
||||
texName, texName, resPathView, texName);
|
||||
} else {
|
||||
os << "image = None\n";
|
||||
}
|
||||
|
||||
os.format(
|
||||
"material = bpy.data.materials.new('%s')\n"
|
||||
os.format(fmt(
|
||||
"material = bpy.data.materials.new('{}')\n"
|
||||
"material.use_nodes = True\n"
|
||||
"new_nodetree = material.node_tree\n"
|
||||
"for n in new_nodetree.nodes:\n"
|
||||
|
@ -435,8 +435,8 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
"tex_node = new_nodetree.nodes.new('ShaderNodeTexImage')\n"
|
||||
"tex_node.image = image\n"
|
||||
"bm = bmesh.new()\n"
|
||||
"verts = []\n",
|
||||
w.header.name.c_str());
|
||||
"verts = []\n"),
|
||||
w.header.name);
|
||||
|
||||
for (uint32_t i = 0; i < info->quadCoordCount; ++i) {
|
||||
int ti;
|
||||
|
@ -447,7 +447,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
else
|
||||
ti = i;
|
||||
zeus::simd_floats f(info->quadCoords[ti].simd);
|
||||
os.format("verts.append(bm.verts.new((%f,%f,%f)))\n", f[0], f[1], f[2]);
|
||||
os.format(fmt("verts.append(bm.verts.new(({},{},{})))\n"), f[0], f[1], f[2]);
|
||||
}
|
||||
os << "bm.faces.new(verts)\n"
|
||||
"bm.loops.layers.uv.new('UV')\n"
|
||||
|
@ -461,36 +461,36 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
else
|
||||
ti = i;
|
||||
zeus::simd_floats f(info->uvCoords[ti].simd);
|
||||
os.format("bm.verts[%d].link_loops[0][bm.loops.layers.uv[0]].uv = (%f,%f)\n", i, f[0], f[1]);
|
||||
os.format(fmt("bm.verts[{}].link_loops[0][bm.loops.layers.uv[0]].uv = ({},{})\n"), i, f[0], f[1]);
|
||||
}
|
||||
os.format(
|
||||
"binding = bpy.data.meshes.new('%s')\n"
|
||||
os.format(fmt(
|
||||
"binding = bpy.data.meshes.new('{}')\n"
|
||||
"bm.to_mesh(binding)\n"
|
||||
"bm.free()\n"
|
||||
"binding.materials.append(material)\n",
|
||||
w.header.name.c_str());
|
||||
"binding.materials.append(material)\n"),
|
||||
w.header.name);
|
||||
}
|
||||
}
|
||||
|
||||
zeus::simd_floats colorF(w.header.color.simd);
|
||||
os.format(
|
||||
"frme_obj = bpy.data.objects.new(name='%s', object_data=binding)\n"
|
||||
"frme_obj.pass_index = %d\n"
|
||||
"parentName = '%s'\n"
|
||||
"frme_obj.retro_widget_type = 'RETRO_%.4s'\n"
|
||||
"frme_obj.retro_widget_use_anim_controller = %s\n"
|
||||
"frme_obj.retro_widget_default_visible = %s\n"
|
||||
"frme_obj.retro_widget_default_active = %s\n"
|
||||
"frme_obj.retro_widget_cull_faces = %s\n"
|
||||
"frme_obj.retro_widget_color = (%f,%f,%f,%f)\n"
|
||||
"frme_obj.retro_widget_model_draw_flags = bpy.types.Object.retro_widget_model_draw_flags[1]['items'][%i][0]\n"
|
||||
"frme_obj.retro_widget_is_worker = %s\n"
|
||||
"frme_obj.retro_widget_worker_id = %d\n"
|
||||
os.format(fmt(
|
||||
"frme_obj = bpy.data.objects.new(name='{}', object_data=binding)\n"
|
||||
"frme_obj.pass_index = {}\n"
|
||||
"parentName = '{}'\n"
|
||||
"frme_obj.retro_widget_type = 'RETRO_{}'\n"
|
||||
"frme_obj.retro_widget_use_anim_controller = {}\n"
|
||||
"frme_obj.retro_widget_default_visible = {}\n"
|
||||
"frme_obj.retro_widget_default_active = {}\n"
|
||||
"frme_obj.retro_widget_cull_faces = {}\n"
|
||||
"frme_obj.retro_widget_color = ({},{},{},{})\n"
|
||||
"frme_obj.retro_widget_model_draw_flags = bpy.types.Object.retro_widget_model_draw_flags[1]['items'][{}][0]\n"
|
||||
"frme_obj.retro_widget_is_worker = {}\n"
|
||||
"frme_obj.retro_widget_worker_id = {}\n"
|
||||
"if parentName not in bpy.data.objects:\n"
|
||||
" frme_obj.retro_widget_parent = parentName\n"
|
||||
"else:\n"
|
||||
" frme_obj.parent = bpy.data.objects[parentName]\n",
|
||||
w.header.name.c_str(), pIdx++, w.header.parent.c_str(), w.type.getChars(),
|
||||
" frme_obj.parent = bpy.data.objects[parentName]\n"),
|
||||
w.header.name, pIdx++, w.header.parent, w.type,
|
||||
w.header.useAnimController ? "True" : "False", w.header.defaultVisible ? "True" : "False",
|
||||
w.header.defaultActive ? "True" : "False", w.header.cullFaces ? "True" : "False", colorF[0], colorF[1],
|
||||
colorF[2], colorF[3], w.header.modelDrawFlags, w.isWorker ? "True" : "False", w.workerId);
|
||||
|
@ -503,7 +503,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
|
||||
os.linkBlend(modelPath.getAbsolutePathUTF8().data(), pakRouter.getBestEntryName(*cmdlE).c_str(), true);
|
||||
|
||||
os.format("frme_obj.retro_model_light_mask = %d\n", info->lightMask);
|
||||
os.format(fmt("frme_obj.retro_model_light_mask = {}\n"), info->lightMask);
|
||||
os << "print(obj.name)\n"
|
||||
"copy_obj = duplicateObject(obj)\n"
|
||||
"copy_obj.parent = frme_obj\n"
|
||||
|
@ -518,9 +518,9 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
using PANEInfo = Widget::PANEInfo;
|
||||
if (PANEInfo* info = static_cast<PANEInfo*>(w.widgetInfo.get())) {
|
||||
zeus::simd_floats f(info->scaleCenter.simd);
|
||||
os.format(
|
||||
"frme_obj.retro_pane_dimensions = (%f,%f)\n"
|
||||
"frme_obj.retro_pane_scale_center = (%f,%f,%f)\n",
|
||||
os.format(fmt(
|
||||
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
||||
"frme_obj.retro_pane_scale_center = ({},{},{})\n"),
|
||||
info->xDim, info->zDim, f[0], f[1], f[2]);
|
||||
}
|
||||
} else if (w.type == SBIG('TXPN')) {
|
||||
|
@ -535,49 +535,49 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
zeus::simd_floats fillF(info->fillColor.simd);
|
||||
zeus::simd_floats outlineF(info->outlineColor.simd);
|
||||
zeus::simd_floats extentF(info->blockExtent.simd);
|
||||
os.format(
|
||||
"frme_obj.retro_pane_dimensions = (%f,%f)\n"
|
||||
"frme_obj.retro_pane_scale_center = (%f,%f,%f)\n"
|
||||
"frme_obj.retro_textpane_font_path = '%s'\n"
|
||||
"frme_obj.retro_textpane_word_wrap = %s\n"
|
||||
"frme_obj.retro_textpane_horizontal = %s\n"
|
||||
"frme_obj.retro_textpane_fill_color = (%f,%f,%f,%f)\n"
|
||||
"frme_obj.retro_textpane_outline_color = (%f,%f,%f,%f)\n"
|
||||
"frme_obj.retro_textpane_block_extent = (%f,%f)\n"
|
||||
"frme_obj.retro_textpane_jp_font_path = '%s'\n"
|
||||
"frme_obj.retro_textpane_jp_font_scale = (%d,%d)\n"
|
||||
os.format(fmt(
|
||||
"frme_obj.retro_pane_dimensions = ({},{})\n"
|
||||
"frme_obj.retro_pane_scale_center = ({},{},{})\n"
|
||||
"frme_obj.retro_textpane_font_path = '{}'\n"
|
||||
"frme_obj.retro_textpane_word_wrap = {}\n"
|
||||
"frme_obj.retro_textpane_horizontal = {}\n"
|
||||
"frme_obj.retro_textpane_fill_color = ({},{},{},{})\n"
|
||||
"frme_obj.retro_textpane_outline_color = ({},{},{},{})\n"
|
||||
"frme_obj.retro_textpane_block_extent = ({},{})\n"
|
||||
"frme_obj.retro_textpane_jp_font_path = '{}'\n"
|
||||
"frme_obj.retro_textpane_jp_font_scale = ({},{})\n"
|
||||
"frme_obj.retro_textpane_hjustification = "
|
||||
"bpy.types.Object.retro_textpane_hjustification[1]['items'][%d][0]\n"
|
||||
"bpy.types.Object.retro_textpane_hjustification[1]['items'][{}][0]\n"
|
||||
"frme_obj.retro_textpane_vjustification = "
|
||||
"bpy.types.Object.retro_textpane_vjustification[1]['items'][%d][0]\n",
|
||||
info->xDim, info->zDim, scaleF[0], scaleF[1], scaleF[2], fontPath.getRelativePathUTF8().data(),
|
||||
"bpy.types.Object.retro_textpane_vjustification[1]['items'][{}][0]\n"),
|
||||
info->xDim, info->zDim, scaleF[0], scaleF[1], scaleF[2], fontPath.getRelativePathUTF8(),
|
||||
info->wordWrap ? "True" : "False", info->horizontal ? "True" : "False", fillF[0], fillF[1], fillF[2],
|
||||
fillF[3], outlineF[0], outlineF[1], outlineF[2], outlineF[3], extentF[0], extentF[1],
|
||||
jpFontPath.getRelativePathUTF8().data(), info->jpnPointScale[0], info->jpnPointScale[1],
|
||||
jpFontPath.getRelativePathUTF8(), info->jpnPointScale[0], info->jpnPointScale[1],
|
||||
int(info->justification), int(info->verticalJustification));
|
||||
}
|
||||
} else if (w.type == SBIG('TBGP')) {
|
||||
using TBGPInfo = Widget::TBGPInfo;
|
||||
if (TBGPInfo* info = static_cast<TBGPInfo*>(w.widgetInfo.get())) {
|
||||
os.format(
|
||||
"frme_obj.retro_tablegroup_elem_count = %d\n"
|
||||
"frme_obj.retro_tablegroup_elem_default = %d\n"
|
||||
"frme_obj.retro_tablegroup_wraparound = %s\n",
|
||||
os.format(fmt(
|
||||
"frme_obj.retro_tablegroup_elem_count = {}\n"
|
||||
"frme_obj.retro_tablegroup_elem_default = {}\n"
|
||||
"frme_obj.retro_tablegroup_wraparound = {}\n"),
|
||||
info->elementCount, info->defaultSelection, info->selectWraparound ? "True" : "False");
|
||||
}
|
||||
} else if (w.type == SBIG('GRUP')) {
|
||||
using GRUPInfo = Widget::GRUPInfo;
|
||||
if (GRUPInfo* info = static_cast<GRUPInfo*>(w.widgetInfo.get())) {
|
||||
os.format("frme_obj.retro_group_default_worker = %d\n", info->defaultWorker);
|
||||
os.format(fmt("frme_obj.retro_group_default_worker = {}\n"), info->defaultWorker);
|
||||
}
|
||||
} else if (w.type == SBIG('SLGP')) {
|
||||
using SLGPInfo = Widget::SLGPInfo;
|
||||
if (SLGPInfo* info = static_cast<SLGPInfo*>(w.widgetInfo.get())) {
|
||||
os.format(
|
||||
"frme_obj.retro_slider_min = %f\n"
|
||||
"frme_obj.retro_slider_max = %f\n"
|
||||
"frme_obj.retro_slider_default = %f\n"
|
||||
"frme_obj.retro_slider_increment = %f\n",
|
||||
os.format(fmt(
|
||||
"frme_obj.retro_slider_min = {}\n"
|
||||
"frme_obj.retro_slider_max = {}\n"
|
||||
"frme_obj.retro_slider_default = {}\n"
|
||||
"frme_obj.retro_slider_increment = {}\n"),
|
||||
info->min, info->max, info->cur, info->increment);
|
||||
}
|
||||
} else if (w.type == SBIG('ENRG')) {
|
||||
|
@ -585,15 +585,15 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
if (ENRGInfo* info = static_cast<ENRGInfo*>(w.widgetInfo.get())) {
|
||||
hecl::ProjectPath txtrPath = pakRouter.getWorking(info->texture);
|
||||
if (txtrPath)
|
||||
os.format("frme_obj.retro_energybar_texture_path = '%s'\n", txtrPath.getRelativePathUTF8().data());
|
||||
os.format(fmt("frme_obj.retro_energybar_texture_path = '{}'\n"), txtrPath.getRelativePathUTF8());
|
||||
}
|
||||
} else if (w.type == SBIG('METR')) {
|
||||
using METRInfo = Widget::METRInfo;
|
||||
if (METRInfo* info = static_cast<METRInfo*>(w.widgetInfo.get())) {
|
||||
os.format(
|
||||
"frme_obj.retro_meter_no_round_up = %s\n"
|
||||
"frme_obj.retro_meter_max_capacity = %d\n"
|
||||
"frme_obj.retro_meter_worker_count = %d\n",
|
||||
os.format(fmt(
|
||||
"frme_obj.retro_meter_no_round_up = {}\n"
|
||||
"frme_obj.retro_meter_max_capacity = {}\n"
|
||||
"frme_obj.retro_meter_worker_count = {}\n"),
|
||||
info->noRoundUp ? "True" : "False", info->maxCapacity, info->workerCount);
|
||||
}
|
||||
}
|
||||
|
@ -602,14 +602,14 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
for (int i = 0; i < 3; ++i)
|
||||
w.basis[i].simd.copy_to(xfMtxF[i]);
|
||||
zeus::simd_floats originF(w.origin.simd);
|
||||
os.format(
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
os.format(fmt(
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"frme_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"frme_obj.location = mtxd[0]\n"
|
||||
"frme_obj.rotation_quaternion = mtxd[1] @ angle\n"
|
||||
"frme_obj.scale = mtxd[2]\n"
|
||||
"bpy.context.scene.collection.objects.link(frme_obj)\n",
|
||||
"bpy.context.scene.collection.objects.link(frme_obj)\n"),
|
||||
xfMtxF[0][0], xfMtxF[0][1], xfMtxF[0][2], originF[0], xfMtxF[1][0], xfMtxF[1][1], xfMtxF[1][2], originF[1],
|
||||
xfMtxF[2][0], xfMtxF[2][1], xfMtxF[2][2], originF[2]);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
if (!areaPath.isFile())
|
||||
continue;
|
||||
|
||||
Log.report(logvisor::Info, _SYS_STR("Visiting %s"), area.path.getRelativePath().data());
|
||||
Log.report(logvisor::Info, fmt(_SYS_STR("Visiting {}")), area.path.getRelativePath());
|
||||
|
||||
hecl::ProjectPath memRelayPath(area.path, _SYS_STR("!memoryrelays.yaml"));
|
||||
|
||||
|
@ -290,7 +290,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
}
|
||||
|
||||
if (!areaInit)
|
||||
Log.report(logvisor::Info, _SYS_STR("No layer directories for area %s"), area.path.getRelativePath().data());
|
||||
Log.report(logvisor::Info, fmt(_SYS_STR("No layer directories for area {}")), area.path.getRelativePath());
|
||||
|
||||
/* Build deplist */
|
||||
MLVL::Area& areaOut = mlvl.areas.back();
|
||||
|
@ -486,7 +486,7 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath, const World& wld) {
|
|||
|
||||
/* Cull duplicate scans and add to list */
|
||||
for (const Scan& scan : scans) {
|
||||
if (!scan.scanId)
|
||||
if (!scan.scanId.isValid())
|
||||
continue;
|
||||
if (addedScans.find(scan.scanId) == addedScans.cend()) {
|
||||
addedScans.insert(scan.scanId);
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace DataSpec::DNAMP1 {
|
|||
void MREA::ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
||||
atUint32 bdMagic = rs.readUint32Big();
|
||||
if (bdMagic != 0xBABEDEAD)
|
||||
Log.report(logvisor::Fatal, "invalid BABEDEAD magic");
|
||||
Log.report(logvisor::Fatal, fmt("invalid BABEDEAD magic"));
|
||||
os << "bpy.context.scene.world.use_nodes = True\n"
|
||||
"bg_node = bpy.context.scene.world.node_tree.nodes['Background']\n"
|
||||
"bg_node.inputs[1].default_value = 0.0\n";
|
||||
|
@ -202,8 +202,8 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
"from mathutils import Vector\n"
|
||||
"bpy.context.scene.render.fps = 60\n"
|
||||
"\n";
|
||||
os.format("bpy.context.scene.name = '%s'\n",
|
||||
pakRouter.getBestEntryName(entry, false).c_str());
|
||||
os.format(fmt("bpy.context.scene.name = '{}'\n"),
|
||||
pakRouter.getBestEntryName(entry, false));
|
||||
DNACMDL::InitGeomBlenderContext(os, dataSpec.getMasterShaderPath());
|
||||
MaterialSet::RegisterMaterialProps(os);
|
||||
os << "# Clear Scene\n"
|
||||
|
@ -244,11 +244,11 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
|||
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
|
||||
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>(
|
||||
os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
|
||||
os.format(
|
||||
"obj.retro_disable_enviro_visor = %s\n"
|
||||
"obj.retro_disable_thermal_visor = %s\n"
|
||||
"obj.retro_disable_xray_visor = %s\n"
|
||||
"obj.retro_thermal_level = '%s'\n",
|
||||
os.format(fmt(
|
||||
"obj.retro_disable_enviro_visor = {}\n"
|
||||
"obj.retro_disable_thermal_visor = {}\n"
|
||||
"obj.retro_disable_xray_visor = {}\n"
|
||||
"obj.retro_thermal_level = '{}'\n"),
|
||||
mHeader.visorFlags.disableEnviro() ? "True" : "False", mHeader.visorFlags.disableThermal() ? "True" : "False",
|
||||
mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr());
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ void MREA::Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKB
|
|||
atUint64 secStart = rs.position();
|
||||
MaterialSet matSet;
|
||||
matSet.read(rs);
|
||||
matSet.nameTextures(pakRouter, hecl::Format("MREA_%s", entry.id.toString().c_str()).c_str(), -1);
|
||||
matSet.nameTextures(pakRouter, fmt::format(fmt("MREA_{}"), entry.id).c_str(), -1);
|
||||
rs.seek(secStart + head.secSizes[0], athena::Begin);
|
||||
|
||||
/* Skip to SCLY */
|
||||
|
@ -499,7 +499,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
/* SCLY */
|
||||
DNAMP1::SCLY sclyData = {};
|
||||
{
|
||||
sclyData.fourCC = 'SCLY';
|
||||
sclyData.fourCC = FOURCC('SCLY');
|
||||
sclyData.version = 1;
|
||||
for (const hecl::ProjectPath& layer : layerScriptPaths) {
|
||||
athena::io::FileReader freader(layer.getAbsolutePath());
|
||||
|
@ -699,19 +699,18 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
#if _WIN32
|
||||
VisiGenPath += _SYS_STR(".exe");
|
||||
#endif
|
||||
hecl::SystemChar thrIdx[16];
|
||||
hecl::SNPrintf(thrIdx, 16, _SYS_STR("%d"), hecl::ClientProcess::GetThreadWorkerIdx());
|
||||
hecl::SystemChar parPid[32];
|
||||
hecl::SystemString thrIdx = fmt::format(fmt(_SYS_STR("{}")), hecl::ClientProcess::GetThreadWorkerIdx());
|
||||
hecl::SystemString parPid;
|
||||
#if _WIN32
|
||||
hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
||||
parPid = fmt::format(fmt(_SYS_STR("{}")), reinterpret_cast<unsigned long long>(GetCurrentProcess()));
|
||||
#else
|
||||
hecl::SNPrintf(parPid, 32, _SYS_STR("%lluX"), (unsigned long long)getpid());
|
||||
parPid = fmt::format(fmt(_SYS_STR("{}")), (unsigned long long)getpid());
|
||||
#endif
|
||||
const hecl::SystemChar* args[] = {VisiGenPath.c_str(),
|
||||
visiIntOut.getAbsolutePath().data(),
|
||||
preVisiPath.getAbsolutePath().data(),
|
||||
thrIdx,
|
||||
parPid,
|
||||
thrIdx.c_str(),
|
||||
parPid.c_str(),
|
||||
nullptr};
|
||||
if (0 == hecl::RunProcess(VisiGenPath.c_str(), args)) {
|
||||
athena::io::FileReader r(preVisiPath.getAbsolutePath());
|
||||
|
@ -720,7 +719,7 @@ bool MREA::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
|
|||
r.readBytesToBuf(secs.back().data(), length);
|
||||
visiGood = true;
|
||||
} else {
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Unable to launch %s"), VisiGenPath.c_str());
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to launch {}")), VisiGenPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,7 @@ template <>
|
|||
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||
atUint32 version = reader.readUint32Big();
|
||||
if (version != 0x00030005)
|
||||
Log.report(logvisor::Fatal, "unexpected PAK magic");
|
||||
Log.report(logvisor::Fatal, fmt("unexpected PAK magic"));
|
||||
reader.readUint32Big();
|
||||
|
||||
atUint32 nameCount = reader.readUint32Big();
|
||||
|
|
|
@ -27,7 +27,7 @@ static void OutputOctreeNode(hecl::blender::PyOutStream& os, int idx, const zeus
|
|||
void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName, const zeus::CMatrix4f* xf) {
|
||||
/* Open Py Stream and read sections */
|
||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||
os.format(
|
||||
os <<
|
||||
"import bpy\n"
|
||||
"import bmesh\n"
|
||||
"from mathutils import Vector, Matrix\n"
|
||||
|
@ -38,15 +38,15 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
"material_dict = {}\n"
|
||||
"material_index = []\n"
|
||||
"def make_ground_material(idxMask):\n"
|
||||
" mat = bpy.data.materials.new('Ground %%X' %% idxMask)\n"
|
||||
" mat = bpy.data.materials.new('Ground %X' % idxMask)\n"
|
||||
" mat.diffuse_color = (0.8, 0.460, 0.194, 1.0)\n"
|
||||
" return mat\n"
|
||||
"def make_flyer_material(idxMask):\n"
|
||||
" mat = bpy.data.materials.new('Flyer %%X' %% idxMask)\n"
|
||||
" mat = bpy.data.materials.new('Flyer %X' % idxMask)\n"
|
||||
" mat.diffuse_color = (0.016, 0.8, 0.8, 1.0)\n"
|
||||
" return mat\n"
|
||||
"def make_swimmer_material(idxMask):\n"
|
||||
" mat = bpy.data.materials.new('Swimmer %%X' %% idxMask)\n"
|
||||
" mat = bpy.data.materials.new('Swimmer %X' % idxMask)\n"
|
||||
" mat.diffuse_color = (0.074, 0.293, 0.8, 1.0)\n"
|
||||
" return mat\n"
|
||||
"def select_material(meshIdxMask, meshTypeMask):\n"
|
||||
|
@ -68,19 +68,19 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
" material_dict[key] = mat\n"
|
||||
" material_index.append(key)\n"
|
||||
" return len(material_index)-1\n"
|
||||
"\n"
|
||||
"bpy.context.scene.name = '%s'\n"
|
||||
"\n";
|
||||
os.format(fmt("bpy.context.scene.name = '{}'\n"), entryName);
|
||||
os <<
|
||||
"# Clear Scene\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" bpy.data.collections.remove(bpy.data.collections[0])\n"
|
||||
"\n"
|
||||
"bm = bmesh.new()\n"
|
||||
"height_lay = bm.faces.layers.float.new('Height')\n",
|
||||
entryName.data());
|
||||
"height_lay = bm.faces.layers.float.new('Height')\n";
|
||||
|
||||
for (const Node& n : nodes) {
|
||||
zeus::simd_floats f(n.position.simd);
|
||||
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
|
||||
os.format(fmt("bm.verts.new(({},{},{}))\n"), f[0], f[1], f[2]);
|
||||
}
|
||||
|
||||
os << "bm.verts.ensure_lookup_table()\n";
|
||||
|
@ -88,23 +88,23 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
for (const Region& r : regions) {
|
||||
os << "tri_verts = []\n";
|
||||
for (atUint32 i = 0; i < r.nodeCount; ++i)
|
||||
os.format("tri_verts.append(bm.verts[%u])\n", r.nodeStart + i);
|
||||
os.format(fmt("tri_verts.append(bm.verts[{}])\n"), r.nodeStart + i);
|
||||
|
||||
os.format(
|
||||
os.format(fmt(
|
||||
"face = bm.faces.get(tri_verts)\n"
|
||||
"if face is None:\n"
|
||||
" face = bm.faces.new(tri_verts)\n"
|
||||
" face.normal_flip()\n"
|
||||
"face.material_index = select_material(0x%04X, 0x%04X)\n"
|
||||
"face.material_index = select_material(0x{:04X}, 0x{:04X})\n"
|
||||
"face.smooth = False\n"
|
||||
"face[height_lay] = %f\n"
|
||||
"\n",
|
||||
"face[height_lay] = {}\n"
|
||||
"\n"),
|
||||
r.meshIndexMask, r.meshTypeMask, r.height);
|
||||
|
||||
#if 0
|
||||
const zeus::CVector3f center = xf->multiplyOneOverW(r.centroid);
|
||||
zeus::CAABox aabb(xf->multiplyOneOverW(r.aabb[0]), xf->multiplyOneOverW(r.aabb[1]));
|
||||
os.format("aabb = bpy.data.objects.new('AABB', None)\n"
|
||||
os.format(fmt("aabb = bpy.data.objects.new('AABB', None)\n")
|
||||
"aabb.location = (%f,%f,%f)\n"
|
||||
"aabb.scale = (%f,%f,%f)\n"
|
||||
"aabb.empty_display_type = 'CUBE'\n"
|
||||
|
@ -126,7 +126,7 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
for (const Node& n : nodes) {
|
||||
zeus::simd_floats f(n.position.simd);
|
||||
zeus::simd_floats no(n.position.simd + n.normal.simd);
|
||||
os.format("v = bm.verts.new((%f,%f,%f))\n"
|
||||
os.format(fmt("v = bm.verts.new((%f,%f,%f))\n")
|
||||
"v2 = bm.verts.new((%f,%f,%f))\n"
|
||||
"bm.edges.new((v, v2))\n", f[0], f[1], f[2], no[0], no[1], no[2]);
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
|
|||
zeus::simd_floats xfMtxF[4];
|
||||
for (int i = 0; i < 4; ++i)
|
||||
w.m[i].mSimd.copy_to(xfMtxF[i]);
|
||||
os.format(
|
||||
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
|
||||
os.format(fmt(
|
||||
"mtx = Matrix((({},{},{},{}),({},{},{},{}),({},{},{},{}),(0.0,0.0,0.0,1.0)))\n"
|
||||
"mtxd = mtx.decompose()\n"
|
||||
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
|
||||
"path_mesh_obj.location = mtxd[0]\n"
|
||||
"path_mesh_obj.rotation_quaternion = mtxd[1]\n"
|
||||
"path_mesh_obj.scale = mtxd[2]\n",
|
||||
"path_mesh_obj.scale = mtxd[2]\n"),
|
||||
xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0], xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1],
|
||||
xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]);
|
||||
}
|
||||
|
|
|
@ -85,15 +85,15 @@ struct SCAN : BigDNA {
|
|||
PAK::Entry& entry) {
|
||||
SCAN scan;
|
||||
scan.read(rs);
|
||||
if (scan.string) {
|
||||
if (scan.string.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
|
||||
ent->name = hecl::Format("SCAN_%s_strg", entry.id.toString().c_str());
|
||||
ent->name = fmt::format(fmt("SCAN_{}_strg"), entry.id);
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
const Texture& tex = scan.textures[i];
|
||||
if (tex.texture) {
|
||||
if (tex.texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
|
||||
ent->name = hecl::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i + 1);
|
||||
ent->name = fmt::format(fmt("SCAN_{}_tex{}"), entry.id, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace DataSpec::DNAMP1 {
|
|||
|
||||
template <>
|
||||
void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
|
||||
fourCC = rs.readUint32Little();
|
||||
fourCC.read(rs);
|
||||
version = rs.readUint32Big();
|
||||
layerCount = rs.readUint32Big();
|
||||
rs.enumerateBig(layerSizes, layerCount);
|
||||
|
@ -19,7 +19,7 @@ void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
|
|||
|
||||
template <>
|
||||
void SCLY::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws) {
|
||||
ws.writeUint32Big(fourCC);
|
||||
fourCC.write(ws);
|
||||
ws.writeUint32Big(version);
|
||||
ws.writeUint32Big(layerCount);
|
||||
ws.enumerateBig(layerSizes);
|
||||
|
@ -77,7 +77,7 @@ void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
|||
|
||||
template <>
|
||||
void SCLY::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& docin) {
|
||||
fourCC = docin.readUint32("fourCC");
|
||||
Do<BigDNA::ReadYaml>({"fourCC"}, fourCC, docin);
|
||||
version = docin.readUint32("version");
|
||||
layerCount = docin.enumerate("layerSizes", layerSizes);
|
||||
docin.enumerate("layers", layers);
|
||||
|
@ -85,7 +85,7 @@ void SCLY::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& docin) {
|
|||
|
||||
template <>
|
||||
void SCLY::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& docout) {
|
||||
docout.writeUint32("fourCC", fourCC);
|
||||
Do<BigDNA::WriteYaml>({"fourCC"}, fourCC, docout);
|
||||
docout.writeUint32("version", version);
|
||||
docout.enumerate("layerSizes", layerSizes);
|
||||
docout.enumerate("layers", layers);
|
||||
|
@ -115,12 +115,12 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
|
|||
size_t actualLen = rs.position() - start;
|
||||
if (actualLen != len)
|
||||
Log.report(logvisor::Fatal,
|
||||
_SYS_STR("Error while reading object of type 0x%.2X, did not read the expected amount of data, read "
|
||||
"0x%x, expected 0x%x"),
|
||||
fmt(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of "
|
||||
"data, read 0x{:x}, expected 0x{:x}")),
|
||||
(atUint32)type, actualLen, len);
|
||||
rs.seek(start + len, athena::Begin);
|
||||
} else
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& r
|
|||
obj->type = type;
|
||||
objects.push_back(std::move(obj));
|
||||
} else
|
||||
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
|
||||
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
|
||||
}
|
||||
}
|
||||
} else
|
||||
|
@ -164,7 +164,7 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
|
|||
obj->write(ws);
|
||||
auto wrote = ws.position() - start;
|
||||
if (wrote != expLen)
|
||||
Log.report(logvisor::Error, "expected writing %lu byte SCLY obj; wrote %llu", expLen, wrote);
|
||||
Log.report(logvisor::Error, fmt("expected writing {} byte SCLY obj; wrote {}"), expLen, wrote);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace DataSpec::DNAMP1 {
|
||||
struct SCLY : BigDNA {
|
||||
AT_DECL_EXPLICIT_DNA_YAML
|
||||
Value<FourCC> fourCC;
|
||||
DNAFourCC fourCC;
|
||||
Value<atUint32> version;
|
||||
Value<atUint32> layerCount;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static std::u16string_view::const_iterator CookTextureList(std::u16string& ret,
|
|||
while (true) {
|
||||
auto end = str.find_first_of(u",;", it - str.begin());
|
||||
if (end == std::u16string::npos)
|
||||
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
|
||||
Log.report(logvisor::Fatal, fmt("Missing comma/semicolon token while pasing font tag"));
|
||||
auto endIt = str.begin() + end;
|
||||
hecl::ProjectPath path =
|
||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
||||
|
@ -88,7 +88,7 @@ static std::u16string_view::const_iterator GatherTextureList(std::vector<hecl::P
|
|||
while (true) {
|
||||
auto end = str.find_first_of(u",;", it - str.begin());
|
||||
if (end == std::u16string::npos)
|
||||
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
|
||||
Log.report(logvisor::Fatal, fmt("Missing comma/semicolon token while pasing font tag"));
|
||||
auto endIt = str.begin() + end;
|
||||
hecl::ProjectPath path =
|
||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
|
||||
|
@ -194,7 +194,7 @@ static std::u16string CookString(std::u16string_view str) {
|
|||
it += 5;
|
||||
auto scpos = str.find(u';', it - str.begin());
|
||||
if (scpos == std::u16string::npos)
|
||||
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
|
||||
Log.report(logvisor::Fatal, fmt("Missing semicolon token while pasing font tag"));
|
||||
hecl::ProjectPath path =
|
||||
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
|
||||
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
|
||||
|
@ -245,7 +245,7 @@ void STRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
|
|||
it += 5;
|
||||
auto scpos = str.find(u';', it - strView.begin());
|
||||
if (scpos == std::u16string::npos)
|
||||
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
|
||||
Log.report(logvisor::Fatal, fmt("Missing semicolon token while pasing font tag"));
|
||||
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
|
||||
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
|
||||
if (path)
|
||||
|
@ -307,11 +307,11 @@ template <>
|
|||
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||
atUint32 magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321)
|
||||
Log.report(logvisor::Error, "invalid STRG magic");
|
||||
Log.report(logvisor::Error, fmt("invalid STRG magic"));
|
||||
|
||||
atUint32 version = reader.readUint32Big();
|
||||
if (version != 0)
|
||||
Log.report(logvisor::Error, "invalid STRG version");
|
||||
Log.report(logvisor::Error, fmt("invalid STRG version"));
|
||||
|
||||
_read(reader);
|
||||
}
|
||||
|
@ -408,24 +408,22 @@ void STRG::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader) {
|
|||
continue;
|
||||
|
||||
if (lang.first.size() != 4) {
|
||||
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping",
|
||||
lang.first.c_str());
|
||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must be exactly 4 characters; skipping"), lang.first);
|
||||
return;
|
||||
}
|
||||
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
|
||||
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping",
|
||||
lang.first.c_str());
|
||||
Log.report(logvisor::Warning, fmt("STRG language string '{}' must contain a sequence; skipping"), lang.first);
|
||||
return;
|
||||
}
|
||||
for (const auto& str : lang.second->m_seqChildren) {
|
||||
if (str->m_type != YAML_SCALAR_NODE) {
|
||||
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
|
||||
Log.report(logvisor::Warning, fmt("STRG language '{}' must contain all scalars; skipping"), lang.first);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
|
||||
Log.report(logvisor::Warning, fmt("STRG must have a mapping root node; skipping"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@ zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const {
|
|||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
zeus::CAABox aabbOut;
|
||||
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(model);
|
||||
conn.openBlend(path);
|
||||
hecl::blender::DataStream ds = conn.beginData();
|
||||
auto aabb = ds.getMeshAABB();
|
||||
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
||||
} else if (animationParameters.animationCharacterSet) {
|
||||
} else if (animationParameters.animationCharacterSet.isValid()) {
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
|
||||
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
|
||||
hecl::blender::DataStream ds = conn.beginData();
|
||||
|
|
|
@ -37,7 +37,7 @@ struct Actor : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ struct ActorContraption : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ struct AtomicAlpha : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
|
|
|
@ -35,15 +35,15 @@ struct AtomicBeta : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
if (part) {
|
||||
if (part.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ struct Babygoth : IScriptObject {
|
|||
UniqueID32 cinf = patternedInfo.animationParameters.getCINF(pakRouter);
|
||||
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
|
||||
|
||||
if (noShellModel && noShellSkin) {
|
||||
if (noShellModel.isValid() && noShellSkin.isValid()) {
|
||||
charAssoc.m_cmdlRigs[noShellModel] = std::make_pair(noShellSkin, cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[noShellSkin] =
|
||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet, "ATTACH.SHELLESS.CSKR");
|
||||
|
@ -55,47 +55,47 @@ struct Babygoth : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (fireballWeapon) {
|
||||
if (fireballWeapon.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(fireballWeapon);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (fireBreathWeapon) {
|
||||
if (fireBreathWeapon.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(fireBreathWeapon);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (fireBreathRes) {
|
||||
if (fireBreathRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(fireBreathRes);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (noShellModel) {
|
||||
if (noShellModel.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(noShellModel);
|
||||
ent->name = name + "_emodel";
|
||||
}
|
||||
if (noShellSkin) {
|
||||
if (noShellSkin.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(noShellSkin);
|
||||
ent->name = name + "_eskin";
|
||||
}
|
||||
if (intermediateCrackParticle) {
|
||||
if (intermediateCrackParticle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(intermediateCrackParticle);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (crackOneParticle) {
|
||||
if (crackOneParticle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(crackOneParticle);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (crackTwoParticle) {
|
||||
if (crackTwoParticle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(crackTwoParticle);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (destroyShellParticle) {
|
||||
if (destroyShellParticle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(destroyShellParticle);
|
||||
ent->name = name + "_part5";
|
||||
}
|
||||
if (flamePlayerSteamTxtr) {
|
||||
if (flamePlayerSteamTxtr.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(flamePlayerSteamTxtr);
|
||||
ent->name = name + "_tex";
|
||||
}
|
||||
if (flamePlayerIceTxtr) {
|
||||
if (flamePlayerIceTxtr.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(flamePlayerIceTxtr);
|
||||
ent->name = name + "_part6";
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ struct Beetle : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (tailModel) {
|
||||
if (tailModel.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tailModel);
|
||||
ent->name = name + "_tailModel";
|
||||
}
|
||||
|
|
|
@ -32,31 +32,31 @@ struct BloodFlower : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (particle5) {
|
||||
if (particle5.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
|
||||
ent->name = name + "_part5";
|
||||
}
|
||||
|
|
|
@ -27,23 +27,23 @@ struct Burrower : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ struct CameraFilterKeyframe : IScriptObject {
|
|||
UniqueID32 texture;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_texture";
|
||||
}
|
||||
|
|
|
@ -45,15 +45,15 @@ struct ChozoGhost : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -22,15 +22,15 @@ struct DamageableTrigger : IScriptObject {
|
|||
VisorParameters visorParameters;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (patternTex1) {
|
||||
if (patternTex1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex1);
|
||||
ent->name = name + "_patternTex1";
|
||||
}
|
||||
if (patternTex2) {
|
||||
if (patternTex2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex2);
|
||||
ent->name = name + "_patternTex2";
|
||||
}
|
||||
if (colorTex) {
|
||||
if (colorTex.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(colorTex);
|
||||
ent->name = name + "_colorTex";
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ struct Debris : IScriptObject {
|
|||
Value<bool> active;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -49,19 +49,19 @@ struct DebrisExtended : IScriptObject {
|
|||
Value<bool> active;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const {
|
|||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
zeus::CAABox aabbOut;
|
||||
|
||||
if (animationParameters.animationCharacterSet) {
|
||||
if (animationParameters.animationCharacterSet.isValid()) {
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
|
||||
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
|
||||
hecl::blender::DataStream ds = conn.beginData();
|
||||
|
|
|
@ -59,7 +59,7 @@ struct Drone : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (crsc) {
|
||||
if (crsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(crsc);
|
||||
ent->name = name + "_crsc";
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ struct Effect : IScriptObject {
|
|||
LightParameters lightParameters;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (part) {
|
||||
if (part.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ struct ElectroMagneticPulse : IScriptObject {
|
|||
UniqueID32 particle;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -57,39 +57,39 @@ struct ElitePirate : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (particle5) {
|
||||
if (particle5.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
|
||||
ent->name = name + "_part5";
|
||||
}
|
||||
if (particle6) {
|
||||
if (particle6.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
|
||||
ent->name = name + "_part6";
|
||||
}
|
||||
if (particle7) {
|
||||
if (particle7.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle7);
|
||||
ent->name = name + "_part7";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -34,19 +34,19 @@ struct EnergyBall : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_texture";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -35,23 +35,23 @@ struct Eyeball : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
if (beamContactFxId) {
|
||||
if (beamContactFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamContactFxId);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (beamPulseFxId) {
|
||||
if (beamPulseFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamPulseFxId);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (beamTextureId) {
|
||||
if (beamTextureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamTextureId);
|
||||
ent->name = name + "_tex1";
|
||||
}
|
||||
if (beamGlowTextureId) {
|
||||
if (beamGlowTextureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamGlowTextureId);
|
||||
ent->name = name + "_tex2";
|
||||
}
|
||||
|
|
|
@ -46,24 +46,24 @@ struct FishCloud : IScriptObject {
|
|||
Value<bool> hotInThermal;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
animationParameters.nameANCS(pakRouter, name + "_animp");
|
||||
if (deathParticle1) {
|
||||
if (deathParticle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle1);
|
||||
ent->name = name + "_deathParticle1";
|
||||
}
|
||||
if (deathParticle2) {
|
||||
if (deathParticle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle2);
|
||||
ent->name = name + "_deathParticle2";
|
||||
}
|
||||
if (deathParticle3) {
|
||||
if (deathParticle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle3);
|
||||
ent->name = name + "_deathParticle3";
|
||||
}
|
||||
if (deathParticle4) {
|
||||
if (deathParticle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle4);
|
||||
ent->name = name + "_deathParticle4";
|
||||
}
|
||||
|
|
|
@ -38,19 +38,19 @@ struct Flaahgra : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (dependencyGroup) {
|
||||
if (dependencyGroup.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(dependencyGroup);
|
||||
ent->name = name + "_dgrp";
|
||||
}
|
||||
|
|
|
@ -50,31 +50,31 @@ struct FlyingPirate : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (wpsc3) {
|
||||
if (wpsc3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc3);
|
||||
ent->name = name + "_wpsc3";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
|
|
|
@ -62,39 +62,39 @@ struct GunTurret : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (projectileRes) {
|
||||
if (projectileRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(projectileRes);
|
||||
ent->name = name + "_projectileRes";
|
||||
}
|
||||
if (idleLightRes) {
|
||||
if (idleLightRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(idleLightRes);
|
||||
ent->name = name + "_idleLightRes";
|
||||
}
|
||||
if (deactivateLightRes) {
|
||||
if (deactivateLightRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deactivateLightRes);
|
||||
ent->name = name + "_deactivateLightRes";
|
||||
}
|
||||
if (targettingLightRes) {
|
||||
if (targettingLightRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(targettingLightRes);
|
||||
ent->name = name + "_targettingLightRes";
|
||||
}
|
||||
if (frozenEffectRes) {
|
||||
if (frozenEffectRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(frozenEffectRes);
|
||||
ent->name = name + "_frozenEffectRes";
|
||||
}
|
||||
if (chargingEffectRes) {
|
||||
if (chargingEffectRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(chargingEffectRes);
|
||||
ent->name = name + "_chargingEffectRes";
|
||||
}
|
||||
if (panningEffectRes) {
|
||||
if (panningEffectRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(panningEffectRes);
|
||||
ent->name = name + "_panningEffectRes";
|
||||
}
|
||||
if (visorEffectRes) {
|
||||
if (visorEffectRes.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(visorEffectRes);
|
||||
ent->name = name + "_visorEffectRes";
|
||||
}
|
||||
if (extensionModelResId) {
|
||||
if (extensionModelResId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(extensionModelResId);
|
||||
ent->name = name + "_extensionModelResId";
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct HUDMemo : IScriptObject {
|
|||
Value<bool> active;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (message) {
|
||||
if (message.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(message);
|
||||
ent->name = name + "_message";
|
||||
}
|
||||
|
|
|
@ -51,43 +51,43 @@ struct IceSheegoth : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (particle5) {
|
||||
if (particle5.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
|
||||
ent->name = name + "_part5";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_texture";
|
||||
}
|
||||
if (particle6) {
|
||||
if (particle6.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
|
||||
ent->name = name + "_part6";
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ struct Magdolite : IScriptObject {
|
|||
UniqueID32 cinf = patternedInfo.animationParameters.getCINF(pakRouter);
|
||||
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
|
||||
|
||||
if (cmdlHeadless && cskrHeadless) {
|
||||
if (cmdlHeadless.isValid() && cskrHeadless.isValid()) {
|
||||
charAssoc.m_cmdlRigs[cmdlHeadless] = std::make_pair(cskrHeadless, cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[cskrHeadless] =
|
||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet, "ATTACH.HEADLESS.CSKR");
|
||||
|
@ -53,15 +53,15 @@ struct Magdolite : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (cmdlHeadless) {
|
||||
if (cmdlHeadless.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cmdlHeadless);
|
||||
ent->name = name + "_emodel";
|
||||
}
|
||||
if (cskrHeadless) {
|
||||
if (cskrHeadless.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cskrHeadless);
|
||||
ent->name = name + "_eskin";
|
||||
}
|
||||
if (magdoliteParameters.particle) {
|
||||
if (magdoliteParameters.particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(magdoliteParameters.particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
|
|
|
@ -37,23 +37,23 @@ struct MetroidBeta : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (swhc) {
|
||||
if (swhc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(swhc);
|
||||
ent->name = name + "_swhc";
|
||||
}
|
||||
|
|
|
@ -86,19 +86,19 @@ struct MetroidPrimeStage1 : IScriptObject {
|
|||
Value<atUint32> unknown8;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (texture1) {
|
||||
if (texture1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture1);
|
||||
ent->name = name + "_tex1";
|
||||
}
|
||||
|
@ -132,15 +132,15 @@ struct MetroidPrimeStage1 : IScriptObject {
|
|||
Value<atUint32> unknown8;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (unknown1) {
|
||||
if (unknown1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(unknown1);
|
||||
ent->name = name + "_unk1";
|
||||
}
|
||||
if (unknown3) {
|
||||
if (unknown3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(unknown3);
|
||||
ent->name = name + "_unk3";
|
||||
}
|
||||
if (unknown4) {
|
||||
if (unknown4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(unknown4);
|
||||
ent->name = name + "_unk4";
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ struct MetroidPrimeStage1 : IScriptObject {
|
|||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
beamInfo.nameIDs(pakRouter, name + "_beamInfo");
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
|
@ -193,11 +193,11 @@ struct MetroidPrimeStage1 : IScriptObject {
|
|||
Value<bool> unknown15;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_tex";
|
||||
}
|
||||
|
@ -227,31 +227,31 @@ struct MetroidPrimeStage1 : IScriptObject {
|
|||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
primeStruct2b.nameIDs(pakRouter, name + "_prime2b");
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (particle6) {
|
||||
if (particle6.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
|
||||
ent->name = name + "_part6";
|
||||
}
|
||||
if (particle7) {
|
||||
if (particle7.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle7);
|
||||
ent->name = name + "_part7";
|
||||
}
|
||||
if (particle8) {
|
||||
if (particle8.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle8);
|
||||
ent->name = name + "_part8";
|
||||
}
|
||||
if (swhc) {
|
||||
if (swhc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(swhc);
|
||||
ent->name = name + "_swhc";
|
||||
}
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
|
|
|
@ -25,15 +25,15 @@ struct MetroidPrimeStage2 : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct Midi : IScriptObject {
|
|||
Value<atUint32> volume;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (song) {
|
||||
if (song.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(song);
|
||||
ent->name = name + "_song";
|
||||
}
|
||||
|
|
|
@ -27,19 +27,19 @@ struct NewIntroBoss : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (beamContactFxId) {
|
||||
if (beamContactFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamContactFxId);
|
||||
ent->name = name + "_beamContactFxId";
|
||||
}
|
||||
if (beamPulseFxId) {
|
||||
if (beamPulseFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamPulseFxId);
|
||||
ent->name = name + "_beamPulseFxId";
|
||||
}
|
||||
if (beamTextureId) {
|
||||
if (beamTextureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamTextureId);
|
||||
ent->name = name + "_beamTextureId";
|
||||
}
|
||||
if (beamGlowTextureId) {
|
||||
if (beamGlowTextureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(beamGlowTextureId);
|
||||
ent->name = name + "_beamGlowTextureId";
|
||||
}
|
||||
|
|
|
@ -57,64 +57,64 @@ struct OmegaPirate : IScriptObject {
|
|||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
|
||||
actorParameters1.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
|
||||
actorParameters2.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
|
||||
if (cmdlPhazonVeins && cskrPhazonVeins && cinfPhazonVeins) {
|
||||
if (cmdlPhazonVeins.isValid() && cskrPhazonVeins.isValid() && cinfPhazonVeins.isValid()) {
|
||||
charAssoc.m_cmdlRigs[cmdlPhazonVeins] = std::make_pair(cskrPhazonVeins, cinfPhazonVeins);
|
||||
charAssoc.m_cskrCinfToCharacter[cskrPhazonVeins] =
|
||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet, "ATTACH.VEINS.CSKR");
|
||||
charAssoc.m_cskrCinfToCharacter[cinfPhazonVeins] =
|
||||
std::make_pair(patternedInfo.animationParameters.animationCharacterSet,
|
||||
hecl::Format("CINF_%08X.CINF", cinfPhazonVeins.toUint32()));
|
||||
fmt::format(fmt("CINF_{}.CINF"), cinfPhazonVeins));
|
||||
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, cinfPhazonVeins,
|
||||
cmdlPhazonVeins, "VEINS");
|
||||
}
|
||||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (particle3) {
|
||||
if (particle3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
|
||||
ent->name = name + "_part3";
|
||||
}
|
||||
if (particle4) {
|
||||
if (particle4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
|
||||
ent->name = name + "_part4";
|
||||
}
|
||||
if (particle5) {
|
||||
if (particle5.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
|
||||
ent->name = name + "_part5";
|
||||
}
|
||||
if (particle6) {
|
||||
if (particle6.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
|
||||
ent->name = name + "_part6";
|
||||
}
|
||||
if (particle7) {
|
||||
if (particle7.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle7);
|
||||
ent->name = name + "_part7";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
if (model1) {
|
||||
if (model1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model1);
|
||||
ent->name = name + "_model1";
|
||||
}
|
||||
if (cmdlPhazonVeins) {
|
||||
if (cmdlPhazonVeins.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cmdlPhazonVeins);
|
||||
ent->name = name + "_model2";
|
||||
}
|
||||
if (cskrPhazonVeins) {
|
||||
if (cskrPhazonVeins.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cskrPhazonVeins);
|
||||
ent->name = name + "_skin";
|
||||
}
|
||||
if (cinfPhazonVeins) {
|
||||
if (cinfPhazonVeins.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cinfPhazonVeins);
|
||||
ent->name = name + "_rig";
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace DataSpec::DNAMP1 {
|
||||
|
||||
UniqueID32 AnimationParameters::getCINF(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (!animationCharacterSet)
|
||||
if (!animationCharacterSet.isValid())
|
||||
return UniqueID32();
|
||||
const nod::Node* node;
|
||||
const PAK::Entry* ancsEnt = pakRouter.lookupEntry(animationCharacterSet, &node);
|
||||
|
|
|
@ -96,7 +96,7 @@ struct AnimationParameters : BigDNA {
|
|||
UniqueID32 getCINF(PAKRouter<PAKBridge>& pakRouter) const;
|
||||
|
||||
void nameANCS(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (!animationCharacterSet)
|
||||
if (!animationCharacterSet.isValid())
|
||||
return;
|
||||
PAK::Entry* ancsEnt = (PAK::Entry*)pakRouter.lookupEntry(animationCharacterSet);
|
||||
if (ancsEnt->name.empty())
|
||||
|
@ -182,7 +182,7 @@ struct FlareDefinition : BigDNA {
|
|||
Value<atVec4f> unknown4; // CColor
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_texture";
|
||||
}
|
||||
|
@ -278,19 +278,19 @@ struct PatternedInfo : BigDNA {
|
|||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
animationParameters.nameANCS(pakRouter, name + "_animp");
|
||||
if (stateMachine) {
|
||||
if (stateMachine.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(stateMachine);
|
||||
ent->name = name + "_fsm";
|
||||
}
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (electric) {
|
||||
if (electric.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(electric);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ struct ScannableParameters : BigDNA {
|
|||
UniqueID32 scanId;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (scanId) {
|
||||
if (scanId.isValid()) {
|
||||
PAK::Entry* scanEnt = (PAK::Entry*)pakRouter.lookupEntry(scanId);
|
||||
scanEnt->name = name + "_scan";
|
||||
}
|
||||
|
@ -377,12 +377,12 @@ struct ActorParameters : BigDNA {
|
|||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc,
|
||||
const AnimationParameters& animParms) const {
|
||||
auto cinf = animParms.getCINF(pakRouter);
|
||||
if (cmdlXray && cskrXray) {
|
||||
if (cmdlXray.isValid() && cskrXray.isValid()) {
|
||||
charAssoc.m_cmdlRigs[cmdlXray] = std::make_pair(cskrXray, cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[cskrXray] = std::make_pair(animParms.animationCharacterSet, "ATTACH.XRAY.CSKR");
|
||||
charAssoc.addAttachmentRig(animParms.animationCharacterSet, {}, cmdlXray, "XRAY");
|
||||
}
|
||||
if (cmdlThermal && cskrThermal) {
|
||||
if (cmdlThermal.isValid() && cskrThermal.isValid()) {
|
||||
charAssoc.m_cmdlRigs[cmdlThermal] = std::make_pair(cskrThermal, cinf);
|
||||
charAssoc.m_cskrCinfToCharacter[cskrThermal] =
|
||||
std::make_pair(animParms.animationCharacterSet, "ATTACH.THERMAL.CSKR");
|
||||
|
@ -392,19 +392,19 @@ struct ActorParameters : BigDNA {
|
|||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
scannableParameters.nameIDs(pakRouter, name);
|
||||
if (cmdlXray) {
|
||||
if (cmdlXray.isValid()) {
|
||||
PAK::Entry* xmEnt = (PAK::Entry*)pakRouter.lookupEntry(cmdlXray);
|
||||
xmEnt->name = name + "_xraymodel";
|
||||
}
|
||||
if (cskrXray) {
|
||||
if (cskrXray.isValid()) {
|
||||
PAK::Entry* xsEnt = (PAK::Entry*)pakRouter.lookupEntry(cskrXray);
|
||||
xsEnt->name = name + "_xrayskin";
|
||||
}
|
||||
if (cmdlThermal) {
|
||||
if (cmdlThermal.isValid()) {
|
||||
PAK::Entry* xmEnt = (PAK::Entry*)pakRouter.lookupEntry(cmdlThermal);
|
||||
xmEnt->name = name + "_thermalmodel";
|
||||
}
|
||||
if (cskrThermal) {
|
||||
if (cskrThermal.isValid()) {
|
||||
PAK::Entry* xsEnt = (PAK::Entry*)pakRouter.lookupEntry(cskrThermal);
|
||||
xsEnt->name = name + "_thermalskin";
|
||||
}
|
||||
|
@ -442,19 +442,19 @@ struct BeamInfo : BigDNA {
|
|||
DNAColor outerColor;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (contactFxId) {
|
||||
if (contactFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(contactFxId);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (pulseFxId) {
|
||||
if (pulseFxId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(pulseFxId);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (textureId) {
|
||||
if (textureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(textureId);
|
||||
ent->name = name + "_tex1";
|
||||
}
|
||||
if (glowTextureId) {
|
||||
if (glowTextureId.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(glowTextureId);
|
||||
ent->name = name + "_tex2";
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ struct PhazonHealingNodule : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -28,19 +28,19 @@ struct PhazonPool : IScriptObject {
|
|||
Value<float> unknown9;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (model1) {
|
||||
if (model1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model1);
|
||||
ent->name = name + "_model1";
|
||||
}
|
||||
if (model2) {
|
||||
if (model2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model2);
|
||||
ent->name = name + "_model2";
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ struct Pickup : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (pickupParticle) {
|
||||
if (pickupParticle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(pickupParticle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ zeus::CAABox Platform::getVISIAABB(hecl::blender::Token& btok) const {
|
|||
hecl::blender::Connection& conn = btok.getBlenderConnection();
|
||||
zeus::CAABox aabbOut;
|
||||
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(model);
|
||||
conn.openBlend(path);
|
||||
hecl::blender::DataStream ds = conn.beginData();
|
||||
auto aabb = ds.getMeshAABB();
|
||||
aabbOut = zeus::CAABox(aabb.first, aabb.second);
|
||||
} else if (animationParameters.animationCharacterSet) {
|
||||
} else if (animationParameters.animationCharacterSet.isValid()) {
|
||||
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
|
||||
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
|
||||
hecl::blender::DataStream ds = conn.beginData();
|
||||
|
|
|
@ -33,11 +33,11 @@ struct Platform : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (dcln) {
|
||||
if (dcln.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(dcln);
|
||||
ent->name = name + "_dcln";
|
||||
}
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ struct PlayerActor : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (model) {
|
||||
if (model.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
|
||||
ent->name = name + "_model";
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ struct PuddleSpore : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ struct PuddleToadGamma : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (dcln) {
|
||||
if (dcln.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(dcln);
|
||||
ent->name = name + "_dcln";
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ struct Puffer : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (texture) {
|
||||
if (texture.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
|
||||
ent->name = name + "_texture";
|
||||
}
|
||||
|
|
|
@ -54,19 +54,19 @@ struct Ridley : IScriptObject {
|
|||
Value<atVec4f> unknown13; // CColor
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter, const std::string& name) const {
|
||||
if (particle1) {
|
||||
if (particle1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
|
||||
ent->name = name + "_part1";
|
||||
}
|
||||
if (particle2) {
|
||||
if (particle2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
|
||||
ent->name = name + "_part2";
|
||||
}
|
||||
if (texture1) {
|
||||
if (texture1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture1);
|
||||
ent->name = name + "_tex1";
|
||||
}
|
||||
if (texture2) {
|
||||
if (texture2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture2);
|
||||
ent->name = name + "_tex2";
|
||||
}
|
||||
|
@ -125,75 +125,75 @@ struct Ridley : IScriptObject {
|
|||
}
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (particle) {
|
||||
if (particle.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
|
||||
ent->name = name + "_part";
|
||||
}
|
||||
if (model1) {
|
||||
if (model1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model1);
|
||||
ent->name = name + "_model1";
|
||||
}
|
||||
if (model2) {
|
||||
if (model2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model2);
|
||||
ent->name = name + "_model2";
|
||||
}
|
||||
if (model3) {
|
||||
if (model3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model3);
|
||||
ent->name = name + "_model3";
|
||||
}
|
||||
if (model4) {
|
||||
if (model4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model4);
|
||||
ent->name = name + "_model4";
|
||||
}
|
||||
if (model5) {
|
||||
if (model5.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model5);
|
||||
ent->name = name + "_model5";
|
||||
}
|
||||
if (model6) {
|
||||
if (model6.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model6);
|
||||
ent->name = name + "_model6";
|
||||
}
|
||||
if (model7) {
|
||||
if (model7.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model7);
|
||||
ent->name = name + "_model7";
|
||||
}
|
||||
if (model8) {
|
||||
if (model8.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model8);
|
||||
ent->name = name + "_model8";
|
||||
}
|
||||
if (model9) {
|
||||
if (model9.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model9);
|
||||
ent->name = name + "_model9";
|
||||
}
|
||||
if (model10) {
|
||||
if (model10.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model10);
|
||||
ent->name = name + "_model10";
|
||||
}
|
||||
if (model11) {
|
||||
if (model11.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model11);
|
||||
ent->name = name + "_model11";
|
||||
}
|
||||
if (model12) {
|
||||
if (model12.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model12);
|
||||
ent->name = name + "_model12";
|
||||
}
|
||||
if (wpsc1) {
|
||||
if (wpsc1.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
|
||||
ent->name = name + "_wpsc1";
|
||||
}
|
||||
if (wpsc2) {
|
||||
if (wpsc2.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
|
||||
ent->name = name + "_wpsc2";
|
||||
}
|
||||
if (wpsc3) {
|
||||
if (wpsc3.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc3);
|
||||
ent->name = name + "_wpsc3";
|
||||
}
|
||||
if (wpsc4) {
|
||||
if (wpsc4.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc4);
|
||||
ent->name = name + "_wpsc4";
|
||||
}
|
||||
if (elsc) {
|
||||
if (elsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
|
||||
ent->name = name + "_elsc";
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ScriptBeam : IScriptObject {
|
|||
DamageInfo damageInfo;
|
||||
|
||||
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
|
||||
if (wpsc) {
|
||||
if (wpsc.isValid()) {
|
||||
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
|
||||
ent->name = name + "_wpsc";
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue