From d7ac967f129f2594af931977700bbed7741ed20d Mon Sep 17 00:00:00 2001 From: omigamedev Date: Tue, 26 Feb 2019 17:44:36 +0100 Subject: [PATCH] compute tip scale when loading from brush tips, remove tip_width which was replaced by tip_scale --- src/brush.cpp | 2 ++ src/brush.h | 1 - src/node_panel_brush.cpp | 2 -- src/node_panel_brush.h | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/brush.cpp b/src/brush.cpp index 6c6152e..1da8b39 100644 --- a/src/brush.cpp +++ b/src/brush.cpp @@ -339,6 +339,8 @@ bool Brush::load_tip(const std::string& path, const std::string& thumb) m_tip_texture->auto_destroy = true; m_brush_path = path; m_brush_thumb_path = thumb; + auto sz = m_tip_texture->size(); + m_tip_scale = sz.y > sz.x ? glm::vec2(sz.x / sz.y, 1.f) : glm::vec2(1.f, sz.y / sz.x); return true; } diff --git a/src/brush.h b/src/brush.h index aac1b1b..0007441 100644 --- a/src/brush.h +++ b/src/brush.h @@ -24,7 +24,6 @@ public: glm::vec4 m_tip_color = { 0, 0, 0, 1 }; glm::vec2 m_tip_scale = { 1.f, 1.f }; - float m_tip_width = 1.f; float m_tip_size = 50; float m_tip_spacing = .25; float m_tip_flow = 1.f; diff --git a/src/node_panel_brush.cpp b/src/node_panel_brush.cpp index 78d8ee8..c08b104 100644 --- a/src/node_panel_brush.cpp +++ b/src/node_panel_brush.cpp @@ -486,7 +486,6 @@ bool NodePanelBrushPreset::save() i.m_stencil_thumb_path_len = b->m_pattern_thumb_path.size(); i.m_tip_color = b->m_tip_color; i.m_tip_scale = b->m_tip_scale; - i.m_tip_width = b->m_tip_width; i.m_tip_size = b->m_tip_size; i.m_tip_spacing = b->m_tip_spacing; i.m_tip_flow = b->m_tip_flow; @@ -590,7 +589,6 @@ bool NodePanelBrushPreset::restore() auto b = std::make_shared(); b->m_tip_color = i.m_tip_color; b->m_tip_scale = i.m_tip_scale; - b->m_tip_width = i.m_tip_width; b->m_tip_size = i.m_tip_size; b->m_tip_spacing = i.m_tip_spacing; b->m_tip_flow = i.m_tip_flow; diff --git a/src/node_panel_brush.h b/src/node_panel_brush.h index a00ca44..4e58591 100644 --- a/src/node_panel_brush.h +++ b/src/node_panel_brush.h @@ -105,7 +105,6 @@ class NodePanelBrushPreset : public Node glm::vec4 m_tip_color{ 0, 0, 0, 1 }; glm::vec2 m_tip_scale = { 1.f, 1.f }; - float m_tip_width = 1.f; float m_tip_size = 0; float m_tip_spacing = 0; float m_tip_flow = 0;