void FboWarpOutput::keyPressed(int key){
	
	if(editingGrid && keyboardEditingEnabled){
		switch(key) {
				
				// Move
			case 'w':
				changeSelection(0, -1);
				break;
			case 's':
				changeSelection(0, 1);
				break;
			case 'a':
				changeSelection(-1, 0);
				break;
			case 'd':
				changeSelection(1, 0);
				break;
				
				// Scale
			case 'p':
				scaleSelection(0.1);
				break;
			case 'l':
				scaleSelection(-0.1);
				break;
			case 'P':
				scaleSelection(1);
				break;
			case 'L':
				scaleSelection(-1);
				break;
				
				// Shift
			case OF_KEY_UP:
				shiftSelection(0, -1);
				break;	
			case OF_KEY_DOWN:
				shiftSelection(0, 1);
				break;
			case OF_KEY_LEFT:
				shiftSelection(-1, 0);
				break;
			case OF_KEY_RIGHT:
				shiftSelection(1, 0);
				break;
		}
	}
}
Beispiel #2
0
UVWidget::UVWidget( QWidget * parent )
	: QGLWidget( QGLFormat( QGL::SampleBuffers ), parent, 0, Qt::Tool | Qt::WindowStaysOnTopHint ), undoStack( new QUndoStack( this ) )
{
	texnames = QStringList() // these are not translated since they are pulled from nif.xml
		<< "Base Texture"
		<< "Dark Texture"
		<< "Detail Texture"
		<< "Gloss Texture"
		<< "Glow Texture"
		<< "Bump Map Texture"
		<< "Decal 0 Texture"
		<< "Decal 1 Texture"
		<< "Decal 2 Texture"
		<< "Decal 3 Texture";
	
	setWindowTitle( tr("UV Editor") );
	setFocusPolicy( Qt::StrongFocus );
	
	textures = new TexCache( this );
	
	zoom = 1.2;
	
	pos = QPoint( 0, 0 );
	
	mousePos = QPoint( -1000, -1000 );
	
	setCursor( QCursor( Qt::CrossCursor ) );
	setMouseTracking( true );
	
	setContextMenuPolicy( Qt::ActionsContextMenu );
	
	QAction * aUndo = undoStack->createUndoAction( this );
	QAction * aRedo = undoStack->createRedoAction( this );
	
	aUndo->setShortcut( QKeySequence::Undo );
	aRedo->setShortcut( QKeySequence::Redo );
	
	addAction( aUndo );
	addAction( aRedo );
	
	QAction * aSep = new QAction( this );
	aSep->setSeparator( true );
	addAction( aSep );
	
	QAction * aSelectAll = new QAction( tr( "Select &All" ), this );
	aSelectAll->setShortcut( QKeySequence::SelectAll );
	connect( aSelectAll, SIGNAL( triggered() ), this, SLOT( selectAll() ) );
	addAction( aSelectAll );
	
	QAction * aSelectNone = new QAction( tr( "Select &None" ), this );
	connect( aSelectNone, SIGNAL( triggered() ), this, SLOT( selectNone() ) );
	addAction( aSelectNone );
	
	QAction * aSelectFaces = new QAction( tr( "Select &Faces" ), this );
	connect( aSelectFaces, SIGNAL( triggered() ), this, SLOT( selectFaces() ) );
	addAction( aSelectFaces );
	
	QAction * aSelectConnected = new QAction( tr( "Select &Connected" ), this );
	connect( aSelectConnected, SIGNAL( triggered() ), this, SLOT( selectConnected() ) );
	addAction( aSelectConnected );
	
	QAction * aScaleSelection = new QAction( tr( "&Scale and Translate Selected" ), this );
	aScaleSelection->setShortcut( QKeySequence( "Alt+S" ) );
	connect( aScaleSelection, SIGNAL( triggered() ), this, SLOT( scaleSelection() ) );
	addAction( aScaleSelection );
	
	QAction * aRotateSelection = new QAction( tr( "&Rotate Selected" ), this );
	aRotateSelection->setShortcut( QKeySequence( "Alt+R" ) );
	connect( aRotateSelection, SIGNAL( triggered() ), this, SLOT( rotateSelection() ) );
	addAction( aRotateSelection );
	
	aSep = new QAction( this );
	aSep->setSeparator( true );
	addAction( aSep );
	
	aTextureBlend = new QAction( tr( "Texture Alpha Blending" ), this );
	aTextureBlend->setCheckable( true );
	aTextureBlend->setChecked( true );
	connect( aTextureBlend, SIGNAL( toggled( bool ) ), this, SLOT( updateGL() ) );
	addAction( aTextureBlend );
	
	coordSetGroup = new QActionGroup( this );
	connect( coordSetGroup, SIGNAL( triggered( QAction * ) ), this, SLOT( selectCoordSet() ) );
	
	coordSetSelect = new QMenu( tr( "Select Coordinate Set" ) );
	addAction( coordSetSelect->menuAction() );
	connect( coordSetSelect, SIGNAL( aboutToShow() ), this, SLOT( getCoordSets() ) );
	
	texSlotGroup = new QActionGroup( this );
	connect( texSlotGroup, SIGNAL( triggered( QAction * ) ), this, SLOT( selectTexSlot() ) );
	
	menuTexSelect = new QMenu( tr( "Select Texture Slot" ) );
	addAction( menuTexSelect->menuAction() );
	connect( menuTexSelect, SIGNAL( aboutToShow() ), this, SLOT( getTexSlots() ) );
	
	currentTexSlot = 0;
	
	connect( Options::get(), SIGNAL( sigChanged() ), this, SLOT( updateGL() ) );
}