mirror of https://github.com/AxioDL/metaforce.git
Reformat pass
This commit is contained in:
parent
d7559823ea
commit
a9bcb7a9ce
|
@ -1,3 +1,3 @@
|
|||
message(STATUS "32-bit asset name map not found; downloading to '${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin'")
|
||||
file(DOWNLOAD "https://axiodl.com/files/AssetNameMap32.dat"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=90b4e941c192eef41c81e60314f348bc787d1336)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin SHOW_PROGRESS EXPECTED_HASH SHA1=90b4e941c192eef41c81e60314f348bc787d1336)
|
||||
|
|
|
@ -34,8 +34,9 @@ void LoadAssetMap(athena::io::MemoryReader& ar) {
|
|||
if (ar.length() >= 4)
|
||||
ar.readBytesToBuf(&magic, 4);
|
||||
if (magic != FOURCC('AIDM'))
|
||||
Log.report(logvisor::Warning,
|
||||
FMT_STRING(_SYS_STR("Unable to load asset map; Assets will not have proper filenames for most files.")));
|
||||
Log.report(
|
||||
logvisor::Warning,
|
||||
FMT_STRING(_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);
|
||||
|
@ -64,8 +65,9 @@ void InitAssetNameMap() {
|
|||
LoadAssetMap(ar);
|
||||
delete[](decompressed);
|
||||
} else {
|
||||
Log.report(logvisor::Warning,
|
||||
FMT_STRING(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files.")));
|
||||
Log.report(
|
||||
logvisor::Warning,
|
||||
FMT_STRING(_SYS_STR("AssetNameMap32 unavailable; Assets will not have proper filenames for most files.")));
|
||||
}
|
||||
/* Now load the 64bit map for MP3 */
|
||||
if (ASSET_NAME_MP64_DECOMPRESSED_SZ != 0u) {
|
||||
|
@ -76,8 +78,9 @@ void InitAssetNameMap() {
|
|||
LoadAssetMap(ar);
|
||||
delete[](decompressed);
|
||||
} else {
|
||||
Log.report(logvisor::Warning,
|
||||
FMT_STRING(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files.")));
|
||||
Log.report(
|
||||
logvisor::Warning,
|
||||
FMT_STRING(_SYS_STR("AssetNameMap64 unavailable; Assets will not have proper filenames for most files.")));
|
||||
}
|
||||
g_AssetNameMapInit = true;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import bpy
|
||||
|
||||
|
||||
# Root Eevee Nodes
|
||||
|
||||
# Additive output node
|
||||
|
@ -32,6 +33,7 @@ def make_additive_output():
|
|||
new_grp.links.new(transparent_bdsf.outputs[0], emissive_add_shader.inputs[0])
|
||||
new_grp.links.new(emissive_add_shader.outputs[0], mat_out.inputs['Surface'])
|
||||
|
||||
|
||||
# Blend output node
|
||||
def make_blend_opaque_output():
|
||||
for tp in ('HECLBlendOutput', 'HECLOpaqueOutput'):
|
||||
|
@ -50,7 +52,8 @@ def make_blend_opaque_output():
|
|||
# Links
|
||||
new_grp.links.new(grp_in.outputs['Surface'], mat_out.inputs['Surface'])
|
||||
|
||||
#0 - RetroShader
|
||||
|
||||
# 0 - RetroShader
|
||||
def make_retro_shader():
|
||||
new_grp = bpy.data.node_groups.new('RetroShader', 'ShaderNodeTree')
|
||||
surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface')
|
||||
|
@ -216,6 +219,7 @@ def make_retro_shader():
|
|||
new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2])
|
||||
new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface'])
|
||||
|
||||
|
||||
def make_retro_dynamic_shader():
|
||||
new_grp = bpy.data.node_groups.new('RetroDynamicShader', 'ShaderNodeTree')
|
||||
surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface')
|
||||
|
@ -386,6 +390,7 @@ def make_retro_dynamic_shader():
|
|||
new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2])
|
||||
new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface'])
|
||||
|
||||
|
||||
def make_retro_dynamic_alpha_shader():
|
||||
new_grp = bpy.data.node_groups.new('RetroDynamicAlphaShader', 'ShaderNodeTree')
|
||||
surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface')
|
||||
|
@ -567,6 +572,7 @@ def make_retro_dynamic_alpha_shader():
|
|||
new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2])
|
||||
new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface'])
|
||||
|
||||
|
||||
def make_retro_dynamic_character_shader():
|
||||
new_grp = bpy.data.node_groups.new('RetroDynamicCharacterShader', 'ShaderNodeTree')
|
||||
surface_output = new_grp.outputs.new('NodeSocketShader', 'Surface')
|
||||
|
@ -721,6 +727,7 @@ def make_retro_dynamic_character_shader():
|
|||
new_grp.links.new(final_add_shader.outputs['Shader'], alpha_mix.inputs[2])
|
||||
new_grp.links.new(alpha_mix.outputs['Shader'], mat_out.inputs['Surface'])
|
||||
|
||||
|
||||
# MP3 / DKCR Material Passes:
|
||||
# https://wiki.axiodl.com/w/Materials_(Metroid_Prime_3)
|
||||
|
||||
|
@ -1000,6 +1007,7 @@ def make_retro_shader_mp3_color():
|
|||
new_grp.links.new(nodes["Mix Shader"].outputs[0], nodes["Add Shader.011"].inputs[0])
|
||||
new_grp.links.new(nodes["Group Input"].outputs[12], nodes["Transparent BSDF"].inputs[0])
|
||||
|
||||
|
||||
def make_retro_shader_mp3_bloom():
|
||||
new_grp = bpy.data.node_groups.new("__RetroShaderMP3Bloom", "ShaderNodeTree")
|
||||
new_grp.use_fake_user = True
|
||||
|
@ -1191,6 +1199,7 @@ def make_retro_shader_mp3_bloom():
|
|||
new_grp.links.new(nodes["Add Shader.001"].outputs[0], nodes["Add Shader"].inputs[1])
|
||||
new_grp.links.new(nodes["Group Input"].outputs[11], nodes["Transparent BSDF.001"].inputs[0])
|
||||
|
||||
|
||||
def make_retro_shader_mp3():
|
||||
new_grp = bpy.data.node_groups.new("RetroShaderMP3", "ShaderNodeTree")
|
||||
new_grp.use_fake_user = True
|
||||
|
@ -1368,6 +1377,7 @@ def make_retro_shader_mp3():
|
|||
new_grp.links.new(nodes["Group Input"].outputs[18], nodes["Group.001"].inputs[12])
|
||||
new_grp.links.new(nodes["Group Input"].outputs[18], nodes["Group"].inputs[11])
|
||||
|
||||
|
||||
ROOT_SHADER_GROUPS = (
|
||||
make_retro_shader,
|
||||
make_retro_dynamic_shader,
|
||||
|
@ -1378,6 +1388,7 @@ ROOT_SHADER_GROUPS = (
|
|||
make_retro_shader_mp3
|
||||
)
|
||||
|
||||
|
||||
# UV animation nodes:
|
||||
# https://wiki.axiodl.com/w/Materials_(Metroid_Prime)#UV_Animations
|
||||
|
||||
|
@ -1415,6 +1426,7 @@ def make_uva0():
|
|||
new_grp.links.new(vec_xf.outputs[0], uv_scale.inputs[0])
|
||||
new_grp.links.new(uv_scale.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 1 - Modelview Inverse
|
||||
def make_uva1():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode1NodeN', 'ShaderNodeTree')
|
||||
|
@ -1433,6 +1445,7 @@ def make_uva1():
|
|||
# Links
|
||||
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 2 - UV Scroll
|
||||
def make_uva2():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode2Node', 'ShaderNodeTree')
|
||||
|
@ -1474,6 +1487,7 @@ def make_uva2():
|
|||
new_grp.links.new(adder1.outputs[0], adder2.inputs[1])
|
||||
new_grp.links.new(adder2.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 3 - Rotation
|
||||
def make_uva3():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode3Node', 'ShaderNodeTree')
|
||||
|
@ -1509,6 +1523,7 @@ def make_uva3():
|
|||
new_grp.links.new(grp_in.outputs[2], mult.inputs[0])
|
||||
new_grp.links.new(mult.outputs[0], add1.inputs[1])
|
||||
|
||||
|
||||
# 4 - Horizontal Filmstrip Animation
|
||||
def make_uva4():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode4Node', 'ShaderNodeTree')
|
||||
|
@ -1594,6 +1609,7 @@ def make_uva4():
|
|||
new_grp.links.new(map1.outputs[0], add1.inputs[0])
|
||||
new_grp.links.new(add1.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 5 - Vertical Filmstrip Animation
|
||||
def make_uva5():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode5Node', 'ShaderNodeTree')
|
||||
|
@ -1679,6 +1695,7 @@ def make_uva5():
|
|||
new_grp.links.new(map1.outputs[0], add1.inputs[0])
|
||||
new_grp.links.new(add1.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 6 - Model Matrix
|
||||
def make_uva6():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode6NodeN', 'ShaderNodeTree')
|
||||
|
@ -1708,6 +1725,7 @@ def make_uva6():
|
|||
new_grp.links.new(geom_in.outputs['Object'], adder1.inputs[1])
|
||||
new_grp.links.new(adder1.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 7 - Mode Who Must Not Be Named
|
||||
def make_uva7():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode7NodeN', 'ShaderNodeTree')
|
||||
|
@ -1807,6 +1825,7 @@ def make_uva7():
|
|||
new_grp.links.new(mult5.outputs[0], add2.inputs[1])
|
||||
new_grp.links.new(add2.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
# 8 - Mode 8
|
||||
def make_uva8():
|
||||
new_grp = bpy.data.node_groups.new('RetroUVMode8Node', 'ShaderNodeTree')
|
||||
|
@ -1834,6 +1853,7 @@ def make_uva8():
|
|||
# Links
|
||||
new_grp.links.new(grp_in.outputs[0], grp_out.inputs[0])
|
||||
|
||||
|
||||
UV_ANIMATION_GROUPS = (
|
||||
make_uva0,
|
||||
make_uva1,
|
||||
|
@ -1846,6 +1866,7 @@ UV_ANIMATION_GROUPS = (
|
|||
make_uva8
|
||||
)
|
||||
|
||||
|
||||
def make_master_shader_library():
|
||||
make_additive_output()
|
||||
make_blend_opaque_output()
|
||||
|
@ -1853,4 +1874,3 @@ def make_master_shader_library():
|
|||
shad()
|
||||
for uva in UV_ANIMATION_GROUPS:
|
||||
uva()
|
||||
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
# Assembles a source/header pair list for use in a DNA library
|
||||
macro(make_dnalist)
|
||||
file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}")
|
||||
foreach(type ${ARGN})
|
||||
get_filename_component(dir ${type} DIRECTORY)
|
||||
if(dir)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}")
|
||||
set(dir "${dir}/")
|
||||
endif()
|
||||
get_filename_component(name ${type} NAME)
|
||||
list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp")
|
||||
list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp")
|
||||
endforeach()
|
||||
file(RELATIVE_PATH subdir "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
set(CMAKE_CURRENT_LIST_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}")
|
||||
foreach (type ${ARGN})
|
||||
get_filename_component(dir ${type} DIRECTORY)
|
||||
if (dir)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_LIST_BINARY_DIR}/${dir}")
|
||||
set(dir "${dir}/")
|
||||
endif ()
|
||||
get_filename_component(name ${type} NAME)
|
||||
list(APPEND DNA_SOURCES "${subdir}/${dir}atdna_${name}.cpp")
|
||||
list(APPEND DNA_HEADERS "${subdir}/${dir}${name}.hpp")
|
||||
endforeach ()
|
||||
endmacro()
|
||||
|
||||
# Assembles source files together for the main DataSpecCommon library
|
||||
macro(dataspec_add_list rel_path a_list)
|
||||
unset(tmp_list)
|
||||
foreach(path IN LISTS ${a_list})
|
||||
if (IS_ABSOLUTE ${path})
|
||||
list(APPEND tmp_list "${path}")
|
||||
else()
|
||||
list(APPEND tmp_list "${rel_path}/${path}")
|
||||
endif()
|
||||
endforeach(path)
|
||||
set(${a_list} "${tmp_list}")
|
||||
unset(tmp_list)
|
||||
foreach (path IN LISTS ${a_list})
|
||||
if (IS_ABSOLUTE ${path})
|
||||
list(APPEND tmp_list "${path}")
|
||||
else ()
|
||||
list(APPEND tmp_list "${rel_path}/${path}")
|
||||
endif ()
|
||||
endforeach (path)
|
||||
set(${a_list} "${tmp_list}")
|
||||
endmacro(dataspec_add_list)
|
||||
|
||||
# Each game's DNA library
|
||||
|
@ -41,31 +41,31 @@ bintoc(RetroMasterShader.cpp Blender/RetroMasterShader.py RETRO_MASTER_SHADER)
|
|||
|
||||
# Download asset name databases
|
||||
add_custom_command(OUTPUT AssetNameMap32.bin COMMAND ${CMAKE_COMMAND} ARGS -P
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap32Download.cmake)
|
||||
bintoc_compress(AssetNameMap32.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap32.bin ASSET_NAME_MP32)
|
||||
|
||||
add_custom_command(OUTPUT AssetNameMap64.bin COMMAND ${CMAKE_COMMAND} ARGS -P
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssetMap64Download.cmake)
|
||||
bintoc_compress(AssetNameMap64.cpp ${CMAKE_CURRENT_BINARY_DIR}/AssetNameMap64.bin ASSET_NAME_MP64)
|
||||
|
||||
# Each game's DataSpec implementation
|
||||
add_library(RetroDataSpec
|
||||
SpecBase.cpp
|
||||
${DNACOMMON_SOURCES}
|
||||
SpecMP1.cpp
|
||||
${DNAMP1_SOURCES}
|
||||
${ScriptObjectsMP1_SOURCES}
|
||||
${DNAMP1_SFX_SOURCES}
|
||||
SpecMP2.cpp
|
||||
${DNAMP2_SOURCES}
|
||||
SpecMP3.cpp
|
||||
${DNAMP3_SOURCES}
|
||||
Blender/BlenderSupport.hpp
|
||||
Blender/BlenderSupport.cpp
|
||||
Blender/RetroMasterShader.py
|
||||
AssetNameMap.hpp
|
||||
AssetNameMap.cpp
|
||||
RetroMasterShader.cpp)
|
||||
SpecBase.cpp
|
||||
${DNACOMMON_SOURCES}
|
||||
SpecMP1.cpp
|
||||
${DNAMP1_SOURCES}
|
||||
${ScriptObjectsMP1_SOURCES}
|
||||
${DNAMP1_SFX_SOURCES}
|
||||
SpecMP2.cpp
|
||||
${DNAMP2_SOURCES}
|
||||
SpecMP3.cpp
|
||||
${DNAMP3_SOURCES}
|
||||
Blender/BlenderSupport.hpp
|
||||
Blender/BlenderSupport.cpp
|
||||
Blender/RetroMasterShader.py
|
||||
AssetNameMap.hpp
|
||||
AssetNameMap.cpp
|
||||
RetroMasterShader.cpp)
|
||||
add_library(AssetNameMap
|
||||
AssetNameMap32.bin AssetNameMap32.cpp
|
||||
AssetNameMap64.bin AssetNameMap64.cpp)
|
||||
|
@ -74,19 +74,19 @@ add_library(AssetNameMapNull
|
|||
|
||||
get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES)
|
||||
target_include_directories(RetroDataSpec PUBLIC ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}
|
||||
${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
|
||||
${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
|
||||
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} lzokay logvisor)
|
||||
if(COMMAND add_sanitizers)
|
||||
add_sanitizers(RetroDataSpec)
|
||||
endif()
|
||||
if (COMMAND add_sanitizers)
|
||||
add_sanitizers(RetroDataSpec)
|
||||
endif ()
|
||||
|
||||
# Resolve all DNA sources into target
|
||||
list(LENGTH DNA_SOURCES count)
|
||||
math(EXPR count "${count}-1")
|
||||
foreach(i RANGE ${count})
|
||||
list(GET DNA_SOURCES ${i} src)
|
||||
list(GET DNA_HEADERS ${i} header)
|
||||
target_atdna(RetroDataSpec ${src} ${header})
|
||||
endforeach()
|
||||
foreach (i RANGE ${count})
|
||||
list(GET DNA_SOURCES ${i} src)
|
||||
list(GET DNA_HEADERS ${i} header)
|
||||
target_atdna(RetroDataSpec ${src} ${header})
|
||||
endforeach ()
|
||||
|
||||
add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_PROPERTY:RetroDataSpec,INCLUDE_DIRECTORIES>")
|
||||
|
|
|
@ -118,27 +118,25 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he
|
|||
{
|
||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||
|
||||
os.format(FMT_STRING(
|
||||
"import bpy\n"
|
||||
"from mathutils import Vector\n"
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" 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));
|
||||
os.format(FMT_STRING("import bpy\n"
|
||||
"from mathutils import Vector\n"
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"
|
||||
"\n"
|
||||
"# Clear Scene\n"
|
||||
"if len(bpy.data.collections):\n"
|
||||
" 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));
|
||||
|
||||
std::unordered_set<typename PAKRouter::IDType> cinfsDone;
|
||||
for (const auto& info : chResInfo) {
|
||||
/* Provide data to add-on */
|
||||
os.format(FMT_STRING(
|
||||
"actor_subtype = actor_data.subtypes.add()\n"
|
||||
"actor_subtype.name = '{}'\n\n"),
|
||||
info.name);
|
||||
os.format(FMT_STRING("actor_subtype = actor_data.subtypes.add()\n"
|
||||
"actor_subtype.name = '{}'\n\n"),
|
||||
info.name);
|
||||
|
||||
/* Build CINF if needed */
|
||||
if (cinfsDone.find(info.cinf) == cinfsDone.end()) {
|
||||
|
@ -177,7 +175,7 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he
|
|||
|
||||
/* Link CMDL */
|
||||
if (const typename PAKRouter::EntryType* cmdlE =
|
||||
pakRouter.lookupEntry(overlay.second.first, nullptr, true, false)) {
|
||||
pakRouter.lookupEntry(overlay.second.first, nullptr, true, false)) {
|
||||
hecl::ProjectPath cmdlPath = pakRouter.getWorking(cmdlE);
|
||||
os.linkMesh(cmdlPath.getAbsolutePathUTF8(), pakRouter.getBestEntryName(*cmdlE));
|
||||
|
||||
|
@ -249,18 +247,16 @@ bool ReadANCSToBlender(hecl::blender::Token& btok, const ANCSDNA& ancs, const he
|
|||
for (const auto& id : animResInfo) {
|
||||
typename ANCSDNA::ANIMType anim;
|
||||
if (pakRouter.lookupAndReadDNA(id.second.animId, anim, true)) {
|
||||
os.format(FMT_STRING(
|
||||
"act = bpy.data.actions.new('{}')\n"
|
||||
"act.use_fake_user = True\n"
|
||||
"act.anim_id = '{}'\n"),
|
||||
id.second.name, id.second.animId);
|
||||
os.format(FMT_STRING("act = bpy.data.actions.new('{}')\n"
|
||||
"act.use_fake_user = True\n"
|
||||
"act.anim_id = '{}'\n"),
|
||||
id.second.name, id.second.animId);
|
||||
anim.sendANIMToBlender(os, inverter, id.second.additive);
|
||||
}
|
||||
|
||||
os.format(FMT_STRING(
|
||||
"actor_action = actor_data.actions.add()\n"
|
||||
"actor_action.name = '{}'\n"),
|
||||
id.second.name);
|
||||
os.format(FMT_STRING("actor_action = actor_data.actions.add()\n"
|
||||
"actor_action.name = '{}'\n"),
|
||||
id.second.name);
|
||||
|
||||
/* Extract EVNT if present */
|
||||
anim.extractEVNT(id.second, outPath, pakRouter, force);
|
||||
|
|
|
@ -12,7 +12,6 @@ template <class PAKBridge>
|
|||
struct PATH;
|
||||
}
|
||||
|
||||
|
||||
struct AROTBuilder {
|
||||
using ColMesh = hecl::blender::ColMesh;
|
||||
|
||||
|
|
|
@ -18,72 +18,67 @@ void ReadBabeDeadLightToBlender(hecl::blender::PyOutStream& os, const BabeDeadLi
|
|||
switch (light.lightType) {
|
||||
case BabeDeadLight::LightType::LocalAmbient:
|
||||
case BabeDeadLight::LightType::LocalAmbient2:
|
||||
os.format(FMT_STRING(
|
||||
"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);
|
||||
os.format(FMT_STRING("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(FMT_STRING(
|
||||
"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(({},{},{})))\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");
|
||||
os.format(FMT_STRING("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(({},{},{})))\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(FMT_STRING(
|
||||
"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 = {}\n"
|
||||
"\n"),
|
||||
s, l, light.color.simd[0], light.color.simd[1], light.color.simd[2],
|
||||
light.castShadows ? "True" : "False");
|
||||
os.format(FMT_STRING("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 = {}\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(FMT_STRING(
|
||||
"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(({},{},{})))\n"
|
||||
"lamp.shadow_soft_size = 0.5\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");
|
||||
os.format(FMT_STRING("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(({},{},{})))\n"
|
||||
"lamp.shadow_soft_size = 0.5\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");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
os.format(FMT_STRING(
|
||||
"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 = {}\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 = ({},{},{},1.0)\n"
|
||||
"lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n"
|
||||
"lamp_obj.location = ({},{},{})\n"
|
||||
"bpy.context.scene.collection.objects.link(lamp_obj)\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]);
|
||||
os.format(FMT_STRING("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 = {}\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 = ({},{},{},1.0)\n"
|
||||
"lamp.node_tree.links.new(hue_sat_node.outputs[0], lamp.node_tree.nodes['Emission'].inputs[0])\n"
|
||||
"lamp_obj.location = ({},{},{})\n"
|
||||
"bpy.context.scene.collection.objects.link(lamp_obj)\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]);
|
||||
|
||||
switch (light.falloff) {
|
||||
case BabeDeadLight::Falloff::Constant:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace hecl::blender {
|
||||
struct Light;
|
||||
class PyOutStream;
|
||||
}
|
||||
} // namespace hecl::blender
|
||||
|
||||
namespace DataSpec {
|
||||
|
||||
|
|
|
@ -84,15 +84,14 @@ void ReadMaterialSetToBlender_1_2(hecl::blender::PyOutStream& os, const Material
|
|||
}
|
||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, tex);
|
||||
hecl::SystemUTF8Conv resPathView(resPath);
|
||||
os.format(FMT_STRING(
|
||||
"if '{}' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['{}']\n"
|
||||
"else:\n"
|
||||
" image = bpy.data.images.load('''//{}''')\n"
|
||||
" image.name = '{}'\n"
|
||||
"texmap_list.append(image)\n"
|
||||
"\n"),
|
||||
texName, texName, resPathView, texName);
|
||||
os.format(FMT_STRING("if '{}' in bpy.data.images:\n"
|
||||
" image = bpy.data.images['{}']\n"
|
||||
"else:\n"
|
||||
" image = bpy.data.images.load('''//{}''')\n"
|
||||
" image.name = '{}'\n"
|
||||
"texmap_list.append(image)\n"
|
||||
"\n"),
|
||||
texName, texName, resPathView, texName);
|
||||
}
|
||||
|
||||
unsigned m = 0;
|
||||
|
@ -148,11 +147,10 @@ public:
|
|||
for (const auto& [ev, evVec] : m_extraVerts) {
|
||||
for (const std::pair<atInt16, atUint16>& se : evVec) {
|
||||
if (se.second == nextVert) {
|
||||
os.format(FMT_STRING(
|
||||
"bm.verts.ensure_lookup_table()\n"
|
||||
"orig_vert = bm.verts[{}]\n"
|
||||
"vert = bm.verts.new(orig_vert.co)\n"),
|
||||
ev + baseVert);
|
||||
os.format(FMT_STRING("bm.verts.ensure_lookup_table()\n"
|
||||
"orig_vert = bm.verts[{}]\n"
|
||||
"vert = bm.verts.new(orig_vert.co)\n"),
|
||||
ev + baseVert);
|
||||
rp.first.second->weightVertex(os, *rp.second.second, se.first);
|
||||
++nextVert;
|
||||
++addedVerts;
|
||||
|
@ -466,12 +464,11 @@ void InitGeomBlenderContext(hecl::blender::PyOutStream& os, const hecl::ProjectP
|
|||
"\n";
|
||||
|
||||
/* Link master shader library */
|
||||
os.format(FMT_STRING(
|
||||
"# Master shader library\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());
|
||||
os.format(FMT_STRING("# Master shader library\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());
|
||||
}
|
||||
|
||||
void FinishBlenderMesh(hecl::blender::PyOutStream& os, unsigned matSetCount, int meshIdx) {
|
||||
|
@ -824,67 +821,73 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
atUint8 flip = 0;
|
||||
for (int v = 0; v < vertCount - 2; ++v) {
|
||||
if (flip) {
|
||||
os.format(FMT_STRING(
|
||||
"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);
|
||||
os.format(FMT_STRING("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(FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\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(FMT_STRING(
|
||||
" 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"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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(FMT_STRING(
|
||||
"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);
|
||||
os.format(FMT_STRING("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(FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\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(FMT_STRING(
|
||||
" 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"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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]);
|
||||
}
|
||||
|
@ -901,34 +904,36 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
|
|||
} else if (ptype == GX::TRIANGLES) {
|
||||
for (int v = 0; v < vertCount; v += 3) {
|
||||
|
||||
os.format(FMT_STRING(
|
||||
"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);
|
||||
os.format(FMT_STRING("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(FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\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(FMT_STRING(
|
||||
" 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"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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]);
|
||||
}
|
||||
|
@ -945,34 +950,36 @@ 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(FMT_STRING(
|
||||
"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);
|
||||
os.format(FMT_STRING("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(FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\n"
|
||||
" loop_from_facevert(last_mesh, last_face, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[2]\n"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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, {})[last_mesh.loops.layers.uv[{}]].uv = "
|
||||
"uv_tri[1]\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(FMT_STRING(
|
||||
" 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"),
|
||||
os.format(
|
||||
FMT_STRING(
|
||||
" 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]);
|
||||
}
|
||||
|
@ -1060,13 +1067,12 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade
|
|||
|
||||
/* Open Py Stream and read sections */
|
||||
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
|
||||
os.format(FMT_STRING(
|
||||
"import bpy\n"
|
||||
"import bmesh\n"
|
||||
"\n"
|
||||
"bpy.context.scene.name = '{}'\n"
|
||||
"bpy.context.scene.hecl_mesh_obj = bpy.context.scene.name\n"),
|
||||
pakRouter.getBestEntryName(entry));
|
||||
os.format(FMT_STRING("import bpy\n"
|
||||
"import bmesh\n"
|
||||
"\n"
|
||||
"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);
|
||||
|
||||
|
@ -1083,25 +1089,29 @@ bool ReadCMDLToBlender(hecl::blender::Connection& conn, athena::io::IStreamReade
|
|||
}
|
||||
|
||||
template bool ReadCMDLToBlender<PAKRouter<DNAMP1::PAKBridge>, DNAMP1::MaterialSet,
|
||||
std::pair<std::pair<UniqueID32, DNAMP1::CSKR*>, std::pair<UniqueID32, DNAMP1::CINF*>>, DNACMDL::SurfaceHeader_1, 2>(
|
||||
std::pair<std::pair<UniqueID32, DNAMP1::CSKR*>, std::pair<UniqueID32, DNAMP1::CINF*>>,
|
||||
DNACMDL::SurfaceHeader_1, 2>(
|
||||
hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter<DNAMP1::PAKBridge>& pakRouter,
|
||||
const PAKRouter<DNAMP1::PAKBridge>::EntryType& entry, const SpecBase& dataspec,
|
||||
const std::pair<std::pair<UniqueID32, DNAMP1::CSKR*>, std::pair<UniqueID32, DNAMP1::CINF*>>& rp);
|
||||
|
||||
template bool ReadCMDLToBlender<PAKRouter<DNAMP2::PAKBridge>, DNAMP2::MaterialSet,
|
||||
std::pair<std::pair<UniqueID32, DNAMP2::CSKR*>, std::pair<UniqueID32, DNAMP2::CINF*>>, DNACMDL::SurfaceHeader_2, 4>(
|
||||
std::pair<std::pair<UniqueID32, DNAMP2::CSKR*>, std::pair<UniqueID32, DNAMP2::CINF*>>,
|
||||
DNACMDL::SurfaceHeader_2, 4>(
|
||||
hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter<DNAMP2::PAKBridge>& pakRouter,
|
||||
const PAKRouter<DNAMP2::PAKBridge>::EntryType& entry, const SpecBase& dataspec,
|
||||
const std::pair<std::pair<UniqueID32, DNAMP2::CSKR*>, std::pair<UniqueID32, DNAMP2::CINF*>>& rp);
|
||||
|
||||
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
|
||||
std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>, DNACMDL::SurfaceHeader_3, 4>(
|
||||
std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>,
|
||||
DNACMDL::SurfaceHeader_3, 4>(
|
||||
hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter<DNAMP3::PAKBridge>& pakRouter,
|
||||
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry, const SpecBase& dataspec,
|
||||
const std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>& rp);
|
||||
|
||||
template bool ReadCMDLToBlender<PAKRouter<DNAMP3::PAKBridge>, DNAMP3::MaterialSet,
|
||||
std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>, DNACMDL::SurfaceHeader_3, 5>(
|
||||
std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>,
|
||||
DNACMDL::SurfaceHeader_3, 5>(
|
||||
hecl::blender::Connection& conn, athena::io::IStreamReader& reader, PAKRouter<DNAMP3::PAKBridge>& pakRouter,
|
||||
const PAKRouter<DNAMP3::PAKBridge>::EntryType& entry, const SpecBase& dataspec,
|
||||
const std::pair<std::pair<UniqueID64, DNAMP3::CSKR*>, std::pair<UniqueID64, DNAMP3::CINF*>>& rp);
|
||||
|
@ -1592,9 +1602,10 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
|
|||
return true;
|
||||
}
|
||||
|
||||
template bool WriteHMDLCMDL<DNAMP1::HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
|
||||
const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const Mesh& mesh,
|
||||
hecl::blender::PoolSkinIndex& poolSkinIndex);
|
||||
template bool
|
||||
WriteHMDLCMDL<DNAMP1::HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(const hecl::ProjectPath& outPath,
|
||||
const hecl::ProjectPath& inPath, const Mesh& mesh,
|
||||
hecl::blender::PoolSkinIndex& poolSkinIndex);
|
||||
|
||||
struct MaterialPool {
|
||||
std::vector<const Material*> materials;
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
make_dnalist(CMDL
|
||||
FONT
|
||||
DGRP
|
||||
FSM2
|
||||
MAPA
|
||||
MAPU
|
||||
PATH
|
||||
MayaSpline
|
||||
EGMC
|
||||
SAVWCommon
|
||||
ParticleCommon
|
||||
MetaforceVersionInfo
|
||||
Tweaks/ITweakPlayerGun)
|
||||
FONT
|
||||
DGRP
|
||||
FSM2
|
||||
MAPA
|
||||
MAPU
|
||||
PATH
|
||||
MayaSpline
|
||||
EGMC
|
||||
SAVWCommon
|
||||
ParticleCommon
|
||||
MetaforceVersionInfo
|
||||
Tweaks/ITweakPlayerGun)
|
||||
|
||||
set(DNACOMMON_SOURCES
|
||||
DNACommon.hpp DNACommon.cpp
|
||||
PAK.hpp PAK.cpp
|
||||
GX.hpp GX.cpp
|
||||
FSM2.hpp FSM2.cpp
|
||||
MLVL.hpp MLVL.cpp
|
||||
CMDL.cpp
|
||||
MAPA.cpp
|
||||
MAPU.cpp
|
||||
PATH.hpp PATH.cpp
|
||||
STRG.hpp STRG.cpp
|
||||
TXTR.hpp TXTR.cpp
|
||||
ANCS.hpp ANCS.cpp
|
||||
ANIM.hpp ANIM.cpp
|
||||
PART.hpp PART.cpp
|
||||
SWHC.hpp SWHC.cpp
|
||||
CRSC.hpp CRSC.cpp
|
||||
ELSC.hpp ELSC.cpp
|
||||
WPSC.hpp WPSC.cpp
|
||||
DPSC.hpp DPSC.cpp
|
||||
ParticleCommon.cpp
|
||||
FONT.cpp
|
||||
DGRP.cpp
|
||||
ATBL.hpp ATBL.cpp
|
||||
DeafBabe.hpp DeafBabe.cpp
|
||||
BabeDead.hpp BabeDead.cpp
|
||||
RigInverter.hpp RigInverter.cpp
|
||||
AROTBuilder.hpp AROTBuilder.cpp
|
||||
OBBTreeBuilder.hpp OBBTreeBuilder.cpp
|
||||
MetaforceVersionInfo.hpp
|
||||
Tweaks/ITweak.hpp
|
||||
Tweaks/TweakWriter.hpp
|
||||
Tweaks/ITweakGame.hpp
|
||||
Tweaks/ITweakParticle.hpp
|
||||
Tweaks/ITweakPlayer.hpp
|
||||
Tweaks/ITweakPlayerControl.hpp
|
||||
Tweaks/ITweakGunRes.hpp
|
||||
Tweaks/ITweakPlayerRes.hpp
|
||||
Tweaks/ITweakGui.hpp
|
||||
Tweaks/ITweakSlideShow.hpp
|
||||
Tweaks/ITweakTargeting.hpp
|
||||
Tweaks/ITweakAutoMapper.hpp
|
||||
Tweaks/ITweakBall.hpp
|
||||
Tweaks/ITweakGuiColors.hpp)
|
||||
DNACommon.hpp DNACommon.cpp
|
||||
PAK.hpp PAK.cpp
|
||||
GX.hpp GX.cpp
|
||||
FSM2.hpp FSM2.cpp
|
||||
MLVL.hpp MLVL.cpp
|
||||
CMDL.cpp
|
||||
MAPA.cpp
|
||||
MAPU.cpp
|
||||
PATH.hpp PATH.cpp
|
||||
STRG.hpp STRG.cpp
|
||||
TXTR.hpp TXTR.cpp
|
||||
ANCS.hpp ANCS.cpp
|
||||
ANIM.hpp ANIM.cpp
|
||||
PART.hpp PART.cpp
|
||||
SWHC.hpp SWHC.cpp
|
||||
CRSC.hpp CRSC.cpp
|
||||
ELSC.hpp ELSC.cpp
|
||||
WPSC.hpp WPSC.cpp
|
||||
DPSC.hpp DPSC.cpp
|
||||
ParticleCommon.cpp
|
||||
FONT.cpp
|
||||
DGRP.cpp
|
||||
ATBL.hpp ATBL.cpp
|
||||
DeafBabe.hpp DeafBabe.cpp
|
||||
BabeDead.hpp BabeDead.cpp
|
||||
RigInverter.hpp RigInverter.cpp
|
||||
AROTBuilder.hpp AROTBuilder.cpp
|
||||
OBBTreeBuilder.hpp OBBTreeBuilder.cpp
|
||||
MetaforceVersionInfo.hpp
|
||||
Tweaks/ITweak.hpp
|
||||
Tweaks/TweakWriter.hpp
|
||||
Tweaks/ITweakGame.hpp
|
||||
Tweaks/ITweakParticle.hpp
|
||||
Tweaks/ITweakPlayer.hpp
|
||||
Tweaks/ITweakPlayerControl.hpp
|
||||
Tweaks/ITweakGunRes.hpp
|
||||
Tweaks/ITweakPlayerRes.hpp
|
||||
Tweaks/ITweakGui.hpp
|
||||
Tweaks/ITweakSlideShow.hpp
|
||||
Tweaks/ITweakTargeting.hpp
|
||||
Tweaks/ITweakAutoMapper.hpp
|
||||
Tweaks/ITweakBall.hpp
|
||||
Tweaks/ITweakGuiColors.hpp)
|
||||
|
||||
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
|
||||
|
|
|
@ -27,18 +27,22 @@ struct _CRSM {
|
|||
#define FLOAT_ENTRY(name, identifier) float identifier = 0.f;
|
||||
#include "CRSC.def"
|
||||
|
||||
template<typename _Func>
|
||||
template <typename _Func>
|
||||
void constexpr Enumerate(_Func f) {
|
||||
#define ENTRY(name, identifier) f(FOURCC(name), identifier);
|
||||
#include "CRSC.def"
|
||||
}
|
||||
|
||||
template<typename _Func>
|
||||
template <typename _Func>
|
||||
bool constexpr Lookup(FourCC fcc, _Func f) {
|
||||
switch (fcc.toUint32()) {
|
||||
#define ENTRY(name, identifier) case SBIG(name): f(identifier); return true;
|
||||
#define ENTRY(name, identifier) \
|
||||
case SBIG(name): \
|
||||
f(identifier); \
|
||||
return true;
|
||||
#include "CRSC.def"
|
||||
default: return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -29,9 +29,8 @@ hecl::ProjectPath UniqueIDBridge::TranslatePakIdToPath(const IDType& id, bool si
|
|||
LogDNACommon.report(logvisor::Warning, FMT_STRING("unable to translate {} to path"), id);
|
||||
return {};
|
||||
}
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
FMT_STRING("g_PakRouter or s_Project must be set to non-null before "
|
||||
"calling UniqueIDBridge::TranslatePakIdToPath"));
|
||||
LogDNACommon.report(logvisor::Fatal, FMT_STRING("g_PakRouter or s_Project must be set to non-null before "
|
||||
"calling UniqueIDBridge::TranslatePakIdToPath"));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -53,7 +52,8 @@ hecl::ProjectPath UniqueIDBridge::MakePathFromString(std::string_view str) {
|
|||
return {};
|
||||
hecl::Database::Project* project = s_Project.get();
|
||||
if (!project)
|
||||
LogDNACommon.report(logvisor::Fatal, FMT_STRING("UniqueIDBridge::setGlobalProject must be called before MakePathFromString"));
|
||||
LogDNACommon.report(logvisor::Fatal,
|
||||
FMT_STRING("UniqueIDBridge::setGlobalProject must be called before MakePathFromString"));
|
||||
hecl::ProjectPath path = hecl::ProjectPath(*project, str);
|
||||
project->addBridgePathToCache(IDType(path).toUint64(), path);
|
||||
return path;
|
||||
|
@ -90,9 +90,7 @@ void UniqueID32::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
|
|||
s += 4;
|
||||
}
|
||||