Additional addon features for MP3

This commit is contained in:
Jack Andersen 2020-04-09 17:19:33 -10:00
parent 2c98306dff
commit 8fd6664984
13 changed files with 90 additions and 37 deletions

View File

@ -50,6 +50,7 @@ class hecl_scene_panel(bpy.types.Panel):
sm_row = layout.row(align=True)
sm_row.prop_enum(context.scene, 'hecl_shader_model', 'ORIGINAL')
sm_row.prop_enum(context.scene, 'hecl_shader_model', 'PBR')
layout.prop(context.scene, 'hecl_mp3_bloom', text='View MP3 Bloom')
for exp_type in hecl_typeS:
if exp_type[0] == context.scene.hecl_type and callable(exp_type[3]):
@ -133,9 +134,15 @@ def shader_model_update(self, context):
value = 0.0
if self.hecl_shader_model == 'PBR':
value = 1.0
bloom_value = 0.0
if self.hecl_mp3_bloom:
bloom_value = 1.0
for shad in ('RetroShader', 'RetroDynamicShader', 'RetroDynamicAlphaShader', 'RetroDynamicCharacterShader'):
if shad in bpy.data.node_groups and 'NewShaderModel' in bpy.data.node_groups[shad].nodes:
bpy.data.node_groups[shad].nodes['NewShaderModel'].outputs[0].default_value = value
for shad in ('RetroShaderMP3',):
if shad in bpy.data.node_groups and 'Mix Shader' in bpy.data.node_groups[shad].nodes:
bpy.data.node_groups[shad].nodes['Mix Shader'].inputs[0].default_value = bloom_value
# Load scene callback
from bpy.app.handlers import persistent
@ -239,6 +246,10 @@ def register():
('PBR', "PBR", "Hybrid PBR materials replacing original reflection")],
update=shader_model_update,
default='ORIGINAL')
bpy.types.Scene.hecl_mp3_bloom = bpy.props.BoolProperty(name="HECL View MP3 Bloom",
description="Preview MP3 bloom factors of model",
update=shader_model_update,
default=False)
bpy.app.handlers.load_post.append(scene_loaded)
Patching.register()

View File

@ -93,7 +93,7 @@ public:
hecl::GuiMode = info.gui;
}
virtual ~ToolBase() = default;
virtual hecl::SystemString toolName() const = 0;
virtual hecl::SystemStringView toolName() const = 0;
virtual int run() = 0;
virtual void cancel() {}
explicit operator bool() const { return m_good; }

View File

