Commit 42aefb78 authored by Jan Möbius's avatar Jan Möbius
Browse files

Extended interface to keep features via scripting

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@19587 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b5bcd373
...@@ -104,6 +104,10 @@ initializePlugin() ...@@ -104,6 +104,10 @@ initializePlugin()
void void
SmootherPlugin::pluginsInitialized(){ SmootherPlugin::pluginsInitialized(){
emit setSlotDescription("smooth(int,int,QString,QString,double,bool)", "Smooth an object",
QString("object_id,iterations,direction,continuity,maxDistance,respectFeatures").split(","),
QString("id of an object, number of smoothing iterations, Smoothing direction. (tangential;normal;tangential+normal), Continuity. (C1 or C2), max distance the smoothed mesh is allowed to differ from the original,Keep features intact").split(","));
emit setSlotDescription("smooth(int,int,QString,QString,double)", "Smooth an object", emit setSlotDescription("smooth(int,int,QString,QString,double)", "Smooth an object",
QString("object_id,iterations,direction,continuity,maxDistance").split(","), QString("object_id,iterations,direction,continuity,maxDistance").split(","),
QString("id of an object, number of smoothing iterations, Smoothing direction. (tangential;normal;tangential+normal), Continuity. (C1 or C2), max distance the smoothed mesh is allowed to differ from the original").split(",")); QString("id of an object, number of smoothing iterations, Smoothing direction. (tangential;normal;tangential+normal), Continuity. (C1 or C2), max distance the smoothed mesh is allowed to differ from the original").split(","));
...@@ -237,15 +241,7 @@ slot_smooth() ...@@ -237,15 +241,7 @@ slot_smooth()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** \brief Smooth object void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction , QString _continuity, double _maxDistance, bool _respectFeatures ) {
*
* @param _objectId Object to smooth
* @param _iterations Number of smoothing iterations
* @param _direction tangential/normal/tangential+normal
* @param _continuity C0/C1
* @param _maxDistance the maximum distance that the smoothed mesh is allowed to differ from the original mesh
*/
void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction , QString _continuity, double _maxDistance) {
BaseObjectData* baseObjectData; BaseObjectData* baseObjectData;
if ( ! PluginFunctions::getObject(_objectId,baseObjectData) ) { if ( ! PluginFunctions::getObject(_objectId,baseObjectData) ) {
...@@ -326,6 +322,10 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction ...@@ -326,6 +322,10 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction
smoother.set_absolute_local_error( FLT_MAX ); smoother.set_absolute_local_error( FLT_MAX );
} }
// Keep features?
data->features(_respectFeatures);
smoother.skip_features(_respectFeatures);
smoother.initialize(component,continuity); smoother.initialize(component,continuity);
smoother.smooth( _iterations ); smoother.smooth( _iterations );
......
...@@ -154,14 +154,15 @@ public slots: ...@@ -154,14 +154,15 @@ public slots:
/** \brief smooth an object /** \brief smooth an object
* *
* @param _objectId Id of the object that should be smoothed * @param _objectId Id of the object that should be smoothed
* @param _iterations Number of iterations * @param _iterations Number of iterations
* @param _direction Tangential or normal? * @param _direction Tangential or normal?
* @param _continuity Continuity selection * @param _continuity Continuity selection
* @param _maxDistance Maximal distance after smoothing * @param _maxDistance Maximal distance after smoothing
* @param _respectFeatures Keep features
* *
*/ */
void smooth(int _objectId , int _iterations , QString _direction , QString _continuity, double _maxDistance = -1.0); void smooth(int _objectId , int _iterations , QString _direction , QString _continuity, double _maxDistance = -1.0, bool _respectFeatures = true);
/** @} */ /** @} */
......
Supports Markdown
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