Developer Documentation
MaterialPicker.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 
44 
45 #include "MaterialPicker.hh"
46 
49 #include <ACG/QtWidgets/QtMaterialDialog.hh>
50 #include <sstream>
51 
52 #include <ACG/Scenegraph/MaterialNode.hh>
53 
54 #include <QMessageBox>
55 #include <QMenu>
56 
57 //------------------------------------------------------------------------------
58 MaterialPicker::MaterialPicker()
59  :
60  pickModeName_("MaterialPicker"),
61  propName_(name()+QString("/Materials")),
62  pickMaterialButton_(0),
63  fillMaterialButton_(0),
64  materialListWidget_(0),
65  materialStrings_(),
66  shortKeyRow_(),
67  materialNode_(),
68  pickMaterial_(false),
69  fillMaterial_(false)
70 
71 {
72 }
73 
74 //------------------------------------------------------------------------------
75 
76 MaterialPicker::~MaterialPicker() {
77 
78 }
79 
80 //------------------------------------------------------------------------------
81 
82 void MaterialPicker::initializePlugin() {
83  QWidget* toolBox = new QWidget();
84 
85  pickMaterialButton_ = new QPushButton("&pick Material", toolBox);
86  fillMaterialButton_ = new QPushButton("&fill Material", toolBox);
87  QPushButton* clearListButton = new QPushButton("Clear List", toolBox);
88  QPushButton* removeItemButton = new QPushButton("Remove", toolBox);
89 
90  pickMaterialButton_->setCheckable(true);
91  fillMaterialButton_->setCheckable(true);
92 
93  QLabel* materials = new QLabel("Materials:");
94 
95  materialListWidget_ = new QListWidget(toolBox);
96 
97  //load saved materials
98  materialStrings_ = OpenFlipperSettings().value(propName_, QStringList()).toStringList();
99  for (int i = 0; i < materialStrings_.size(); ++i)
100  {
101  QStringList savedString = materialStrings_[i].split(";");
102  std::stringstream stream;
103  MaterialInfo materialInfo;
104  stream << savedString[1].toStdString();
105  stream >> materialInfo.color_material;
106  stream.str("");
107  stream.clear();
108  stream << savedString[2].toStdString();
109  stream >> materialInfo.base_color;
110  stream.str("");
111  stream.clear();
112  stream << savedString[3].toStdString();
113  stream >> materialInfo.ambient_color;
114  stream.str("");
115  stream.clear();
116  stream << savedString[4].toStdString();
117  stream >> materialInfo.diffuse_color;
118  stream.str("");
119  stream.clear();
120  stream << savedString[5].toStdString();
121  stream >> materialInfo.specular_color;
122  stream.str("");
123  stream.clear();
124  stream << savedString[6].toStdString();
125  stream >> materialInfo.shininess;
126  stream.str("");
127  stream.clear();
128  stream << savedString[7].toStdString();
129  stream >> materialInfo.reflectance;
130  stream.str("");
131  stream.clear();
132  stream << savedString[8].toStdString();
133  stream >> materialInfo.key;
134 
135  if (materialInfo.key != Qt::Key_unknown) {
136  shortKeyRow_[materialInfo.key] = materialListWidget_->count();
137  }
138 
139  materialListWidget_->addItem( itemName(savedString[0],materialInfo.key) );
140  materialList_.push_back(materialInfo);
141  }
142 
143  //if material was saved, set first as current
144  if (materialStrings_.size())
145  materialListWidget_->setCurrentItem(materialListWidget_->item(0));
146  else
147  fillMaterialButton_->setEnabled(false);
148 
149  QGridLayout* removeGrid = new QGridLayout();
150  removeGrid->addWidget(removeItemButton,0,0);
151  removeGrid->addWidget(clearListButton,0,1);
152 
153  QGridLayout* pickGrid = new QGridLayout();
154  pickGrid->addWidget(pickMaterialButton_, 0, 0);
155  pickGrid->addWidget(fillMaterialButton_, 0, 1);
156 
157  QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, toolBox);
158  layout->addWidget(materials);
159  layout->addWidget(materialListWidget_);
160 
161  layout->addLayout(removeGrid);
162  layout->addLayout(pickGrid);
163 
164  connect(pickMaterialButton_, SIGNAL(clicked()), this, SLOT(slotPickMaterialMode()));
165  connect(fillMaterialButton_, SIGNAL(clicked()), this, SLOT(slotFillMaterialMode()));
166  connect(clearListButton, SIGNAL(clicked()), this, SLOT(clearList()));
167  connect(materialListWidget_, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(editMode(QListWidgetItem*)));
168  connect(materialListWidget_->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),this,SLOT(saveNewName(QWidget*, QAbstractItemDelegate::EndEditHint)));
169  connect(removeItemButton, SIGNAL(clicked()), this, SLOT(slotRemoveCurrentItem()));
170  connect(materialListWidget_,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(createContextMenu(const QPoint&)));
171 
172  materialListWidget_->setContextMenuPolicy(Qt::CustomContextMenu);
173  QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"material_picker.png");
174  emit addToolbox( tr("Material Picker"), toolBox, toolIcon);
175 }
176 //------------------------------------------------------------------------------
177 
178 void MaterialPicker::removeItem(QListWidgetItem* _item)
179 {
180  unsigned index = materialListWidget_->row(_item);
181  materialListWidget_->takeItem(index);
182  materialList_.erase(materialList_.begin()+index);
183  materialStrings_.erase(materialStrings_.begin()+index);
184  if (materialStrings_.isEmpty())
185  OpenFlipperSettings().remove(propName_);
186  else
187  OpenFlipperSettings().setValue(propName_, materialStrings_);
188  fillMaterialButton_->setEnabled(materialListWidget_->count());
189 
190  //update hotkey table
191  std::map<int,size_t>::iterator eraseIter = shortKeyRow_.end();
192  for (std::map<int,size_t>::iterator iter = shortKeyRow_.begin(); iter != shortKeyRow_.end(); ++iter)
193  {
194  if (iter->second > index)
195  --(iter->second);
196  else if (iter->second == index)
197  eraseIter = iter;
198  }
199  if (eraseIter != shortKeyRow_.end())
200  shortKeyRow_.erase(eraseIter);
201 
202 }
203 
204 //------------------------------------------------------------------------------
205 
206 void MaterialPicker::clearList() {
207  materialListWidget_->clear();
208  materialList_.clear();
209  materialStrings_.clear();
210  fillMaterialButton_->setEnabled(false);
211 
212  //setting value empty instead of removing will cause an error at start up
213  OpenFlipperSettings().remove(propName_);
214 }
215 
216 //------------------------------------------------------------------------------
217 
218 void MaterialPicker::slotRemoveCurrentItem()
219 {
220  if (!materialListWidget_->count())
221  return;
222 
223  QMessageBox msgBox;
224  QListWidgetItem* item = materialListWidget_->currentItem();
225  msgBox.setText(tr("Remove ")+plainName(item->text(),materialListWidget_->currentRow())+tr("?"));
226  msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
227  msgBox.setDefaultButton(QMessageBox::Ok);
228  int ret = msgBox.exec();
229 
230  if (ret == QMessageBox::Ok)
231  removeItem(materialListWidget_->currentItem());
232 }
233 //------------------------------------------------------------------------------
234 
235 void MaterialPicker::slotPickMaterialMode() {
236  pickMaterialButton_->setChecked(true);
237  fillMaterialButton_->setChecked(false);
238  pickMaterial_ = true;
239  fillMaterial_ = false;
240 
241  PluginFunctions::actionMode( Viewer::PickingMode );
242  PluginFunctions::pickMode(pickModeName_);
243 }
244 
245 //------------------------------------------------------------------------------
246 
247 void MaterialPicker::slotFillMaterialMode() {
248  fillMaterialButton_->setChecked(true);
249  pickMaterialButton_->setChecked(false);
250  fillMaterial_ = true;
251  pickMaterial_ = false;
252 
253  PluginFunctions::actionMode( Viewer::PickingMode );
254  PluginFunctions::pickMode(pickModeName_);
255 }
256 
257 //------------------------------------------------------------------------------
258 
259 void MaterialPicker::pluginsInitialized() {
260  emit addPickMode(pickModeName_);
261  for (unsigned i = 0; i < supportedKeys_; ++i)
262  emit registerKey (Qt::Key_1+i, Qt::ControlModifier, QString(tr("Material %1")).arg(i+1), false);
263 }
264 
265 //------------------------------------------------------------------------------
266 
267 void MaterialPicker::slotMouseEvent(QMouseEvent* _event) {
268  if ( PluginFunctions::pickMode() != pickModeName_)
269  return;
270 
271  if (_event->type() == QEvent::MouseButtonPress) {
272  size_t node_idx, target_idx;
273  OpenMesh::Vec3d hitPoint;
274 
275  // Get picked object's identifier by picking in scenegraph
276  if ( PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING ,_event->pos(), node_idx, target_idx, &hitPoint) ){
277  BaseObjectData* object;
278  if ( PluginFunctions::getPickedObject(node_idx, object) ) {
279 
280  // pick material
281  if ( pickMaterial_ && !fillMaterial_ ) {
282  MaterialNode* material = object->materialNode();
283 
284  if (material) {
285 
286  // store the material information
287  MaterialInfo materialInfo;
288  materialInfo.color_material = material->colorMaterial();
289  materialInfo.base_color = material->base_color();
290  materialInfo.ambient_color = material->ambient_color();
291  materialInfo.diffuse_color = material->diffuse_color();
292  materialInfo.specular_color = material->specular_color();
293  materialInfo.shininess = material->shininess();
294  materialInfo.reflectance = material->reflectance();
295 
296  materialInfo.key = Qt::Key_unknown;
297  if (shortKeyRow_.size() < supportedKeys_)
298  {
299  materialInfo.key = Qt::Key_1+(int)shortKeyRow_.size();
300  shortKeyRow_[materialInfo.key] = materialListWidget_->count();
301  }
302 
303  // update list widget and material list
304  QString name = QString("material id: %1").arg(material->id());
305  materialListWidget_->addItem( itemName(name,materialInfo.key) );
306 
307  materialListWidget_->setCurrentItem( materialListWidget_->item(materialListWidget_->count() - 1) );
308 
309  materialList_.push_back(materialInfo);
310 
311  //save material
312  QString matStr = materialString(materialInfo,name);
313  materialStrings_.push_back(matStr);
314  OpenFlipperSettings().setValue(propName_, materialStrings_);
315 
316  fillMaterialButton_->setEnabled(true);
317  OpenFlipperSettings().setValue(propName_, materialStrings_);
318  }
319 
320  // apply material from current item in list widget to picked object
321  } else if ( fillMaterial_ && !pickMaterial_ ){
322  MaterialNode* material = object->materialNode();
323 
324  if (material) {
325 
326  if (materialListWidget_->count() > 0)
327  {
328  int row = materialListWidget_->currentRow();
329  material->colorMaterial(materialList_[row].color_material);
330  material->set_base_color(materialList_[row].base_color);
331  material->set_ambient_color(materialList_[row].ambient_color);
332  material->set_diffuse_color(materialList_[row].diffuse_color);
333  material->set_specular_color(materialList_[row].specular_color);
334  material->set_shininess(materialList_[row].shininess);
335  material->set_reflectance(materialList_[row].reflectance);
336  }
337 
338  }
339  }
340  }
341  }
342  }
343 }
344 
345 //------------------------------------------------------------------------------
346 
347 void MaterialPicker::editModeCurrent()
348 {
349  editMode(materialListWidget_->currentItem());
350 }
351 
352 //------------------------------------------------------------------------------
353 void MaterialPicker::editMode(QListWidgetItem* _item) {
354  _item->setFlags(_item->flags() | Qt::ItemIsEditable);
355  materialListWidget_->editItem(_item);
356  _item->setText( plainName(_item->text(),materialListWidget_->row(_item)));
357 }
358 
359 //------------------------------------------------------------------------------
360 void MaterialPicker::saveNewName ( QWidget * _editor, QAbstractItemDelegate::EndEditHint _hint )
361 {
362  saveNewName(materialListWidget_->currentItem());
363 }
364 //------------------------------------------------------------------------------
365 QString MaterialPicker::plainName(const QString &string, int index)
366 {
367  if (materialList_[index].key == Qt::Key_unknown)
368  return string;
369 
370  QString str(string);
371  return str.remove(0,4);
372 }
373 //------------------------------------------------------------------------------
374 void MaterialPicker::saveNewName (QListWidgetItem* _item)
375 {
376  unsigned index = materialListWidget_->row(_item);
377  QString str = materialStrings_[index];
378  QStringList strList = str.split(";");
379 
380  //pass name
381  strList[0] = _item->text();
382  //highlight hotkey support
383  if (materialList_[index].key != Qt::Key_unknown)
384  _item->setText( itemName(strList[0], materialList_[index].key) );
385 
386 
387  //create new String to save
388  str = "";
389  for (int i = 0; i < strList.size()-1; ++i)
390  str += strList[i] + ";";
391  str += strList[strList.size()-1];
392  materialStrings_[index] = str;
393  OpenFlipperSettings().setValue(propName_, materialStrings_);
394 }
395 //------------------------------------------------------------------------------
396 
397 QString MaterialPicker::itemName(const QString &_name, int _key)
398 {
399  if (_key == Qt::Key_unknown)
400  return _name;
401 
402  return QString(tr("(%1) ")).arg(QString::number(_key-Qt::Key_1+1)) +_name;
403 }
404 
405 //------------------------------------------------------------------------------
406 
407 void MaterialPicker::slotPickModeChanged(const std::string& _mode) {
408  pickMaterialButton_->setChecked( _mode == pickModeName_ && pickMaterial_ );
409  fillMaterialButton_->setChecked( _mode == pickModeName_ && fillMaterial_ );
410 }
411 
412 //------------------------------------------------------------------------------
413 void MaterialPicker::slotKeyEvent(QKeyEvent* _event)
414 {
415  for (unsigned i = 0; i < supportedKeys_; ++i)
416  {
417  int key = Qt::Key_1+i;
418  if (_event->key() == key && _event->modifiers() == Qt::ControlModifier)
419  {
420  if (shortKeyRow_.find(key) == shortKeyRow_.end())
421  return;
422  slotFillMaterialMode();
423  materialListWidget_->setCurrentRow((int)shortKeyRow_[key]);
424  }
425  }
426 }
427 //------------------------------------------------------------------------------
428 void MaterialPicker::changeHotKey(const int _key)
429 {
430  std::map<int,size_t>::iterator iter = shortKeyRow_.find(_key);
431 
432  if (iter != shortKeyRow_.end())
433  {
434  //remove old key
435  int oldIndex = (int)iter->second;
436  QListWidgetItem* oldItem = materialListWidget_->item(oldIndex);
437  //remove name
438  oldItem->setText( plainName(oldItem->text(),oldIndex) );
439  materialList_[oldIndex].key = Qt::Key_unknown; //unregister key after rename, otherwise the renaming will fail
440  materialStrings_[oldIndex] = materialString(materialList_[oldIndex],oldItem->text());
441  saveNewName(oldItem);
442  }
443 
444  //set the new item (save and hint)
445  int newIndex = materialListWidget_->currentRow();
446  QListWidgetItem* newItem = materialListWidget_->item(newIndex);
447  materialList_[newIndex].key = _key;
448 
449  materialStrings_[newIndex] = materialString(materialList_[newIndex],newItem->text());
450  saveNewName(newItem);
451 
452  shortKeyRow_[_key] = newIndex;
453 }
454 //------------------------------------------------------------------------------
455 QString MaterialPicker::materialString(const MaterialInfo& _mat, const QString &_name)
456 {
457  std::stringstream stream;
458  stream << _name.toStdString();
459  stream << ";" << _mat.color_material;
460  stream << ";" << _mat.base_color;
461  stream << ";" << _mat.ambient_color;
462  stream << ";" << _mat.diffuse_color;
463  stream << ";" << _mat.specular_color;
464  stream << ";" << _mat.shininess;
465  stream << ";" << _mat.reflectance;
466  stream << ";" << _mat.key;
467 
468  return QString(stream.str().c_str());
469 }
470 //------------------------------------------------------------------------------
471 void MaterialPicker::slotMaterialProperties()
472 {
473  if (materialNode_)
474  return;
475 
476  //QListWidgetItem* item = materialListWidget_->currentItem();
477  materialListWidget_->setDisabled(true);
478 
479  materialNode_.reset(new MaterialNode());
480  int row = materialListWidget_->currentRow();
481  materialNode_->colorMaterial(materialList_[row].color_material);
482  materialNode_->set_base_color(materialList_[row].base_color);
483  materialNode_->set_ambient_color(materialList_[row].ambient_color);
484  materialNode_->set_diffuse_color(materialList_[row].diffuse_color);
485  materialNode_->set_specular_color(materialList_[row].specular_color);
486  materialNode_->set_shininess(materialList_[row].shininess);
487  materialNode_->set_reflectance(materialList_[row].reflectance);
488 
489  ACG::QtWidgets::QtMaterialDialog* dialog = new ACG::QtWidgets::QtMaterialDialog( 0, materialNode_.get() );
490 
491  dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);
492 
493  connect(dialog,SIGNAL(finished(int)),this,SLOT(slotEnableListWidget(int)));
494  connect(dialog,SIGNAL(accepted()),this,SLOT(slotMaterialChanged()));
495 
496  dialog->setWindowIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png"));
497 
498  dialog->show();
499 
500 }
501 //------------------------------------------------------------------------------
502 void MaterialPicker::slotMaterialChanged()
503 {
504  if (materialNode_)
505  {
506  int index = materialListWidget_->currentRow();
507  // store the material information
508  MaterialInfo materialInfo;
509  materialInfo.color_material = materialNode_->colorMaterial();
510  materialInfo.base_color = materialNode_->base_color();
511  materialInfo.ambient_color = materialNode_->ambient_color();
512  materialInfo.diffuse_color = materialNode_->diffuse_color();
513  materialInfo.specular_color = materialNode_->specular_color();
514  materialInfo.shininess = materialNode_->shininess();
515  materialInfo.reflectance = materialNode_->reflectance();
516  materialInfo.key = materialList_[index].key;
517  QString name = plainName(materialListWidget_->currentItem()->text(),materialListWidget_->currentRow());
518  materialStrings_[index] = materialString(materialInfo,name);
519  materialList_[index] = materialInfo;
520  OpenFlipperSettings().setValue(propName_, materialStrings_);
521  }
522  OpenFlipperSettings().setValue(propName_, materialStrings_);
523 }
524 
525 //------------------------------------------------------------------------------
526 void MaterialPicker::slotEnableListWidget(int _save){
527  materialListWidget_->setEnabled(true);
528  if (_save == QDialog::Accepted)
529  slotMaterialChanged();
530  materialNode_.reset();
531 }
532 
533 //------------------------------------------------------------------------------
534 void MaterialPicker::createContextMenu(const QPoint& _point)
535 {
536  QMenu *menu = new QMenu(materialListWidget_);
537 
538  QAction* action = menu->addAction(tr("Material Properties"));
539  QIcon icon;
540  icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
541  action->setIcon(icon);
542  action->setEnabled(true);
543  connect(action,SIGNAL(triggered(bool)),this,SLOT(slotMaterialProperties()));
544 
545  action = menu->addAction(tr("Rename"));
546  connect(action,SIGNAL(triggered(bool)),this,SLOT(editModeCurrent()));
547 
548  action = menu->addAction(tr("Remove"));
549  connect(action, SIGNAL(triggered(bool)),this,SLOT(slotRemoveCurrentItem()));
550 
551  menu->addSeparator();
552 
553  //add hotkey selectors
554  for (unsigned i = 0; i < supportedKeys_; ++i)
555  {
556 
557  QAction* action = menu->addAction(tr("Key %1").arg(i+1));
558  connect(action,&QAction::triggered, [=]() { changeHotKey(Qt::Key_1+i); } );
559 
560  std::map<int,size_t>::iterator iter = shortKeyRow_.find(Qt::Key_1 + i);
561 
562  //Disable already selected hotkey number
563  if (iter != shortKeyRow_.end() && iter->second == static_cast<size_t>(materialListWidget_->currentRow()))
564  action->setDisabled(true);
565  }
566 
567  menu->exec(materialListWidget_->mapToGlobal(_point),0);
568 
569 
570 
571 }
572 
573 
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void editMode(QListWidgetItem *_item)
items can be renamed by double clicking them
void set_specular_color(const Vec4f &_s)
set the specular color
const Vec4f & ambient_color() const
get the ambient color.
const Vec4f & specular_color() const
get the specular color
void set_ambient_color(const Vec4f &_a)
set the ambient color.
float shininess() const
get shininess
void saveNewName(QWidget *_editor, QAbstractItemDelegate::EndEditHint _hint)
saves the new material name with hotkey hint
void set_shininess(float _s)
set shininess
const Vec4f & diffuse_color() const
get the diffuse color.
QString materialString(const MaterialInfo &_mat, const QString &_name)
returns a formatted string for saving
void set_diffuse_color(const Vec4f &_d)
set the diffuse color.
Viewer::ActionMode actionMode()
Get the current Action mode.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
pick any of the prior targets (should be implemented for all nodes)
Definition: PickTarget.hh:84
QString name()
Return a name for the plugin.
const std::string pickMode()
Get the current Picking mode.
const Vec4f & base_color() const
get the base color ( same as emission() )
void createContextMenu(const QPoint &_point)
creates context menu on current item (current is the item at mouse position)
void set_reflectance(double _m)
set reflectance
unsigned int id() const
Definition: BaseNode.hh:423
void set_base_color(const Vec4f &_c)
set the base color ( Same as set_emission(const Vec4f& _c) )
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
QString itemName(const QString &_name, int _key)
returns the item name with hotkey hint
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
QString plainName(const QString &string, int index)
returns the plain name of the material without hotkey hint
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
double reflectance() const
get reflectance
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
void changeHotKey(const int _key)
change specified HotKey to current item
void colorMaterial(const bool _cm)
Set colorMaterial.