Commit be4fb622 authored by Mike Kremer's avatar Mike Kremer
Browse files

Allow edge colorizing.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8400 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 119b800e
......@@ -304,6 +304,32 @@ IdList SelectionPlugin::getEdgeSelection( int objectId )
}
//=========================================================
/// colorize the edge selection
void SelectionPlugin::colorizeEdgeSelection(int objectId, int r, int g, int b )
{
BaseObjectData* object;
if ( ! PluginFunctions::getObject(objectId,object) ) {
emit log(LOGERR,"colorizeEdgeSelection : unable to get object" );
return;
}
if ( object->dataType() == DATA_TRIANGLE_MESH )
colorizeSelection(PluginFunctions::triMesh(object), EDGE, r, g, b);
else if ( object->dataType() == DATA_POLY_MESH )
colorizeSelection(PluginFunctions::polyMesh(object), EDGE, r, g, b);
else {
emit log(LOGERR,"colorizeEdgeSelection : Unsupported object Type" );
return;
}
emit scriptInfo( "colorizeEdgeSelection( ObjectId, "
+ QString::number(r) + ", " + QString::number(g) + ", " + QString::number(b) + " )" );
emit updatedObject(objectId);
}
......@@ -165,11 +165,6 @@ void SelectionPlugin::selectBoundary( int objectID ){
void SelectionPlugin::colorizeSelection( int objectID ){
if (selectionType_ & EDGE){
emit log(LOGERR, "Edge coloring not supported.");
return;
}
QColor color = QColorDialog::getColor();
if ( color.isValid() ){
......@@ -179,5 +174,8 @@ void SelectionPlugin::colorizeSelection( int objectID ){
if (selectionType_ & FACE)
colorizeFaceSelection( objectID, color.red(), color.green(), color.blue() );
if (selectionType_ & EDGE)
colorizeEdgeSelection( objectID, color.red(), color.green(), color.blue() );
}
}
......@@ -511,6 +511,9 @@ class SelectionPlugin : public QObject, BaseInterface , MouseInterface, KeyInter
/// return a list of all selected edges
IdList getEdgeSelection( int objectId );
/// colorize the edge selection
void colorizeEdgeSelection(int objectId, int r, int g, int b );
//==========================================
......
......@@ -406,6 +406,18 @@ void SelectionPlugin::colorizeSelection(MeshT* _mesh, SelectionPrimitive _type,
if ( _mesh->status(f_it).selected() )
_mesh->set_color(f_it, color);
}
if (_type & EDGE){
typename MeshT::EdgeIter e_it, e_end( _mesh->edges_end() );
// Request edge color attribute
if( !_mesh->has_edge_colors() )
_mesh->request_edge_colors();
for (e_it=_mesh->edges_begin(); e_it!=e_end; ++e_it)
if ( _mesh->status(e_it).selected() )
_mesh->set_color(e_it, color);
}
}
Supports Markdown
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