Commit 59fec4ec authored by Jan Möbius's avatar Jan Möbius

Use option if objects should be target by default

parent 8053095b
Pipeline #2291 passed with stage
in 80 minutes and 4 seconds
......@@ -274,7 +274,19 @@ addEmpty()
// new object data struct
BSplineCurveObject * object = new BSplineCurveObject();
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 = "BSplineCurve_" + QString::number( object->id() ) + ".bsc";
......
......@@ -272,7 +272,18 @@ addEmpty()
// new object data struct
BSplineSurfaceObject * object = new BSplineSurfaceObject();
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 = "BSplineSurface_" + QString::number( object->id() ) + ".bss";
......
......@@ -116,7 +116,18 @@ int TypeCameraPlugin::addEmpty() {
// new object data struct
CameraObject* object = new CameraObject ();
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() ));
......
......@@ -48,7 +48,8 @@
\*===========================================================================*/
#include "TypeCoordsys.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypeCoordsysPlugin::TypeCoordsysPlugin() {
......@@ -65,7 +66,18 @@ int TypeCoordsysPlugin::addEmpty(){
// new object data struct
CoordsysObject * object = new CoordsysObject();
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 Coordinate System %1.cos").arg( object->id() ));
......
......@@ -49,6 +49,7 @@
#include "TypeHexahedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypeHexahedralMeshPlugin::TypeHexahedralMeshPlugin() :
render_switch_(0),
......@@ -103,7 +104,18 @@ int TypeHexahedralMeshPlugin::addEmpty() {
// New object data struct
HexahedralMeshObject* object = new HexahedralMeshObject(DATA_HEXAHEDRAL_MESH);
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 Hexahedral Mesh %1.ovm").arg( object->id() ));
......
......@@ -50,8 +50,7 @@
#include "TypePlane.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypePlanePlugin::TypePlanePlugin() {
......@@ -69,7 +68,18 @@ int TypePlanePlugin::addEmpty(){
// new object data struct
PlaneObject * object = new PlaneObject();
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 Plane %1.pla").arg( object->id() ));
......
......@@ -50,7 +50,8 @@
#include "TypePolyLine.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypePolyLinePlugin::TypePolyLinePlugin() {
......@@ -67,7 +68,18 @@ int TypePolyLinePlugin::addEmpty(){
// new object data struct
PolyLineObject * object = new PolyLineObject();
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 = tr("New PolyLine %1.pol").arg( object->id() );
......
......@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh>
#include "PolyMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//-----------------------------------------------------------------------------
......@@ -75,7 +76,18 @@ int TypePolyMeshPlugin::addEmpty(){
// new object data struct
PolyMeshObject * object = new PolyMeshObject( typeId("PolyMesh") );
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 PolyMesh %1.off").arg( object->id() ));
......
......@@ -49,6 +49,7 @@
#include "TypePolyhedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypePolyhedralMeshPlugin::TypePolyhedralMeshPlugin() :
render_switch_(NULL),
......@@ -111,7 +112,18 @@ int TypePolyhedralMeshPlugin::addEmpty() {
// new object data struct
PolyhedralMeshObject* object = new PolyhedralMeshObject(DATA_POLYHEDRAL_MESH);
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 PolyHedral Mesh %1.ovm").arg( object->id() ));
......
......@@ -52,6 +52,7 @@
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/common/BackupData.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include "SkeletonBackup.hh"
TypeSkeletonPlugin::TypeSkeletonPlugin()
......@@ -193,7 +194,18 @@ int TypeSkeletonPlugin::addEmpty(){
// new object data struct
SkeletonObject * object = new SkeletonObject();
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 Skeleton %1.skl").arg( object->id() ));
......
......@@ -70,7 +70,18 @@ int TypeSpherePlugin::addEmpty(){
// new object data struct
SphereObject * object = new SphereObject();
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 Sphere %1.sph").arg( object->id() ));
......
......@@ -60,9 +60,11 @@
#include "TypeSplatCloud.hh"
#include <OpenFlipper/common/BackupData.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include "SplatCloudBackup.hh"
//== CONSTANTS ===================================================
......@@ -296,7 +298,18 @@ int TypeSplatCloudPlugin::addEmpty()
if( object == 0 )
return -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 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() ));
......
......@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh>
#include "TriMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//-----------------------------------------------------------------------------
......@@ -74,7 +75,18 @@ int TypeTriangleMeshPlugin::addEmpty(){
// new object data struct
TriMeshObject * object = new TriMeshObject( typeId("TriangleMesh") );
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("TriangleMesh new %1.off").arg( object->id() ));
......
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