Commit 7c254896 authored by Dirk Wilden's avatar Dirk Wilden
Browse files

copyObject moved to loadsaveinterface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5856 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e436b5f
......@@ -177,35 +177,6 @@ bool getObject( const int _identifier , BaseObjectData*& _object ) {
// ===============================================================================
// ===============================================================================
int copyObject( const int _id ) {
if ( _id == -1 )
return -1;
// get the node
BaseObject* object = objectRoot_->childExists(_id);
if ( !object ) {
std::cerr << "Error while copying object ... not found" << std::endl;
return -1;
}
// remove the whole subtree below this item
BaseObject* copy = object->copy();
if ( copy == 0 ) {
std::cerr << "Unable to create a copy of the object." << std::endl;
}
// Integrate into object tree
copy->setParent( object->parent() );
if ( object->parent() )
object->parent()->appendChild(copy);
else
std::cerr << "Unable to add copy to object list" << std::endl;
return copy->id();
}
bool object_exists( const int _identifier ) {
if ( _identifier == -1 )
......
......@@ -73,20 +73,6 @@ namespace PluginFunctions {
DLLEXPORT
bool getPickedObject(const unsigned int _node_idx , BaseObjectData*& _object);
/** \brief Create a copy of the object with the given id
*
* Creates a copy of an object. All scenegraph nodes will be created. The object will
* be part of the object tree at the same location as the parent of the original mesh.
* This has to be done by setParent of the object.
*
* @return Pointer to new object or 0 if failed;
* */
DLLEXPORT
int copyObject( const int _id );
/** @} */
//=======================================
......
......@@ -84,6 +84,8 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
// LoadSaveInterface
void deleteObject( int _id );
void emptyObjectAdded( int _id );
void copyObject( int _oldId, int& _newId);
private slots :
// BaseInterface
void pluginsInitialized();
......
......@@ -125,14 +125,9 @@ int DataControlPlugin::getObject( QString _name ) {
*/
int DataControlPlugin::copyObject( int objectId ) {
int newObject = PluginFunctions::copyObject( objectId );
int newObject;
if ( newObject == -1 )
std::cerr << "Unable to copy object" << std::endl;
else{
emit emptyObjectAdded(newObject);
emit updatedObject(newObject);
}
emit copyObject( objectId, newObject );
return newObject;
}
......
......@@ -142,15 +142,10 @@ void DataControlPlugin::slotCopy() {
BaseObject* copyItem = model_->getItem( indexList[i] );
int newObject = PluginFunctions::copyObject(copyItem->id());
int newObject;
emit copyObject( copyItem->id(), newObject );
if ( newObject == -1 ) {
emit log(LOGERR, "Unable to copy object" );
continue;
} else {
emit emptyObjectAdded( newObject );
emit updatedObject( newObject );
}
}
emit updateView();
......
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