Commit 4eaf0357 authored by Jan Möbius's avatar Jan Möbius
Browse files

New Scripts for view control plugin

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4944 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 41df7374
......@@ -198,24 +198,9 @@ void ViewControlPlugin::contextMenuTriggered(QAction* _action){
if ( objectId == -1)
return;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(objectId,object) )
return;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
triMeshObject->hideSelection( triMeshObject->selectionVisible() );
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
polyMeshObject->hideSelection( polyMeshObject->selectionVisible() );
}
showSelection( objectId , !selectionVisible( objectId) );
emit updateView();
}
if ( _action->text() == SHOW_AREAS) {
......@@ -226,24 +211,9 @@ void ViewControlPlugin::contextMenuTriggered(QAction* _action){
if ( objectId == -1)
return;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(objectId,object) )
return;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
triMeshObject->hideAreas( triMeshObject->areasVisible() );
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
polyMeshObject->hideAreas( polyMeshObject->areasVisible() );
}
showModelingAreas( objectId, !modelingAreasVisible(objectId) );
emit updateView();
}
if ( _action->text() == SHOW_FEATURES) {
......@@ -298,6 +268,101 @@ void ViewControlPlugin::contextMenuTriggered(QAction* _action){
}
bool ViewControlPlugin::selectionVisible( int _id ) {
if ( _id == -1)
return false;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(_id,object) )
return false;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
return triMeshObject->selectionVisible();
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
return polyMeshObject->selectionVisible();
}
return false;
}
bool ViewControlPlugin::modelingAreasVisible( int _id ) {
if ( _id == -1)
return false;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(_id,object) )
return false;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
return triMeshObject->areasVisible();
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
return( polyMeshObject->areasVisible() );
}
return false;
}
void ViewControlPlugin::showModelingAreas( int _id , bool _state ) {
if ( _id == -1)
return;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(_id,object) )
return;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
triMeshObject->hideAreas( !_state);
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
polyMeshObject->hideAreas( !_state);
}
}
void ViewControlPlugin::showSelection( int _id , bool _state ) {
if ( _id == -1)
return;
BaseObjectData* object = 0;
if ( ! PluginFunctions::getObject(_id,object) )
return;
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMeshObject* triMeshObject = PluginFunctions::triMeshObject( object );
if ( triMeshObject )
triMeshObject->hideSelection( !_state );
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMeshObject* polyMeshObject = PluginFunctions::polyMeshObject( object );
if ( polyMeshObject )
polyMeshObject->hideSelection( !_state );
}
}
void ViewControlPlugin::slotUpdateContextMenu( int _objectId ){
viewControlMenu_->clear();
......
......@@ -120,6 +120,20 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
// initialize the shader Widget
void initShaderWidget();
public slots:
/// For meshes returns if the selection for this object is visible
bool selectionVisible( int _id );
/// Allows to enable/disable visualization of the objects selection for meshes
void showSelection( int _id , bool _state );
/// For meshes returns if the modeling areas for this object is visible
bool modelingAreasVisible( int _id );
/// Allows to enable/disable visualization of the objects modeling area for meshes
void showModelingAreas( int _id , bool _state );
};
#endif //ViewControlPlugin_HH
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