#include "pch.h"
#include "node_tool_bucket.h"

Node* NodeToolBucket::clone_instantiate() const
{
    return new this_class;
}

void NodeToolBucket::clone_finalize(Node* dest) const
{
    parent::clone_finalize(dest);
    auto n = static_cast<this_class*>(dest);
    n->init_controls();
}

void NodeToolBucket::init()
{
    parent::init();
    init_template("tpl-tool-bucket");
    init_controls();
}

void NodeToolBucket::init_controls()
{
    m_slider_threshold = find<NodeSliderH>("threshold");
}

float NodeToolBucket::get_threshold() const
{
    return glm::max(1.f, m_slider_threshold->get_value() * 255.f);
}
