init brush settings at startup

This commit is contained in:
2017-09-30 22:45:35 +01:00
parent 4b49772af8
commit ccde247f2a
4 changed files with 26 additions and 13 deletions

View File

@@ -493,6 +493,18 @@ void App::initLayout()
init_menu_edit();
init_menu_layer();
Brush b;
b.m_tex_id = brushes->get_texture_id(0);
b.id = brushes->get_brush_id(0);
b.m_tip_size = .1f;
b.m_tip_flow = .5f;
b.m_tip_spacing = .1f;
b.m_tip_opacity = 1.f;
stroke->m_canvas->m_brush = b;
canvas->m_brush = b;
brush_update();
// hacky thing to make the toolbar buttons not steal events when moving cursor fast
if (auto* toolbar = layout[main_id]->find<Node>("toolbar"))
toolbar->m_flood_events = true;

View File

@@ -7,22 +7,22 @@ NS_START
class Brush
{
public:
int id;
int id = 0;
std::string m_name;
uint16_t m_tex_id;
uint16_t m_tex_id = 0;
glm::vec4 m_tip_color;
float m_tip_size;
float m_tip_spacing;
float m_tip_flow;
float m_tip_opacity;
float m_tip_angle;
float m_tip_size = 0;
float m_tip_spacing = 0;
float m_tip_flow = 0;
float m_tip_opacity = 0;
float m_tip_angle = 0;
bool m_tip_angle_follow = false;
bool m_tip_flow_pressure = false;
bool m_tip_size_pressure = false;
float m_jitter_scale;
float m_jitter_angle;
float m_jitter_spread;
float m_jitter_flow;
float m_jitter_scale = 0;
float m_jitter_angle = 0;
float m_jitter_spread = 0;
float m_jitter_flow = 0;
};
struct StrokeSample

View File

@@ -66,7 +66,7 @@ void NodePanelStroke::init_slider(NodeSliderH*& target, const char* id, float ui
target = find<NodeSliderH>(id);
target->on_value_changed = std::bind(&NodePanelStroke::handle_slide,
this, prop, std::placeholders::_1, std::placeholders::_2);
m_canvas->m_brush.*prop = target->m_value.x;
//m_canvas->m_brush.*prop = target->m_value.x;
}
void NodePanelStroke::handle_slide(float ui::Brush::* prop, Node* target, float value)

View File

@@ -30,7 +30,8 @@ void NodeStrokePreview::init_controls()
{
m_mesh.create();
m_sampler.create();
m_sampler_brush.create(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
m_sampler_brush.create();
m_sampler_brush.set_filter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
TextureManager::load("data/Icons/Round-Hard.png");
m_brush.m_tex_id = const_hash("data/Icons/Round-Hard.png");
}