diff --git a/src/core/core/glframebuffer.cpp b/src/core/core/glframebuffer.cpp
index 8574f42..df2d6ab 100644
--- a/src/core/core/glframebuffer.cpp
+++ b/src/core/core/glframebuffer.cpp
@@ -141,7 +141,7 @@ void Framebuffer::queryPoints(int index, QRect rect_, GLenum pixel_format) {
f->glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
f->glReadBuffer(GL_COLOR_ATTACHMENT0 + index);
pbo.bind(f);
- f->glReadPixels(rect_.x(), height() - rect_.bottom(), rect_.width(), rect_.height(), GL_RGBA, pixel_format, 0);
+ f->glReadPixels(rect_.x(), height() - rect_.bottom() - 1, rect_.width(), rect_.height(), GL_RGBA, pixel_format, 0);
pbo_queried = rect_.width() * rect_.height();
pbo.release(f);
}
diff --git a/src/core/render/renderer.cpp b/src/core/render/renderer.cpp
index 7ffa97e..c6fce3a 100644
--- a/src/core/render/renderer.cpp
+++ b/src/core/render/renderer.cpp
@@ -519,10 +519,10 @@ void Renderer::renderScene() {
/// reload materials on change
phase.begin("scene reload");
if (scene_changed || scene.need_reload_materials) {
+ if (scene.need_reload_materials) emit view->materialsChanged();
rend_selection.generateObjectsID(scene);
reloadMaterials(scene);
if (edit_mode) recreateMaterialThumbnails();
- emit view->materialsChanged();
}
phase.end();
diff --git a/src/core/scene/glcamera.cpp b/src/core/scene/glcamera.cpp
index 348d275..93f66c8 100644
--- a/src/core/scene/glcamera.cpp
+++ b/src/core/scene/glcamera.cpp
@@ -74,10 +74,13 @@ QMatrix4x4 Camera::viewMatrix() const {
// qDebug() << pos() << aim();
ret.translate(0., 0., -distance());
ret.rotate(-roll_, 0., 0., 1.);
- ret *= trans.matrixRotateScale().inverted();
+ ret *= trans.matrixRotate().inverted();
if (parent_) {
- QMatrix4x4 pmat = parent_->worldTransform();
- offset_ = pmat.column(3).toVector3D();
+ Transform tr;
+ tr.setMatrix(parent_->worldTransform());
+ tr.setDirty();
+ QMatrix4x4 pmat = tr.matrixRotate();
+ offset_ = parent_->worldTransform().column(3).toVector3D();
pmat(0, 3) = pmat(1, 3) = pmat(2, 3) = 0.;
pmat.translate(aim());
ret *= pmat.inverted();
diff --git a/src/widgets/material_editor.cpp b/src/widgets/material_editor.cpp
index 06967ff..cbe9252 100644
--- a/src/widgets/material_editor.cpp
+++ b/src/widgets/material_editor.cpp
@@ -36,7 +36,7 @@ MaterialEditor::MaterialEditor(QWidget * parent): QWidget(parent) {
ui->label_13->hide();
mat = 0;
active = true;
- ignore_next = 0;
+ ignore_next = false;
}
@@ -51,7 +51,7 @@ void MaterialEditor::changeEvent(QEvent * e) {
void MaterialEditor::materialChanged() {
if (!active || !mat) return;
- ignore_next = 2;
+ ignore_next = true;
mat->_changed = true;
mat->color_diffuse = ui->mapDiffuse->color();
mat->color_emission = ui->mapEmission->color();
@@ -65,8 +65,8 @@ void MaterialEditor::materialChanged() {
void MaterialEditor::setMaterial(Material * m) {
- if (ignore_next > 0) {
- // ignore_next = false;
+ if (ignore_next) {
+ ignore_next = false;
return;
}
active = false;
diff --git a/src/widgets/material_editor.h b/src/widgets/material_editor.h
index 2210d58..b1836e5 100644
--- a/src/widgets/material_editor.h
+++ b/src/widgets/material_editor.h
@@ -40,7 +40,7 @@ protected:
void changeEvent(QEvent * e);
bool active;
- int ignore_next;
+ bool ignore_next;
Ui::MaterialEditor * ui;
Material * mat;
diff --git a/src/widgets/material_map_editor.ui b/src/widgets/material_map_editor.ui
index b5d887c..8ec8a12 100644
--- a/src/widgets/material_map_editor.ui
+++ b/src/widgets/material_map_editor.ui
@@ -94,10 +94,10 @@
0.200000000000000
- 0.000000000000000
+ -999.000000000000000
- 1.000000000000000
+ 9999.000000000000000
@@ -192,10 +192,10 @@
-
- -1.000000000000000
+ -2.000000000000000
- 1.000000000000000
+ 2.000000000000000
1.000000000000000
@@ -210,10 +210,10 @@
0.200000000000000
- -99.000000000000000
+ -999.000000000000000
- 99.000000000000000
+ 9999.000000000000000
@@ -242,10 +242,10 @@
0.200000000000000
- -99.000000000000000
+ -999.000000000000000
- 99.000000000000000
+ 9999.000000000000000
diff --git a/src/widgets/materials_editor.cpp b/src/widgets/materials_editor.cpp
index 7833423..28490c2 100644
--- a/src/widgets/materials_editor.cpp
+++ b/src/widgets/materials_editor.cpp
@@ -107,13 +107,14 @@ void MaterialsEditor::selectionChanged() {
if (!view) return;
// qDebug() << "selectionChanged";
ObjectBase * o = view->selectedObject();
- if (o) selectMaterial(o->material());
+ if (!o) return;
+ if (o->material()) selectMaterial(o->material());
}
void MaterialsEditor::materialsChanged() {
- if (ui->widgetMaterial->ignore_next > 0) {
- ui->widgetMaterial->ignore_next--;
+ if (ui->widgetMaterial->ignore_next) {
+ ui->widgetMaterial->ignore_next = false;
return;
}
Material * cm = currentMaterial();
@@ -153,6 +154,7 @@ void MaterialsEditor::on_buttonRename_clicked() {
int ind = ui->comboMaterial->currentIndex();
ui->comboMaterial->setItemText(ind, QString("[%1] " + nn).arg(ind + 1));
ui->comboMaterial->setItemData(ind, nn);
+ view->scene()->treeChanged();
}
@@ -193,6 +195,7 @@ void MaterialsEditor::on_buttonAssign_clicked() {
ObjectBaseList ol = view->selectedObjects();
foreach(ObjectBase * o, ol)
o->setMaterial(m, true);
+ view->scene()->treeChanged();
}
diff --git a/src/widgets/object_editor.ui b/src/widgets/object_editor.ui
index d94335f..5c00aef 100644
--- a/src/widgets/object_editor.ui
+++ b/src/widgets/object_editor.ui
@@ -60,7 +60,7 @@
0
- -287
+ -300
444
1100
@@ -590,7 +590,7 @@
true
- 999.000000000000000
+ 9999.000000000000000