diff --git a/src/abr.cpp b/src/abr.cpp index 8995fdc..23e52a9 100644 --- a/src/abr.cpp +++ b/src/abr.cpp @@ -164,7 +164,7 @@ std::vector> ABR::compute_brushes(const std::string& path // Shape dynamics if (p->value("useTipDynamics")) { - // other properties 'brushProjection', 'minimumRoundness', 'roundnessDynamics', 'tiltScale' + // other properties 'brushProjection', 'minimumRoundness', 'tiltScale' if (auto jitter_size = p->get("szVr")) { @@ -205,15 +205,14 @@ std::vector> ABR::compute_brushes(const std::string& path // Transfer settings if (p->value("usePaintDynamics")) { - // TODO: implement this when opacity is per-sample - //auto jitter_opacity = p->get("opVr"); - //if (jitter_opacity) - //{ - // b->m_jitter_opacity = jitter_opacity->value("jitter") * 0.01f; - // // TODO: jitter_opacity->value("Mnm ") * 0.01f; // minimum size - // if (jitter_opacity->value("bVTy") == 2) - // b->m_tip_opacity_pressure; - //} + auto jitter_opacity = p->get("opVr"); + if (jitter_opacity) + { + b->m_jitter_opacity = jitter_opacity->value("jitter") * 0.01f; + // TODO: jitter_opacity->value("Mnm ") * 0.01f; // minimum size + if (jitter_opacity->value("bVTy") == 2) + b->m_tip_opacity_pressure = true; + } auto jitter_flow = p->get("prVr"); if (jitter_flow) diff --git a/src/node_panel_brush.h b/src/node_panel_brush.h index 0874a9c..b3feb07 100644 --- a/src/node_panel_brush.h +++ b/src/node_panel_brush.h @@ -80,7 +80,6 @@ public: class NodePanelBrushPreset : public Node { NodeBrushPresetItem* m_current = nullptr; - Node* m_container; NodeButtonCustom* m_btn_add; NodeButtonCustom* m_btn_up; NodeButtonCustom* m_btn_down; @@ -171,6 +170,7 @@ class NodePanelBrushPreset : public Node float m_pattern_depth = 1.f; }; public: + Node* m_container; std::function& brush)> on_brush_changed; std::function on_popup_close; virtual Node* clone_instantiate() const override; diff --git a/src/node_panel_stroke.cpp b/src/node_panel_stroke.cpp index 1f3439b..339dbf3 100644 --- a/src/node_panel_stroke.cpp +++ b/src/node_panel_stroke.cpp @@ -168,6 +168,7 @@ void NodePanelStroke::update_controls() m_tip_angle_follow->checked = b->m_tip_angle_follow; m_tip_angle_init->checked = b->m_tip_angle_init; m_tip_flow_pressure->checked = b->m_tip_flow_pressure; + m_tip_opacity_pressure->checked = b->m_tip_opacity_pressure; m_tip_size_pressure->checked = b->m_tip_size_pressure; m_jitter_aspect_bothaxis->checked = b->m_jitter_aspect_bothaxis; @@ -281,6 +282,8 @@ void NodePanelStroke::init_controls() tick->SetSize(16, 32); tick->SetPosition(pos.x, pos.y + (m_preset_button->m_size.y - 32) * 0.5f); tick->set_image("data/ui/popup-tick.png"); + float hh = m_presets_popup->m_container->m_children.size() > 10 ? App::I.height * .75f : 400.f; + m_presets_popup->SetSize(300, glm::max(hh, 400.f)); root()->update(); if ((pos.y + m_presets_popup->m_size.y) > screen.y) pos.y = screen.y - m_presets_popup->m_size.y;