@ -145,7 +145,7 @@ public:
}
}
hecl::SystemString toolName() const override { return _SYS_STR("cook"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("cook"sv); }
int run() override {
hecl::MultiProgressPrinter printer(true);

View File

@ -112,7 +112,7 @@ public:
help.endWrap();
}
hecl::SystemString toolName() const override { return _SYS_STR("extract"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("extract"sv); }
static void _recursivePrint(int level, hecl::Database::IDataSpec::ExtractReport& rep) {
for (int l = 0; l < level; ++l)

View File

@ -18,34 +18,33 @@ public:
~ToolHelp() override = default;
static void Help(HelpOutput& help) {
/* clang-format off */
help.printBold(
_SYS_STR(" ___________ \n") _SYS_STR(
" ,.-'\"...........``~., \n") _SYS_STR(" "
",.-\".......................\"-., \n")
_SYS_STR(" ,/..................................\":, \n") _SYS_STR(
" .,?........................................, \n")
_SYS_STR(" /...........................................,}\n") _SYS_STR(
" ./........................................,:`^`..}\n")
_SYS_STR(" ./.......................................,:\"...../\n") _SYS_STR(
" ?.....__..................................:`...../\n")
_SYS_STR(" /__.(...\"~-,_...........................,:`....../\n") _SYS_STR(
" /(_....\"~,_....\"~,_.....................,:`...._/ \n")
_SYS_STR(" {.._$;_....\"=,_.....\"-,_......,.-~-,},.~\";/....} \n") _SYS_STR(
" ((...*~_......\"=-._...\";,,./`........../\"..../ \n")
_SYS_STR(" ,,,___.`~,......\"~.,....................`......}....../ \n") _SYS_STR(
"............(....`=-,,...`.........................(...;_,,-\" \n")
_SYS_STR("............/.`~,......`-.................................../ \n")
_SYS_STR(".............`~.*-,.....................................|,./...,__ "
"\n") _SYS_STR(",,_..........}.>-._..................................."
"|.......`=~-, \n") _SYS_STR(
".....`=~-,__......`,................................. \n")
_SYS_STR("...................`=~-,,.,........................... \n")
_SYS_STR(".........................`:,,..........................`\n")
_SYS_STR(
"...........................`=-,...............,%%`>--==`` \n")
_SYS_STR(
".................................._.........._,-%%...` \n")
_SYS_STR("...................................,\n"));
_SYS_STR(" ___________ \n")
_SYS_STR(" ,.-'\"...........``~., \n")
_SYS_STR(" ,.-\".......................\"-., \n")
_SYS_STR(" ,/..................................\":, \n")
_SYS_STR(" .,?........................................, \n")
_SYS_STR(" /...........................................,}\n")
_SYS_STR(" ./........................................,:`^`..}\n")
_SYS_STR(" ./.......................................,:\"...../\n")
_SYS_STR(" ?.....__..................................:`...../\n")
_SYS_STR(" /__.(...\"~-,_...........................,:`....../\n")
_SYS_STR(" /(_....\"~,_....\"~,_.....................,:`...._/ \n")
_SYS_STR(" {.._$;_....\"=,_.....\"-,_......,.-~-,},.~\";/....} \n")
_SYS_STR(" ((...*~_......\"=-._...\";,,./`........../\"..../ \n")
_SYS_STR(" ,,,___.`~,......\"~.,....................`......}....../ \n")
_SYS_STR("............(....`=-,,...`.........................(...;_,,-\" \n")
_SYS_STR("............/.`~,......`-.................................../ \n")
_SYS_STR(".............`~.*-,.....................................|,./...,__ \n")
_SYS_STR(",,_..........}.>-._...................................|.......`=~-, \n")
_SYS_STR(".....`=~-,__......`,................................. \n")
_SYS_STR("...................`=~-,,.,........................... \n")
_SYS_STR(".........................`:,,..........................`\n")
_SYS_STR("...........................`=-,...............,%%`>--==`` \n")
_SYS_STR(".................................._.........._,-%%...` \n")
_SYS_STR("...................................,\n"));
/* clang-format on */
}
static void ShowHelp(const hecl::SystemString& toolName) {
@ -72,7 +71,7 @@ public:
ho.go();
}
hecl::SystemString toolName() const override { return _SYS_STR("help"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("help"sv); }
int run() override {
ShowHelp(m_info.args.front());

View File

@ -71,7 +71,7 @@ public:
help.endWrap();
}
hecl::SystemString toolName() const override { return _SYS_STR("image"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("image"sv); }
int run() override {
if (XTERM_COLOR)

View File

@ -73,5 +73,5 @@ public:
help.endWrap();
}
hecl::SystemString toolName() const override { return _SYS_STR("init"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("init"sv); }
};

View File

@ -0,0 +1,34 @@
#pragma once
#include "ToolBase.hpp"
#include <cstdio>
class ToolInstallAddon final : public ToolBase {
public:
explicit ToolInstallAddon(const ToolPassInfo& info) : ToolBase(info) {}
int run() override {
hecl::blender::SharedBlenderToken.getBlenderConnection();
return 0;
}
static void Help(HelpOutput& help) {
help.secHead(_SYS_STR("NAME"));
help.beginWrap();
help.wrap(_SYS_STR("hecl-installaddon - Installs embedded Blender addon into local Blender\n"));
help.endWrap();
help.secHead(_SYS_STR("SYNOPSIS"));
help.beginWrap();
help.wrap(_SYS_STR("hecl installaddon\n"));
help.endWrap();
help.secHead(_SYS_STR("DESCRIPTION"));
help.beginWrap();
help.wrap(_SYS_STR("Installs the hecl Blender addon into Blender. The path to the blender executable ")
_SYS_STR("can be overridden by setting the BLENDER_BIN environment variable."));
help.endWrap();
}
hecl::SystemStringView toolName() const override { return _SYS_STR("installaddon"sv); }
};

View File

@ -151,7 +151,7 @@ public:
help.endWrap();
}
hecl::SystemString toolName() const override { return _SYS_STR("package"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("package"sv); }
int run() override {
if (XTERM_COLOR)

View File

@ -71,7 +71,7 @@ public:
help.endWrap();
}
hecl::SystemString toolName() const override { return _SYS_STR("spec"); }
hecl::SystemStringView toolName() const override { return _SYS_STR("spec"sv); }
int run() override {
if (!m_info.project) {

View File

@ -27,6 +27,7 @@ logvisor::Module LogModule("hecl::Driver");
#include "ToolCook.hpp"
#include "ToolPackage.hpp"
#include "ToolImage.hpp"
#include "ToolInstallAddon.hpp"
#include "ToolHelp.hpp"
/* Static reference to dataspec additions
@ -49,9 +50,9 @@ static void printHelp(const hecl::SystemChar* pname) {
else
fmt::print(fmt(_SYS_STR("HECL")));
#if HECL_HAS_NOD
#define TOOL_LIST "extract|init|cook|package|image|help"
#define TOOL_LIST "extract|init|cook|package|image|installaddon|help"
#else
#define TOOL_LIST "extract|init|cook|package|help"
#define TOOL_LIST "extract|init|cook|package|installaddon|help"
#endif
#if HECL_GIT
fmt::print(fmt(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: {} " TOOL_LIST "\n")), pname);
@ -251,6 +252,10 @@ static std::unique_ptr<ToolBase> MakeSelectedTool(hecl::SystemString toolName, T
}
#endif
if (toolNameLower == _SYS_STR("installaddon")) {
return std::make_unique<ToolInstallAddon>(info);
}
if (toolNameLower == _SYS_STR("help")) {
return std::make_unique<ToolHelp>(info);
}

View File

@ -717,6 +717,7 @@ class Connection {
std::atomic_bool m_lock = {false};
bool m_pyStreamActive = false;
bool m_dataStreamActive = false;
bool m_blenderQuit = false;
#if _WIN32
PROCESS_INFORMATION m_pinfo = {};
std::thread m_consoleThread;

View File

@ -1661,6 +1661,9 @@ MapUniverse DataStream::compileMapUniverse() {
}
void Connection::quitBlender() {
if (m_blenderQuit)
return;
m_blenderQuit = true;
char lineBuf[256];
if (m_lock) {
if (m_pyStreamActive) {