Commit a74d54e1 authored by Jan Möbius's avatar Jan Möbius

Made Light source properties available in datacontrol context menu


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9111 383ad7c9-94d9-4d36-a494-682f7c89f535
parent feaca8c9
......@@ -210,6 +210,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Called by the popup menu in order to turn lights on/off
void slotSwitchLight();
/// Called by the popup menu in order to edit lights
void slotEditLight();
///Called by the popup menu to set material properties
void slotMaterialProperties();
......
......@@ -54,6 +54,8 @@
#include <QMessageBox>
#include "Menu.hh"
#include <ObjectTypes/Light/LightWidget.hh>
//******************************************************************************
......@@ -294,9 +296,14 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
action = menu.addAction(tr("Remove"),this,SLOT ( slotPopupRemove() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-delete-item.png");
action->setIcon(icon);
menu.addSeparator();
action = menu.addAction(tr("Switch On/Off"),this,SLOT ( slotSwitchLight() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightType.png");
action->setIcon(icon);
action = menu.addAction(tr("Edit Light"),this,SLOT ( slotEditLight() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightType.png");
action->setIcon(icon);
} else {
action = menu.addAction(tr("Zoom to object"),this,SLOT ( slotZoomTo() ));
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"zoom-in.png");
......@@ -555,6 +562,33 @@ void DataControlPlugin::slotSwitchLight() {
//******************************************************************************
/**
* \brief Switch light source on or off
*/
void DataControlPlugin::slotEditLight() {
QItemSelectionModel* selection = view_->selectionModel();
// Get all selected rows
QModelIndexList indexList = selection->selectedRows ( 0 );
int selectedRows = indexList.size();
if (selectedRows == 1) {
LightObject* light = 0;
int id = model_->itemId( indexList[0]);
if (id == -1 || !PluginFunctions::getObject( id, light ) )
return;
if(light == 0) return;
LightWidget* widget = new LightWidget( light->lightNode() );
widget->show();
}
}
//******************************************************************************
/** \brief Zoom to an object
*
*/
......
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