Commit 7e543184 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'all_target' into 'master'

Introduce option to always set a newly created object (via addEmpty) to be target for most types

I couldn't find a reason for this not to make sense as the default setting.

See merge request !125
parents efd6e2ac 59fec4ec
Pipeline #2299 passed with stage
in 81 minutes and 16 seconds
......@@ -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));
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>699</width>
<width>702</width>
<height>700</height>
</rect>
</property>
......@@ -36,8 +36,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>662</width>
<height>862</height>
<width>721</width>
<height>957</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -50,7 +50,7 @@
<string/>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -412,6 +412,35 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_15">
<property name="title">
<string>General Object Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_26">
<item>
<widget class="QCheckBox" name="allTarget">
<property name="toolTip">
<string>The add empty object functions will set all new objects to be target by default</string>
</property>
<property name="statusTip">
<string>The add empty object functions will set all new objects to be target by default</string>
</property>
<property name="whatsThis">
<string>The add empty object functions will set all new objects to be target by default</string>
</property>
<property name="text">
<string>Set all newly added objects to target</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
......
......@@ -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";
......
......@@ -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";
......
......@@ -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() ));
......
......@@ -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,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() ));
......
......@@ -49,6 +49,7 @@
#include "TypeHexahedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
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() ));
......
......@@ -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,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() ));
......
......@@ -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,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
......
......@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh>
#include "PolyMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//-----------------------------------------------------------------------------
......@@ -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() ));
......
......@@ -49,6 +49,7 @@
#include "TypePolyhedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
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() ));
......
......@@ -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,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() ));
......
......@@ -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() ));
......
......@@ -60,9 +60,11 @@
#include "TypeSplatCloud.hh"
#include <OpenFlipper/common/BackupData.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#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() ));
......
......@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh>
#include "TriMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//-----------------------------------------------------------------------------
......@@ -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() ));
......
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