fix mixer clear residual data, reduce brush preview updates especially on gesture
This commit is contained in:
@@ -1259,6 +1259,7 @@ void Canvas::stroke_start(glm::vec3 point, float pressure)
|
||||
m_tmp_dual[i].unbindFramebuffer();
|
||||
}
|
||||
}
|
||||
m_mixer.clear();
|
||||
m_show_tmp = true;
|
||||
}
|
||||
void Canvas::layer_add(std::string name, std::shared_ptr<Layer> layer /*= nullptr*/, int index /*= 0*/)
|
||||
@@ -1670,7 +1671,6 @@ bool Canvas::create(int width, int height)
|
||||
m_plane.create<1>(1, 1);
|
||||
m_plane_brush.create<1>(1, 1);
|
||||
m_brush_shape.create();
|
||||
m_brush_mix.create(8, 8);
|
||||
for (auto& l : m_layers)
|
||||
l->create(width, height, "");
|
||||
m_smask.create(width, height, "mask");
|
||||
|
||||
@@ -131,7 +131,6 @@ public:
|
||||
RTT m_tmp_dual[6];
|
||||
RTT m_mixer;
|
||||
float m_mixer_scale = 1;
|
||||
Texture2D m_brush_mix;
|
||||
Texture2D m_tex[6];
|
||||
Texture2D m_tex2[6];
|
||||
RTT m_merge_rtt;
|
||||
|
||||
@@ -83,7 +83,7 @@ void CanvasModeBasicCamera::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
m_zoom_canvas += me->m_scroll_delta * 0.1f;
|
||||
Canvas::I->m_cam_fov = glm::clamp(Canvas::I->m_cam_fov - me->m_scroll_delta * 2.0f,
|
||||
Canvas::I->m_cam_fov_min, Canvas::I->m_cam_fov_max);
|
||||
App::I->brush_update(true, true);
|
||||
//App::I->brush_update(true, true);
|
||||
break;
|
||||
case kEventType::MouseCancel:
|
||||
m_draggingR = false;
|
||||
@@ -110,7 +110,7 @@ void CanvasModeBasicCamera::on_GestureEvent(GestureEvent* ge)
|
||||
Canvas::I->m_cam_fov_min, Canvas::I->m_cam_fov_max);
|
||||
auto angle = Canvas::I->m_pan * 0.003f;
|
||||
Canvas::I->m_cam_rot = glm::eulerAngleXY(angle.y, angle.x);
|
||||
App::I->brush_update(true, true);
|
||||
//App::I->brush_update(true, true);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -206,7 +206,7 @@ void NodePanelStroke::init_controls()
|
||||
*Canvas::I->m_current_brush = *b;
|
||||
Canvas::I->m_current_brush->m_tip_color = old_color;
|
||||
Canvas::I->m_current_brush->load();
|
||||
m_preview->draw_stroke();
|
||||
//m_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_pattern_thumb->set_image(b->m_pattern_thumb_path);
|
||||
@@ -330,7 +330,7 @@ void NodePanelStroke::init_controls()
|
||||
m_blend_mode = find<NodeComboBox>("blend-mode");
|
||||
m_blend_mode->on_select = [this](Node*, int index) {
|
||||
Canvas::I->m_current_brush->m_blend_mode = index;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
};
|
||||
@@ -464,7 +464,7 @@ void NodePanelStroke::init_controls()
|
||||
m_tip_aspect_reset->on_click = [this](Node*) {
|
||||
m_tip_aspect->set_value(0.5);
|
||||
Canvas::I->m_current_brush->m_tip_aspect = 0.5f;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
};
|
||||
@@ -472,7 +472,7 @@ void NodePanelStroke::init_controls()
|
||||
m_dual_blend_mode = find<NodeComboBox>("dual-blend-mode");
|
||||
m_dual_blend_mode->on_select = [this](Node*, int index) {
|
||||
Canvas::I->m_current_brush->m_dual_blend_mode = index;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
};
|
||||
@@ -480,7 +480,7 @@ void NodePanelStroke::init_controls()
|
||||
m_pattern_blend_mode = find<NodeComboBox>("pattern-blend-mode");
|
||||
m_pattern_blend_mode->on_select = [this](Node*, int index) {
|
||||
Canvas::I->m_current_brush->m_pattern_blend_mode = index;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
};
|
||||
@@ -540,7 +540,7 @@ void NodePanelStroke::handle_slide(float Brush::* prop, Node* target, float valu
|
||||
{
|
||||
auto curve = m_curves.find((NodeSliderH*)target);
|
||||
Canvas::I->m_current_brush.get()->*prop = curve != m_curves.end() ? curve->second.to_value(value) : value;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ void NodePanelStroke::init_checkbox(NodeCheckBox*& target, const char* id, bool
|
||||
void NodePanelStroke::handle_checkbox(bool Brush::* prop, Node *target, bool value)
|
||||
{
|
||||
Canvas::I->m_current_brush.get()->*prop = value;
|
||||
m_preview->draw_stroke();
|
||||
//m_preview->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user