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*/ ) { ...@@ -273,6 +273,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
maxRecentBox->setValue( OpenFlipperSettings().value("Core/File/MaxRecent",15).toInt() ); maxRecentBox->setValue( OpenFlipperSettings().value("Core/File/MaxRecent",15).toInt() );
rbReloadShaders->setChecked(OpenFlipperSettings().value("Core/File/ReloadShaders",false).toBool()) ; rbReloadShaders->setChecked(OpenFlipperSettings().value("Core/File/ReloadShaders",false).toBool()) ;
leShaderOutputDir->setText(OpenFlipperSettings().value("Core/File/ShaderOutputDir","").toString()); leShaderOutputDir->setText(OpenFlipperSettings().value("Core/File/ShaderOutputDir","").toString());
allTarget->setChecked( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() );
// UI settings // UI settings
toolBoxOrientation->setCurrentIndex((OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight",true).toBool() ? 0 : 1)); toolBoxOrientation->setCurrentIndex((OpenFlipperSettings().value("Core/Gui/ToolBoxes/ToolBoxOnTheRight",true).toBool() ? 0 : 1));
...@@ -584,6 +586,8 @@ void OptionsWidget::slotApply() { ...@@ -584,6 +586,8 @@ void OptionsWidget::slotApply() {
OpenFlipperSettings().setValue("Core/File/ShaderOutputDir",leShaderOutputDir->text() ) ; OpenFlipperSettings().setValue("Core/File/ShaderOutputDir",leShaderOutputDir->text() ) ;
ACG::ShaderCache::getInstance()->setDebugOutputDir(leShaderOutputDir->text().toUtf8()); ACG::ShaderCache::getInstance()->setDebugOutputDir(leShaderOutputDir->text().toUtf8());
OpenFlipperSettings().setValue("Core/File/AllTarget",allTarget->isChecked());
// Toolbox orientation // Toolbox orientation
OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/ToolBoxOnTheRight", (toolBoxOrientation->currentIndex() == 0)); OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/ToolBoxOnTheRight", (toolBoxOrientation->currentIndex() == 0));
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>699</width> <width>702</width>
<height>700</height> <height>700</height>
</rect> </rect>
</property> </property>
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>662</width> <width>721</width>
<height>862</height> <height>957</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<string/> <string/>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<property name="usesScrollButtons"> <property name="usesScrollButtons">
<bool>true</bool> <bool>true</bool>
...@@ -412,6 +412,35 @@ ...@@ -412,6 +412,35 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">
<property name="orientation"> <property name="orientation">
......
...@@ -274,11 +274,19 @@ addEmpty() ...@@ -274,11 +274,19 @@ addEmpty()
// new object data struct // new object data struct
BSplineCurveObject * object = new BSplineCurveObject(); 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); 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"; QString name = "BSplineCurve_" + QString::number( object->id() ) + ".bsc";
......
...@@ -272,11 +272,18 @@ addEmpty() ...@@ -272,11 +272,18 @@ addEmpty()
// new object data struct // new object data struct
BSplineSurfaceObject * object = new BSplineSurfaceObject(); BSplineSurfaceObject * object = new BSplineSurfaceObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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"; QString name = "BSplineSurface_" + QString::number( object->id() ) + ".bss";
......
...@@ -116,9 +116,17 @@ int TypeCameraPlugin::addEmpty() { ...@@ -116,9 +116,17 @@ int TypeCameraPlugin::addEmpty() {
// new object data struct // new object data struct
CameraObject* object = new CameraObject (); CameraObject* object = new CameraObject ();
if ( PluginFunctions::objectCount() == 1 || if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
PluginFunctions::targetCount() == 0) { object->target(true);
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() )); QString name = QString(tr("New Camera %1.cam").arg( object->id() ));
......
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
\*===========================================================================*/ \*===========================================================================*/
#include "TypeCoordsys.hh" #include "TypeCoordsys.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypeCoordsysPlugin::TypeCoordsysPlugin() { TypeCoordsysPlugin::TypeCoordsysPlugin() {
...@@ -65,11 +66,18 @@ int TypeCoordsysPlugin::addEmpty(){ ...@@ -65,11 +66,18 @@ int TypeCoordsysPlugin::addEmpty(){
// new object data struct // new object data struct
CoordsysObject * object = new CoordsysObject(); CoordsysObject * object = new CoordsysObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New Coordinate System %1.cos").arg( object->id() ));
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "TypeHexahedralMesh.hh" #include "TypeHexahedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh> #include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypeHexahedralMeshPlugin::TypeHexahedralMeshPlugin() : TypeHexahedralMeshPlugin::TypeHexahedralMeshPlugin() :
render_switch_(0), render_switch_(0),
...@@ -103,11 +104,18 @@ int TypeHexahedralMeshPlugin::addEmpty() { ...@@ -103,11 +104,18 @@ int TypeHexahedralMeshPlugin::addEmpty() {
// New object data struct // New object data struct
HexahedralMeshObject* object = new HexahedralMeshObject(DATA_HEXAHEDRAL_MESH); HexahedralMeshObject* object = new HexahedralMeshObject(DATA_HEXAHEDRAL_MESH);
if (PluginFunctions::objectCount() == 1) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New Hexahedral Mesh %1.ovm").arg( object->id() ));
......
...@@ -50,8 +50,7 @@ ...@@ -50,8 +50,7 @@
#include "TypePlane.hh" #include "TypePlane.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh> #include <OpenFlipper/common/GlobalOptions.hh>
TypePlanePlugin::TypePlanePlugin() { TypePlanePlugin::TypePlanePlugin() {
...@@ -69,11 +68,18 @@ int TypePlanePlugin::addEmpty(){ ...@@ -69,11 +68,18 @@ int TypePlanePlugin::addEmpty(){
// new object data struct // new object data struct
PlaneObject * object = new PlaneObject(); PlaneObject * object = new PlaneObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New Plane %1.pla").arg( object->id() ));
......
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
#include "TypePolyLine.hh" #include "TypePolyLine.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypePolyLinePlugin::TypePolyLinePlugin() { TypePolyLinePlugin::TypePolyLinePlugin() {
...@@ -67,12 +68,19 @@ int TypePolyLinePlugin::addEmpty(){ ...@@ -67,12 +68,19 @@ int TypePolyLinePlugin::addEmpty(){
// new object data struct // new object data struct
PolyLineObject * object = new PolyLineObject(); PolyLineObject * object = new PolyLineObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); 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() ); QString name = tr("New PolyLine %1.pol").arg( object->id() );
// call the local function to update names // call the local function to update names
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh> #include <OpenFlipper/common/BackupData.hh>
#include "PolyMeshBackup.hh" #include "PolyMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -75,11 +76,18 @@ int TypePolyMeshPlugin::addEmpty(){ ...@@ -75,11 +76,18 @@ int TypePolyMeshPlugin::addEmpty(){
// new object data struct // new object data struct
PolyMeshObject * object = new PolyMeshObject( typeId("PolyMesh") ); PolyMeshObject * object = new PolyMeshObject( typeId("PolyMesh") );
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New PolyMesh %1.off").arg( object->id() ));
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "TypePolyhedralMesh.hh" #include "TypePolyhedralMesh.hh"
#include <ObjectTypes/Plane/Plane.hh> #include <ObjectTypes/Plane/Plane.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
TypePolyhedralMeshPlugin::TypePolyhedralMeshPlugin() : TypePolyhedralMeshPlugin::TypePolyhedralMeshPlugin() :
render_switch_(NULL), render_switch_(NULL),
...@@ -111,11 +112,18 @@ int TypePolyhedralMeshPlugin::addEmpty() { ...@@ -111,11 +112,18 @@ int TypePolyhedralMeshPlugin::addEmpty() {
// new object data struct // new object data struct
PolyhedralMeshObject* object = new PolyhedralMeshObject(DATA_POLYHEDRAL_MESH); PolyhedralMeshObject* object = new PolyhedralMeshObject(DATA_POLYHEDRAL_MESH);
if (PluginFunctions::objectCount() == 1) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New PolyHedral Mesh %1.ovm").arg( object->id() ));
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "OpenFlipper/BasePlugin/PluginFunctions.hh" #include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/common/BackupData.hh> #include <OpenFlipper/common/BackupData.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include "SkeletonBackup.hh" #include "SkeletonBackup.hh"
TypeSkeletonPlugin::TypeSkeletonPlugin() TypeSkeletonPlugin::TypeSkeletonPlugin()
...@@ -193,11 +194,18 @@ int TypeSkeletonPlugin::addEmpty(){ ...@@ -193,11 +194,18 @@ int TypeSkeletonPlugin::addEmpty(){
// new object data struct // new object data struct
SkeletonObject * object = new SkeletonObject(); SkeletonObject * object = new SkeletonObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New Skeleton %1.skl").arg( object->id() ));
......
...@@ -70,11 +70,18 @@ int TypeSpherePlugin::addEmpty(){ ...@@ -70,11 +70,18 @@ int TypeSpherePlugin::addEmpty(){
// new object data struct // new object data struct
SphereObject * object = new SphereObject(); SphereObject * object = new SphereObject();
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); QString name = QString(tr("New Sphere %1.sph").arg( object->id() ));
......
...@@ -60,9 +60,11 @@ ...@@ -60,9 +60,11 @@
#include "TypeSplatCloud.hh" #include "TypeSplatCloud.hh"
#include <OpenFlipper/common/BackupData.hh> #include <OpenFlipper/common/BackupData.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include "SplatCloudBackup.hh" #include "SplatCloudBackup.hh"
//== CONSTANTS =================================================== //== CONSTANTS ===================================================
...@@ -296,11 +298,18 @@ int TypeSplatCloudPlugin::addEmpty() ...@@ -296,11 +298,18 @@ int TypeSplatCloudPlugin::addEmpty()
if( object == 0 ) if( object == 0 )
return -1; return -1;
if( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target( true ); 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 ) // If no target is available, we set the new object as target
object->target( true ); if (PluginFunctions::targetCount() == 0 )
object->target(true);
}
QString name = QString(tr("New Splat Cloud %1.spl").arg( object->id() )); QString name = QString(tr("New Splat Cloud %1.spl").arg( object->id() ));
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <OpenFlipper/common/BackupData.hh> #include <OpenFlipper/common/BackupData.hh>
#include "TriMeshBackup.hh" #include "TriMeshBackup.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -74,11 +75,18 @@ int TypeTriangleMeshPlugin::addEmpty(){ ...@@ -74,11 +75,18 @@ int TypeTriangleMeshPlugin::addEmpty(){
// new object data struct // new object data struct
TriMeshObject * object = new TriMeshObject( typeId("TriangleMesh") ); TriMeshObject * object = new TriMeshObject( typeId("TriangleMesh") );
if ( PluginFunctions::objectCount() == 1 ) if ( OpenFlipperSettings().value("Core/File/AllTarget",false).toBool() )
object->target(true); object->target(true);
else {
if (PluginFunctions::targetCount() == 0 ) // Only the first object in the scene will be target
object->target(true); 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() )); 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