preset size text
This commit is contained in:
@@ -87,8 +87,9 @@
|
|||||||
<!--brush-presets-item icon-->
|
<!--brush-presets-item icon-->
|
||||||
<layout id="tpl-brush-preset">
|
<layout id="tpl-brush-preset">
|
||||||
<button-custom width="300" height="70" margin="1" pad="5" align="center" justify="center" dir="row">
|
<button-custom width="300" height="70" margin="1" pad="5" align="center" justify="center" dir="row">
|
||||||
<border color="1" width="40" height="60" align="center" justify="center">
|
<border color="1" width="40" height="60" align="center" justify="center" dir="col">
|
||||||
<image id="thumb" width="40" height="40"/>
|
<image id="thumb" width="40" height="40"/>
|
||||||
|
<text id="caption-size" text="000" color="0" margin="3 0 0 0"/>
|
||||||
</border>
|
</border>
|
||||||
<stroke-preview id="canvas" width="1" grow="1" height="60"/>
|
<stroke-preview id="canvas" width="1" grow="1" height="60"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ void NodeBrushPresetItem::init()
|
|||||||
color_normal = glm::vec4(.3, .3, .3, 1);
|
color_normal = glm::vec4(.3, .3, .3, 1);
|
||||||
m_color = color_normal;
|
m_color = color_normal;
|
||||||
m_thumb = find<NodeImage>("thumb");
|
m_thumb = find<NodeImage>("thumb");
|
||||||
|
m_caption_size = find<NodeText>("caption-size");
|
||||||
m_preview = find<NodeStrokePreview>("canvas");
|
m_preview = find<NodeStrokePreview>("canvas");
|
||||||
m_preview->m_min_flow = 1.f;
|
m_preview->m_min_flow = 1.f;
|
||||||
}
|
}
|
||||||
@@ -367,20 +368,7 @@ void NodePanelBrushPreset::init()
|
|||||||
m_container = find<Node>("brushes");
|
m_container = find<Node>("brushes");
|
||||||
m_btn_add = find<NodeButtonCustom>("btn-add");
|
m_btn_add = find<NodeButtonCustom>("btn-add");
|
||||||
m_btn_add->on_click = [this] (Node*) {
|
m_btn_add->on_click = [this] (Node*) {
|
||||||
NodeBrushPresetItem* brush = new NodeBrushPresetItem;
|
add_brush(std::make_shared<Brush>(*Canvas::I->m_current_brush));
|
||||||
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);
|
|
||||||
save();
|
save();
|
||||||
};
|
};
|
||||||
m_btn_up = find<NodeButtonCustom>("btn-up");
|
m_btn_up = find<NodeButtonCustom>("btn-up");
|
||||||
@@ -691,6 +679,7 @@ bool NodePanelBrushPreset::restore()
|
|||||||
brush->m_brush = b;
|
brush->m_brush = b;
|
||||||
brush->m_preview->m_brush = b;
|
brush->m_preview->m_brush = b;
|
||||||
brush->m_preview->draw_stroke();
|
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->m_thumb->set_image(brush->m_brush->m_brush_thumb_path);
|
||||||
brush->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
|
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_preview->draw_stroke();
|
||||||
b->m_thumb->m_use_mipmaps = true;
|
b->m_thumb->m_use_mipmaps = true;
|
||||||
b->m_thumb->set_image(brush->m_brush_thumb_path);
|
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);
|
b->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "node_stroke_preview.h"
|
#include "node_stroke_preview.h"
|
||||||
#include "brush.h"
|
#include "brush.h"
|
||||||
#include "node_scroll.h"
|
#include "node_scroll.h"
|
||||||
|
#include "node_text.h"
|
||||||
|
|
||||||
class NodeButtonBrush : public NodeButtonCustom
|
class NodeButtonBrush : public NodeButtonCustom
|
||||||
{
|
{
|
||||||
@@ -72,6 +73,7 @@ public:
|
|||||||
bool m_selected = false;
|
bool m_selected = false;
|
||||||
NodeStrokePreview* m_preview;
|
NodeStrokePreview* m_preview;
|
||||||
NodeImage* m_thumb;
|
NodeImage* m_thumb;
|
||||||
|
NodeText* m_caption_size;
|
||||||
virtual Node* clone_instantiate() const override;
|
virtual Node* clone_instantiate() const override;
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user