twice materialChanged signal fixed
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
bool active;
|
||||
int ignore_next;
|
||||
bool ignore_next;
|
||||
Ui::MaterialEditor * ui;
|
||||
Material * mat;
|
||||
|
||||
|
||||
@@ -94,10 +94,10 @@
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
<property name="spinMinimum">
|
||||
<double>0.000000000000000</double>
|
||||
<double>-999.000000000000000</double>
|
||||
</property>
|
||||
<property name="spinMaximum">
|
||||
<double>1.000000000000000</double>
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -192,10 +192,10 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="SpinSlider" name="sliderAmount">
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
<double>-2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
@@ -210,10 +210,10 @@
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
<property name="spinMinimum">
|
||||
<double>-99.000000000000000</double>
|
||||
<double>-999.000000000000000</double>
|
||||
</property>
|
||||
<property name="spinMaximum">
|
||||
<double>99.000000000000000</double>
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -242,10 +242,10 @@
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
<property name="spinMinimum">
|
||||
<double>-99.000000000000000</double>
|
||||
<double>-999.000000000000000</double>
|
||||
</property>
|
||||
<property name="spinMaximum">
|
||||
<double>99.000000000000000</double>
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-287</y>
|
||||
<y>-300</y>
|
||||
<width>444</width>
|
||||
<height>1100</height>
|
||||
</rect>
|
||||
@@ -590,7 +590,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="spinMaximum">
|
||||
<double>999.000000000000000</double>
|
||||
<double>9999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user