iOS: fix app id in path, pen pressure filtering on Line
This commit is contained in:
@@ -31,7 +31,7 @@ bool Asset::exist(std::string path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ifstream f(path);
|
std::ifstream f(path, std::ios::binary);
|
||||||
return f.is_open();
|
return f.is_open();
|
||||||
}
|
}
|
||||||
return false; // useless return for the stupid xcode
|
return false; // useless return for the stupid xcode
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "brush.h"
|
#include "brush.h"
|
||||||
#include "asset.h"
|
#include "asset.h"
|
||||||
|
#include "app.h"
|
||||||
|
|
||||||
void BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::mat4& proj)
|
void BrushMesh::draw(const std::vector<StrokeSample>& samples, const glm::mat4& proj)
|
||||||
{
|
{
|
||||||
@@ -491,11 +492,17 @@ bool Brush::read(BinaryStreamReader& r)
|
|||||||
r >> d;
|
r >> d;
|
||||||
d.value<Serializer::CString>("m_name", m_name);
|
d.value<Serializer::CString>("m_name", m_name);
|
||||||
d.value<Serializer::CString>("m_brush_path", m_brush_path);
|
d.value<Serializer::CString>("m_brush_path", m_brush_path);
|
||||||
|
m_brush_path = str_replace(m_brush_path, "{data_path}", App::I.data_path);
|
||||||
d.value<Serializer::CString>("m_brush_thumb_path", m_brush_thumb_path);
|
d.value<Serializer::CString>("m_brush_thumb_path", m_brush_thumb_path);
|
||||||
|
m_brush_thumb_path = str_replace(m_brush_thumb_path, "{data_path}", App::I.data_path);
|
||||||
d.value<Serializer::CString>("m_dual_path", m_dual_path);
|
d.value<Serializer::CString>("m_dual_path", m_dual_path);
|
||||||
|
m_dual_path = str_replace(m_dual_path, "{data_path}", App::I.data_path);
|
||||||
d.value<Serializer::CString>("m_dual_thumb_path", m_dual_thumb_path);
|
d.value<Serializer::CString>("m_dual_thumb_path", m_dual_thumb_path);
|
||||||
|
m_dual_thumb_path = str_replace(m_dual_thumb_path, "{data_path}", App::I.data_path);
|
||||||
d.value<Serializer::CString>("m_pattern_path", m_pattern_path);
|
d.value<Serializer::CString>("m_pattern_path", m_pattern_path);
|
||||||
|
m_pattern_path = str_replace(m_pattern_path, "{data_path}", App::I.data_path);
|
||||||
d.value<Serializer::CString>("m_pattern_thumb_path", m_pattern_thumb_path);
|
d.value<Serializer::CString>("m_pattern_thumb_path", m_pattern_thumb_path);
|
||||||
|
m_pattern_thumb_path = str_replace(m_pattern_thumb_path, "{data_path}", App::I.data_path);
|
||||||
|
|
||||||
d.value<Serializer::Vec4>("m_tip_color", m_tip_color);
|
d.value<Serializer::Vec4>("m_tip_color", m_tip_color);
|
||||||
d.value<Serializer::Vec2>("m_tip_scale", m_tip_scale);
|
d.value<Serializer::Vec2>("m_tip_scale", m_tip_scale);
|
||||||
@@ -576,12 +583,18 @@ void Brush::write(BinaryStreamWriter& w) const
|
|||||||
d.class_id = "brush";
|
d.class_id = "brush";
|
||||||
d.name = L"Brush class";
|
d.name = L"Brush class";
|
||||||
d.props["m_name"] = std::make_shared<Serializer::CString>(m_name);
|
d.props["m_name"] = std::make_shared<Serializer::CString>(m_name);
|
||||||
d.props["m_brush_path"] = std::make_shared<Serializer::CString>(m_brush_path);
|
d.props["m_brush_path"] = std::make_shared<Serializer::CString>(
|
||||||
d.props["m_brush_thumb_path"] = std::make_shared<Serializer::CString>(m_brush_thumb_path);
|
str_replace(m_brush_path, App::I.data_path, "{data_path}"));
|
||||||
d.props["m_dual_path"] = std::make_shared<Serializer::CString>(m_dual_path);
|
d.props["m_brush_thumb_path"] = std::make_shared<Serializer::CString>(
|
||||||
d.props["m_dual_thumb_path"] = std::make_shared<Serializer::CString>(m_dual_thumb_path);
|
str_replace(m_brush_thumb_path, App::I.data_path, "{data_path}"));
|
||||||
d.props["m_pattern_path"] = std::make_shared<Serializer::CString>(m_pattern_path);
|
d.props["m_dual_path"] = std::make_shared<Serializer::CString>(
|
||||||
d.props["m_pattern_thumb_path"] = std::make_shared<Serializer::CString>(m_pattern_thumb_path);
|
str_replace(m_dual_path, App::I.data_path, "{data_path}"));
|
||||||
|
d.props["m_dual_thumb_path"] = std::make_shared<Serializer::CString>(
|
||||||
|
str_replace(m_dual_thumb_path, App::I.data_path, "{data_path}"));
|
||||||
|
d.props["m_pattern_path"] = std::make_shared<Serializer::CString>(
|
||||||
|
str_replace(m_pattern_path, App::I.data_path, "{data_path}"));
|
||||||
|
d.props["m_pattern_thumb_path"] = std::make_shared<Serializer::CString>(
|
||||||
|
str_replace(m_pattern_thumb_path, App::I.data_path, "{data_path}"));
|
||||||
|
|
||||||
d.props["m_tip_color"] = std::make_shared<Serializer::Vec4>(m_tip_color);
|
d.props["m_tip_color"] = std::make_shared<Serializer::Vec4>(m_tip_color);
|
||||||
d.props["m_tip_scale"] = std::make_shared<Serializer::Vec2>(m_tip_scale);
|
d.props["m_tip_scale"] = std::make_shared<Serializer::Vec2>(m_tip_scale);
|
||||||
|
|||||||
@@ -900,7 +900,8 @@ void Canvas::stroke_start(glm::vec3 point, float pressure)
|
|||||||
m_current_stroke = std::make_unique<Stroke>();
|
m_current_stroke = std::make_unique<Stroke>();
|
||||||
m_current_stroke->m_camera.rot = m_cam_rot;
|
m_current_stroke->m_camera.rot = m_cam_rot;
|
||||||
m_current_stroke->m_camera.fov = m_cam_fov;
|
m_current_stroke->m_camera.fov = m_cam_fov;
|
||||||
m_current_stroke->m_filter_points = false;
|
if (m_current_mode == kCanvasMode::Line)
|
||||||
|
m_current_stroke->m_filter_points = false;
|
||||||
m_current_stroke->randomize_prng();
|
m_current_stroke->randomize_prng();
|
||||||
m_current_stroke->start(m_current_brush);
|
m_current_stroke->start(m_current_brush);
|
||||||
m_current_stroke->add_point(point, pressure);
|
m_current_stroke->add_point(point, pressure);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ bool NodeButtonBrush::read(BinaryStreamReader& r)
|
|||||||
d.value<Serializer::CString>("high_path", high_path);
|
d.value<Serializer::CString>("high_path", high_path);
|
||||||
d.value<Serializer::CString>("thumb_path", thumb_path);
|
d.value<Serializer::CString>("thumb_path", thumb_path);
|
||||||
d.value<Serializer::Boolean>("m_user_brush", m_user_brush);
|
d.value<Serializer::Boolean>("m_user_brush", m_user_brush);
|
||||||
|
high_path = str_replace(high_path, "{data_path}", App::I.data_path);
|
||||||
|
thumb_path = str_replace(thumb_path, "{data_path}", App::I.data_path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,8 +59,10 @@ void NodeButtonBrush::write(BinaryStreamWriter& w) const
|
|||||||
d.class_id = "brush";
|
d.class_id = "brush";
|
||||||
d.name = L"Brush class";
|
d.name = L"Brush class";
|
||||||
d.props["brush_name"] = std::make_shared<Serializer::CString>(brush_name);
|
d.props["brush_name"] = std::make_shared<Serializer::CString>(brush_name);
|
||||||
d.props["high_path"] = std::make_shared<Serializer::CString>(high_path);
|
d.props["high_path"] = std::make_shared<Serializer::CString>(
|
||||||
d.props["thumb_path"] = std::make_shared<Serializer::CString>(thumb_path);
|
str_replace(high_path, App::I.data_path, "{data_path}"));
|
||||||
|
d.props["thumb_path"] = std::make_shared<Serializer::CString>(
|
||||||
|
str_replace(thumb_path, App::I.data_path, "{data_path}"));
|
||||||
d.props["m_user_brush"] = std::make_shared<Serializer::Boolean>(m_user_brush);
|
d.props["m_user_brush"] = std::make_shared<Serializer::Boolean>(m_user_brush);
|
||||||
w << d;
|
w << d;
|
||||||
}
|
}
|
||||||
@@ -544,7 +548,7 @@ bool NodePanelBrushPreset::restore()
|
|||||||
auto vmin = sr.ru16();
|
auto vmin = sr.ru16();
|
||||||
if (vmaj != 0 && vmin != 1)
|
if (vmaj != 0 && vmin != 1)
|
||||||
{
|
{
|
||||||
LOG("unrecognised version %d.$d", vmaj, vmin);
|
LOG("unrecognised version %d.%d", vmaj, vmin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
src/util.cpp
18
src/util.cpp
@@ -508,6 +508,22 @@ bool str_iequals(const std::string& a, const std::string& b)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string str_replace(const std::string& string, const std::string& search, const std::string& replace)
|
||||||
|
{
|
||||||
|
std::string ret = string;
|
||||||
|
// Get the first occurrence
|
||||||
|
size_t pos = ret.find(search);
|
||||||
|
// Repeat till end is reached
|
||||||
|
while(pos != std::string::npos)
|
||||||
|
{
|
||||||
|
// Replace this occurrence of Sub String
|
||||||
|
ret.replace(pos, search.size(), replace);
|
||||||
|
// Get the next occurrence from the current position
|
||||||
|
pos = ret.find(search, pos + replace.size());
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static const char* gl2str(GLenum err)
|
static const char* gl2str(GLenum err)
|
||||||
{
|
{
|
||||||
switch (err)
|
switch (err)
|
||||||
@@ -611,4 +627,4 @@ void parallel_for(unsigned nb_elements, std::function<void(int i)> functor, bool
|
|||||||
// Wait for the other thread to finish their task
|
// Wait for the other thread to finish their task
|
||||||
if (use_threads)
|
if (use_threads)
|
||||||
std::for_each(my_threads.begin(), my_threads.end(), std::mem_fn(&std::thread::join));
|
std::for_each(my_threads.begin(), my_threads.end(), std::mem_fn(&std::thread::join));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ std::string unescape(const std::string& s);
|
|||||||
std::wstring str2wstr(const std::string& str);
|
std::wstring str2wstr(const std::string& str);
|
||||||
std::string wstr2str(const std::wstring& wstr);
|
std::string wstr2str(const std::wstring& wstr);
|
||||||
bool str_iequals(const std::string& a, const std::string& b);
|
bool str_iequals(const std::string& a, const std::string& b);
|
||||||
|
std::string str_replace(const std::string& string, const std::string& search, const std::string& replace);
|
||||||
|
|
||||||
size_t curl_data_handler(void *contents, size_t size, size_t nmemb, void *userp);
|
size_t curl_data_handler(void *contents, size_t size, size_t nmemb, void *userp);
|
||||||
size_t curl_data_write(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
size_t curl_data_write(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||||
@@ -181,7 +182,7 @@ public:
|
|||||||
post_cv.wait(lock, [&]() { return unlocked | (q.size() < Max); });
|
post_cv.wait(lock, [&]() { return unlocked | (q.size() < Max); });
|
||||||
if (q.size() >= Max) return;
|
if (q.size() >= Max) return;
|
||||||
}
|
}
|
||||||
if (std::find(q.begin(), q.end(), pkt) == q.end());
|
if (std::find(q.begin(), q.end(), pkt) == q.end())
|
||||||
top ? q.push_front(pkt) : q.push_back(pkt);
|
top ? q.push_front(pkt) : q.push_back(pkt);
|
||||||
get_cv.notify_one();
|
get_cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user