Blender 3.0 fixes

This commit is contained in:
Phillip Stephens 2022-01-02 19:25:11 -08:00
parent 5491fd75cf
commit 2f0febba27
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
6 changed files with 64 additions and 51 deletions

View File

@ -768,8 +768,8 @@ def make_retro_shader_mp3_color():
input.default_value = (0.0, 0.0, 0.0, 1.0)
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0
input.min_value = 0.000000
input.max_value = 1.000000
input.min_value = 0
input.max_value = 1
input = new_grp.inputs.new("NodeSocketFloatFactor", "OPAC")
input.default_value = 1.0
input.min_value = 0.000000
@ -1057,8 +1057,8 @@ def make_retro_shader_mp3_bloom():
input.max_value = 1.000000
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0
input.min_value = 0.000000
input.max_value = 1.000000
input.min_value = 0
input.max_value = 1
new_grp.outputs.new("NodeSocketShader", "Shader")
nodes = {}
node = new_grp.nodes.new("ShaderNodeMath")
@ -1261,8 +1261,8 @@ def make_retro_shader_mp3():
input.max_value = 1.000000
input = new_grp.inputs.new("NodeSocketInt", "Add INCA")
input.default_value = 0
input.min_value = 0.000000
input.max_value = 1.000000
input.min_value = 0
input.max_value = 1
input = new_grp.inputs.new("NodeSocketFloatFactor", "BNIF")
input.default_value = 0.0
input.min_value = 0.000000

View File

@ -215,6 +215,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
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);
if (cmdlEnt != nullptr && cskrEnt != nullptr && cinfEnt != nullptr) {
cmdlEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_model"), id, ci.name);
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skin"), id, ci.name);
cinfEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_skel"), id, ci.name);
@ -228,6 +229,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssoci
cskrEnt->name = fmt::format(FMT_STRING("ANCS_{}_{}_iceskin"), id, ci.name);
}
}
}
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
ancs.getAnimationResInfo(&pakRouter, animInfo);
for (auto& [animIdx, animResInfo] : animInfo) {

View File

@ -338,7 +338,7 @@ bool FRME::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
"cam.lens_unit = 'FOV'\n"
"cam.clip_start = {}\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);
if (proj->aspect > 1.f)
os.format(FMT_STRING("cam.angle = math.atan2({}, 1.0 / math.tan(math.radians({} / 2.0))) * 2.0\n"),

View File

@ -505,7 +505,11 @@ try:
bpy.context.preferences.filepaths.save_version = 0
print('SAVING %s' % 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')
else:
writepipestr(b'CANCELLED')

View File

@ -79,6 +79,12 @@ SDNARead::SDNARead(std::string_view path) {
r.readUBytesToBuf(magicBuf, 7);
r.seek(0, athena::SeekOrigin::Begin);
if (strncmp(magicBuf, "BLENDER", 7)) {
atUint32 magic = hecl::SLittle(*(atUint32*)(magicBuf));
if (magic == 0xfd2fb528) {
/* Try zstandard decompression */
// TODO: Implement
m_data = {};
} else if (magic == 0x88b1f) {
/* Try gzip decompression */
std::unique_ptr<uint8_t[]> compBuf(new uint8_t[4096]);
m_data.resize((length * 2 + 4095) & ~4095);
@ -118,6 +124,7 @@ SDNARead::SDNARead(std::string_view path) {
m_data = std::vector<uint8_t>();
return;
}
}
} else {
m_data.resize(length);
r.readUBytesToBuf(m_data.data(), length);

View File

@ -161,7 +161,7 @@ bool IsPathBlend(const hecl::ProjectPath& path) {
}
buf = hecl::SLittle(buf);
return buf == 0x4e454c42 || buf == 0x88b1f;
return buf == 0x4e454c42 || buf == 0x88b1f || buf == 0xfd2fb528;
}
bool IsPathYAML(const hecl::ProjectPath& path) {