preset size text
This commit is contained in:
@@ -343,6 +343,7 @@ void NodeBrushPresetItem::init()
|
||||
color_normal = glm::vec4(.3, .3, .3, 1);
|
||||
m_color = color_normal;
|
||||
m_thumb = find<NodeImage>("thumb");
|
||||
m_caption_size = find<NodeText>("caption-size");
|
||||
m_preview = find<NodeStrokePreview>("canvas");
|
||||
m_preview->m_min_flow = 1.f;
|
||||
}
|
||||
@@ -367,20 +368,7 @@ void NodePanelBrushPreset::init()
|
||||
m_container = find<Node>("brushes");
|
||||
m_btn_add = find<NodeButtonCustom>("btn-add");
|
||||
m_btn_add->on_click = [this] (Node*) {
|
||||
NodeBrushPresetItem* brush = new NodeBrushPresetItem;
|
||||
m_container->add_child(brush);
|
||||
brush->init();
|
||||
brush->create();
|
||||
brush->loaded();
|
||||
brush->thumb_path = Canvas::I->m_current_brush->m_brush_thumb_path;
|
||||
brush->high_path = Canvas::I->m_current_brush->m_brush_path;
|
||||
brush->m_brush = std::make_shared<Brush>(*Canvas::I->m_current_brush);
|
||||
//brush->m_brush->m_tip_size = .05f;
|
||||
brush->m_preview->m_brush = brush->m_brush;
|
||||
brush->m_preview->draw_stroke();
|
||||
brush->m_thumb->m_use_mipmaps = true;
|
||||
brush->m_thumb->set_image(brush->m_brush->m_brush_thumb_path);
|
||||
brush->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
|
||||
add_brush(std::make_shared<Brush>(*Canvas::I->m_current_brush));
|
||||
save();
|
||||
};
|
||||
m_btn_up = find<NodeButtonCustom>("btn-up");
|
||||
@@ -691,6 +679,7 @@ bool NodePanelBrushPreset::restore()
|
||||
brush->m_brush = b;
|
||||
brush->m_preview->m_brush = b;
|
||||
brush->m_preview->draw_stroke();
|
||||
brush->m_caption_size->set_text_format("%d", (int)b->m_tip_size);
|
||||
brush->m_thumb->set_image(brush->m_brush->m_brush_thumb_path);
|
||||
brush->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
|
||||
}
|
||||
@@ -716,5 +705,6 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr<Brush> brush)
|
||||
b->m_preview->draw_stroke();
|
||||
b->m_thumb->m_use_mipmaps = true;
|
||||
b->m_thumb->set_image(brush->m_brush_thumb_path);
|
||||
b->m_caption_size->set_text_format("%d", (int)brush->m_tip_size);
|
||||
b->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user