Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50
51 #include "MaterialPicker.hh"
52
53 #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
54 #include <OpenFlipper/common/GlobalOptions.hh>
55 #include <ACG/QtWidgets/QtMaterialDialog.hh>
56 #include <sstream>
57
58 //------------------------------------------------------------------------------
59 MaterialPicker::MaterialPicker()
60 :
61 pickModeName_("MaterialPicker"),
62 propName_(name()+QString("/Materials")),
63 pickMaterialButton_(0),
64 fillMaterialButton_(0),
65 materialListWidget_(0),
66 materialStrings_(),
67 shortKeyRow_(),
68 materialNode_(),
69 pickMaterial_(false),
70 fillMaterial_(false)
71
72 {
73 }
74
75 //------------------------------------------------------------------------------
76
77 MaterialPicker::~MaterialPicker() {
78
79 }
80
81 //------------------------------------------------------------------------------
82
83 void MaterialPicker::initializePlugin() {
84 QWidget* toolBox = new QWidget();
85
86 pickMaterialButton_ = new QPushButton("&pick Material", toolBox);
87 fillMaterialButton_ = new QPushButton("&fill Material", toolBox);
88 QPushButton* clearListButton = new QPushButton("Clear List", toolBox);
89 QPushButton* removeItemButton = new QPushButton("Remove", toolBox);
90
91 pickMaterialButton_->setCheckable(true);
92 fillMaterialButton_->setCheckable(true);
93
94 QLabel* materials = new QLabel("Materials:");
95
96 materialListWidget_ = new QListWidget(toolBox);
97
98 //load saved materials
99 materialStrings_ = OpenFlipperSettings().value(propName_, QStringList()).toStringList();
100 for (int i = 0; i < materialStrings_.size(); ++i)
101 {
102 QStringList savedString = materialStrings_[i].split(";");
103 std::stringstream stream;
104 MaterialInfo materialInfo;
105 stream << savedString[1].toStdString();
106 stream >> materialInfo.color_material;
107 stream.str("");
108 stream.clear();
109 stream << savedString[2].toStdString();
110 stream >> materialInfo.base_color;
111 stream.str("");
112 stream.clear();
113 stream << savedString[3].toStdString();
114 stream >> materialInfo.ambient_color;
115 stream.str("");
116 stream.clear();
117 stream << savedString[4].toStdString();
118 stream >> materialInfo.diffuse_color;
119 stream.str("");
120 stream.clear();
121 stream << savedString[5].toStdString();
122 stream >> materialInfo.specular_color;
123 stream.str("");
124 stream.clear();
125 stream << savedString[6].toStdString();
126 stream >> materialInfo.shininess;
127 stream.str("");
128 stream.clear();
129 stream << savedString[7].toStdString();
130 stream >> materialInfo.reflectance;
131 stream.str("");
132 stream.clear();
133 stream << savedString[8].toStdString();
134 stream >> materialInfo.key;
135
136 if (materialInfo.key != Qt::Key_unknown)
137 shortKeyRow_[materialInfo.key] = materialListWidget_->count();
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 unsigned int 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 materialListWidget_->setCurrentItem( materialListWidget_->item(materialListWidget_->count() - 1) );
307
308 materialList_.push_back(materialInfo);
309
310 //save material
311 QString matStr = materialString(materialInfo,name);
312 materialStrings_.push_back(matStr);
313 OpenFlipperSettings().setValue(propName_, materialStrings_);
314
315 fillMaterialButton_->setEnabled(true);
316 OpenFlipperSettings().setValue(propName_, materialStrings_);
317 }
318
319 // apply material from current item in list widget to picked object
320 } else if ( fillMaterial_ && !pickMaterial_ ){
321 MaterialNode* material = object->materialNode();
322
323 if (material) {
324
325 if (materialListWidget_->count() > 0)
326 {
327 int row = materialListWidget_->currentRow();
328 material->colorMaterial(materialList_[row].color_material);
329 material->set_base_color(materialList_[row].base_color);
330 material->set_ambient_color(materialList_[row].ambient_color);
331 material->set_diffuse_color(materialList_[row].diffuse_color);
332 material->set_specular_color(materialList_[row].specular_color);
333 material->set_shininess(materialList_[row].shininess);
334 material->set_reflectance(materialList_[row].reflectance);
335 }
336
337 }
338 }
339 }
340 }
341 }
342 }
343
344 //------------------------------------------------------------------------------
345
346 void MaterialPicker::editModeCurrent()
347 {
348 editMode(materialListWidget_->currentItem());
349 }
350
351 //------------------------------------------------------------------------------
352 void MaterialPicker::editMode(QListWidgetItem* _item) {
353 _item->setFlags(_item->flags() | Qt::ItemIsEditable);
354 materialListWidget_->editItem(_item);
355 _item->setText( plainName(_item->text(),materialListWidget_->row(_item)));
356 }
357
358 //------------------------------------------------------------------------------
359 void MaterialPicker::saveNewName ( QWidget * _editor, QAbstractItemDelegate::EndEditHint _hint )
360 {
361 saveNewName(materialListWidget_->currentItem());
362 }
363 //------------------------------------------------------------------------------
364 QString MaterialPicker::plainName(const QString &string, int index)
365 {
366 if (materialList_[index].key == Qt::Key_unknown)
367 return string;
368
369 QString str(string);
370 return str.remove(0,4);
371 }
372 //------------------------------------------------------------------------------
373 void MaterialPicker::saveNewName (QListWidgetItem* _item)
374 {
375 unsigned index = materialListWidget_->row(_item);
376 QString str = materialStrings_[index];
377 QStringList strList = str.split(";");
378
379 //pass name
380 strList[0] = _item->text();
381 //highlight hotkey support
382 if (materialList_[index].key != Qt::Key_unknown)
383 _item->setText( itemName(strList[0], materialList_[index].key) );
384
385
386 //create new String to save
387 str = "";
388 for (int i = 0; i < strList.size()-1; ++i)
389 str += strList[i] + ";";
390 str += strList[strList.size()-1];
391 materialStrings_[index] = str;
392 OpenFlipperSettings().setValue(propName_, materialStrings_);
393 }
394 //------------------------------------------------------------------------------
395
396 QString MaterialPicker::itemName(const QString &_name, int _key)
397 {
398 if (_key == Qt::Key_unknown)
399 return _name;
400 return QString(tr("(%1) ")).arg(QString::number(_key-Qt::Key_1+1)) +_name;
401 }
402
403 //------------------------------------------------------------------------------
404
405 void MaterialPicker::slotPickModeChanged(const std::string& _mode) {
406 pickMaterialButton_->setChecked( _mode == pickModeName_ && pickMaterial_ );
407 fillMaterialButton_->setChecked( _mode == pickModeName_ && fillMaterial_ );
408 }
409
410 //------------------------------------------------------------------------------
411 void MaterialPicker::slotKeyEvent(QKeyEvent* _event)
412 {
413 for (unsigned i = 0; i < supportedKeys_; ++i)
414 {
415 int key = Qt::Key_1+i;
416 if (_event->key() == key && _event->modifiers() == Qt::ControlModifier)
417 {
418 if (shortKeyRow_.find(key) == shortKeyRow_.end())
419 return;
420 slotFillMaterialMode();
421 materialListWidget_->setCurrentRow((int)shortKeyRow_[key]);
422 }
423 }
424 }
425 //------------------------------------------------------------------------------
426 void MaterialPicker::changeHotKey(const int _key)
427 {
428 std::map<int,size_t>::iterator iter = shortKeyRow_.find(_key);
429
430 if (iter != shortKeyRow_.end())
431 {
432 //remove old key
433 int oldIndex = (int)iter->second;
434 QListWidgetItem* oldItem = materialListWidget_->item(oldIndex);
435 //remove name
436 oldItem->setText( plainName(oldItem->text(),oldIndex) );
437 materialList_[oldIndex].key = Qt::Key_unknown; //unregister key after rename, otherwise the renaming will fail
438 materialStrings_[oldIndex] = materialString(materialList_[oldIndex],oldItem->text());
439 saveNewName(oldItem);
440 }
441
442 //set the new item (save and hint)
443 int newIndex = materialListWidget_->currentRow();
444 QListWidgetItem* newItem = materialListWidget_->item(newIndex);
445 materialList_[newIndex].key = _key;
446
447 materialStrings_[newIndex] = materialString(materialList_[newIndex],newItem->text());
448 saveNewName(newItem);
449
450 shortKeyRow_[_key] = newIndex;
451 }
452 //------------------------------------------------------------------------------
453 QString MaterialPicker::materialString(const MaterialInfo& _mat, const QString &_name)
454 {
455 std::stringstream stream;
456 stream << _name.toStdString();
457 stream << ";" << _mat.color_material;
458 stream << ";" << _mat.base_color;
459 stream << ";" << _mat.ambient_color;
460 stream << ";" << _mat.diffuse_color;
461 stream << ";" << _mat.specular_color;
462 stream << ";" << _mat.shininess;
463 stream << ";" << _mat.reflectance;
464 stream << ";" << _mat.key;
465
466 return QString(stream.str().c_str());
467 }
468 //------------------------------------------------------------------------------
469 void MaterialPicker::slotMaterialProperties()
470 {
471 if (materialNode_)
472 return;
473
474 //QListWidgetItem* item = materialListWidget_->currentItem();
475 materialListWidget_->setDisabled(true);
476
477 materialNode_.reset(new MaterialNode());
478 int row = materialListWidget_->currentRow();
479 materialNode_->colorMaterial(materialList_[row].color_material);
480 materialNode_->set_base_color(materialList_[row].base_color);
481 materialNode_->set_ambient_color(materialList_[row].ambient_color);
482 materialNode_->set_diffuse_color(materialList_[row].diffuse_color);
483 materialNode_->set_specular_color(materialList_[row].specular_color);
484 materialNode_->set_shininess(materialList_[row].shininess);
485 materialNode_->set_reflectance(materialList_[row].reflectance);
486
487 ACG::QtWidgets::QtMaterialDialog* dialog = new ACG::QtWidgets::QtMaterialDialog( 0, materialNode_.get() );
488
489 dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);
490
491 connect(dialog,SIGNAL(finished(int)),this,SLOT(slotEnableListWidget(int)));
492 connect(dialog,SIGNAL(accepted()),this,SLOT(slotMaterialChanged()));
493
494 dialog->setWindowIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png"));
495
496 dialog->show();
497
498 }
499 //------------------------------------------------------------------------------
500 void MaterialPicker::slotMaterialChanged()
501 {
502 if (materialNode_)
503 {
504 int index = materialListWidget_->currentRow();
505 // store the material information
506 MaterialInfo materialInfo;
507 materialInfo.color_material = materialNode_->colorMaterial();
508 materialInfo.base_color = materialNode_->base_color();
509 materialInfo.ambient_color = materialNode_->ambient_color();
510 materialInfo.diffuse_color = materialNode_->diffuse_color();
511 materialInfo.specular_color = materialNode_->specular_color();
512 materialInfo.shininess = materialNode_->shininess();
513 materialInfo.reflectance = materialNode_->reflectance();
514 materialInfo.key = materialList_[index].key;
515 QString name = plainName(materialListWidget_->currentItem()->text(),materialListWidget_->currentRow());
516 materialStrings_[index] = materialString(materialInfo,name);
517 materialList_[index] = materialInfo;
518 OpenFlipperSettings().setValue(propName_, materialStrings_);
519 }
520 OpenFlipperSettings().setValue(propName_, materialStrings_);
521 }
522
523 //------------------------------------------------------------------------------
524 void MaterialPicker::slotEnableListWidget(int _save){
525 materialListWidget_->setEnabled(true);
526 if (_save == QDialog::Accepted)
527 slotMaterialChanged();
528 materialNode_.reset();
529 }
530
531 //------------------------------------------------------------------------------
532 void MaterialPicker::createContextMenu(const QPoint& _point)
533 {
534 QMenu *menu = new QMenu(materialListWidget_);
535
536 QAction* action = menu->addAction(tr("Material Properties"));
537 QIcon icon;
538 icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
539 action->setIcon(icon);
540 action->setEnabled(true);
541 connect(action,SIGNAL(triggered(bool)),this,SLOT(slotMaterialProperties()));
542
543 action = menu->addAction(tr("Rename"));
544 connect(action,SIGNAL(triggered(bool)),this,SLOT(editModeCurrent()));
545
546 action = menu->addAction(tr("Remove"));
547 connect(action, SIGNAL(triggered(bool)),this,SLOT(slotRemoveCurrentItem()));
548
549 menu->addSeparator();
550
551 //add hotkey selectors
552 QSignalMapper* signalMapper = new QSignalMapper(menu);
553 for (unsigned i = 0; i < supportedKeys_; ++i)
554 {
555 QAction* action = menu->addAction(tr("Key %1").arg(i+1));
556 connect(action,SIGNAL(triggered(bool)),signalMapper,SLOT(map()));
557 signalMapper->setMapping(action,Qt::Key_1+i);
558 std::map<int,size_t>::iterator iter = shortKeyRow_.find(Qt::Key_1+i);
559
560 //Disable already selected hotkey number
561 if (iter != shortKeyRow_.end() && iter->second == static_cast<size_t>(materialListWidget_->currentRow()))
562 action->setDisabled(true);
563 }
564
565 connect(signalMapper, SIGNAL(mapped(const int &)),this, SLOT(changeHotKey(const int &)));
566 menu->exec(materialListWidget_->mapToGlobal(_point),0);
567
568
569 }
570
571 #if QT_VERSION < 0x050000
572 Q_EXPORT_PLUGIN2( materialPicker , MaterialPicker );
573 #endif
574
OpenFlipperSettings
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Definition: GlobalOptions.cc:938
ACG::SceneGraph::MaterialNode::diffuse_color
const Vec4f & diffuse_color() const
get the diffuse color.
Definition: MaterialNode.hh:416
MaterialPicker::editMode
void editMode(QListWidgetItem *_item)
items can be renamed by double clicking them
Definition: MaterialPicker.cc:352
MaterialPicker::materialString
QString materialString(const MaterialInfo &_mat, const QString &_name)
returns a formatted string for saving
Definition: MaterialPicker.cc:453
MaterialPicker::MaterialInfo
Definition: MaterialPicker.hh:106
BaseObjectData
Definition: BaseObjectData.hh:105
ACG::SceneGraph::PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
Definition: BaseNode.hh:110
MaterialPicker::plainName
QString plainName(const QString &string, int index)
returns the plain name of the material without hotkey hint
Definition: MaterialPicker.cc:364
ACG::SceneGraph::MaterialNode::base_color
const Vec4f & base_color() const
get the base color
Definition: MaterialNode.hh:406
ACG::QtWidgets::QtMaterialDialog
Definition: QtMaterialDialog.hh:95
MaterialPicker::fillMaterial_
bool fillMaterial_
stores the state of the fill material button
Definition: MaterialPicker.hh:138
ACG::SceneGraph::MaterialNode::set_base_color
void set_base_color(const Vec4f &_c)
set the base color
Definition: MaterialNode.hh:404
MaterialPicker::pickMaterial_
bool pickMaterial_
stores the state of the pick material button
Definition: MaterialPicker.hh:136
PluginFunctions::pickMode
const std::string pickMode()
Get the current Picking mode.
Definition: PluginFunctions.cc:579
MaterialPicker::itemName
QString itemName(const QString &_name, int _key)
returns the item name with hotkey hint
Definition: MaterialPicker.cc:396
ACG::SceneGraph::ACG::SceneGraph::BaseNode::id
unsigned int id() const
Definition: MeshNode2T.cc:399
OpenMesh::VectorT
Definition: Vector11T.hh:83
ACG::SceneGraph::MaterialNode::set_specular_color
void set_specular_color(const Vec4f &_s)
set the specular color
Definition: MaterialNode.hh:419
ACG::SceneGraph::MaterialNode::set_reflectance
void set_reflectance(double _m)
set reflectance
Definition: MaterialNode.hh:443
GlobalOptions.hh
ACG::SceneGraph::MaterialNode::shininess
float shininess() const
get shininess
Definition: MaterialNode.hh:440
ACG::SceneGraph::MaterialNode::specular_color
const Vec4f & specular_color() const
get the specular color
Definition: MaterialNode.hh:421
MaterialPicker::changeHotKey
void changeHotKey(const int _key)
change specified HotKey to current item
Definition: MaterialPicker.cc:426
ACG::SceneGraph::MaterialNode::reflectance
double reflectance() const
get reflectance
Definition: MaterialNode.hh:445
OpenFlipperQSettings::value
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: OpenFlipperQSettings.cc:53
PluginFunctions::scenegraphPick
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
Definition: PluginFunctions.cc:482
ACG::SceneGraph::MaterialNode::set_diffuse_color
void set_diffuse_color(const Vec4f &_d)
set the diffuse color.
Definition: MaterialNode.hh:414
ACG::SceneGraph::MaterialNode::colorMaterial
void colorMaterial(const bool _cm)
Set colorMaterial.
Definition: MaterialNode.hh:429
PluginFunctions.hh
PluginFunctions::actionMode
Viewer::ActionMode actionMode()
Get the current Action mode.
Definition: PluginFunctions.cc:590
OpenFlipperQSettings::setValue
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
Definition: OpenFlipperQSettings.cc:68
MaterialPicker
Definition: MaterialPicker.hh:66
MaterialPicker::saveNewName
void saveNewName(QWidget *_editor, QAbstractItemDelegate::EndEditHint _hint)
saves the new material name with hotkey hint
Definition: MaterialPicker.cc:359
MaterialNode
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
Definition: BaseObjectData.hh:88
ACG::SceneGraph::MaterialNode
Definition: MaterialNode.hh:321
PluginFunctions::getPickedObject
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
Definition: PluginFunctions.cc:263
ACG::SceneGraph::MaterialNode::set_shininess
void set_shininess(float _s)
set shininess
Definition: MaterialNode.hh:438
MaterialPicker::name
QString name()
Return a name for the plugin.
Definition: MaterialPicker.hh:101
MaterialPicker::createContextMenu
void createContextMenu(const QPoint &_point)
creates context menu on current item (current is the item at mouse position)
Definition: MaterialPicker.cc:532
ACG::SceneGraph::MaterialNode::set_ambient_color
void set_ambient_color(const Vec4f &_a)
set the ambient color.
Definition: MaterialNode.hh:409
ACG::SceneGraph::MaterialNode::ambient_color
const Vec4f & ambient_color() const
get the ambient color.
Definition: MaterialNode.hh:411