mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-04 18:45:30 +00:00
Fixed some typo, added missing call to RegisterBuiltinVariables().
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
option(ENABLE_DEBUG_MILKDROP_PRESET "Enable STDERR debug output in Milkdrop preset code (Debug builds only)" OFF)
|
||||
|
||||
add_library(MilkdropPreset OBJECT
|
||||
BlurTexture.hpp
|
||||
BlurTexture.cpp
|
||||
BlurTexture.hpp
|
||||
Border.cpp
|
||||
Border.hpp
|
||||
Constants.hpp
|
||||
@ -13,8 +13,7 @@ add_library(MilkdropPreset OBJECT
|
||||
CustomWaveform.hpp
|
||||
DarkenCenter.cpp
|
||||
DarkenCenter.hpp
|
||||
PresetFileParser.cpp
|
||||
PresetFileParser.hpp
|
||||
EvalLibMutex.cpp
|
||||
Filters.cpp
|
||||
Filters.hpp
|
||||
IdlePreset.cpp
|
||||
@ -36,6 +35,8 @@ add_library(MilkdropPreset OBJECT
|
||||
PerPixelContext.hpp
|
||||
PerPixelMesh.cpp
|
||||
PerPixelMesh.hpp
|
||||
PresetFileParser.cpp
|
||||
PresetFileParser.hpp
|
||||
PresetFrameIO.cpp
|
||||
PresetFrameIO.hpp
|
||||
PresetState.cpp
|
||||
@ -51,7 +52,6 @@ add_library(MilkdropPreset OBJECT
|
||||
WaveformPerFrameContext.hpp
|
||||
WaveformPerPointContext.cpp
|
||||
WaveformPerPointContext.hpp
|
||||
EvalLibMutex.cpp
|
||||
)
|
||||
|
||||
target_include_directories(MilkdropPreset
|
||||
|
||||
@ -65,7 +65,7 @@ void MilkdropPreset::InitializePreset(PresetFileParser& parsedFile)
|
||||
{
|
||||
auto wave = std::make_unique<CustomWaveform>(m_state);
|
||||
wave->Initialize(parsedFile, i);
|
||||
m_customWaveforms[0] = std::move(wave);
|
||||
m_customWaveforms[i] = std::move(wave);
|
||||
}
|
||||
|
||||
// Custom shapes:
|
||||
@ -73,7 +73,7 @@ void MilkdropPreset::InitializePreset(PresetFileParser& parsedFile)
|
||||
{
|
||||
auto shape = std::make_unique<CustomShape>(m_state);
|
||||
shape->Initialize(parsedFile, i);
|
||||
m_customShapes[0] = std::move(shape);
|
||||
m_customShapes[i] = std::move(shape);
|
||||
}
|
||||
|
||||
CompileCodeAndRunInitExpressions();
|
||||
@ -82,6 +82,7 @@ void MilkdropPreset::InitializePreset(PresetFileParser& parsedFile)
|
||||
void MilkdropPreset::CompileCodeAndRunInitExpressions()
|
||||
{
|
||||
// Per-frame init and code
|
||||
m_perFrameContext.RegisterBuiltinVariables();
|
||||
m_perFrameContext.LoadStateVariables(m_state);
|
||||
m_perFrameContext.EvaluateInitCode(m_state);
|
||||
m_perFrameContext.CompilePerFrameCode(m_state.perFrameCode);
|
||||
|
||||
@ -43,7 +43,7 @@ void ShapePerFrameContext::RegisterBuiltinVariables()
|
||||
for (int t = 0; t < TVarCount; t++)
|
||||
{
|
||||
std::string tvar = "t" + std::to_string(t + 1);
|
||||
q_vars[t] = projectm_eval_context_register_variable(perFrameCodeContext, tvar.c_str());
|
||||
t_vars[t] = projectm_eval_context_register_variable(perFrameCodeContext, tvar.c_str());
|
||||
}
|
||||
|
||||
REG_VAR(bass);
|
||||
@ -150,6 +150,11 @@ void ShapePerFrameContext::EvaluateInitCode(const std::string& perFrameInitCode,
|
||||
void ShapePerFrameContext::CompilePerFrameCode(const std::string& perFrameCode,
|
||||
const CustomShape& shape)
|
||||
{
|
||||
if (perFrameCode.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
perFrameCodeHandle = projectm_eval_code_compile(perFrameCodeContext, perFrameCode.c_str());
|
||||
if (perFrameCodeHandle == nullptr)
|
||||
{
|
||||
|
||||
@ -43,7 +43,7 @@ void WaveformPerFrameContext::RegisterBuiltinVariables()
|
||||
for (int t = 0; t < TVarCount; t++)
|
||||
{
|
||||
std::string tvar = "t" + std::to_string(t + 1);
|
||||
q_vars[t] = projectm_eval_context_register_variable(perFrameCodeContext, tvar.c_str());
|
||||
t_vars[t] = projectm_eval_context_register_variable(perFrameCodeContext, tvar.c_str());
|
||||
}
|
||||
|
||||
REG_VAR(bass);
|
||||
|
||||
Reference in New Issue
Block a user