preset button to simple button
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
<node dir="row">
|
||||
<node width="36%" dir="col">
|
||||
<!--<node height="20" justify="center" margin="5 0 5 0"><text text="Shade"/></node>-->
|
||||
<node height="40" justify="center" margin="5 0 0 0">
|
||||
<node height="30" justify="center" margin="5 0 0 0">
|
||||
<text text="Preset"/>
|
||||
</node>
|
||||
<node height="40" justify="center" margin="5 0 0 0">
|
||||
@@ -163,10 +163,7 @@
|
||||
</node>
|
||||
<node dir="col" align="center" grow="1" width="1" flood-events="1">
|
||||
<!--<node height="20" pad="1" width="100%" margin="5 0 5 0"><slider-h id="tip-shade" value="1"/></node>-->
|
||||
<button-custom id="preset-button" width="100%" height="40" margin="5 0 0 0" dir="row" pad="4">
|
||||
<image id="preset-thumb" width="32" height="100%"/>
|
||||
<stroke-preview id="preset-preview" width="10" grow="1" height="100%"/>
|
||||
</button-custom>
|
||||
<button id="preset-button" text="Select Preset" width="100%" height="30" margin="5 0 0 0" dir="row"/>
|
||||
<node dir="row" margin="5 0 0 0">
|
||||
<button-custom id="tip-change" width="40" height="40" dir="row" pad="4">
|
||||
<image id="tip-change-thumb" width="32" height="100%"/>
|
||||
|
||||
@@ -33,7 +33,7 @@ void NodePanelGrid::init_controls()
|
||||
m_hm_preview = find<NodeImageTexture>("grid-heightmap-preview");
|
||||
m_hm_load = find<NodeButton>("grid-heightmap-load");
|
||||
m_hm_clear = find<NodeButton>("grid-heightmap-clear");
|
||||
m_hm_reload = find<NodeButton>("grid-heightmap-reload");
|
||||
m_hm_reload = find<NodeButtonCustom>("grid-heightmap-reload");
|
||||
m_hm_wireframe = find<NodeSliderH>("grid-heightmap-wireframe");
|
||||
m_hm_thickness = find<NodeSliderH>("grid-heightmap-thickness");
|
||||
m_hm_height = find<NodeSliderH>("grid-heightmap-height");
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define NANORT_USE_CPP11_FEATURE
|
||||
#define NANORT_ENABLE_PARALLEL_BUILD
|
||||
#include "nanort.h"
|
||||
#include "node_button_custom.h"
|
||||
|
||||
class NodeHeightmapOverlay : public NodeBorder
|
||||
{
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
NodeImageTexture* m_hm_preview;
|
||||
NodeButton* m_hm_load;
|
||||
NodeButton* m_hm_clear;
|
||||
NodeButton* m_hm_reload;
|
||||
NodeButtonCustom* m_hm_reload;
|
||||
NodeComboBox* m_hm_shading;
|
||||
NodeSliderH* m_hm_height;
|
||||
NodeSliderH* m_hm_wireframe;
|
||||
|
||||
@@ -268,12 +268,7 @@ void NodePanelStroke::init_controls()
|
||||
|
||||
// BRUSH PRESETS
|
||||
|
||||
m_preset_thumb = find<NodeImage>("preset-thumb");
|
||||
m_preset_thumb->m_use_mipmaps = true;
|
||||
m_preset_preview = find<NodeStrokePreview>("preset-preview");
|
||||
m_preset_preview->m_brush = b;
|
||||
m_preset_preview->draw_stroke();
|
||||
m_preset_button = find<NodeButtonCustom>("preset-button");
|
||||
m_preset_button = find<NodeButton>("preset-button");
|
||||
m_preset_button->on_click = [this](Node*) {
|
||||
auto screen = root()->m_size;
|
||||
glm::vec2 pos = m_preset_button->m_pos + glm::vec2(m_preset_button->m_size.x, 0);
|
||||
@@ -302,10 +297,8 @@ void NodePanelStroke::init_controls()
|
||||
b->m_tip_color = Canvas::I->m_current_brush->m_tip_color;
|
||||
*Canvas::I->m_current_brush = *b;
|
||||
m_preview->draw_stroke();
|
||||
m_preset_preview->draw_stroke();
|
||||
m_brush_thumb->set_image(b->m_brush_thumb_path);
|
||||
m_dual_brush_thumb->set_image(b->m_dual_thumb_path);
|
||||
m_preset_thumb->set_image(b->m_brush_thumb_path);
|
||||
m_pattern_thumb->set_image(b->m_pattern_thumb_path);
|
||||
update_controls();
|
||||
};
|
||||
|
||||
@@ -45,9 +45,7 @@ public:
|
||||
NodeImage* m_brush_thumb;
|
||||
NodeImage* m_dual_brush_thumb;
|
||||
NodeImage* m_pattern_thumb;
|
||||
NodeImage* m_preset_thumb;
|
||||
NodeButtonCustom* m_preset_button;
|
||||
NodeStrokePreview* m_preset_preview;
|
||||
NodeButton* m_preset_button;
|
||||
|
||||
NodeCheckBox* m_tip_invert;
|
||||
NodeCheckBox* m_tip_flipx;
|
||||
|
||||
@@ -280,14 +280,14 @@ void NodeStrokePreview::draw_stroke()
|
||||
{
|
||||
float w = m_size.x * App::I.zoom;
|
||||
float h = m_size.y * App::I.zoom;
|
||||
glm::vec2 pad = { 0, 0 };
|
||||
glm::vec2 pad = { 10, 10 };
|
||||
if (!b->m_tip_size_pressure)
|
||||
pad = m_size * App::I.zoom * .15f;
|
||||
pad.x = pad.y = m_size.y * App::I.zoom * .15f;
|
||||
std::vector<glm::vec2> kp = { pad, { pad.x, h - pad.y },{ w - pad.x, pad.y },{ w - pad.x, h - pad.y } };
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
float t = (float)i / 100.f;
|
||||
float p = glm::pow(1.f - glm::abs(t * 2.f - 1.f), 2.f);
|
||||
float p = glm::clamp((1.f - glm::abs(t * 2.f - 1.f)) * 1.1f, 0.f, 1.f);
|
||||
m_stroke.add_point(glm::vec3(BezierCurve::Bezier2D(kp, t), 0), p);
|
||||
if (b->m_dual_enabled)
|
||||
m_dual_stroke.add_point(glm::vec3(BezierCurve::Bezier2D(kp, t), 0), p);
|
||||
|
||||
Reference in New Issue
Block a user