refactor Brush to be used in shared_ptr
This commit is contained in:
@@ -120,6 +120,11 @@ uint16_t NodePanelBrush::get_texture_id(int index) const
|
||||
return m_brushes[index]->high_id;
|
||||
}
|
||||
|
||||
std::string NodePanelBrush::get_texture_path(int index) const
|
||||
{
|
||||
return m_brushes[index]->high_path;
|
||||
}
|
||||
|
||||
std::string NodePanelBrush::get_thumb_path(int index) const
|
||||
{
|
||||
return m_brushes[index]->thumb_path;
|
||||
@@ -201,14 +206,15 @@ void NodePanelBrushPreset::init()
|
||||
brush->thumb_path = path;
|
||||
brush->high_path = path_hi;
|
||||
brush->high_id = const_hash(path_hi.c_str());
|
||||
brush->m_brush.m_tex_id = const_hash(path.c_str());
|
||||
brush->m_brush.m_tip_size = .05;
|
||||
brush->m_brush.m_tip_flow = .2;
|
||||
brush->m_brush.m_tip_opacity = 1;
|
||||
brush->m_brush.m_tip_spacing = 0.03;
|
||||
//brush->m_brush.m_jitter_spread = (rand() % 1000) * 0.0001;
|
||||
brush->m_brush = std::make_shared<Brush>();
|
||||
//brush->m_brush->m_tex_id = const_hash(path.c_str());
|
||||
brush->m_brush->m_tip_size = .05;
|
||||
brush->m_brush->m_tip_flow = .2;
|
||||
brush->m_brush->m_tip_opacity = 1;
|
||||
brush->m_brush->m_tip_spacing = 0.03;
|
||||
//brush->m_brush->m_jitter_spread = (rand() % 1000) * 0.0001;
|
||||
brush->m_preview->m_brush = brush->m_brush;
|
||||
brush->m_preview->draw_stroke();
|
||||
//brush->m_preview->draw_stroke();
|
||||
brush->m_thumb->m_path = path;
|
||||
brush->m_thumb->m_tex_id = const_hash(path.c_str());
|
||||
brush->m_thumb->create();
|
||||
@@ -230,11 +236,11 @@ void NodePanelBrushPreset::handle_click(Node* target)
|
||||
on_brush_changed(this, m_current->m_brushID);
|
||||
}
|
||||
|
||||
Brush NodePanelBrushPreset::get_brush(int index) const
|
||||
std::shared_ptr<Brush> NodePanelBrushPreset::get_brush(int index) const
|
||||
{
|
||||
auto b = m_brushes[index]->m_brush;
|
||||
auto& b = m_brushes[index]->m_brush;
|
||||
TextureManager::load(m_brushes[index]->high_path.c_str(), true);
|
||||
b.m_tex_id = m_brushes[index]->high_id;
|
||||
//b->m_tex_id = m_brushes[index]->high_id;
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -244,6 +250,11 @@ uint16_t NodePanelBrushPreset::get_texture_id(int index) const
|
||||
return m_brushes[index]->high_id;
|
||||
}
|
||||
|
||||
std::string NodePanelBrushPreset::get_texture_path(int index) const
|
||||
{
|
||||
return m_brushes[index]->high_path;
|
||||
}
|
||||
|
||||
int NodePanelBrushPreset::get_brush_id(int index) const
|
||||
{
|
||||
return m_brushes[index]->m_brushID;
|
||||
|
||||
Reference in New Issue
Block a user