Ejemplo n.º 1
0
// UI数値セット
void AnimationForm::slot_setUI(FrameData data)
{
	m_bDontSetData = true ;
	if ( data.pos_x != ui->doubleSpinBox_pos_x->value() ) { ui->doubleSpinBox_pos_x->setValue(data.pos_x); }
	if ( data.pos_y != ui->doubleSpinBox_pos_y->value() ) { ui->doubleSpinBox_pos_y->setValue(data.pos_y); }
	if ( data.pos_z != ui->doubleSpinBox_pos_z->value() ) { ui->doubleSpinBox_pos_z->setValue(data.pos_z); }
	if ( data.rot_x != ui->doubleSpinBox_rot_x->value() ) { ui->doubleSpinBox_rot_x->setValue(data.rot_x); }
	if ( data.rot_y != ui->doubleSpinBox_rot_y->value() ) { ui->doubleSpinBox_rot_y->setValue(data.rot_y); }
	if ( data.rot_z != ui->doubleSpinBox_rot_z->value() ) { ui->doubleSpinBox_rot_z->setValue(data.rot_z); }
	if ( data.fScaleX != (float)ui->doubleSpinBox_scale_x->value() ) { ui->doubleSpinBox_scale_x->setValue(data.fScaleX) ; }
	if ( data.fScaleY != (float)ui->doubleSpinBox_scale_y->value() ) { ui->doubleSpinBox_scale_y->setValue(data.fScaleY) ; }

	if ( data.left   != ui->doubleSpinBox_uv_left->value() ) { ui->doubleSpinBox_uv_left->setValue(data.left); }
	if ( data.right  != ui->doubleSpinBox_uv_right->value() ) { ui->doubleSpinBox_uv_right->setValue(data.right); }
	if ( data.top    != ui->doubleSpinBox_uv_top->value() ) { ui->doubleSpinBox_uv_top->setValue(data.top); }
	if ( data.bottom != ui->doubleSpinBox_uv_bottom->value() ) { ui->doubleSpinBox_uv_bottom->setValue(data.bottom); }

	if ( data.center_x != ui->doubleSpinBox_center_x->value() ) { ui->doubleSpinBox_center_x->setValue(data.center_x); }
	if ( data.center_y != ui->doubleSpinBox_center_y->value() ) { ui->doubleSpinBox_center_y->setValue(data.center_y); }
	if ( data.nImage != ui->comboBox_image_no->currentText().toInt() ) {
		for ( int i = 0 ; i < ui->comboBox_image_no->count() ; i ++ ) {
			if ( ui->comboBox_image_no->itemText(i).toInt() == data.nImage ) {
				ui->comboBox_image_no->setCurrentIndex(i);
				break ;
			}
		}
		emit sig_imageChangeTab(data.nImage) ;
	}
	if ( data.bUVAnime != ui->checkBox_uv_anime->isChecked() ) { ui->checkBox_uv_anime->setChecked(data.bUVAnime); }
	if ( data.rgba[0] != ui->spinBox_r->value() ) { ui->spinBox_r->setValue(data.rgba[0]); }
	if ( data.rgba[1] != ui->spinBox_g->value() ) { ui->spinBox_g->setValue(data.rgba[1]); }
	if ( data.rgba[2] != ui->spinBox_b->value() ) { ui->spinBox_b->setValue(data.rgba[2]); }
	if ( data.rgba[3] != ui->spinBox_a->value() ) { ui->spinBox_a->setValue(data.rgba[3]); }
	m_bDontSetData = false ;

	if ( data.getRect() != m_pEditData->getCatchRect() ) {
		QRectF rect = data.getRect() ;
		m_pEditData->setCatchRect(rect);
		emit sig_imageChangeRect(rect) ;
		emit sig_imageRepaint() ;
	}
}
Ejemplo n.º 2
0
// uv bottom 変更
void AnimationForm::slot_changeUvBottom( double val )
{
	if ( m_pGlWidget->getDragMode() != AnimeGLWidget::kDragMode_None ) { return ; }
	if ( m_bDontSetData ) { return ; }

	addNowSelectLayerAndFrame();
	FrameData *p = getNowSelectFrameData() ;
	if ( !p ) { return ; }

	p->bottom = val ;
	addCommandEdit(*p) ;

	QRectF rect = p->getRect() ;
	m_pEditData->setCatchRect(rect);
	emit sig_imageRepaint() ;
}
Ejemplo n.º 3
0
void CAnm2D::renderOpenGL_FrameData(const FrameData &data, QMatrix4x4 mat)
{
	QRectF rect ;
	QRect uv = data.getRect() ;
	QRectF uvF ;

	AnmImage *pImage = getImage(data.nImage) ;
	if ( !pImage ) { return ; }

	const GLTexture *pTex = gEditData.getTexture(pImage->path) ;
	if ( !pTex ) { return ; }

	glPushMatrix() ;
	{
		double m[16] ;
		convMat(m, mat) ;
		m[14] /= 4096.0 ;
		glMultMatrixd(m) ;

		Vertex v = data.getVertex() ;
		rect.setLeft(v.x0);
		rect.setRight(v.x1) ;
		rect.setTop(v.y0);
		rect.setBottom(v.y1);

		int w = pTex->imgSize.width() ;
		int h = pTex->imgSize.height() ;
		uvF.setLeft((float)uv.left()/w) ;
		uvF.setRight((float)uv.right()/w) ;
		uvF.setTop(1.0f-(float)uv.top()/h) ;
		uvF.setBottom(1.0f-(float)uv.bottom()/h) ;

		glBindTexture(GL_TEXTURE_2D, pTex->nTexObj) ;

		QColor col ;
		col.setRed(data.rgba[0]);
		col.setGreen(data.rgba[1]);
		col.setBlue(data.rgba[2]);
		col.setAlpha(data.rgba[3]);

		drawRect(rect, uvF, 0, col) ;
	}
	glPopMatrix() ;
}