diff --git a/OpenFlipper/widgets/optionsWidget/optionsWidget.cc b/OpenFlipper/widgets/optionsWidget/optionsWidget.cc index a89b8a7510e3ff0d1877a1dbf48b69405e17e6d7..5ac32fd1413ac5fc280c9be03196c8ccc4f9ffd3 100644 --- a/OpenFlipper/widgets/optionsWidget/optionsWidget.cc +++ b/OpenFlipper/widgets/optionsWidget/optionsWidget.cc @@ -273,6 +273,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { maxRecentBox->setValue( OpenFlipperSettings().value("Core/File/MaxRecent",15).toInt() ); rbReloadShaders->setChecked(OpenFlipperSettings().value("Core/File/ReloadShaders",false).toBool()) ; leShaderOutputDir->setText(OpenFlipperSettings().value("Core/File/ShaderOutputDir","").toString()); + allTarget->setChecked( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ); + // UI settings toolBoxOrientation->setCurrentIndex((OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight",true).toBool() ? 0 : 1)); @@ -584,6 +586,8 @@ void OptionsWidget::slotApply() { OpenFlipperSettings().setValue("Core/File/ShaderOutputDir",leShaderOutputDir->text() ) ; ACG::ShaderCache::getInstance()->setDebugOutputDir(leShaderOutputDir->text().toUtf8()); + OpenFlipperSettings().setValue("Core/File/AllTarget",allTarget->isChecked()); + // Toolbox orientation OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/ToolBoxOnTheRight", (toolBoxOrientation->currentIndex() == 0)); diff --git a/OpenFlipper/widgets/optionsWidget/optionsWidget.ui b/OpenFlipper/widgets/optionsWidget/optionsWidget.ui index b6278e7e4bd2c12ad1d3af0edcf0d71eef9a1988..0028d16bfb36944e6a5230466dad5c56cba270a6 100644 --- a/OpenFlipper/widgets/optionsWidget/optionsWidget.ui +++ b/OpenFlipper/widgets/optionsWidget/optionsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 699 + 702 700 @@ -36,8 +36,8 @@ 0 0 - 662 - 862 + 721 + 957 @@ -50,7 +50,7 @@ - 1 + 0 true @@ -412,6 +412,35 @@ + + + + General Object Options + + + + + + + + The add empty object functions will set all new objects to be target by default + + + The add empty object functions will set all new objects to be target by default + + + The add empty object functions will set all new objects to be target by default + + + Set all newly added objects to target + + + + + + + + diff --git a/PluginCollection-TypePlugins/Plugin-TypeBSplineCurve/TypeBSplineCurve.cc b/PluginCollection-TypePlugins/Plugin-TypeBSplineCurve/TypeBSplineCurve.cc index ac2e067398edd50d12afa7c452567321ea5b2ab7..b4d8d83068d93e553b724fb9b554cfdc43e2d372 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeBSplineCurve/TypeBSplineCurve.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeBSplineCurve/TypeBSplineCurve.cc @@ -274,11 +274,19 @@ addEmpty() // new object data struct BSplineCurveObject * object = new BSplineCurveObject(); - if ( PluginFunctions::objectCount() == 1 ) - object->target(true); - if (PluginFunctions::targetCount() == 0 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { + + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = "BSplineCurve_" + QString::number( object->id() ) + ".bsc"; diff --git a/PluginCollection-TypePlugins/Plugin-TypeBSplineSurface/TypeBSplineSurface.cc b/PluginCollection-TypePlugins/Plugin-TypeBSplineSurface/TypeBSplineSurface.cc index a8f4a4868b4db373e629b7370cd0240f10390cb4..a56b97df4e7b453e810d8d6787ff0d26d611bafe 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeBSplineSurface/TypeBSplineSurface.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeBSplineSurface/TypeBSplineSurface.cc @@ -272,11 +272,18 @@ addEmpty() // new object data struct BSplineSurfaceObject * object = new BSplineSurfaceObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = "BSplineSurface_" + QString::number( object->id() ) + ".bss"; diff --git a/PluginCollection-TypePlugins/Plugin-TypeCamera/TypeCamera.cc b/PluginCollection-TypePlugins/Plugin-TypeCamera/TypeCamera.cc index cf3c5c217001ea85677c64d79a2901d6fe81dd47..c016464df9708b0e818db1c9ca78b6fcbd62038c 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeCamera/TypeCamera.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeCamera/TypeCamera.cc @@ -116,9 +116,17 @@ int TypeCameraPlugin::addEmpty() { // new object data struct CameraObject* object = new CameraObject (); - if ( PluginFunctions::objectCount() == 1 || - PluginFunctions::targetCount() == 0) { - object->target ( true ); + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) + object->target(true); + else { + + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); } QString name = QString(tr("New Camera %1.cam").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeCoordsys/TypeCoordsys.cc b/PluginCollection-TypePlugins/Plugin-TypeCoordsys/TypeCoordsys.cc index fcb362115783a53f3efc923b3a9ce3136f6b60ae..8314064d91092e0c46fa7735641bf5fd12f6c713 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeCoordsys/TypeCoordsys.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeCoordsys/TypeCoordsys.cc @@ -48,7 +48,8 @@ \*===========================================================================*/ #include "TypeCoordsys.hh" -#include "OpenFlipper/BasePlugin/PluginFunctions.hh" +#include +#include TypeCoordsysPlugin::TypeCoordsysPlugin() { @@ -65,11 +66,18 @@ int TypeCoordsysPlugin::addEmpty(){ // new object data struct CoordsysObject * object = new CoordsysObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Coordinate System %1.cos").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeHexahedralMesh/TypeHexahedralMesh.cc b/PluginCollection-TypePlugins/Plugin-TypeHexahedralMesh/TypeHexahedralMesh.cc index 53f541a20e68939678dd3c350a8e47697d33e2b1..51daa74f29f064c887b36830e6b8dd756c445ec8 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeHexahedralMesh/TypeHexahedralMesh.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeHexahedralMesh/TypeHexahedralMesh.cc @@ -49,6 +49,7 @@ #include "TypeHexahedralMesh.hh" #include +#include TypeHexahedralMeshPlugin::TypeHexahedralMeshPlugin() : render_switch_(0), @@ -103,11 +104,18 @@ int TypeHexahedralMeshPlugin::addEmpty() { // New object data struct HexahedralMeshObject* object = new HexahedralMeshObject(DATA_HEXAHEDRAL_MESH); - if (PluginFunctions::objectCount() == 1) - object->target(true); + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) + object->target(true); + else { - if (PluginFunctions::targetCount() == 0) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Hexahedral Mesh %1.ovm").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypePlane/TypePlane.cc b/PluginCollection-TypePlugins/Plugin-TypePlane/TypePlane.cc index a2202fd3a772b925e7fbad02c619e21cb43e607a..29e43adc7daae9aa4b04ee25a5e226b2943322f4 100644 --- a/PluginCollection-TypePlugins/Plugin-TypePlane/TypePlane.cc +++ b/PluginCollection-TypePlugins/Plugin-TypePlane/TypePlane.cc @@ -50,8 +50,7 @@ #include "TypePlane.hh" -#include "OpenFlipper/BasePlugin/PluginFunctions.hh" - +#include #include TypePlanePlugin::TypePlanePlugin() { @@ -69,11 +68,18 @@ int TypePlanePlugin::addEmpty(){ // new object data struct PlaneObject * object = new PlaneObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Plane %1.pla").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypePolyLine/TypePolyLine.cc b/PluginCollection-TypePlugins/Plugin-TypePolyLine/TypePolyLine.cc index f5c99e291e56ecccde59740df4ac4b43f65396d6..109f5f917ced47ee4492d6c4edd42b26e009fc6c 100644 --- a/PluginCollection-TypePlugins/Plugin-TypePolyLine/TypePolyLine.cc +++ b/PluginCollection-TypePlugins/Plugin-TypePolyLine/TypePolyLine.cc @@ -50,7 +50,8 @@ #include "TypePolyLine.hh" -#include "OpenFlipper/BasePlugin/PluginFunctions.hh" +#include +#include TypePolyLinePlugin::TypePolyLinePlugin() { @@ -67,12 +68,19 @@ int TypePolyLinePlugin::addEmpty(){ // new object data struct PolyLineObject * object = new PolyLineObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { + + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } - if (PluginFunctions::targetCount() == 0 ) - object->target(true); - QString name = tr("New PolyLine %1.pol").arg( object->id() ); // call the local function to update names diff --git a/PluginCollection-TypePlugins/Plugin-TypePolyMesh/TypePolyMesh.cc b/PluginCollection-TypePlugins/Plugin-TypePolyMesh/TypePolyMesh.cc index 046aab1eb5df7649340cd6da48cbb91b18f34dc1..4ef1f71706aaa3a1d5751096b2aeba624b1e7521 100644 --- a/PluginCollection-TypePlugins/Plugin-TypePolyMesh/TypePolyMesh.cc +++ b/PluginCollection-TypePlugins/Plugin-TypePolyMesh/TypePolyMesh.cc @@ -52,6 +52,7 @@ #include #include "PolyMeshBackup.hh" +#include //----------------------------------------------------------------------------- @@ -75,11 +76,18 @@ int TypePolyMeshPlugin::addEmpty(){ // new object data struct PolyMeshObject * object = new PolyMeshObject( typeId("PolyMesh") ); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New PolyMesh %1.off").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypePolyhedralMesh/TypePolyhedralMesh.cc b/PluginCollection-TypePlugins/Plugin-TypePolyhedralMesh/TypePolyhedralMesh.cc index 9e8c4a6d0a0ac40fae9e0bc4b28edbdf01dde4da..04a2d3205c9b9d18250b15cb5644bf6fee249e51 100644 --- a/PluginCollection-TypePlugins/Plugin-TypePolyhedralMesh/TypePolyhedralMesh.cc +++ b/PluginCollection-TypePlugins/Plugin-TypePolyhedralMesh/TypePolyhedralMesh.cc @@ -49,6 +49,7 @@ #include "TypePolyhedralMesh.hh" #include +#include TypePolyhedralMeshPlugin::TypePolyhedralMeshPlugin() : render_switch_(NULL), @@ -111,11 +112,18 @@ int TypePolyhedralMeshPlugin::addEmpty() { // new object data struct PolyhedralMeshObject* object = new PolyhedralMeshObject(DATA_POLYHEDRAL_MESH); - if (PluginFunctions::objectCount() == 1) - object->target(true); + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) + object->target(true); + else { - if (PluginFunctions::targetCount() == 0) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New PolyHedral Mesh %1.ovm").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeSkeleton/TypeSkeleton.cc b/PluginCollection-TypePlugins/Plugin-TypeSkeleton/TypeSkeleton.cc index 736c4580f1830406d9ca68db6dde0991bfc519ed..3091e919a0640f39ef22ba0d19677de559d63f39 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeSkeleton/TypeSkeleton.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeSkeleton/TypeSkeleton.cc @@ -52,6 +52,7 @@ #include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include +#include #include "SkeletonBackup.hh" TypeSkeletonPlugin::TypeSkeletonPlugin() @@ -193,11 +194,18 @@ int TypeSkeletonPlugin::addEmpty(){ // new object data struct SkeletonObject * object = new SkeletonObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Skeleton %1.skl").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeSphere/TypeSphere.cc b/PluginCollection-TypePlugins/Plugin-TypeSphere/TypeSphere.cc index 7fb0f6c741fe80149feddcec76f37342243f5179..a137ad32da356e0d0c5596615e0404240391cd86 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeSphere/TypeSphere.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeSphere/TypeSphere.cc @@ -70,11 +70,18 @@ int TypeSpherePlugin::addEmpty(){ // new object data struct SphereObject * object = new SphereObject(); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Sphere %1.sph").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeSplatCloud/TypeSplatCloud.cc b/PluginCollection-TypePlugins/Plugin-TypeSplatCloud/TypeSplatCloud.cc index f22bf60c1f062ebb40b287b83628ab3d64629ac1..ce93f07dd726b4baa6ed25f7016f541017b03c51 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeSplatCloud/TypeSplatCloud.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeSplatCloud/TypeSplatCloud.cc @@ -60,9 +60,11 @@ #include "TypeSplatCloud.hh" #include +#include #include "SplatCloudBackup.hh" + //== CONSTANTS =================================================== @@ -296,11 +298,18 @@ int TypeSplatCloudPlugin::addEmpty() if( object == 0 ) return -1; - if( PluginFunctions::objectCount() == 1 ) - object->target( true ); + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) + object->target(true); + else { + + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); - if( PluginFunctions::targetCount() == 0 ) - object->target( true ); + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("New Splat Cloud %1.spl").arg( object->id() )); diff --git a/PluginCollection-TypePlugins/Plugin-TypeTriangleMesh/TypeTriangleMesh.cc b/PluginCollection-TypePlugins/Plugin-TypeTriangleMesh/TypeTriangleMesh.cc index 16804f21ff8eefd01be048d2f0fced71471d62d8..8b3eda013ca1213bc2b12c412ee276a82f5f5aea 100644 --- a/PluginCollection-TypePlugins/Plugin-TypeTriangleMesh/TypeTriangleMesh.cc +++ b/PluginCollection-TypePlugins/Plugin-TypeTriangleMesh/TypeTriangleMesh.cc @@ -52,6 +52,7 @@ #include #include "TriMeshBackup.hh" +#include //----------------------------------------------------------------------------- @@ -74,11 +75,18 @@ int TypeTriangleMeshPlugin::addEmpty(){ // new object data struct TriMeshObject * object = new TriMeshObject( typeId("TriangleMesh") ); - if ( PluginFunctions::objectCount() == 1 ) + if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() ) object->target(true); + else { - if (PluginFunctions::targetCount() == 0 ) - object->target(true); + // Only the first object in the scene will be target + if ( PluginFunctions::objectCount() == 1 ) + object->target(true); + + // If no target is available, we set the new object as target + if (PluginFunctions::targetCount() == 0 ) + object->target(true); + } QString name = QString(tr("TriangleMesh new %1.off").arg( object->id() ));