Commit 7449843f authored by Jan Möbius's avatar Jan Möbius

Moved basecolor setting from openFunctions to baseobjectdata as the default...

Moved basecolor setting from openFunctions to baseobjectdata as the default should not override loaded settings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10146 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b9c7612a
......@@ -485,35 +485,6 @@ void Core::slotObjectOpened ( int _id ) {
BaseObjectData* object;
PluginFunctions::getObject(_id,object);
QColor color;
if ( OpenFlipper::Options::randomBaseColor() ){
//init random seed
srand ( time(NULL) );
QColor bckgrnd = OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>();
int diff;
do{
color.setRgb(rand()%255, rand()%255, rand()%255);
diff = (bckgrnd.red() - color.red()) *(bckgrnd.red() - color.red())
+(bckgrnd.green() - color.green())*(bckgrnd.green() - color.green())
+(bckgrnd.blue() - color.blue()) *(bckgrnd.blue() - color.blue());
}while (diff < 70000);
}
else{
color = OpenFlipper::Options::defaultBaseColor();
}
ACG::Vec4f colorV;
colorV[0] = color.redF();
colorV[1] = color.greenF();
colorV[2] = color.blueF();
colorV[3] = color.alphaF();
object->setBaseColor( colorV );
// ================================================================================
// Set defaults for DrawMode, ViewingDirection and Projection if this is the first opened object
// If a plugin changes the drawmode later, this setting will be overridden!
......
......@@ -54,6 +54,7 @@
#include "Types.hh"
#include <ACG/Scenegraph/SceneGraph.hh>
#include <OpenFlipper/common/BaseObjectCore.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <QDir>
......@@ -145,8 +146,40 @@ void BaseObjectData::init() {
stencilRefNode_ = new StencilRefNode(boundingBoxNode(), "New Stencil Reference");
stencilRefNode_->set_status( ACG::SceneGraph::BaseNode::HideNode );
}
if ( materialNode_ == 0 )
if ( materialNode_ == 0 ) {
materialNode_ = new MaterialNode(stencilRefNode(), "New Material");
QColor color;
if ( OpenFlipper::Options::randomBaseColor() ){
//init random seed
srand ( time(NULL) );
QColor bckgrnd = OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>();
int diff;
do{
color.setRgb(rand()%255, rand()%255, rand()%255);
diff = (bckgrnd.red() - color.red()) *(bckgrnd.red() - color.red())
+(bckgrnd.green() - color.green())*(bckgrnd.green() - color.green())
+(bckgrnd.blue() - color.blue()) *(bckgrnd.blue() - color.blue());
} while (diff < 70000);
}
else{
color = OpenFlipper::Options::defaultBaseColor();
}
ACG::Vec4f colorV;
colorV[0] = color.redF();
colorV[1] = color.greenF();
colorV[2] = color.blueF();
colorV[3] = color.alphaF();
materialNode_->set_base_color(colorV);
materialNode_->set_color(colorV);
}
}
......@@ -279,11 +312,6 @@ StencilRefNode* BaseObjectData::stencilRefNode() {
return stencilRefNode_;
}
void BaseObjectData::setBaseColor(ACG::Vec4f _color) {
materialNode_->set_base_color(_color);
}
bool BaseObjectData::manipPlaced() {
return manipPlaced_;
}
......
......@@ -220,9 +220,6 @@ class DLLEXPORT BaseObjectData : public BaseObject
/// get a pointer to the stencil reference node
StencilRefNode* stencilRefNode();
/// Set the color of the object
void setBaseColor(ACG::Vec4f _color);
/// Check if the manipulator has been placed
bool manipPlaced();
......
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