brush scale for non-square brushes
This commit is contained in:
42
src/abr.cpp
42
src/abr.cpp
@@ -120,12 +120,13 @@ std::vector<std::shared_ptr<Brush>> ABR::compute_brushes(const std::string& path
|
||||
b->m_tip_flow = .90f;
|
||||
b->m_tip_opacity = 1.f;
|
||||
|
||||
b->m_tip_wet = p->value<UnitFloat>("Wtdg");
|
||||
b->m_tip_noise = p->value<Boolean>("Nose") ? 1.f : 0.f;
|
||||
|
||||
b->m_tip_aspect = (1.f - samp->value<UnitFloat>("Rndn") * 0.01) * 0.5f + 0.5f;
|
||||
b->m_tip_size = samp->value<UnitFloat>("Dmtr");
|
||||
b->m_tip_spacing = samp->value<UnitFloat>("Spcn") * 0.01f;
|
||||
b->m_tip_angle = samp->value<UnitFloat>("Angl") / 360.f + 0.5f; // [-180, 180] -> [0, 1]
|
||||
b->m_tip_wet = p->value<UnitFloat>("Wtdg");
|
||||
b->m_tip_noise = samp->value<UnitFloat>("Nose");
|
||||
b->m_tip_angle = samp->value<UnitFloat>("Angl") / 360.f; // [-180, 180] -> [0, 1]
|
||||
b->m_tip_flipx = samp->value<Boolean>("flipX");
|
||||
b->m_tip_flipy = samp->value<Boolean>("flipY");
|
||||
|
||||
@@ -137,7 +138,10 @@ std::vector<std::shared_ptr<Brush>> ABR::compute_brushes(const std::string& path
|
||||
b->m_brush_thumb_path = path + "/brushes/thumbs/" + tip_uid + ".png";
|
||||
|
||||
const auto& samp_img = m_samples[tip_uid];
|
||||
b->m_tip_width = (float)samp_img->width / (float)samp_img->height;
|
||||
if (samp_img->height > samp_img->width)
|
||||
b->m_tip_scale = { (float)samp_img->width / (float)samp_img->height, 1.f };
|
||||
else
|
||||
b->m_tip_scale = { 1.f, (float)samp_img->height / (float)samp_img->width };
|
||||
}
|
||||
else if (samp->class_id == "computedBrush")
|
||||
{
|
||||
@@ -162,6 +166,8 @@ std::vector<std::shared_ptr<Brush>> ABR::compute_brushes(const std::string& path
|
||||
{
|
||||
b->m_jitter_scale = jitter_size->value<UnitFloat>("jitter") * 0.01f;
|
||||
// TODO: p->value<UnitFloat>("minimumDiameter") * 0.001f; // minimum size
|
||||
if (jitter_size->value<Integer>("bVTy") == 2)
|
||||
b->m_tip_size_pressure;
|
||||
}
|
||||
|
||||
auto jitter_angle = p->get<Descriptor>("angleDynamics");
|
||||
@@ -189,6 +195,30 @@ std::vector<std::shared_ptr<Brush>> ABR::compute_brushes(const std::string& path
|
||||
b->m_tip_randflipy = p->value<Boolean>("flipY");
|
||||
}
|
||||
|
||||
// Transfer settings
|
||||
if (p->value<Boolean>("usePaintDynamics"))
|
||||
{
|
||||
// TODO: implement this when opacity is per-sample
|
||||
//auto jitter_opacity = p->get<Descriptor>("opVr");
|
||||
//if (jitter_opacity)
|
||||
//{
|
||||
// b->m_jitter_opacity = jitter_opacity->value<UnitFloat>("jitter") * 0.01f;
|
||||
// // TODO: jitter_opacity->value<UnitFloat>("Mnm ") * 0.01f; // minimum size
|
||||
// if (jitter_opacity->value<Integer>("bVTy") == 2)
|
||||
// b->m_tip_opacity_pressure;
|
||||
//}
|
||||
|
||||
auto jitter_flow = p->get<Descriptor>("prVr");
|
||||
if (jitter_flow)
|
||||
{
|
||||
b->m_jitter_flow = jitter_flow->value<UnitFloat>("jitter") * 0.01f;
|
||||
// TODO: m_jitter_flow->value<UnitFloat>("Mnm ") * 0.01f; // minimum size
|
||||
if (jitter_flow->value<Integer>("bVTy") == 2)
|
||||
b->m_tip_flow_pressure = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> modes = {
|
||||
"normal", // normal (not in Photoshop)
|
||||
"Mltp", // multiply
|
||||
@@ -246,7 +276,7 @@ std::vector<std::shared_ptr<Brush>> ABR::compute_brushes(const std::string& path
|
||||
b->m_dual_opacity = 1.f;
|
||||
|
||||
//b->m_tip_aspect = (1.f - samp->value<UnitFloat>("Rndn") * 0.01) * 0.5f + 0.5f;
|
||||
b->m_dual_size = samp->value<UnitFloat>("Dmtr");
|
||||
b->m_dual_size = samp->value<UnitFloat>("Dmtr") / b->m_tip_size;
|
||||
b->m_dual_spacing = samp->value<UnitFloat>("Spcn") * 0.01f;
|
||||
//b->m_tip_angle = samp->value<UnitFloat>("Angl") / 360.f + 0.5f; // [-180, 180] -> [0, 1]
|
||||
//b->m_tip_wet = p->value<UnitFloat>("Wtdg");
|
||||
@@ -408,7 +438,7 @@ std::shared_ptr<ABR::Descriptor> ABR::parse_objc()
|
||||
if (!property)
|
||||
return nullptr;
|
||||
if (ret->props.find(key) != ret->props.end())
|
||||
LOG("DUPLICATE prop %d\n", key.c_str());
|
||||
LOG("DUPLICATE prop %s\n", key.c_str());
|
||||
ret->props[key] = property;
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user