示例#1
0
MainWindow2::MainWindow2( QWidget *parent ) :
QMainWindow( parent ),
ui( new Ui::MainWindow2 )
{
    ui->setupUi( this );
    
    m_object = new Object();
    m_object->defaultInitialisation();

    editor = new Editor( this );
    m_pScribbleArea = editor->getScribbleArea();
    m_pTimeLine = new TimeLine( this, editor );
    makeTimeLineConnections();

    arrangePalettes();
    createMenus();
    loadAllShortcuts();

    // must run after 'arragePalettes'
    editor->setObject( m_object );
    editor->resetUI();

    readSettings();

    makeColorPaletteConnections();
	makeColorWheelConnections();

    connect(editor, SIGNAL(needSave()), this, SLOT(saveDocument()));
    connect(m_pToolSet, SIGNAL(clearButtonClicked()), editor, SLOT(clearCurrentFrame()));
    connect(editor, SIGNAL(changeTool(ToolType)), m_pToolSet, SLOT(setCurrentTool(ToolType)));

    editor->setCurrentLayer( this->editor->m_pObject->getLayerCount() - 1 );
}
void MaterialVar_Integer::updateObject()
{
    if (!updating && getMaterial() && getMaterial()->getVar(getMaterialVarIndex()))
    {
        Magic3D::MaterialVar_Integer* variable = (Magic3D::MaterialVar_Integer*)getMaterial()->getVar(getMaterialVarIndex());

        if (ui->txtX->isVisible())
        {
            variable->setValue(0, ui->txtX->value());
        }

        if (ui->txtY->isVisible())
        {
            variable->setValue(1, ui->txtY->value());
        }

        if (ui->txtZ->isVisible())
        {
            variable->setValue(2, ui->txtZ->value());
        }

        if (ui->txtW->isVisible())
        {
            variable->setValue(3, ui->txtW->value());
        }

        needSave();
        update();
        mainWindow->update();
    }
}
示例#3
0
void MaterialInfo::on_sldShininess_valueChanged(int value)
{
    if (!updating && material)
    {
        material->setShininess(value);
        needSave();
    }
}
示例#4
0
void Editor::updateAutoSaveCounter()
{
    if (mIsAutosave == false)
        return;

    mAutosaveCounter++;
    if (mAutosaveCounter >= mAutosaveNumber)
    {
        mAutosaveCounter = 0;
        emit needSave();
    }
}
示例#5
0
bool MapEditor::saveCheck()
{
    if(!needSave())
        return false;

    QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Attention"), tr("Tout travail non sauvegardé sera perdu.\nQue faire ?"), QMessageBox::Save|QMessageBox::Discard|QMessageBox::Cancel);
    if(ret == QMessageBox::Cancel)
        return true;

    if(ret == QMessageBox::Discard)
        return false;

    if(ret == QMessageBox::Save)
        return saveMap();

    return true;
}
示例#6
0
文件: editor.cpp 项目: qbdp/pencil
void Editor::modification( int layerNumber )
{
    if ( mObject != NULL )
    {
        mObject->modification();
    }
    lastModifiedFrame = currentFrame();
    lastModifiedLayer = layerNumber;

    mScribbleArea->update();
    
	emit updateTimeLine();

    numberOfModifications++;
    if ( mIsAutosave && numberOfModifications > autosaveNumber )
    {
        numberOfModifications = 0;
        emit needSave();
    }
}
示例#7
0
void MaterialInfo::updateObject()
{
    if (!updating && material)
    {
        if (ui->rbAlpha->isChecked())
            material->setBlend(Magic3D::eBLEND_ALPHA);
        else if (ui->rbMultiply->isChecked())
            material->setBlend(Magic3D::eBLEND_MULTIPLY);
        else if (ui->rbAdd->isChecked())
            material->setBlend(Magic3D::eBLEND_ADD);
        else if (ui->rbDivide->isChecked())
            material->setBlend(Magic3D::eBLEND_DIVIDE);
        else if (ui->rbInvert->isChecked())
            material->setBlend(Magic3D::eBLEND_INVERT);
        else if (ui->rbColor->isChecked())
            material->setBlend(Magic3D::eBLEND_COLOR);

        material->setShininess(ui->sldShininess->value());
        material->setAlphaTest(ui->txtAlphaTest->value());

        if (ui->cmbTexture1->currentIndex() > 0)
        {
            material->setTexture(0, Magic3D::ResourceManager::getTextures()->get(ui->cmbTexture1->currentText().toStdString()));
        }
        else
        {
            material->setTexture(0, NULL);
        }

        Magic3D::Texture* texture = material->getTexture(0);
        if (texture)
        {
            texture->setWrap(ui->rbClamp1->isChecked());
        }

        if (ui->cmbTexture2->currentIndex() > 0)
        {
            material->setTexture(1, Magic3D::ResourceManager::getTextures()->get(ui->cmbTexture2->currentText().toStdString()));
        }
        else
        {
            material->setTexture(1, NULL);
        }

        texture = material->getTexture(1);
        if (texture)
        {
            texture->setWrap(ui->rbClamp2->isChecked());
        }

        if (ui->cmbShader->currentIndex() > 0)
        {
            material->setShader(Magic3D::ResourceManager::getShaders()->get(ui->cmbShader->currentText().toStdString()));
        }
        else
        {
            material->setShader(NULL);
        }

        needSave();

        mainWindow->update();
        mainWindow->object2dinfo->update();

        loadMaterial();
    }
}
void MaterialVar_Matrix::updateObject()
{
    if (!updating && getMaterial() && getMaterial()->getVar(getMaterialVarIndex()))
    {
        Magic3D::MaterialVar_Matrix* variable = (Magic3D::MaterialVar_Matrix*)getMaterial()->getVar(getMaterialVarIndex());

        if (ui->txt_0_0->isVisible())
        {
            variable->setValue(0, 0, ui->txt_0_0->value());
        }
        if (ui->txt_0_1->isVisible())
        {
            variable->setValue(0, 1, ui->txt_0_1->value());
        }
        if (ui->txt_0_2->isVisible())
        {
            variable->setValue(0, 2, ui->txt_0_2->value());
        }
        if (ui->txt_0_3->isVisible())
        {
            variable->setValue(0, 3, ui->txt_0_3->value());
        }

        if (ui->txt_1_0->isVisible())
        {
            variable->setValue(1, 0, ui->txt_1_0->value());
        }
        if (ui->txt_1_1->isVisible())
        {
            variable->setValue(1, 1, ui->txt_1_1->value());
        }
        if (ui->txt_1_2->isVisible())
        {
            variable->setValue(1, 2, ui->txt_1_2->value());
        }
        if (ui->txt_1_3->isVisible())
        {
            variable->setValue(1, 3, ui->txt_1_3->value());
        }

        if (ui->txt_2_0->isVisible())
        {
            variable->setValue(2, 0, ui->txt_2_0->value());
        }
        if (ui->txt_2_1->isVisible())
        {
            variable->setValue(2, 1, ui->txt_2_1->value());
        }
        if (ui->txt_2_2->isVisible())
        {
            variable->setValue(2, 2, ui->txt_2_2->value());
        }
        if (ui->txt_2_3->isVisible())
        {
            variable->setValue(2, 3, ui->txt_2_3->value());
        }

        if (ui->txt_3_0->isVisible())
        {
            variable->setValue(3, 0, ui->txt_3_0->value());
        }
        if (ui->txt_3_1->isVisible())
        {
            variable->setValue(3, 1, ui->txt_3_1->value());
        }
        if (ui->txt_3_2->isVisible())
        {
            variable->setValue(3, 2, ui->txt_3_2->value());
        }
        if (ui->txt_3_3->isVisible())
        {
            variable->setValue(3, 3, ui->txt_3_3->value());
        }

        needSave();
        update();
        mainWindow->update();
    }
}