Skip to content

Commit

Permalink
fix #41
Browse files Browse the repository at this point in the history
  • Loading branch information
vooku committed Mar 28, 2020
1 parent 9ad2f09 commit 29c1afb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions skinny/src/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void Gui::reload()
layerMidiInputs_[i]->setText("");
layerCCInputs_[i]->setText("");
layerRetriggerToggles_[i]->setChecked(false);
blendModeDropdowns_[i]->select(0);
blendModeDropdowns_[i]->select(static_cast<int>(DEFAULT_BLEND_MODE));
}
}

Expand Down Expand Up @@ -657,13 +657,12 @@ void Gui::setupBlendModePanel(glm::ivec2& pos)
blendModePanel_->addBreak();

std::vector<string> options;
for (auto i = static_cast<int>(BlendMode::Normal); i < static_cast<int>(BlendMode::Count); ++i)
for (auto i = static_cast<int>(BlendMode::Overlay); i < static_cast<int>(BlendMode::Count); ++i)
options.push_back(c_str(static_cast<BlendMode>(i)));

for (int i = 0; i < blendModeDropdowns_.size(); ++i) {
blendModeDropdowns_[i] = blendModePanel_->addDropdown("Select...", options);
blendModeDropdowns_[i]->setName(std::to_string(i));
blendModeDropdowns_[i]->select(static_cast<int>(BlendMode::Normal));
blendModeDropdowns_[i]->onDropdownEvent(this, &Gui::onBlendModeDropdown);
}
blendModePanel_->addBreak();
Expand Down
2 changes: 1 addition & 1 deletion skinny/src/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Layer::Layer(int id, ErrorType error) :
id_(id),
name_(error == ErrorType::Invalid ? "Invalid description." : "Failed to load."),
valid_(false),
blendMode_(BlendMode::Normal),
blendMode_(DEFAULT_BLEND_MODE),
alpha_(0)
{
}
Expand Down
4 changes: 2 additions & 2 deletions skinny/src/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const char * c_str(BlendMode blendMode)
{
switch (blendMode)
{
case BlendMode::Normal:
return "Normal";
case BlendMode::Overlay:
return "Overlay";
case BlendMode::Multiply:
return "Multiply";
case BlendMode::Screen:
Expand Down
4 changes: 3 additions & 1 deletion skinny/src/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static constexpr const char * FONT_ITALIC = "fonts/IBMPlexSerif-Italic.ttf";

enum class BlendMode {
Invalid = -1,
Normal = 0, // s
Overlay = 0, // s
Multiply = 1, // b * s
Screen = 2, // 1 - ((1 - b) * (1 - s))
Darken = 3, // min(b, s)
Expand All @@ -37,6 +37,8 @@ enum class BlendMode {

const char* c_str(BlendMode blendMode);

static const BlendMode DEFAULT_BLEND_MODE = BlendMode::LinearDodge;

enum class EffectType {
Invalid = -1,
Solarize = 0,
Expand Down
2 changes: 1 addition & 1 deletion skinny/src/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct LayerDescription : public MappableDescription {
midiNote note = invalid_midi,
midiNote cc = invalid_midi,
//float alpha = 1.0f,
const BlendMode& blendMode = BlendMode::Normal);
const BlendMode& blendMode = DEFAULT_BLEND_MODE);

bool fromXml(ofxXmlSettings& config) override;
void toXml(ofxXmlSettings& config) const override;
Expand Down

0 comments on commit 29c1afb

Please sign in to comment.