Commit a5ffdad5 authored by Dirk Wilden's avatar Dirk Wilden

added Material Properties

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3967 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fa01d11a
......@@ -45,6 +45,7 @@
#include <ACG/GL/GLState.hh>
#include <QStringList>
#include <ACG/Scenegraph/BaseNode.hh>
#include <ACG/QtWidgets/QtMaterialDialog.hh>
#include <QModelIndexList>
#include <queue>
......
......@@ -204,6 +204,12 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, Globa
///Called by the popup menu to zoom to an object
void slotZoomTo();
///Called by the popup menu to set material properties
void slotMaterialProperties();
///Called when the material properties were changed inside the material dialog
void slotNodeChanged( ACG::SceneGraph::BaseNode* _node );
private :
/// Index where a popup has been opened
QModelIndex popupIndex_;
......
......@@ -37,8 +37,11 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <ACG/QtWidgets/QtMaterialDialog.hh>
#include <QInputDialog>
/// Slot for Remove action in ContextMenu
void DataControlPlugin::slotPopupRemove ( ) {
QItemSelectionModel* selection = view_->selectionModel();
......@@ -69,6 +72,7 @@ void DataControlPlugin::slotPopupRemove ( ) {
emit updated_objects(-1);
}
/// Slot for Ungroup action in ContextMenu
void DataControlPlugin::slotUngroup ( ) {
QItemSelectionModel* selection = view_->selectionModel();
......@@ -90,6 +94,7 @@ void DataControlPlugin::slotUngroup ( ) {
emit updated_objects(-1);
}
/// Slot for Copy action in ContextMenu
void DataControlPlugin::slotCopy ( ) {
QItemSelectionModel* selection = view_->selectionModel();
......@@ -114,6 +119,7 @@ void DataControlPlugin::slotCopy ( ) {
emit update_view();
}
/// Slot for Group action in ContextMenu
void DataControlPlugin::slotGroup ( ) {
QItemSelectionModel* selection = view_->selectionModel();
......@@ -150,6 +156,7 @@ void DataControlPlugin::slotGroup ( ) {
emit updated_objects(-1);
}
/// ContextMenu requested - creates the contextMenu
void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
popupIndex_ = view_->indexAt(_pos);
......@@ -196,6 +203,9 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
action = menu.addAction("Rename",this,SLOT ( slotRename() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"edit-rename.png");
action->setIcon(icon);
action = menu.addAction("Material Properties",this,SLOT ( slotMaterialProperties() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
action->setIcon(icon);
menu.addSeparator();
action = menu.addAction("Remove",this,SLOT ( slotPopupRemove() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-delete-item.png");
......@@ -263,6 +273,36 @@ void DataControlPlugin::slotRename(){
}
}
void DataControlPlugin::slotMaterialProperties(){
QItemSelectionModel* selection = view_->selectionModel();
// Get all selected rows
QModelIndexList indexList = selection->selectedRows ( 0 );
int selectedRows = indexList.size();
if (selectedRows == 1){
BaseObject* item = model_->getItem( indexList[0]);
BaseObjectData* itemData = dynamic_cast< BaseObjectData* > (item);
ACG::QtWidgets::QtMaterialDialog* dialog = new ACG::QtWidgets::QtMaterialDialog( 0, itemData->materialNode() );
dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);
connect(dialog, SIGNAL(signalNodeChanged(ACG::SceneGraph::BaseNode*)),
this, SLOT(slotNodeChanged(ACG::SceneGraph::BaseNode*)) );
dialog->setWindowIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png"));
dialog->show();
}
}
///Called when the material properties were changed inside the material dialog
void DataControlPlugin::slotNodeChanged( ACG::SceneGraph::BaseNode* /*_node*/ ){
emit update_view();
}
void DataControlPlugin::slotZoomTo(){
QItemSelectionModel* selection = view_->selectionModel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment