Commit efd441ef authored by Jan Möbius's avatar Jan Möbius

Split out plugin functions to allow call to updatedObject

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12769 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d35fa0c2
......@@ -117,8 +117,14 @@ void RemesherPlugin::threadFinished(QString _jobId) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType(DATA_TRIANGLE_MESH | DATA_POLY_MESH)) ;
o_it != PluginFunctions::objectsEnd(); ++o_it) {
emit updatedObject(o_it->id(), UPDATE_GEOMETRY | UPDATE_TOPOLOGY );
emit createBackup(o_it->id(), "Remeshing", UPDATE_GEOMETRY | UPDATE_TOPOLOGY);
if ( operation_ == REMESH_ADAPTIVE ) {
emit updatedObject(o_it->id(), UPDATE_TOPOLOGY );
emit createBackup(o_it->id(), "Adaptive remeshing", UPDATE_TOPOLOGY);
} else if ( operation_ == REMESH_UNIFORM ) {
emit updatedObject(o_it->id(), UPDATE_TOPOLOGY );
emit createBackup(o_it->id(), "Uniform remeshing", UPDATE_TOPOLOGY);
}
}
// Detach job from progress emitter
......@@ -257,20 +263,22 @@ void RemesherPlugin::adaptiveRemeshing() {
unsigned int iters = tool_->adaptive_iters->text().toInt();
bool projection = tool_->adaptive_projection->isChecked();
adaptiveRemeshing(o_it->id(), error, min_edge, max_edge, iters, projection);
slotAdaptiveRemeshing(o_it->id(), error, min_edge, max_edge, iters, projection);
}
}
// ----------------------------------------------------------------------------------------
void RemesherPlugin::adaptiveRemeshing(int _objectID,
double _error,
double _min_edge_length,
double _max_edge_length,
unsigned int _iters,
bool _use_projection) {
void RemesherPlugin::slotAdaptiveRemeshing(int _objectID,
double _error,
double _min_edge_length,
double _max_edge_length,
unsigned int _iters,
bool _use_projection) {
operation_ = REMESH_ADAPTIVE;
BaseObjectData* object = 0;
if (PluginFunctions::getObject(_objectID, object)) {
......@@ -287,9 +295,9 @@ void RemesherPlugin::adaptiveRemeshing(int _objectID,
mesh->update_normals();
QString projectionString = "FALSE";
QString projectionString = "\"FALSE\"";
if (_use_projection)
projectionString = "TRUE";
projectionString = "\"TRUE\"";
emit scriptInfo("adaptiveRemeshing(" + QString::number(_objectID) + ", "
+ QString::number(_error) + ", "
......@@ -353,18 +361,20 @@ void RemesherPlugin::uniformRemeshing(){
// on edge flips which are only defined
// for triangle configurations.
uniformRemeshing(o_it->id(), edge_length, iters, area_iters, projection);
slotUniformRemeshing(o_it->id(), edge_length, iters, area_iters, projection);
}
}
// ----------------------------------------------------------------------------------------
void RemesherPlugin::uniformRemeshing(int _objectID,
double _edge_length,
unsigned int _iters,
unsigned int _area_iters,
bool _use_projection) {
void RemesherPlugin::slotUniformRemeshing(int _objectID,
double _edge_length,
unsigned int _iters,
unsigned int _area_iters,
bool _use_projection) {
operation_ = REMESH_UNIFORM;
BaseObjectData* object = 0;
if (PluginFunctions::getObject(_objectID, object)) {
......@@ -380,16 +390,16 @@ void RemesherPlugin::uniformRemeshing(int _objectID,
mesh->update_normals();
QString projectionString = "FALSE";
QString projectionString = "\"FALSE\"";
if (_use_projection)
projectionString = "TRUE";
projectionString = "\"TRUE\"";
emit scriptInfo("adaptiveRemeshing(" + QString::number(_objectID) + ", "
+ QString::number(_edge_length) + ", "
+ QString::number(_iters) + ", "
+ QString::number(_area_iters) + ", "
+ QString::number(_iters) + ", "
+ projectionString + ")");
emit scriptInfo("uniformRemeshing(" + QString::number(_objectID) + ", "
+ QString::number(_edge_length) + ", "
+ QString::number(_iters) + ", "
+ QString::number(_area_iters) + ", "
+ QString::number(_iters) + ", "
+ projectionString + ")");
return;
}
......@@ -399,5 +409,34 @@ void RemesherPlugin::uniformRemeshing(int _objectID,
// ----------------------------------------------------------------------------------------
void RemesherPlugin::adaptiveRemeshing(int _objectID,
double _error,
double _min_edge_length,
double _max_edge_length,
unsigned int _iters,
bool _use_projection) {
slotAdaptiveRemeshing(_objectID,_error,_min_edge_length,_max_edge_length,_iters,_use_projection);
emit updatedObject(_objectID, UPDATE_TOPOLOGY );
emit createBackup(_objectID, "Adaptive remeshing", UPDATE_TOPOLOGY);
}
// ----------------------------------------------------------------------------------------
void RemesherPlugin::uniformRemeshing(int _objectID,
double _edge_length,
unsigned int _iters,
unsigned int _area_iters,
bool _use_projection) {
slotUniformRemeshing(_objectID,_edge_length,_iters,_area_iters,_use_projection);
emit updatedObject(_objectID, UPDATE_TOPOLOGY );
emit createBackup(_objectID, "Uniform remeshing", UPDATE_TOPOLOGY);
}
// ----------------------------------------------------------------------------------------
Q_EXPORT_PLUGIN2( remesherplugin, RemesherPlugin );
......@@ -127,6 +127,10 @@ private :
QIcon* toolIcon_;
enum RemeshingOperation { REMESH_UNIFORM, REMESH_ADAPTIVE };
RemeshingOperation operation_;
private slots:
//---- Adaptive Remeshing ------------
......@@ -150,6 +154,19 @@ private slots:
/// Compute mean edge length and set values
void computeInitValues();
void slotAdaptiveRemeshing(int _objectId,
double _error,
double _min_edge_length,
double _max_edge_length,
unsigned int _iters,
bool _use_projection = true);
void slotUniformRemeshing(int _objectId,
double _edge_length,
unsigned int _iters,
unsigned int _area_iters,
bool _use_projection = true);
//scripting functions
public slots:
......@@ -160,7 +177,7 @@ public slots:
double _max_edge_length,
unsigned int _iters,
bool _use_projection = true);
void uniformRemeshing(int _objectId,
double _edge_length,
unsigned int _iters,
......
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