update Xcode project, fix some warnings, update android icons, ignore unrecognized files in the doc browser

This commit is contained in:
2018-09-22 23:21:39 +02:00
parent 3191730c31
commit c6f8bf7b9f
25 changed files with 33 additions and 22 deletions

View File

@@ -103,8 +103,6 @@ void App::initAssets()
LOG("initializing assets create sampler");
sampler.create(GL_NEAREST);
LOG("initializing assets load uvs texture");
if (!tex.load("data/uvs.jpg"))
LOG("error loading image");
LOG("initializing assets completed");
}

View File

@@ -47,7 +47,6 @@ public:
std::deque<std::unique_ptr<uint8_t[]>> rec_frames;
Sampler sampler;
Texture2D tex;
LayoutManager layout;
NodeMessageBox* msgbox;
NodeSettings* settings;

View File

@@ -752,7 +752,7 @@ void App::initLayout()
}
int current_layer = (int)glm::clamp<int>(
floor(value * c.m_layers.size()), 1, c.m_layers.size() - 1);
floor(value * c.m_layers.size()), 1, (int)c.m_layers.size() - 1);
auto l = layers->get_layer_at(current_layer);
layers->handle_layer_selected(l);
layers->handle_layer_opacity(l, 1.f);

View File

@@ -187,7 +187,7 @@ std::vector<ui::StrokeSample> ui::Stroke::compute_samples()
LOG("Invalid sample");
samples.push_back(s);
}
return std::move(samples);
return samples;
}
bool ui::Stroke::has_sample()
{

View File

@@ -799,7 +799,7 @@ void ui::Canvas::layer_remove(int idx) // m_order index
i--;
m_layers.erase(m_layers.begin() + n);
m_order.erase(m_order.begin() + idx);
m_current_layer_idx = m_order[std::min<int>(m_layers.size() - 1, idx)];
m_current_layer_idx = m_order[std::min<int>((int)m_layers.size() - 1, idx)];
}
void ui::Canvas::layer_order(int idx, int pos) // m_order index
{
@@ -1283,8 +1283,8 @@ void ui::Canvas::inject_xmp(std::string jpg_path)
unsigned char* xmp_section = (unsigned char*)malloc(sizeof(xmp) + 4);
xmp_section[0] = 0xff;
xmp_section[1] = 0xe1;
xmp_section[2] = ((int)sizeof(xmp) + 2) >> 8;
xmp_section[3] = ((int)sizeof(xmp) + 2) >> 0;
xmp_section[2] = (uint8_t)((int)sizeof(xmp) + 2) >> 8;
xmp_section[3] = (uint8_t)((int)sizeof(xmp) + 2) >> 0;
memcpy(xmp_section + 4, xmp, sizeof(xmp));
fwrite(jpeg_data, 1, i, fp);
@@ -1843,7 +1843,7 @@ ui::Image ui::Canvas::thumbnail_generate(int w, int h)
glClearColor(cc[0], cc[1], cc[2], cc[3]);
glActiveTexture(GL_TEXTURE0);
return std::move(image);
return image;
}
ui::Image ui::Canvas::thumbnail_read(std::string data_path)
@@ -1870,7 +1870,7 @@ ui::Image ui::Canvas::thumbnail_read(std::string data_path)
fread((uint8_t*)thumb.data(), thumb.size(), 1, fp);
fclose(fp);
LOG("project thumbnail read from %s", data_path.c_str());
return std::move(thumb);
return thumb;
}
void ui::Canvas::draw_objects(std::function<void(const glm::mat4& camera, const glm::mat4& proj, int i)> observer, Layer& layer)
@@ -2016,7 +2016,7 @@ std::vector<ui::Shape::vertex_t> ui::Canvas::triangulate(const std::vector<std::
node = node->end ? nullptr : node->next;
current->next = nullptr;
}
LOG("poly %ld", outline.size());
LOG("poly %zu", outline.size());
if (outline.size() > 2)
{
@@ -2101,7 +2101,7 @@ ui::Layer::Snapshot ui::Layer::snapshot(std::string data_path)
//int ret = stbi_write_png(name, m_rtt[i].getWidth(), m_rtt[i].getHeight(), 4, snap.image[i].get(), m_rtt[i].stride());
}
counter++;
return std::move(snap);
return snap;
}
void ui::Layer::clear(const glm::vec4& c)

View File

