mirror of https://github.com/AxioDL/metaforce.git
Blender 3.0 fixes
This commit is contained in:
parent
5491fd75cf
commit
2f0febba27
|
@ -768,8 +768,8 @@ def make_retro_shader_mp3_color():
|
||||||
input.default_value = (0.0, 0.0, 0.0, 1.0)
|
input.default_value = (0.0, 0.0, 0.0, 1.0)
|
||||||
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
||||||
input.default_value = 0
|
input.default_value = 0
|
||||||
input.min_value = 0.000000
|
input.min_value = 0
|
||||||
input.max_value = 1.000000
|
input.max_value = 1
|
||||||
input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC")
|
input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC")
|
||||||
input.default_value = 1.0
|
input.default_value = 1.0
|
||||||
input.min_value = 0.000000
|
input.min_value = 0.000000
|
||||||
|
@ -1057,8 +1057,8 @@ def make_retro_shader_mp3_bloom():
|
||||||
input.max_value = 1.000000
|
input.max_value = 1.000000
|
||||||
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
||||||
input.default_value = 0
|
input.default_value = 0
|
||||||
input.min_value = 0.000000
|
input.min_value = 0
|
||||||
input.max_value = 1.000000
|
input.max_value = 1
|
||||||
new_grp.outputs.new("NodeSocketShader", "Shader")
|
new_grp.outputs.new("NodeSocketShader", "Shader")
|
||||||
nodes = {}
|
nodes = {}
|
||||||
node = new_grp.nodes.new("ShaderNodeMath")
|
node = new_grp.nodes.new("ShaderNodeMath")
|
||||||
|
@ -1261,8 +1261,8 @@ def make_retro_shader_mp3():
|
||||||
input.max_value = 1.000000
|
input.max_value = 1.000000
|
||||||
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
|
||||||
input.default_value = 0
|
input.default_value = 0
|
||||||
input.min_value = 0.000000
|
input.min_value = 0
|
||||||
input.max_value = 1.000000
|
input.max_value = 1
|
||||||
input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF")
|
input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF")
|
||||||
input.default_value = 0.0
|
input.default_value = 0.0
|
||||||
input.min_value = 0.000000
|
input.min_value = 0.000000
|
||||||
|
|
|
@ -215,17 +215,19 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
|
||||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
|
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
|
||||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
|
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
|
||||||
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
|
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
|
||||||
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name);
|
if (cmdlEnt != nullptr && cskrEnt != nullptr && cinfEnt != nullptr) {
|
||||||
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name);
|
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name);
|
||||||
cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name);
|
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name);
|
||||||
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
|
cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name);
|
||||||
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
if (ci.cmdlIce.isValid() && ci.cskrIce.isValid()) {
|
||||||
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
charAssoc.m_cmdlRigs[ci.cmdlIce] = {ci.cskrIce, ci.cinf};
|
||||||
std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
charAssoc.m_cskrToCharacter[ci.cskrIce] =
|
||||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
|
std::make_pair(entry.id, fmt::format(FMT_STRING("{}.ICE_{}.CSKR"), ci.name, ci.cskrIce));
|
||||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
|
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
|
||||||
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name);
|
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
|
||||||
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
|
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_icemodel"), id, ci.name);
|
||||||
|
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
|
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
|
||||||
|
|
|
@ -338,7 +338,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
|
||||||
"cam.lens_unit = 'FOV'\n"
|
"cam.lens_unit = 'FOV'\n"
|
||||||
"cam.clip_start = {}\n"
|
"cam.clip_start = {}\n"
|
||||||
"cam.clip_end = {}\n"
|
"cam.clip_end = {}\n"
|
||||||
"bpy.context.scene.render.resolution_x = 480 * {}\n"),
|
"bpy.context.scene.render.resolution_x = int(480 * {})\n"),
|
||||||
proj->znear, proj->zfar, proj->aspect);
|
proj->znear, proj->zfar, proj->aspect);
|
||||||
if (proj->aspect > 1.f)
|
if (proj->aspect > 1.f)
|
||||||
os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"),
|
os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"),
|
||||||
|
|
|
@ -505,7 +505,11 @@ try:
|
||||||
bpy.context.preferences.filepaths.save_version = 0
|
bpy.context.preferences.filepaths.save_version = 0
|
||||||
print('SAVING %s' % loaded_blend)
|
print('SAVING %s' % loaded_blend)
|
||||||
if loaded_blend:
|
if loaded_blend:
|
||||||
if 'FINISHED' in bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True):
|
if bpy.app.version >= (3, 0, 0):
|
||||||
|
ret = bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=False)
|
||||||
|
else:
|
||||||
|
ret = bpy.ops.wm.save_as_mainfile(filepath=loaded_blend, check_existing=False, compress=True)
|
||||||
|
if 'FINISHED' in ret:
|
||||||
writepipestr(b'FINISHED')
|
writepipestr(b'FINISHED')
|
||||||
else:
|
else:
|
||||||
writepipestr(b'CANCELLED')
|
writepipestr(b'CANCELLED')
|
||||||
|
|
|
@ -79,44 +79,51 @@ SDNARead::SDNARead(std::string_view path) {
|
||||||
r.readUBytesToBuf(magicBuf, 7);
|
r.readUBytesToBuf(magicBuf, 7);
|
||||||
r.seek(0, athena::SeekOrigin::Begin);
|
r.seek(0, athena::SeekOrigin::Begin);
|
||||||
if (strncmp(magicBuf, "BLENDER", 7)) {
|
if (strncmp(magicBuf, "BLENDER", 7)) {
|
||||||
/* Try gzip decompression */
|
atUint32 magic = hecl::SLittle(*(atUint32*)(magicBuf));
|
||||||
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
|
if (magic == 0xfd2fb528) {
|
||||||
m_data.resize((length * 2 + 4095) & ~4095);
|
/* Try zstandard decompression */
|
||||||
z_stream zstrm = {};
|
// TODO: Implement
|
||||||
inflateInit2(&zstrm, 16 + MAX_WBITS);
|
m_data = {};
|
||||||
zstrm.next_out = (Bytef*)m_data.data();
|
} else if (magic == 0x88b1f) {
|
||||||
zstrm.avail_out = m_data.size();
|
/* Try gzip decompression */
|
||||||
zstrm.total_out = 0;
|
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
|
||||||
|
m_data.resize((length * 2 + 4095) & ~4095);
|
||||||
|
z_stream zstrm = {};
|
||||||
|
inflateInit2(&zstrm, 16 + MAX_WBITS);
|
||||||
|
zstrm.next_out = (Bytef*)m_data.data();
|
||||||
|
zstrm.avail_out = m_data.size();
|
||||||
|
zstrm.total_out = 0;
|
||||||
|
|
||||||
atUint64 rs;
|
atUint64 rs;
|
||||||
while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) {
|
while ((rs = r.readUBytesToBuf(compBuf.get(), 4096))) {
|
||||||
int inflateRet;
|
int inflateRet;
|
||||||
zstrm.next_in = compBuf.get();
|
zstrm.next_in = compBuf.get();
|
||||||
zstrm.avail_in = rs;
|
zstrm.avail_in = rs;
|
||||||
while (zstrm.avail_in) {
|
while (zstrm.avail_in) {
|
||||||
if (!zstrm.avail_out) {
|
if (!zstrm.avail_out) {
|
||||||
zstrm.avail_out = m_data.size();
|
zstrm.avail_out = m_data.size();
|
||||||
m_data.resize(zstrm.avail_out * 2);
|
m_data.resize(zstrm.avail_out * 2);
|
||||||
zstrm.next_out = (Bytef*)m_data.data() + zstrm.avail_out;
|
zstrm.next_out = (Bytef*)m_data.data() + zstrm.avail_out;
|
||||||
|
}
|
||||||
|
inflateRet = inflate(&zstrm, Z_NO_FLUSH);
|
||||||
|
if (inflateRet == Z_STREAM_END)
|
||||||
|
break;
|
||||||
|
if (inflateRet != Z_OK) {
|
||||||
|
inflateEnd(&zstrm);
|
||||||
|
m_data = std::vector<uint8_t>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inflateRet = inflate(&zstrm, Z_NO_FLUSH);
|
|
||||||
if (inflateRet == Z_STREAM_END)
|
if (inflateRet == Z_STREAM_END)
|
||||||
break;
|
break;
|
||||||
if (inflateRet != Z_OK) {
|
|
||||||
inflateEnd(&zstrm);
|
|
||||||
m_data = std::vector<uint8_t>();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (inflateRet == Z_STREAM_END)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
inflateEnd(&zstrm);
|
inflateEnd(&zstrm);
|
||||||
|
|
||||||
if (strncmp((char*)m_data.data(), "BLENDER", 7)) {
|
if (strncmp((char*)m_data.data(), "BLENDER", 7)) {
|
||||||
m_data = std::vector<uint8_t>();
|
m_data = std::vector<uint8_t>();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_data.resize(length);
|
m_data.resize(length);
|
||||||
|
|
|
@ -161,7 +161,7 @@ bool IsPathBlend(const hecl::ProjectPath& path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = hecl::SLittle(buf);
|
buf = hecl::SLittle(buf);
|
||||||
return buf == 0x4e454c42 || buf == 0x88b1f;
|
return buf == 0x4e454c42 || buf == 0x88b1f || buf == 0xfd2fb528;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPathYAML(const hecl::ProjectPath& path) {
|
bool IsPathYAML(const hecl::ProjectPath& path) {
|
||||||
|
|
Loading…
Reference in New Issue