@@ -235,7 +235,7 @@ public:
{
}
virtual Action* get_redo()
virtual Action* get_redo() override
{
auto redo = m_canvas->create_action(m_layer_idx);
return redo;

View File

@@ -157,7 +157,7 @@ kEventResult Node::on_event(Event* e)
break;
GestureEvent* ge = static_cast<GestureEvent*>(e);
bool inside = point_in_rect(ge->m_pos, m_clip);
bool inside_old = m_mouse_inside;
//bool inside_old = m_mouse_inside;
m_mouse_inside = inside;
if ((inside || m_mouse_captured) && handle_event(e) == kEventResult::Consumed)
return kEventResult::Consumed;
@@ -208,7 +208,9 @@ void Node::removed(Node* parent)
const Node* Node::init_template(const char* id)
{
const auto& m_template = static_cast<Node*>((*m_manager)[const_hash(id)]->m_children[0].get());
auto hid = const_hash(id);
Node* top = m_manager->get(hid);
Node* m_template = static_cast<Node*>(top->m_children[0].get());
for (auto& c : m_template->m_children)
{
auto node = c->clone();

View File

@@ -135,7 +135,7 @@ void NodeCanvas::draw()
if (m_canvas->m_layers[layer_index].m_opacity == .0f)
continue;
int z = (int)m_canvas->m_order.size() - i;
int z = (int)(m_canvas->m_order.size() - i);
auto plane_mvp_z = proj * camera *
glm::scale(glm::vec3(z + 1)) *
glm::eulerAngleYXZ(yaw, pitch, roll) *
@@ -362,7 +362,6 @@ void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
kEventResult NodeCanvas::handle_event(Event* e)
{
static std::vector<CanvasMode>* old_mode = nullptr;
Node::handle_event(e);
MouseEvent* me = static_cast<MouseEvent*>(e);
KeyEvent* ke = static_cast<KeyEvent*>(e);

View File

@@ -88,5 +88,7 @@ void NodeComboBox::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute*
case kAttribute::Default:
m_current_index = attr->IntValue();
break;
default:
break;
}
}

View File

@@ -72,6 +72,10 @@ void NodeDialogBrowse::init_controls()
auto names = Asset::list_files(data_path, false, ".*\\.ppi");
for (const auto& n : names)
{
ui::Image thumb = ui::Canvas::I->thumbnail_read(data_path + "/" + n);
if (thumb.width == 0 || thumb.height == 0)
continue;
auto node = new NodeDialogBrowseItem;
node->m_manager = m_manager;
node->init();
@@ -90,7 +94,6 @@ void NodeDialogBrowse::init_controls()
};
// load thumb
ui::Image thumb = ui::Canvas::I->thumbnail_read(node->m_path);
auto image_tex = node->find<NodeImageTexture>("thumb-tex");
image_tex->tex.destroy();
image_tex->tex.create(thumb);

View File

@@ -30,7 +30,7 @@ kEventResult NodeScroll::handle_event(Event* e)
NodeBorder::handle_event(e);
auto me = static_cast<MouseEvent*>(e);
auto ge = static_cast<GestureEvent*>(e);
auto loc = (me->m_pos - m_pos) * root()->m_zoom;
//auto loc = (me->m_pos - m_pos) * root()->m_zoom;
switch (e->m_type)
{
case kEventType::MouseDownL:

View File

@@ -293,7 +293,7 @@ bool ui::HeightmapPlane::create(float w, float h, const Image& img, float scale)
// generate indices
for (int y = 0; y <= div; y++)
{
int i = y * (div + 1);
//int i = y * (div + 1);
for (int x = 0; x <= div; x++)
{
if (x < div)

View File

@@ -15,7 +15,7 @@ public:
void assign(GLuint tex, int w = -1, int h = -1, GLuint internal_format = GL_RGBA8, GLuint format = GL_RGBA);
bool load(std::string filename);
bool load_file(std::string filename);
void destroy() { if (m_tex) LOG("TEX destroy %d", m_tex); glDeleteTextures(1, &m_tex); }
void destroy() { if (m_tex) LOG("TEX destroy %d", m_tex); glDeleteTextures(1, &m_tex); m_tex = 0; }
void bind() const { glBindTexture(GL_TEXTURE_2D, m_tex); }
void unbind() const { glBindTexture(GL_TEXTURE_2D, 0); }
void update(const uint8_t* data);