mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 08:09:39 +00:00
totally new parameters system...bugs surelly will be present!
This commit is contained in:
parent
0ae731bceb
commit
675a4ab804
@ -67,7 +67,7 @@ const QString FilterTopoPlugin::filterInfo(FilterIDType filterId)
|
||||
//
|
||||
// Filter interface start up
|
||||
//
|
||||
void FilterTopoPlugin::initParameterSet(QAction *action, MeshDocument & md, FilterParameterSet & parlst)
|
||||
void FilterTopoPlugin::initParameterSet(QAction *action, MeshDocument & md, RichParameterSet & parlst)
|
||||
{
|
||||
MeshModel *target= md.mm();
|
||||
foreach (target, md.meshList)
|
||||
@ -78,22 +78,22 @@ void FilterTopoPlugin::initParameterSet(QAction *action, MeshDocument & md, Filt
|
||||
switch(ID(action)) {
|
||||
case FP_RE_TOPO :
|
||||
// Iterations editbox
|
||||
parlst.addInt( "it",
|
||||
parlst.addParam(new RichInt( "it",
|
||||
4,
|
||||
"Number of refinement iterations used to build the new mesh",
|
||||
"As higher is this value, as well defined will be the new mesh. Consider that more than 5 iterations may slow down your system");
|
||||
"As higher is this value, as well defined will be the new mesh. Consider that more than 5 iterations may slow down your system"));
|
||||
// Distance editbox
|
||||
parlst.addAbsPerc( "dist", 0.3f, 0.01f, 0.99f,
|
||||
parlst.addParam(new RichAbsPerc( "dist", 0.3f, 0.01f, 0.99f,
|
||||
"Incremental distance %",
|
||||
"This param represents the % distance for the local search algorithm used for new vertices allocation. Generally, 0.25-0.30 is a good value");
|
||||
"This param represents the % distance for the local search algorithm used for new vertices allocation. Generally, 0.25-0.30 is a good value"));
|
||||
// Topology mesh list
|
||||
parlst.addMesh( "userMesh", md.mm(),
|
||||
parlst.addParam(new RichMesh( "userMesh", md.mm(),
|
||||
"Topology mesh",
|
||||
"This mesh will be used as the new base topology, and will be replaced by the new mesh");
|
||||
"This mesh will be used as the new base topology, and will be replaced by the new mesh"));
|
||||
// Original mesh list
|
||||
parlst.addMesh( "inMesh", target,
|
||||
parlst.addParam(new RichMesh( "inMesh", target,
|
||||
"Original mesh",
|
||||
"The new mesh will be elaborated using this model");
|
||||
"The new mesh will be elaborated using this model"));
|
||||
break;
|
||||
|
||||
default : assert(0);
|
||||
@ -103,7 +103,7 @@ void FilterTopoPlugin::initParameterSet(QAction *action, MeshDocument & md, Filt
|
||||
//
|
||||
// Apply filter
|
||||
//
|
||||
bool FilterTopoPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterTopoPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
// To run the retopology algorithm an istance of RetopoMeshBuilder is needed
|
||||
RetopMeshBuilder rm;
|
||||
|
||||
@ -92,7 +92,7 @@ const QString GeometryAgingPlugin::filterInfo(FilterIDType filterId) const
|
||||
}
|
||||
|
||||
/* Initializes the list of parameters (called by the auto dialog framework) */
|
||||
void GeometryAgingPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet ¶ms)
|
||||
void GeometryAgingPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet ¶ms)
|
||||
{
|
||||
if( ID(action) != FP_ERODE)
|
||||
{
|
||||
@ -108,51 +108,51 @@ void GeometryAgingPlugin::initParameterSet(QAction *action, MeshModel &m, Filter
|
||||
if(qRange.second <= qRange.first) hasQ=false;
|
||||
}
|
||||
|
||||
params.addBool("ComputeCurvature", !hasQ, "ReCompute quality from curvature",
|
||||
params.addParam(new RichBool("ComputeCurvature", !hasQ, "ReCompute quality from curvature",
|
||||
"Compute per vertex quality values using mesh mean curvature <br>"
|
||||
"algorithm. In this way only the areas with higher curvature <br>"
|
||||
"will be eroded. If not checked, the quality values already <br>"
|
||||
"present over the mesh will be used.");
|
||||
params.addBool("SmoothQuality", false, "Smooth vertex quality",
|
||||
"present over the mesh will be used."));
|
||||
params.addParam(new RichBool("SmoothQuality", false, "Smooth vertex quality",
|
||||
"Smooth per vertex quality values. This allows to extend the <br>"
|
||||
"area affected by the erosion process.");
|
||||
params.addAbsPerc("QualityThreshold", qRange.first+(qRange.second-qRange.first)*0.66,
|
||||
"area affected by the erosion process."));
|
||||
params.addParam(new RichAbsPerc("QualityThreshold", qRange.first+(qRange.second-qRange.first)*0.66,
|
||||
qRange.first, qRange.second, "Min quality threshold",
|
||||
"Represents the minimum quality value two vertexes must have <br>"
|
||||
"to consider the edge they are sharing.");
|
||||
params.addAbsPerc("EdgeLenThreshold", m.cm.bbox.Diag()*0.02, 0,m.cm.bbox.Diag()*0.5,
|
||||
"to consider the edge they are sharing."));
|
||||
params.addParam(new RichAbsPerc("EdgeLenThreshold", m.cm.bbox.Diag()*0.02, 0,m.cm.bbox.Diag()*0.5,
|
||||
"Edge len threshold",
|
||||
"The minimum length of an edge. Useful to avoid the creation of too many small faces.");
|
||||
params.addAbsPerc("ChipDepth", m.cm.bbox.Diag()*0.05, 0, m.cm.bbox.Diag(),
|
||||
"Max chip depth", "The maximum depth of a chip.");
|
||||
params.addInt("Octaves", 3, "Fractal Octaves",
|
||||
"The minimum length of an edge. Useful to avoid the creation of too many small faces."));
|
||||
params.addParam(new RichAbsPerc("ChipDepth", m.cm.bbox.Diag()*0.05, 0, m.cm.bbox.Diag(),
|
||||
"Max chip depth", "The maximum depth of a chip."));
|
||||
params.addParam(new RichInt("Octaves", 3, "Fractal Octaves",
|
||||
"The number of octaves that are used in the generation of the <br>"
|
||||
"fractal noise using Perlin noise; reasonalble values are in the <br>"
|
||||
"1..8 range. Setting it to 1 means using a simple Perlin Noise.");
|
||||
params.addAbsPerc("NoiseFreqScale", m.cm.bbox.Diag()/10, 0, m.cm.bbox.Diag(), "Noise frequency scale",
|
||||
"1..8 range. Setting it to 1 means using a simple Perlin Noise."));
|
||||
params.addParam(new RichAbsPerc("NoiseFreqScale", m.cm.bbox.Diag()/10, 0, m.cm.bbox.Diag(), "Noise frequency scale",
|
||||
"Changes the noise frequency scale: this affects chip dimensions and <br>"
|
||||
"the distance between chips. The value denotes the average values <br>"
|
||||
"between two dents. Smaller number means small and frequent chips.");
|
||||
params.addFloat("NoiseClamp", 0.5, "Noise clamp threshold [0..1]",
|
||||
"between two dents. Smaller number means small and frequent chips."));
|
||||
params.addParam(new RichFloat("NoiseClamp", 0.5, "Noise clamp threshold [0..1]",
|
||||
"All the noise values smaller than this parameter will be <br> "
|
||||
"considered as 0.");
|
||||
params.addFloat("DisplacementSteps", 10, "Displacement steps",
|
||||
"considered as 0."));
|
||||
params.addParam(new RichFloat("DisplacementSteps", 10, "Displacement steps",
|
||||
"The whole displacement process is performed as a sequence of small <br>"
|
||||
"offsets applyed on each vertex. This parameter represents the number <br>"
|
||||
"of steps into which the displacement process will be splitted. <br>"
|
||||
"Useful to avoid the introduction of self intersections. <br>"
|
||||
"Bigger number means better accuracy.");
|
||||
params.addBool("Selected", m.cm.sfn>0, "Affect only selected faces",
|
||||
"The aging procedure will be applied to the selected faces only.");
|
||||
params.addBool("StoreDisplacement", false, "Store erosion informations",
|
||||
"Bigger number means better accuracy."));
|
||||
params.addParam(new RichBool("Selected", m.cm.sfn>0, "Affect only selected faces",
|
||||
"The aging procedure will be applied to the selected faces only."));
|
||||
params.addParam(new RichBool("StoreDisplacement", false, "Store erosion informations",
|
||||
"Select this option if you want to store the erosion informations <br>"
|
||||
"over the mesh. A new attribute will be added to each vertex <br>"
|
||||
"to contain the displacement offset applied to that vertex.");
|
||||
"to contain the displacement offset applied to that vertex."));
|
||||
}
|
||||
|
||||
|
||||
/* The Real Core Function doing the actual mesh processing */
|
||||
bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet ¶ms, vcg::CallBackPos *cb)
|
||||
bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet ¶ms, vcg::CallBackPos *cb)
|
||||
{
|
||||
if( ID(filter) != FP_ERODE)
|
||||
{
|
||||
|
||||
@ -53,8 +53,8 @@ class GeometryAgingPlugin : public QObject, public MeshFilterInterface
|
||||
virtual const int getRequirements(QAction *) {return (MeshModel::MM_FACEMARK |
|
||||
MeshModel::MM_FACEFACETOPO | MeshModel::MM_FACEFLAGBORDER | MeshModel::MM_VERTCURV);}
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *action, MeshModel &m, FilterParameterSet ¶ms);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet ¶ms, vcg::CallBackPos *cb);
|
||||
virtual void initParameterSet(QAction *action, MeshModel &m, RichParameterSet ¶ms);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet ¶ms, vcg::CallBackPos *cb);
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
|
||||
|
||||
|
||||
@ -124,64 +124,64 @@ const int FilterColorProc::getRequirements(QAction *action)
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void FilterColorProc::initParameterSet(QAction *a, MeshDocument& /*md*/, FilterParameterSet & par)
|
||||
void FilterColorProc::initParameterSet(QAction *a, MeshDocument& /*md*/, RichParameterSet & par)
|
||||
{
|
||||
switch(ID(a))
|
||||
{
|
||||
case CP_FILLING:
|
||||
{
|
||||
float r = 255.0f, g = 255.0f, b = 255.0f;
|
||||
par.addDynamicFloat("r", r, 0.0f, 255.0f,"Red:", "Sets the red component of the color.");
|
||||
par.addDynamicFloat("g", g, 0, 255,"Green:", "Sets the green component of the color.");
|
||||
par.addDynamicFloat("b", b, 0, 255,"Blue:", "Sets the blue component of the color.");
|
||||
par.addParam(new RichDynamicFloat("r", r, 0.0f, 255.0f,"Red:", "Sets the red component of the color."));
|
||||
par.addParam(new RichDynamicFloat("g", g, 0, 255,"Green:", "Sets the green component of the color."));
|
||||
par.addParam(new RichDynamicFloat("b", b, 0, 255,"Blue:", "Sets the blue component of the color."));
|
||||
break;
|
||||
}
|
||||
case CP_THRESHOLDING:
|
||||
{
|
||||
float threshold = 128.0f;
|
||||
QColor color1 = QColor(0,0,0), color2 = QColor(255,255,255);
|
||||
par.addColor("color1", color1, "Color 1:", "Sets the color to apply below the threshold.");
|
||||
par.addColor("color2", color2, "Color 2:", "Sets the color to apply above the threshold.");
|
||||
par.addDynamicFloat("threshold", threshold, 0.0f, 255.0f,"Threshold:", "Colors above the threshold becomes Color 2, others Color 1.");
|
||||
par.addParam(new RichColor("color1", color1, "Color 1:", "Sets the color to apply below the threshold."));
|
||||
par.addParam(new RichColor("color2", color2, "Color 2:", "Sets the color to apply above the threshold."));
|
||||
par.addParam(new RichDynamicFloat("threshold", threshold, 0.0f, 255.0f,"Threshold:", "Colors above the threshold becomes Color 2, others Color 1."));
|
||||
break;
|
||||
}
|
||||
case CP_BRIGHTNESS:
|
||||
{
|
||||
float brightness = 0.0f;
|
||||
par.addDynamicFloat("brightness", brightness, -255.0f, 255.0f, "Sets the amount of brightness that will be added/subtracted to the colors.<br>Brightness = 255 -> all white;<br>Brightness = -255 -> all black;");
|
||||
par.addParam(new RichDynamicFloat("brightness", brightness, -255.0f, 255.0f,"Brightness:","Sets the amount of brightness that will be added/subtracted to the colors.<br>Brightness = 255 -> all white;<br>Brightness = -255 -> all black;"));
|
||||
break;
|
||||
}
|
||||
case CP_CONTRAST:
|
||||
{
|
||||
float factor = 1.0f;
|
||||
par.addDynamicFloat("factor", factor, 0.2f, 5.0f, "Contrast factor:", "Sets the amount of contrast of the mesh.");
|
||||
par.addParam(new RichDynamicFloat("factor", factor, 0.2f, 5.0f, "Contrast factor:", "Sets the amount of contrast of the mesh."));
|
||||
break;
|
||||
}
|
||||
case CP_CONTR_BRIGHT:
|
||||
{
|
||||
float brightness = 0.0f;
|
||||
float contrast = 0.0f;
|
||||
par.addDynamicFloat("brightness", brightness, -255.0f, 255.0f, "Brightness:", "Sets the amount of brightness that will be added/subtracted to the colors.<br>Brightness = 255 -> all white;<br>Brightness = -255 -> all black;");
|
||||
par.addDynamicFloat("contrast", contrast, -255.0f, 255.0f, "Contrast factor:", "Sets the amount of contrast of the mesh.");
|
||||
par.addParam(new RichDynamicFloat("brightness", brightness, -255.0f, 255.0f, "Brightness:", "Sets the amount of brightness that will be added/subtracted to the colors.<br>Brightness = 255 -> all white;<br>Brightness = -255 -> all black;"));
|
||||
par.addParam(new RichDynamicFloat("contrast", contrast, -255.0f, 255.0f, "Contrast factor:", "Sets the amount of contrast of the mesh."));
|
||||
break;
|
||||
}
|
||||
case CP_GAMMA :
|
||||
{
|
||||
float gamma = 1.0f;
|
||||
par.addDynamicFloat("gamma", gamma, 0.1f, 5.0f, "Gamma:", "Sets the values of the exponent gamma.");
|
||||
par.addParam(new RichDynamicFloat("gamma", gamma, 0.1f, 5.0f, "Gamma:", "Sets the values of the exponent gamma."));
|
||||
break;
|
||||
}
|
||||
case CP_LEVELS:
|
||||
{
|
||||
float in_min = 0, in_max = 255, out_min = 0, out_max = 255, gamma = 1;
|
||||
par.addDynamicFloat("in_min", in_min, 0.0f, 255.0f, "Min input level:", "");
|
||||
par.addDynamicFloat("gamma", gamma, 0.1f, 5.0f, "Gamma:", "");
|
||||
par.addDynamicFloat("in_max", in_max, 0.0f, 255.0f, "Max input level:", "");
|
||||
par.addDynamicFloat("out_min", out_min, 0.0f, 255.0f, "Min output level:", "");
|
||||
par.addDynamicFloat("out_max", out_max, 0.0f, 255.0f,"Max output level:", "");
|
||||
par.addBool("rCh", true, "Red Channel:", "");
|
||||
par.addBool("gCh", true, "Green Channel:", "");
|
||||
par.addBool("bCh", true, "Blue Channel:", "");
|
||||
par.addParam(new RichDynamicFloat("in_min", in_min, 0.0f, 255.0f, "Min input level:", ""));
|
||||
par.addParam(new RichDynamicFloat("gamma", gamma, 0.1f, 5.0f, "Gamma:", ""));
|
||||
par.addParam(new RichDynamicFloat("in_max", in_max, 0.0f, 255.0f, "Max input level:", ""));
|
||||
par.addParam(new RichDynamicFloat("out_min", out_min, 0.0f, 255.0f, "Min output level:", ""));
|
||||
par.addParam(new RichDynamicFloat("out_max", out_max, 0.0f, 255.0f,"Max output level:", ""));
|
||||
par.addParam(new RichBool("rCh", true, "Red Channel:", ""));
|
||||
par.addParam(new RichBool("gCh", true, "Green Channel:", ""));
|
||||
par.addParam(new RichBool("bCh", true, "Blue Channel:", ""));
|
||||
break;
|
||||
}
|
||||
case CP_COLOURISATION:
|
||||
@ -189,46 +189,46 @@ void FilterColorProc::initParameterSet(QAction *a, MeshDocument& /*md*/, FilterP
|
||||
float intensity = 0.5f;
|
||||
double hue, luminance, saturation;
|
||||
ColorSpace<unsigned char>::RGBtoHSL(1.0, 0.0, 0.0, hue, saturation, luminance);
|
||||
par.addDynamicFloat("hue", (float)hue*360, 0.0f, 360.0f, "Hue:", "Changes the hue of the mesh.");
|
||||
par.addDynamicFloat("saturation", (float)saturation*100, 0.0f, 100.0f, "Saturation:", "Changes the saturation of the mesh.");
|
||||
par.addDynamicFloat("luminance", (float)luminance*100, 0.0f, 100.0f,"Luminance:", "Changes the luminance of the mesh.");
|
||||
par.addDynamicFloat("intensity", intensity*100, 0.0f, 100.0f, "Intensity:", "Sets the intensity with which the color it's blended to the mesh.");
|
||||
par.addParam(new RichDynamicFloat("hue", (float)hue*360, 0.0f, 360.0f, "Hue:", "Changes the hue of the mesh."));
|
||||
par.addParam(new RichDynamicFloat("saturation", (float)saturation*100, 0.0f, 100.0f, "Saturation:", "Changes the saturation of the mesh."));
|
||||
par.addParam(new RichDynamicFloat("luminance", (float)luminance*100, 0.0f, 100.0f,"Luminance:", "Changes the luminance of the mesh."));
|
||||
par.addParam(new RichDynamicFloat("intensity", intensity*100, 0.0f, 100.0f, "Intensity:", "Sets the intensity with which the color it's blended to the mesh."));
|
||||
break;
|
||||
}
|
||||
case CP_DESATURATION:
|
||||
{
|
||||
QStringList l; l << "Lightness" << "Luminosity" << "Average";
|
||||
par.addEnum("method", 0, l,"Desaturation method:", "Lightness is computed as (Max(r,g,b)+Min(r,g,b))/2<br>Luminosity is computed as 0.212*r + 0.715*g + 0.072*b<br>Average is computed as (r+g+b)/3");
|
||||
par.addParam(new RichEnum("method", 0, l,"Desaturation method:", "Lightness is computed as (Max(r,g,b)+Min(r,g,b))/2<br>Luminosity is computed as 0.212*r + 0.715*g + 0.072*b<br>Average is computed as (r+g+b)/3"));
|
||||
break;
|
||||
}
|
||||
case CP_EQUALIZE:
|
||||
{
|
||||
par.addBool("rCh", true, "Red Channel:", "Select the red channel.");
|
||||
par.addBool("gCh", true, "Green Channel:", "Select the green channel.");
|
||||
par.addBool("bCh", true, "Blue Channel:", "Select the blue channel.<br><br>If no channels are selected<br>filter works on Lightness.");
|
||||
par.addParam(new RichBool("rCh", true, "Red Channel:", "Select the red channel."));
|
||||
par.addParam(new RichBool("gCh", true, "Green Channel:", "Select the green channel."));
|
||||
par.addParam(new RichBool("bCh", true, "Blue Channel:", "Select the blue channel.<br><br>If no channels are selected<br>filter works on Lightness."));
|
||||
break;
|
||||
}
|
||||
case CP_WHITE_BAL:
|
||||
{
|
||||
par.addBool("auto",true,"Automatic white balance","If checked, an automatic balancing is done, otherwise an unbalanced white color must be chosen");
|
||||
par.addColor("color", QColor(255,255,255),"Unbalanced white: ","The color that is supposed to be white.");
|
||||
par.addParam(new RichBool("auto",true,"Automatic white balance","If checked, an automatic balancing is done, otherwise an unbalanced white color must be chosen"));
|
||||
par.addParam(new RichColor("color", QColor(255,255,255),"Unbalanced white: ","The color that is supposed to be white."));
|
||||
break;
|
||||
}
|
||||
case CP_PERLIN_COLOR:
|
||||
{
|
||||
par.addDynamicFloat("freq", 10.0f, 0.1f, 50.0f,"Frequency:","Frequency of the Perlin Noise function. High frequencies produces many small splashes of colours, while low frequencies produces few big splashes.");
|
||||
par.addParam(new RichDynamicFloat("freq", 10.0f, 0.1f, 50.0f,"Frequency:","Frequency of the Perlin Noise function. High frequencies produces many small splashes of colours, while low frequencies produces few big splashes."));
|
||||
break;
|
||||
}
|
||||
case CP_COLOR_NOISE:
|
||||
{
|
||||
par.addInt("noiseBits", 1, "Noise bits:","Bits of noise added to each RGB channel. Example: 3 noise bits adds three random offsets in the [-4,+4] interval to each RGB channels.");
|
||||
par.addParam(new RichInt("noiseBits", 1, "Noise bits:","Bits of noise added to each RGB channel. Example: 3 noise bits adds three random offsets in the [-4,+4] interval to each RGB channels."));
|
||||
break;
|
||||
}
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool FilterColorProc::applyFilter(QAction *filter, MeshDocument& md, FilterParameterSet & par, vcg::CallBackPos * /* cb */)
|
||||
bool FilterColorProc::applyFilter(QAction *filter, MeshDocument& md, RichParameterSet & par, vcg::CallBackPos * /* cb */)
|
||||
{
|
||||
MeshModel* m = md.mm(); //get current mesh from document
|
||||
|
||||
|
||||
@ -67,9 +67,9 @@ class FilterColorProc : public QObject, public MeshFilterInterface
|
||||
virtual const int getRequirements(QAction *);
|
||||
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshDocument&, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument&, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb);
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;}
|
||||
virtual void initParameterSet(QAction *,MeshDocument&, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument&, RichParameterSet & /*parent*/, vcg::CallBackPos * cb);
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;}
|
||||
int postCondition(QAction* filter) const;
|
||||
int getPreConditions(QAction *) const;
|
||||
};
|
||||
|
||||
@ -211,90 +211,90 @@ const int FilterFunctionPlugin::getRequirements(QAction *action)
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
Q_UNUSED(m);
|
||||
switch(ID(action)) {
|
||||
|
||||
case FF_VERT_SELECTION :
|
||||
parlst.addString("condSelect","(q < 0)", "boolean function",
|
||||
parlst.addParam(new RichString("condSelect","(q < 0)", "boolean function",
|
||||
"type a boolean function that will be evaluated in order to select a subset of vertices<br>"
|
||||
"example: (y > 0) and (ny > 0)");
|
||||
"example: (y > 0) and (ny > 0)"));
|
||||
|
||||
parlst.addBool("strictSelect",true,"Strict face selection", "If checked a face is selected if <b>ALL</b> its vertices are selected. <br>"
|
||||
"If unchecked a face is selected if <b>at least one</b> of its vertices is selected");
|
||||
parlst.addParam(new RichBool("strictSelect",true,"Strict face selection", "If checked a face is selected if <b>ALL</b> its vertices are selected. <br>"
|
||||
"If unchecked a face is selected if <b>at least one</b> of its vertices is selected"));
|
||||
break;
|
||||
|
||||
case FF_FACE_SELECTION :
|
||||
parlst.addString("condSelect","(fi == 0)", "boolean function",
|
||||
"type a boolean function that will be evaluated in order to select a subset of faces<br>");
|
||||
parlst.addParam(new RichString("condSelect","(fi == 0)", "boolean function",
|
||||
"type a boolean function that will be evaluated in order to select a subset of faces<br>"));
|
||||
break;
|
||||
|
||||
case FF_GEOM_FUNC :
|
||||
parlst.addString("x","x", "func x = ", "insert function to generate new coord for x");
|
||||
parlst.addString("y","y", "func y = ", "insert function to generate new coord for y");
|
||||
parlst.addString("z","sin(x+y)", "func z = ", "insert function to generate new coord for z");
|
||||
parlst.addParam(new RichString("x","x", "func x = ", "insert function to generate new coord for x"));
|
||||
parlst.addParam(new RichString("y","y", "func y = ", "insert function to generate new coord for y"));
|
||||
parlst.addParam(new RichString("z","sin(x+y)", "func z = ", "insert function to generate new coord for z"));
|
||||
break;
|
||||
|
||||
case FF_FACE_COLOR:
|
||||
parlst.addString("r","255", "func r = ", "function to generate Red component. Expected Range 0-255");
|
||||
parlst.addString("g","0", "func g = ", "function to generate Green component. Expected Range 0-255");
|
||||
parlst.addString("b","255", "func b = ", "function to generate Blue component. Expected Range 0-255");
|
||||
parlst.addParam(new RichString("r","255", "func r = ", "function to generate Red component. Expected Range 0-255"));
|
||||
parlst.addParam(new RichString("g","0", "func g = ", "function to generate Green component. Expected Range 0-255"));
|
||||
parlst.addParam(new RichString("b","255", "func b = ", "function to generate Blue component. Expected Range 0-255"));
|
||||
break;
|
||||
|
||||
case FF_FACE_QUALITY:
|
||||
parlst.addString("q","x0+y0+z0", "func q0 = ", "function to generate new Quality foreach face");
|
||||
parlst.addBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]");
|
||||
parlst.addBool("map",false,"map into color", "if checked map quality generated values into per-vertex color");
|
||||
parlst.addParam(new RichString("q","x0+y0+z0", "func q0 = ", "function to generate new Quality foreach face"));
|
||||
parlst.addParam(new RichBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]"));
|
||||
parlst.addParam(new RichBool("map",false,"map into color", "if checked map quality generated values into per-vertex color"));
|
||||
break;
|
||||
|
||||
case FF_VERT_COLOR:
|
||||
parlst.addString("x","255", "func r = ", "function to generate Red component. Expected Range 0-255");
|
||||
parlst.addString("y","255", "func g = ", "function to generate Green component. Expected Range 0-255");
|
||||
parlst.addString("z","0", "func b = ", "function to generate Blue component. Expected Range 0-255");
|
||||
parlst.addParam(new RichString("x","255", "func r = ", "function to generate Red component. Expected Range 0-255"));
|
||||
parlst.addParam(new RichString("y","255", "func g = ", "function to generate Green component. Expected Range 0-255"));
|
||||
parlst.addParam(new RichString("z","0", "func b = ", "function to generate Blue component. Expected Range 0-255"));
|
||||
break;
|
||||
|
||||
case FF_VERT_QUALITY:
|
||||
parlst.addString("q","vi", "func q = ", "function to generate new Quality for every vertex");
|
||||
parlst.addBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]");
|
||||
parlst.addBool("map",false,"map into color", "if checked map quality generated values into per-vertex color");
|
||||
parlst.addParam(new RichString("q","vi", "func q = ", "function to generate new Quality for every vertex"));
|
||||
parlst.addParam(new RichBool("normalize",false,"normalize","if checked normalize all quality values in range [0..1]"));
|
||||
parlst.addParam(new RichBool("map",false,"map into color", "if checked map quality generated values into per-vertex color"));
|
||||
break;
|
||||
|
||||
case FF_DEF_VERT_ATTRIB:
|
||||
parlst.addString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name");
|
||||
parlst.addString("expr","x","Function =", "function to calculate custom attribute value for each vertex");
|
||||
parlst.addParam(new RichString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name"));
|
||||
parlst.addParam(new RichString("expr","x","Function =", "function to calculate custom attribute value for each vertex"));
|
||||
break;
|
||||
|
||||
case FF_DEF_FACE_ATTRIB:
|
||||
parlst.addString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name");
|
||||
parlst.addString("expr","fi","Function =", "function to calculate custom attribute value for each vertex");
|
||||
parlst.addParam(new RichString("name","Radiosity","Name", "the name of new attribute. you can access attribute in other filters through this name"));
|
||||
parlst.addParam(new RichString("expr","fi","Function =", "function to calculate custom attribute value for each vertex"));
|
||||
break;
|
||||
|
||||
case FF_GRID :
|
||||
parlst.addInt("numVertX", 10, "num vertices on x", "number of vertices on x. it must be positive");
|
||||
parlst.addInt("numVertY", 10, "num vertices on y", "number of vertices on y. it must be positive");
|
||||
parlst.addFloat("absScaleX", 0.3f, "x scale", "absolute scale on x (float)");
|
||||
parlst.addFloat("absScaleY", 0.3f, "y scale", "absolute scale on y (float)");
|
||||
parlst.addBool("center",false,"centered on origin", "center grid generated by filter on origin.<br>"
|
||||
"Grid is first generated and than moved into origin (using muparser lib to perform fast calc on every vertex)");
|
||||
parlst.addParam(new RichInt("numVertX", 10, "num vertices on x", "number of vertices on x. it must be positive"));
|
||||
parlst.addParam(new RichInt("numVertY", 10, "num vertices on y", "number of vertices on y. it must be positive"));
|
||||
parlst.addParam(new RichFloat("absScaleX", 0.3f, "x scale", "absolute scale on x (float)"));
|
||||
parlst.addParam(new RichFloat("absScaleY", 0.3f, "y scale", "absolute scale on y (float)"));
|
||||
parlst.addParam(new RichBool("center",false,"centered on origin", "center grid generated by filter on origin.<br>"
|
||||
"Grid is first generated and than moved into origin (using muparser lib to perform fast calc on every vertex)"));
|
||||
break;
|
||||
case FF_ISOSURFACE :
|
||||
parlst.addFloat("voxelSize", 0.05, "Size of Voxel", "Size of the voxel that is used by for the grid where the field is sampled. Smaller this value, higher precision, but higher processing times.");
|
||||
parlst.addFloat("minX", -1, "Min X", "Range where the field is sampled");
|
||||
parlst.addFloat("minY", -1, "Min Y", "Range where the field is sampled");
|
||||
parlst.addFloat("minZ", -1, "Min Z", "Range where the field is sampled");
|
||||
parlst.addFloat("maxX", 1, "Max X", "Range where the field is sampled");
|
||||
parlst.addFloat("maxY", 1, "Max Y", "Range where the field is sampled");
|
||||
parlst.addFloat("maxZ", 1, "Max Z", "Range where the field is sampled");
|
||||
parlst.addString("expr","x*x+y*y+z*z-0.5","Function =", "This expression is evaluated for each voxel of the grid. The surface passing through the zero valued points of this field is then extracted using marching cube.");
|
||||
parlst.addParam(new RichFloat("voxelSize", 0.05, "Size of Voxel", "Size of the voxel that is used by for the grid where the field is sampled. Smaller this value, higher precision, but higher processing times."));
|
||||
parlst.addParam(new RichFloat("minX", -1, "Min X", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichFloat("minY", -1, "Min Y", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichFloat("minZ", -1, "Min Z", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichFloat("maxX", 1, "Max X", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichFloat("maxY", 1, "Max Y", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichFloat("maxZ", 1, "Max Z", "Range where the field is sampled"));
|
||||
parlst.addParam(new RichString("expr","x*x+y*y+z*z-0.5","Function =", "This expression is evaluated for each voxel of the grid. The surface passing through the zero valued points of this field is then extracted using marching cube."));
|
||||
|
||||
break;
|
||||
|
||||
case FF_REFINE :
|
||||
parlst.addString("condSelect","(q0 >= 0 and q1 >= 0)","boolean function","type a boolean function that will be evaluated on every edge");
|
||||
parlst.addString("x","(x0+x1)/2","x =","function to generate x coord of new vertex in [x0,x1].<br>For example (x0+x1)/2");
|
||||
parlst.addString("y","(y0+y1)/2","y =","function to generate x coord of new vertex in [y0,y1].<br>For example (y0+y1)/2");
|
||||
parlst.addString("z","(z0+z1)/2","z =","function to generate x coord of new vertex in [z0,z1].<br>For example (z0+z1)/2");
|
||||
parlst.addParam(new RichString("condSelect","(q0 >= 0 and q1 >= 0)","boolean function","type a boolean function that will be evaluated on every edge"));
|
||||
parlst.addParam(new RichString("x","(x0+x1)/2","x =","function to generate x coord of new vertex in [x0,x1].<br>For example (x0+x1)/2"));
|
||||
parlst.addParam(new RichString("y","(y0+y1)/2","y =","function to generate x coord of new vertex in [y0,y1].<br>For example (y0+y1)/2"));
|
||||
parlst.addParam(new RichString("z","(z0+z1)/2","z =","function to generate x coord of new vertex in [z0,z1].<br>For example (z0+z1)/2"));
|
||||
break;
|
||||
|
||||
default : assert(0);
|
||||
@ -302,7 +302,7 @@ void FilterFunctionPlugin::initParameterSet(QAction *action,MeshModel &m, Filter
|
||||
}
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
Q_UNUSED(cb);
|
||||
switch(ID(filter)) {
|
||||
|
||||
@ -69,9 +69,9 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
void showParserError(const QString &s, mu::Parser::exception_type &e);
|
||||
void normalizeVertexQuality(MeshModel &m);
|
||||
void normalizeFaceQuality(MeshModel &m);
|
||||
|
||||
@ -141,12 +141,12 @@ const QhullPlugin::FilterClass QhullPlugin::getClass(QAction *a)
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_QHULL_CONVEX_HULL :
|
||||
{
|
||||
parlst.addBool("reorient", false,"Re-orient all faces coherentely","Re-orient all faces coherentely");
|
||||
parlst.addParam(new RichBool("reorient", false,"Re-orient all faces coherentely","Re-orient all faces coherentely"));
|
||||
break;
|
||||
}
|
||||
case FP_QHULL_DELAUNAY_TRIANGULATION :
|
||||
@ -155,46 +155,46 @@ void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameter
|
||||
}
|
||||
case FP_QHULL_VORONOI_FILTERING :
|
||||
{
|
||||
parlst.addDynamicFloat("threshold",0.0f, 0.0f, 2000.0f,"threshold ","Factor that, multiplied to the bbox diagonal,"
|
||||
parlst.addParam(new RichDynamicFloat("threshold",0.0f, 0.0f, 2000.0f,"threshold ","Factor that, multiplied to the bbox diagonal,"
|
||||
"set a threshold used to discard the voronoi vertices too far from the origin."
|
||||
"They can cause problems to the qhull library.<br>"
|
||||
"Growing values of 'threshold' will add more voronoi vertices for a better surface"
|
||||
"reconstruction.");
|
||||
"reconstruction."));
|
||||
break;
|
||||
}
|
||||
case FP_QHULL_ALPHA_COMPLEX_AND_SHAPE:
|
||||
{
|
||||
parlst.addAbsPerc("alpha",0,0,m.cm.bbox.Diag(),tr("Alpha value"),tr("Compute the alpha value as percentage of the diagonal of the bbox"));
|
||||
parlst.addEnum("Filtering", 0,
|
||||
parlst.addParam(new RichAbsPerc("alpha",0,0,m.cm.bbox.Diag(),tr("Alpha value"),tr("Compute the alpha value as percentage of the diagonal of the bbox")));
|
||||
parlst.addParam(new RichEnum("Filtering", 0,
|
||||
QStringList() << "Alpha Complex" << "Alpha Shape" ,
|
||||
tr("Get:"),
|
||||
tr("Select the output. The Alpha Shape is the boundary of the Alpha Complex"));
|
||||
tr("Select the output. The Alpha Shape is the boundary of the Alpha Complex")));
|
||||
break;
|
||||
}
|
||||
case FP_QHULL_VISIBLE_POINTS:
|
||||
{
|
||||
parlst.addDynamicFloat("radiusThreshold",
|
||||
parlst.addParam(new RichDynamicFloat("radiusThreshold",
|
||||
0.0f, 0.0f, 7.0f,
|
||||
"radius threshold ","Bounds the radius of the sphere used to select visible points."
|
||||
"It is used to adjust the radius of the sphere (calculated as distance between the center and the farthest point from it) "
|
||||
"according to the following equation: <br>"
|
||||
"radius = radius * pow(10,threshold); <br>"
|
||||
"As the radius increases more points are marked as visible."
|
||||
"Use a big threshold for dense point clouds, a small one for sparse clouds.");
|
||||
"Use a big threshold for dense point clouds, a small one for sparse clouds."));
|
||||
|
||||
parlst.addBool ("usecamera",
|
||||
parlst.addParam(new RichBool ("usecamera",
|
||||
false,
|
||||
"Use ViewPoint from Mesh Camera",
|
||||
"Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs");
|
||||
parlst.addPoint3f("viewpoint",
|
||||
"Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs"));
|
||||
parlst.addParam(new RichPoint3f("viewpoint",
|
||||
Point3f(0.0f, 0.0f, 0.0f),
|
||||
"ViewPoint",
|
||||
"if UseCamera is true, this value is ignored");
|
||||
"if UseCamera is true, this value is ignored"));
|
||||
|
||||
parlst.addBool("convex_hullFP",false,"Show Partial Convex Hull of flipped points", "Show Partial Convex Hull of the transformed point cloud");
|
||||
parlst.addBool("triangVP",false,"Show a triangulation of the visible points", "Show a triangulation of the visible points");
|
||||
parlst.addBool("reorient", false,"Re-orient all faces of the CH coherentely","Re-orient all faces of the CH coherentely."
|
||||
"If no Convex Hulls are selected , this value is ignored");
|
||||
parlst.addParam(new RichBool("convex_hullFP",false,"Show Partial Convex Hull of flipped points", "Show Partial Convex Hull of the transformed point cloud"));
|
||||
parlst.addParam(new RichBool("triangVP",false,"Show a triangulation of the visible points", "Show a triangulation of the visible points"));
|
||||
parlst.addParam(new RichBool("reorient", false,"Re-orient all faces of the CH coherentely","Re-orient all faces of the CH coherentely."
|
||||
"If no Convex Hulls are selected , this value is ignored"));
|
||||
break;
|
||||
break;
|
||||
}
|
||||
@ -203,7 +203,7 @@ void QhullPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameter
|
||||
}
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos */* cb*/)
|
||||
bool QhullPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos */* cb*/)
|
||||
{
|
||||
switch(ID(filter))
|
||||
{
|
||||
|
||||
@ -61,9 +61,9 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
|
||||
};
|
||||
|
||||
@ -83,26 +83,29 @@ const MeshFilterInterface::FilterClass QualityMapperFilter::getClass(QAction *a)
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
//void QualityMapperFilter::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
//void QualityMapperFilter::initParList(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_QUALITY_MAPPER :
|
||||
{
|
||||
_meshMinMaxQuality = tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(m.cm);
|
||||
|
||||
parlst.addFloat("minQualityVal", _meshMinMaxQuality.minV, "Minimum mesh quality","The specified quality value is mapped in the <b>lower</b> end of the choosen color scale. Default value: the minumum quality value found on the mesh." );
|
||||
parlst.addFloat("maxQualityVal", _meshMinMaxQuality.maxV, "Maximum mesh quality","The specified quality value is mapped in the <b>upper</b> end of the choosen color scale. Default value: the maximum quality value found on the mesh." );
|
||||
parlst.addFloat("midHandlePos", 50, "Gamma biasing (0..100)", "Defines a gamma compression of the quality values, by setting the position of the middle of the color scale. Value is defined as a percentage (0..100). Default value is 50, that corresponds to a linear mapping." );
|
||||
parlst.addFloat("brightness", 1.0f, "Mesh brightness", "must be between 0 and 2. 0 represents a completely dark mesh, 1 represents a mesh colorized with original colors, 2 represents a completely bright mesh");
|
||||
parlst.addParam(new RichFloat("minQualityVal", _meshMinMaxQuality.minV, "Minimum mesh quality","The specified quality value is mapped in the <b>lower</b> end of the choosen color scale. Default value: the minumum quality value found on the mesh." ));
|
||||
parlst.addParam(new RichFloat("maxQualityVal", _meshMinMaxQuality.maxV, "Maximum mesh quality","The specified quality value is mapped in the <b>upper</b> end of the choosen color scale. Default value: the maximum quality value found on the mesh." ));
|
||||
parlst.addParam(new RichFloat("midHandlePos", 50, "Gamma biasing (0..100)", "Defines a gamma compression of the quality values, by setting the position of the middle of the color scale. Value is defined as a percentage (0..100). Default value is 50, that corresponds to a linear mapping." ));
|
||||
parlst.addParam(new RichFloat("brightness", 1.0f, "Mesh brightness", "must be between 0 and 2. 0 represents a completely dark mesh, 1 represents a mesh colorized with original colors, 2 represents a completely bright mesh"));
|
||||
//setting default transfer functions names
|
||||
TransferFunction::defaultTFs[GREY_SCALE_TF] = "Grey Scale";
|
||||
TransferFunction::defaultTFs[MESHLAB_RGB_TF] = "Meshlab RGB";
|
||||
TransferFunction::defaultTFs[RGB_TF] = "RGB";
|
||||
TransferFunction::defaultTFs[FRENCH_RGB_TF] = "French RGB";
|
||||
TransferFunction::defaultTFs[RED_SCALE_TF] = "Red Scale";
|
||||
TransferFunction::defaultTFs[GREEN_SCALE_TF] = "Green Scale";
|
||||
TransferFunction::defaultTFs[BLUE_SCALE_TF] = "Blue Scale";
|
||||
TransferFunction::defaultTFs[FLAT_TF] = "Flat";
|
||||
TransferFunction::defaultTFs[SAW_4_TF] = "Saw 4";
|
||||
TransferFunction::defaultTFs[SAW_8_TF] = "Saw 8";
|
||||
|
||||
QStringList tfList;
|
||||
tfList << "Custom Transfer Function File";
|
||||
@ -110,8 +113,8 @@ void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, FilterP
|
||||
//fetching and adding default TFs to TFList
|
||||
tfList << TransferFunction::defaultTFs[(STARTUP_TF_TYPE + i)%NUMBER_OF_DEFAULT_TF];
|
||||
|
||||
parlst.addEnum( "TFsList", 1, tfList, "Transfer Function type to apply to filter", "Choose the Transfer Function to apply to the filter" );
|
||||
parlst.addString("csvFileName", "", "Custom TF Filename", "Filename of the transfer function to be loaded, used only if you have chosen the Custom Transfer Function." );
|
||||
parlst.addParam(new RichEnum( "TFsList", 1, tfList, "Transfer Function type to apply to filter", "Choose the Transfer Function to apply to the filter" ));
|
||||
parlst.addParam(new RichString("csvFileName", "", "Custom TF Filename", "Filename of the transfer function to be loaded, used only if you have chosen the Custom Transfer Function." ));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -121,7 +124,7 @@ void QualityMapperFilter::initParameterSet(QAction *action,MeshModel &m, FilterP
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// Apply color to mesh vertexes
|
||||
bool QualityMapperFilter::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool QualityMapperFilter::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
Q_UNUSED(filter);
|
||||
Q_UNUSED(cb);
|
||||
@ -145,11 +148,11 @@ bool QualityMapperFilter::applyFilter(QAction *filter, MeshModel &m, FilterParam
|
||||
//text TF
|
||||
QString csvFileName = par.getString("csvFileName");
|
||||
if ( csvFileName != "" && loadEqualizerInfo(csvFileName, &eqData) > 0 )
|
||||
{
|
||||
par.setFloat("minQualityVal", eqData.minQualityVal );
|
||||
par.setFloat("maxQualityVal", eqData.maxQualityVal );
|
||||
par.setFloat("midHandlePos", _meshMinMaxQuality.minV + ((_meshMinMaxQuality.maxV-_meshMinMaxQuality.minV)/eqData.midQualityPercentage));
|
||||
par.setFloat("brightness", eqData.brightness);
|
||||
{
|
||||
par.setValue("minQualityVal", FloatValue(eqData.minQualityVal) );
|
||||
par.setValue("maxQualityVal", FloatValue(eqData.maxQualityVal) );
|
||||
par.setValue("midHandlePos", FloatValue(_meshMinMaxQuality.minV + ((_meshMinMaxQuality.maxV-_meshMinMaxQuality.minV)/eqData.midQualityPercentage)));
|
||||
par.setValue("brightness", FloatValue(eqData.brightness));
|
||||
|
||||
//building new TF object from external file
|
||||
transferFunction = new TransferFunction( par.getString("csvFileName") );
|
||||
|
||||
@ -74,8 +74,8 @@ public:
|
||||
int getPreConditions(QAction *) const;
|
||||
int postCondition( QAction* ) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
};
|
||||
|
||||
|
||||
@ -204,20 +204,20 @@ int TriOptimizePlugin::postCondition(QAction *a) const
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m,
|
||||
FilterParameterSet & parlst)
|
||||
RichParameterSet & parlst)
|
||||
{
|
||||
if (ID(action) == FP_CURVATURE_EDGE_FLIP) {
|
||||
parlst.addBool("selection", m.cm.sfn > 0, tr("Update selection"), tr("Apply edge flip optimization on selected faces only"));
|
||||
parlst.addFloat("pthreshold", 1.0f,
|
||||
parlst.addParam(new RichBool("selection", m.cm.sfn > 0, tr("Update selection"), tr("Apply edge flip optimization on selected faces only")));
|
||||
parlst.addParam(new RichFloat("pthreshold", 1.0f,
|
||||
tr("Angle Thr (deg)"),
|
||||
tr("To avoid excessive flipping/swapping we consider only couple of faces with a significant diedral angle (e.g. greater than the indicated threshold). "));
|
||||
tr("To avoid excessive flipping/swapping we consider only couple of faces with a significant diedral angle (e.g. greater than the indicated threshold). ")));
|
||||
|
||||
QStringList cmetrics;
|
||||
cmetrics.push_back("mean");
|
||||
cmetrics.push_back("norm squared");
|
||||
cmetrics.push_back("absolute");
|
||||
|
||||
parlst.addEnum("curvtype", 0, cmetrics, tr("Curvature metric"),
|
||||
parlst.addParam(new RichEnum("curvtype", 0, cmetrics, tr("Curvature metric"),
|
||||
tr("<p style=\'white-space:pre\'>"
|
||||
"Choose a metric to compute surface curvature on vertices<br>"
|
||||
"H = mean curv, K = gaussian curv, A = area per vertex<br><br>"
|
||||
@ -225,15 +225,15 @@ void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m,
|
||||
"2: Norm squared mean curvature = (H * H) / A<br>"
|
||||
"3: Absolute curvature:<br>"
|
||||
" if(K >= 0) return 2 * H<br>"
|
||||
" else return 2 * sqrt(H ^ 2 - A * K)"));
|
||||
" else return 2 * sqrt(H ^ 2 - A * K)")));
|
||||
}
|
||||
|
||||
if (ID(action) == FP_PLANAR_EDGE_FLIP) {
|
||||
parlst.addBool("selection", m.cm.sfn > 0, tr("Update selection"), tr("Apply edge flip optimization on selected faces only"));
|
||||
parlst.addParam(new RichBool("selection", m.cm.sfn > 0, tr("Update selection"), tr("Apply edge flip optimization on selected faces only")));
|
||||
|
||||
parlst.addFloat("pthreshold", 1.0f,
|
||||
parlst.addParam(new RichFloat("pthreshold", 1.0f,
|
||||
tr("Planar threshold (deg)"),
|
||||
tr("angle threshold for planar faces (degrees)"));
|
||||
tr("angle threshold for planar faces (degrees)")));
|
||||
|
||||
QStringList pmetrics;
|
||||
pmetrics.push_back("area/max side");
|
||||
@ -241,7 +241,7 @@ void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m,
|
||||
pmetrics.push_back("mean ratio");
|
||||
pmetrics.push_back("delaunay");
|
||||
pmetrics.push_back("topology");
|
||||
parlst.addEnum("planartype", 0, pmetrics, tr("Planar metric"),
|
||||
parlst.addParam(new RichEnum("planartype", 0, pmetrics, tr("Planar metric"),
|
||||
tr("<p style=\'white-space:pre\'>"
|
||||
"Choose a metric to define the planar flip operation<br><br>"
|
||||
"Triangle quality based<br>"
|
||||
@ -251,22 +251,22 @@ void TriOptimizePlugin::initParameterSet(QAction *action, MeshModel &m,
|
||||
" M transform triangle into equilateral<br><br>"
|
||||
"Others<br>"
|
||||
"4: Fix the Delaunay condition between two faces<br>"
|
||||
"5: Do the flip to improve local topology<br>"));
|
||||
parlst.addInt("iterations", 1, "Post optimization relax iter", tr("number of a planar laplacian smooth iterations that have to be performed after every run"));
|
||||
"5: Do the flip to improve local topology<br>")));
|
||||
parlst.addParam(new RichInt("iterations", 1, "Post optimization relax iter", tr("number of a planar laplacian smooth iterations that have to be performed after every run")));
|
||||
|
||||
}
|
||||
|
||||
if (ID(action) == FP_NEAR_LAPLACIAN_SMOOTH) {
|
||||
parlst.addBool("selection", false, tr("Update selection"), tr("Apply laplacian smooth on selected faces only"));
|
||||
parlst.addFloat("AngleDeg", 0.5f, tr("Max Normal Dev (deg)"), tr("maximum mean normal angle displacement (degrees) from old to new faces"));
|
||||
parlst.addInt("iterations", 1, "Iterations", tr("number of laplacian smooth iterations in every run"));
|
||||
parlst.addParam(new RichBool("selection", false, tr("Update selection"), tr("Apply laplacian smooth on selected faces only")));
|
||||
parlst.addParam(new RichFloat("AngleDeg", 0.5f, tr("Max Normal Dev (deg)"), tr("maximum mean normal angle displacement (degrees) from old to new faces")));
|
||||
parlst.addParam(new RichInt("iterations", 1, "Iterations", tr("number of laplacian smooth iterations in every run")));
|
||||
}
|
||||
}
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// Run mesh optimization
|
||||
bool TriOptimizePlugin::applyFilter(QAction *filter, MeshModel &m,
|
||||
FilterParameterSet & par,
|
||||
RichParameterSet & par,
|
||||
vcg::CallBackPos *cb)
|
||||
{
|
||||
float limit = -std::numeric_limits<float>::epsilon();
|
||||
|
||||
@ -48,8 +48,8 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet &/*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet &/*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual int postCondition( QAction* ) const;
|
||||
|
||||
@ -80,34 +80,34 @@ void FilterScriptDialog::applyScript()
|
||||
for(int action = 0; action < scriptPtr->actionList.size(); action++)
|
||||
{
|
||||
|
||||
FilterParameterSet ¶meterSet = scriptPtr->actionList[action].second;
|
||||
RichParameterSet ¶meterSet = scriptPtr->actionList[action].second;
|
||||
|
||||
for(int i = 0; i < parameterSet.paramList.size(); i++)
|
||||
{
|
||||
//get a modifieable reference
|
||||
FilterParameter ¶meter = parameterSet.paramList[i];
|
||||
RichParameter* parameter = parameterSet.paramList[i];
|
||||
|
||||
//if this is a mesh paramter and the pointer not valid
|
||||
if(parameter.fieldType == FilterParameter::PARMESH &&
|
||||
!mainWindow->GLA()->meshDoc.meshList.contains((MeshModel*)parameter.pointerVal) )
|
||||
{
|
||||
//if the meshmodel pointer is not in the document but not null there must be a problem
|
||||
if(NULL != parameter.pointerVal )
|
||||
{
|
||||
qDebug() << "meshdoc gave us null";
|
||||
QMessageBox::critical(this, tr("Script Failure"), QString("Failed because you set a script parameter to be a mesh which does not exist anymore."));
|
||||
return;
|
||||
} else if(parameter.fieldVal.toInt() >= mainWindow->GLA()->meshDoc.meshList.size() || parameter.fieldVal.toInt() < 0)
|
||||
{
|
||||
qDebug() << "integer is out of bounds:" << parameter.fieldVal.toInt();
|
||||
QMessageBox::critical(this, tr("Script Failure"), QString("One of the filters in the script needs more meshes than you have loaded."));
|
||||
return;
|
||||
} else {
|
||||
qDebug() << "meshdoc has non null value";
|
||||
parameter.pointerVal = mainWindow->GLA()->meshDoc.getMesh(parameter.fieldVal.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
// if(parameter.fieldType == FilterParameter::PARMESH &&
|
||||
// !mainWindow->GLA()->meshDoc.meshList.contains((MeshModel*)parameter.pointerVal) )
|
||||
// {
|
||||
// //if the meshmodel pointer is not in the document but not null there must be a problem
|
||||
// if(NULL != parameter.pointerVal )
|
||||
// {
|
||||
// qDebug() << "meshdoc gave us null";
|
||||
// QMessageBox::critical(this, tr("Script Failure"), QString("Failed because you set a script parameter to be a mesh which does not exist anymore."));
|
||||
// return;
|
||||
// } else if(parameter.fieldVal.toInt() >= mainWindow->GLA()->meshDoc.meshList.size() || parameter.fieldVal.toInt() < 0)
|
||||
// {
|
||||
// qDebug() << "integer is out of bounds:" << parameter.fieldVal.toInt();
|
||||
// QMessageBox::critical(this, tr("Script Failure"), QString("One of the filters in the script needs more meshes than you have loaded."));
|
||||
// return;
|
||||
// } else {
|
||||
// qDebug() << "meshdoc has non null value";
|
||||
// parameter.pointerVal = mainWindow->GLA()->meshDoc.getMesh(parameter.fieldVal.toInt());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ void FilterScriptDialog::moveSelectedFilterUp()
|
||||
int currentRow = ui.scriptListWidget->currentRow();
|
||||
|
||||
//move item up in list
|
||||
QPair<QString, FilterParameterSet> pair = scriptPtr->actionList.takeAt(currentRow);
|
||||
QPair<QString, RichParameterSet> pair = scriptPtr->actionList.takeAt(currentRow);
|
||||
scriptPtr->actionList.insert(currentRow-1, pair);
|
||||
|
||||
//move item up on ui
|
||||
@ -163,7 +163,7 @@ void FilterScriptDialog::moveSelectedFilterDown()
|
||||
int currentRow = ui.scriptListWidget->currentRow();
|
||||
|
||||
//move item down in list
|
||||
QPair<QString, FilterParameterSet> pair = scriptPtr->actionList.takeAt(currentRow);
|
||||
QPair<QString, RichParameterSet> pair = scriptPtr->actionList.takeAt(currentRow);
|
||||
scriptPtr->actionList.insert(currentRow+1, pair);
|
||||
|
||||
//move item down on ui
|
||||
@ -193,7 +193,7 @@ void FilterScriptDialog::editSelectedFilterParameters()
|
||||
return;
|
||||
|
||||
QString actionName = scriptPtr->actionList.at(currentRow).first;
|
||||
FilterParameterSet oldParameterSet = scriptPtr->actionList.at(currentRow).second;
|
||||
RichParameterSet oldParameterSet = scriptPtr->actionList.at(currentRow).second;
|
||||
|
||||
//get the main window
|
||||
MainWindow *mainWindow = qobject_cast<MainWindow*>(parentWidget());
|
||||
@ -215,14 +215,14 @@ void FilterScriptDialog::editSelectedFilterParameters()
|
||||
|
||||
//fill the paramter set with all the names and descriptions which are lost in the
|
||||
//filter script
|
||||
FilterParameterSet newParameterSet;
|
||||
RichParameterSet newParameterSet;
|
||||
iFilter->initParameterSet(action, mainWindow->GLA()->meshDoc, newParameterSet);
|
||||
|
||||
if(newParameterSet.paramList.size() == oldParameterSet.paramList.size())
|
||||
{
|
||||
//now set values to be the old values
|
||||
for(int i = 0; i < newParameterSet.paramList.size(); i++)
|
||||
newParameterSet.paramList[i].setValue(oldParameterSet.paramList.at(i));
|
||||
newParameterSet.paramList[i]->val = oldParameterSet.paramList[i]->val;
|
||||
} else
|
||||
qDebug() << "the size of the given list is not the same as the filter suggests it should be. your filter script may be out of date, or there is a bug in the filter script class";
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -33,159 +33,634 @@
|
||||
#include <meshlab/meshmodel.h>
|
||||
|
||||
|
||||
/*
|
||||
The Filter Parameter class
|
||||
The plugin for each filter exposes a set of typed parameters.
|
||||
The invocation of a filter requires that these parameters have the specified values.
|
||||
The Specification of the parameters can be done in two ways, either by an automatic dialog constructed by the MeshLab framework or by a user built dialog.
|
||||
|
||||
*/
|
||||
class FilterParameterSet;
|
||||
class FilterParameter
|
||||
class Value
|
||||
{
|
||||
public:
|
||||
FilterParameter()
|
||||
{
|
||||
fieldType=-1;
|
||||
}
|
||||
|
||||
FilterParameter(QString name, QString desc, QString tooltip)
|
||||
{
|
||||
fieldType=-1;
|
||||
fieldName=name;
|
||||
fieldDesc=desc;
|
||||
fieldToolTip=tooltip;
|
||||
pointerVal = 0;
|
||||
}
|
||||
|
||||
enum ParType
|
||||
{
|
||||
PARBOOL = 1,
|
||||
PARINT = 2,
|
||||
PARFLOAT = 3,
|
||||
PARSTRING = 4,
|
||||
PARABSPERC = 5,
|
||||
PARMATRIX = 6,
|
||||
PARCOLOR = 7,
|
||||
PARENUM = 8,
|
||||
PARMESH = 9,
|
||||
PARFLOATLIST = 10,
|
||||
PARDYNFLOAT = 11,
|
||||
PAROPENFILENAME = 12,
|
||||
PARSAVEFILENAME = 13,
|
||||
PARPOINT3F = 14
|
||||
};
|
||||
|
||||
QString fieldName;
|
||||
QString fieldDesc;
|
||||
QString fieldToolTip;
|
||||
QVariant fieldVal;
|
||||
|
||||
// The type of the parameter
|
||||
int fieldType;
|
||||
|
||||
float min; // used by the AbsPerc and DynFloat types
|
||||
float max;
|
||||
//int mask; // used by the DynFloat types
|
||||
void *pointerVal;
|
||||
QStringList enumValues;
|
||||
|
||||
//set the value to be that of the input paramter
|
||||
//needed because min, max, enumValues complicate things
|
||||
void setValue(const FilterParameter &inputParameter)
|
||||
{
|
||||
assert(fieldType == inputParameter.fieldType);
|
||||
fieldVal = inputParameter.fieldVal;
|
||||
min = inputParameter.min;
|
||||
max = inputParameter.max;
|
||||
pointerVal = inputParameter.pointerVal;
|
||||
|
||||
//clear any old values
|
||||
enumValues.clear();
|
||||
//add all the new ones
|
||||
enumValues += inputParameter.enumValues;
|
||||
}
|
||||
|
||||
//an equals operator that compares the field name and field type
|
||||
bool operator==(const FilterParameter &inputParameter) const
|
||||
{
|
||||
return (fieldName == inputParameter.fieldName);
|
||||
}
|
||||
|
||||
bool WriteToSettings(QSettings &qs);
|
||||
bool readFromSettings(QSettings &qs);
|
||||
|
||||
QDomElement createElement(QDomDocument &doc);
|
||||
static void addQDomElement(FilterParameterSet &par, QDomElement &np);
|
||||
public:
|
||||
virtual bool getBool() const {assert(0);return bool();}
|
||||
virtual int getInt() const {assert(0);return int();}
|
||||
virtual float getFloat() const {assert(0);return float();}
|
||||
virtual QString getString() const {assert(0);return QString();}
|
||||
virtual vcg::Matrix44f getMatrix44f() const {assert(0);return vcg::Matrix44f();}
|
||||
virtual vcg::Point3f getPoint3f() const {assert(0);return vcg::Point3f();}
|
||||
virtual QColor getColor() const {assert(0);return QColor();}
|
||||
virtual vcg::Color4b getColor4b() const {assert(0);return vcg::Color4b();}
|
||||
virtual float getAbsPerc() const {assert(0);return float();}
|
||||
virtual int getEnum() const {assert(0);return int();}
|
||||
virtual MeshModel* getMesh() const {assert(0);return NULL;}
|
||||
virtual QList<float> getFloatList() const {assert(0);return QList<float>();}
|
||||
virtual float getDynamicFloat() const {assert(0);return float();}
|
||||
virtual QString getFileName() const {assert(0);return QString();}
|
||||
|
||||
|
||||
static const QString TypeName() { return QString("type");}
|
||||
static const QString ValueName() { return QString("value");}
|
||||
virtual bool isBool() const {return false;}
|
||||
virtual bool isInt() const {return false;}
|
||||
virtual bool isFloat() const {return false;}
|
||||
virtual bool isString() const {return false;}
|
||||
virtual bool isMatrix44f() const {return false;}
|
||||
virtual bool isPoint3f() const {return false;}
|
||||
virtual bool isColor() const {return false;}
|
||||
virtual bool isColor4b() const {return false;}
|
||||
virtual bool isAbsPerc() const {return false;}
|
||||
virtual bool isEnum() const {return false;}
|
||||
virtual bool isMesh() const {return false;}
|
||||
virtual bool isFloatList() const {return false;}
|
||||
virtual bool isDynamicFloat() const {return false;}
|
||||
virtual bool isFileName() const {return false;}
|
||||
|
||||
//chose "val" since it is already used and should be replaced by a constant
|
||||
static const QString ValName() { return QString("val");}
|
||||
static const QString MinName() { return QString("min");}
|
||||
static const QString MaxName() { return QString("max");}
|
||||
static const QString MaskName() { return QString("mask");}
|
||||
static const QString ItemName() { return QString("item");}
|
||||
|
||||
//constants for the type names
|
||||
static const QString MeshPointerName() { return QString("MeshPointer");}
|
||||
static const QString FloatListName() { return QString("FloatList");}
|
||||
static const QString DynamicFloatName() { return QString("DynamicFloat");}
|
||||
static const QString OpenFileNameName() { return QString("OpenFileName");}
|
||||
static const QString SaveFileNameName() { return QString("SaveFileName");}
|
||||
|
||||
virtual void set(const Value& p) = 0;
|
||||
virtual ~Value(){}
|
||||
};
|
||||
|
||||
class BoolValue : public Value
|
||||
{
|
||||
public:
|
||||
BoolValue(const bool val): pval(val){};
|
||||
inline bool getBool() const {return pval;}
|
||||
inline bool isBool() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getBool();}
|
||||
~BoolValue() {}
|
||||
private:
|
||||
bool pval;
|
||||
};
|
||||
|
||||
class IntValue : public Value
|
||||
{
|
||||
public:
|
||||
IntValue(const int val) : pval(val){};
|
||||
inline int getInt() const {return pval;}
|
||||
inline bool isInt() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getInt();}
|
||||
~IntValue(){}
|
||||
private:
|
||||
int pval;
|
||||
};
|
||||
|
||||
class FloatValue : public Value
|
||||
{
|
||||
public:
|
||||
FloatValue(const float val) :pval(val){};
|
||||
inline float getFloat() const {return pval;}
|
||||
inline bool isFloat() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getFloat();}
|
||||
~FloatValue(){}
|
||||
private:
|
||||
float pval;
|
||||
};
|
||||
|
||||
class StringValue : public Value
|
||||
{
|
||||
public:
|
||||
StringValue(const QString& val) :pval(val){};
|
||||
inline QString getString() const {return pval;}
|
||||
inline bool isString() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getString();}
|
||||
~StringValue(){}
|
||||
private:
|
||||
QString pval;
|
||||
};
|
||||
|
||||
class Matrix44fValue : public Value
|
||||
{
|
||||
public:
|
||||
Matrix44fValue(const vcg::Matrix44f& val) :pval(val){};
|
||||
inline vcg::Matrix44f getMatrix44f() const {return pval;}
|
||||
inline bool isMatrix44f() const {return true;}
|
||||
inline void set(const Value& p){pval = p.getMatrix44f();}
|
||||
~Matrix44fValue(){}
|
||||
private:
|
||||
vcg::Matrix44f pval;
|
||||
};
|
||||
|
||||
class Point3fValue : public Value
|
||||
{
|
||||
public:
|
||||
Point3fValue(const vcg::Point3f& val) : pval(val){};
|
||||
inline vcg::Point3f getPoint3f() const {return pval;}
|
||||
inline bool isPoint3f() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getPoint3f();}
|
||||
~Point3fValue(){}
|
||||
private:
|
||||
vcg::Point3f pval;
|
||||
};
|
||||
|
||||
class ColorValue : public Value
|
||||
{
|
||||
public:
|
||||
ColorValue(QColor val) :pval(val){};
|
||||
inline QColor getColor() const {return pval;}
|
||||
inline bool isColor() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getColor();}
|
||||
~ColorValue(){}
|
||||
private:
|
||||
QColor pval;
|
||||
};
|
||||
|
||||
class Color4bValue : public Value
|
||||
{
|
||||
public:
|
||||
Color4bValue(QString name,const vcg::Color4b val) :pval(val){};
|
||||
inline vcg::Color4b getColor4b() const {return pval;}
|
||||
inline bool isColor4b() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getColor4b();}
|
||||
~Color4bValue(){}
|
||||
|
||||
private:
|
||||
vcg::Color4b pval;
|
||||
};
|
||||
|
||||
class AbsPercValue : public FloatValue
|
||||
{
|
||||
public:
|
||||
AbsPercValue(const float val) :FloatValue(val){};
|
||||
inline float getAbsPerc() const {return getFloat();}
|
||||
inline bool isAbsPerc() const {return true;}
|
||||
~AbsPercValue(){}
|
||||
};
|
||||
|
||||
class EnumValue : public IntValue
|
||||
{
|
||||
public:
|
||||
EnumValue(const int val) :IntValue(val){};
|
||||
inline int getEnum() const {return getInt();}
|
||||
inline bool isEnum() const {return true;}
|
||||
~EnumValue(){}
|
||||
};
|
||||
|
||||
class FloatListValue : public Value
|
||||
{
|
||||
public:
|
||||
FloatListValue(QList<float>& val) :pval(val){};
|
||||
inline QList<float> getFloatList() const {return pval;}
|
||||
inline void set(const Value& p) {pval = p.getFloatList();}
|
||||
inline bool isFloatList() const {return true;}
|
||||
~FloatListValue() {}
|
||||
private:
|
||||
QList<float> pval;
|
||||
};
|
||||
|
||||
class DynamicFloatValue : public FloatValue
|
||||
{
|
||||
public:
|
||||
DynamicFloatValue(const float val) :FloatValue(val){};
|
||||
inline float getDynamicFloat() const {return getFloat();}
|
||||
inline bool isDynamicFloat() const {return true;}
|
||||
~DynamicFloatValue() {}
|
||||
};
|
||||
|
||||
class FileValue : public Value
|
||||
{
|
||||
public:
|
||||
FileValue(QString filename) :pval(filename){};
|
||||
inline QString getFileName() const {return pval;}
|
||||
inline bool isFileName() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getFileName();}
|
||||
~FileValue(){}
|
||||
private:
|
||||
QString pval;
|
||||
};
|
||||
|
||||
class MeshValue : public Value
|
||||
{
|
||||
public:
|
||||
MeshValue(MeshModel* mesh) : pval(mesh){};
|
||||
inline MeshModel* getMesh() const {return pval;}
|
||||
inline bool isMesh() const {return true;}
|
||||
inline void set(const Value& p) {pval = p.getMesh();}
|
||||
~MeshValue(){}
|
||||
|
||||
private:
|
||||
MeshModel* pval;
|
||||
};
|
||||
|
||||
/******************************/
|
||||
|
||||
class ParameterDecoration
|
||||
{
|
||||
public:
|
||||
QString fieldDesc;
|
||||
QString tooltip;
|
||||
Value* defVal;
|
||||
|
||||
ParameterDecoration(Value* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:fieldDesc(desc),tooltip(tltip),defVal(defvalue) {}
|
||||
|
||||
virtual ~ParameterDecoration(){delete defVal;}
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
The Filter Parameter class
|
||||
*/
|
||||
class BoolDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
BoolDecoration(BoolValue* defvalue,const QString desc=QString(),const QString tltip=QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~BoolDecoration(){}
|
||||
};
|
||||
|
||||
class FilterParameterSet
|
||||
class IntDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
IntDecoration(IntValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~IntDecoration(){}
|
||||
};
|
||||
|
||||
class FloatDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
FloatDecoration(FloatValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~FloatDecoration(){}
|
||||
};
|
||||
|
||||
class StringDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
StringDecoration(StringValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~StringDecoration(){}
|
||||
};
|
||||
|
||||
class Matrix44fDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
Matrix44fDecoration(Matrix44fValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~Matrix44fDecoration(){}
|
||||
};
|
||||
|
||||
class Point3fDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
Point3fDecoration(Point3fValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~Point3fDecoration(){}
|
||||
};
|
||||
|
||||
class ColorDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
ColorDecoration(ColorValue* defvalue,const QString desc = QString(),const QString tltip= QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~ColorDecoration(){}
|
||||
};
|
||||
|
||||
class Color4bDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
Color4bDecoration(Color4bValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~Color4bDecoration(){}
|
||||
};
|
||||
|
||||
class AbsPercDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
AbsPercDecoration(AbsPercValue* defvalue,const float minVal,const float maxVal,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip),min(minVal),max(maxVal) {}
|
||||
float min;
|
||||
float max;
|
||||
~AbsPercDecoration(){}
|
||||
};
|
||||
|
||||
class EnumDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
EnumDecoration(EnumValue* defvalue, QStringList values,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip),enumvalues(values) {}
|
||||
QStringList enumvalues;
|
||||
~EnumDecoration(){}
|
||||
};
|
||||
|
||||
class FloatListDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
FloatListDecoration(FloatListValue* defvalue,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip) {}
|
||||
~FloatListDecoration(){}
|
||||
};
|
||||
|
||||
class DynamicFloatDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
DynamicFloatDecoration(DynamicFloatValue* defvalue, const float minVal,const float maxVal,const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip),min(minVal),max(maxVal) {}
|
||||
~DynamicFloatDecoration(){};
|
||||
float min;
|
||||
float max;
|
||||
};
|
||||
|
||||
class FileDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
FileDecoration(FileValue* defvalue,const QString extension=QString(".*"),const QString desc = QString(),const QString tltip = QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip),ext(extension) {}
|
||||
~FileDecoration(){}
|
||||
|
||||
QString ext;
|
||||
};
|
||||
|
||||
|
||||
class MeshDecoration : public ParameterDecoration
|
||||
{
|
||||
public:
|
||||
MeshDecoration(MeshValue* defvalue,MeshDocument* doc,const QString desc=QString(), const QString tltip=QString())
|
||||
:ParameterDecoration(defvalue,desc,tltip),meshdoc(doc) { meshindex = doc->meshList.indexOf(defvalue->getMesh()); assert(meshindex != -1);}
|
||||
|
||||
MeshDecoration(int meshindex,MeshDocument* doc,const QString desc=QString(), const QString tltip=QString())
|
||||
:ParameterDecoration(NULL,desc,tltip),meshdoc(doc)
|
||||
{
|
||||
assert(meshindex < doc->size() && meshindex >= 0);
|
||||
defVal = new MeshValue(doc->meshList.at(meshindex));
|
||||
}
|
||||
|
||||
~MeshDecoration(){}
|
||||
|
||||
MeshDocument* meshdoc;
|
||||
int meshindex;
|
||||
};
|
||||
|
||||
/******************************/
|
||||
class RichBool;
|
||||
class RichInt;
|
||||
class RichFloat;
|
||||
class RichString;
|
||||
class RichMatrix44f;
|
||||
class RichPoint3f;
|
||||
class RichColor;
|
||||
class RichColor4b;
|
||||
class RichAbsPerc;
|
||||
class RichEnum;
|
||||
class RichFloatList;
|
||||
class RichDynamicFloat;
|
||||
class RichOpenFile;
|
||||
class RichSaveFile;
|
||||
class RichMesh;
|
||||
|
||||
|
||||
class Visitor
|
||||
{
|
||||
public:
|
||||
|
||||
FilterParameterSet(){}
|
||||
// The data is just a list of Parameters
|
||||
//QMap<QString, FilterParameter *> paramMap;
|
||||
QList<FilterParameter> paramList;
|
||||
bool isEmpty() const {return paramList.isEmpty();}
|
||||
// Members
|
||||
virtual void visit( RichBool& pd) = 0;
|
||||
virtual void visit( RichInt& pd) = 0;
|
||||
virtual void visit( RichFloat& pd) = 0;
|
||||
virtual void visit( RichString& pd) = 0;
|
||||
virtual void visit( RichMatrix44f& pd) = 0;
|
||||
virtual void visit( RichPoint3f& pd) = 0;
|
||||
virtual void visit( RichColor& pd) = 0;
|
||||
virtual void visit( RichColor4b& pd) = 0;
|
||||
virtual void visit( RichAbsPerc& pd) = 0;
|
||||
virtual void visit( RichEnum& pd) = 0;
|
||||
virtual void visit( RichFloatList& pd) = 0;
|
||||
virtual void visit( RichDynamicFloat& pd) = 0;
|
||||
virtual void visit( RichOpenFile& pd) = 0;
|
||||
virtual void visit( RichSaveFile& pd) = 0;
|
||||
virtual void visit( RichMesh& pd) = 0;
|
||||
|
||||
void addBool (QString name, bool defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addInt (QString name, int defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addFloat (QString name, float defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addString (QString name, QString defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addMatrix44 (QString name, vcg::Matrix44f defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addPoint3f (QString name, vcg::Point3f defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addColor (QString name, QColor defaultVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addAbsPerc (QString name, float defaultVal, float minVal, float maxVal, QString desc=QString(), QString tooltip=QString());
|
||||
void addEnum (QString name, int defaultVal, QStringList values, QString desc=QString(), QString tooltip=QString());
|
||||
void addMesh (QString name, MeshModel* m, QString desc=QString(), QString tooltip=QString());
|
||||
|
||||
//make the default the mesh that is at the given position in the mesh document
|
||||
//if the filter is run in a script and has added a mesh for a position that does not exist in the MeshDocument, then the
|
||||
//script will fail to run. this is useful for filters that need more than one mesh to work.
|
||||
//if position is set to -1 no mesh will be chosen by default and a blank option will be put in the Enum
|
||||
void addMesh (QString name, int position, QString desc=QString(), QString tooltip=QString());
|
||||
|
||||
/* A way to collect an arbitrary number of floats. Useful if you want the user to input an array of numbers */
|
||||
void addFloatList(QString name, QList<float> &defaultValue, QString desc=QString(), QString tooltip=QString());
|
||||
void addDynamicFloat(QString name, float defaultVal, float minVal, float maxVal, QString desc=QString(), QString tooltip=QString());
|
||||
|
||||
/* A way to use the built in QT file picker widget: QFileDialog::getOpenFileName
|
||||
* - QString extension - the regular exprssion used to decide what files to display in QT's file picker window
|
||||
*/
|
||||
void addOpenFileName(QString name, QString defaultVal, QString extension=QString(".*"), QString desc=QString(), QString tooltip=QString());
|
||||
|
||||
/* A way to use the built in QT file picker widget: QFileDialog::getSaveFileName
|
||||
* - QString extension - the regular exprssion used to decide what files to display in QT's file picker window
|
||||
*/
|
||||
void addSaveFileName(QString name, QString defaultVal, QString extension=QString(".*"), QString desc=QString(), QString tooltip=QString());
|
||||
|
||||
virtual ~Visitor() {}
|
||||
};
|
||||
|
||||
class RichParameter
|
||||
{
|
||||
public:
|
||||
const QString name;
|
||||
|
||||
Value* val;
|
||||
|
||||
ParameterDecoration* pd;
|
||||
|
||||
|
||||
|
||||
RichParameter(const QString nm,Value* v,ParameterDecoration* prdec)
|
||||
:name(nm),pd(prdec),val(v) {}
|
||||
virtual void accept(Visitor& v) = 0;
|
||||
virtual bool operator==(const RichParameter& rp) = 0;
|
||||
virtual ~RichParameter() {delete val;delete pd;}
|
||||
};
|
||||
|
||||
|
||||
class RichBool : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichBool(const QString nm,const bool defval,const QString desc=QString(),const QString tltip=QString())
|
||||
: RichParameter(nm,new BoolValue(defval),new BoolDecoration(new BoolValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isBool() && (name == rb.name) && (val->getBool() == rb.val->getBool()));}
|
||||
|
||||
~RichBool(){}
|
||||
};
|
||||
|
||||
class RichInt : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichInt(const QString nm,const int defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new IntValue(defval),new IntDecoration(new IntValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isInt() &&(name == rb.name) && (val->getInt() == rb.val->getInt()));}
|
||||
~RichInt(){}
|
||||
};
|
||||
|
||||
class RichFloat : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichFloat(const QString nm,const float defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new FloatValue(defval),new FloatDecoration(new FloatValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isFloat() &&(name == rb.name) && (val->getFloat() == rb.val->getFloat()));}
|
||||
~RichFloat(){}
|
||||
};
|
||||
|
||||
class RichString : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichString(const QString nm,const QString defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new StringValue(defval),new StringDecoration(new StringValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isString() &&(name == rb.name) && (val->getString() == rb.val->getString()));}
|
||||
~RichString(){}
|
||||
};
|
||||
|
||||
class RichMatrix44f : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichMatrix44f(const QString nm,const vcg::Matrix44f& defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new Matrix44fValue(defval),new Matrix44fDecoration(new Matrix44fValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isMatrix44f() &&(name == rb.name) && (val->getMatrix44f() == rb.val->getMatrix44f()));}
|
||||
~RichMatrix44f() {}
|
||||
};
|
||||
|
||||
class RichPoint3f : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichPoint3f(const QString nm,const vcg::Point3f defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new Point3fValue(defval),new Point3fDecoration(new Point3fValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isPoint3f() &&(name == rb.name) && (val->getPoint3f() == rb.val->getPoint3f()));}
|
||||
~RichPoint3f(){}
|
||||
};
|
||||
|
||||
class RichColor : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichColor(const QString nm,const QColor defval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new ColorValue(defval),new ColorDecoration(new ColorValue(defval),desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isColor() &&(name == rb.name) && (val->getColor() == rb.val->getColor()));}
|
||||
~RichColor(){}
|
||||
|
||||
};
|
||||
|
||||
class RichColor4b : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichColor4b(const QString nm,Color4bValue* v,Color4bDecoration* prdec)
|
||||
:RichParameter(nm,v,prdec){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isColor4b() &&(name == rb.name) && (val->getColor4b() == rb.val->getColor4b()));}
|
||||
~RichColor4b() {}
|
||||
};
|
||||
|
||||
class RichAbsPerc : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichAbsPerc(const QString nm,const float defval,const float minval,const float maxval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new AbsPercValue(defval),new AbsPercDecoration(new AbsPercValue(defval),minval,maxval,desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isAbsPerc() &&(name == rb.name) && (val->getAbsPerc() == rb.val->getAbsPerc()));}
|
||||
~RichAbsPerc() {}
|
||||
};
|
||||
|
||||
class RichEnum : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichEnum(const QString nm,const int defval,const QStringList values,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new EnumValue(defval),new EnumDecoration(new EnumValue(defval),values,desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isEnum() &&(name == rb.name) && (val->getEnum() == rb.val->getEnum()));}
|
||||
~RichEnum(){}
|
||||
};
|
||||
|
||||
class RichMesh : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichMesh(const QString nm,MeshModel* defval,MeshDocument* doc,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new MeshValue(defval),new MeshDecoration(new MeshValue(defval),doc,desc,tltip)){}
|
||||
|
||||
RichMesh(const QString nm,int meshindex,MeshDocument* doc,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,NULL,new MeshDecoration(meshindex,doc,desc,tltip))
|
||||
{
|
||||
assert(meshindex < doc->size() && meshindex >= 0);
|
||||
val = new MeshValue(doc->meshList.at(meshindex));
|
||||
}
|
||||
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isMesh() &&(name == rb.name) && (val->getMesh() == rb.val->getMesh()));}
|
||||
~RichMesh(){}
|
||||
};
|
||||
|
||||
class RichFloatList : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichFloatList(const QString nm,FloatListValue* v,FloatListDecoration* prdec)
|
||||
:RichParameter(nm,v,prdec){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isFloatList() &&(name == rb.name) && (val->getFloatList() == rb.val->getFloatList()));}
|
||||
~RichFloatList(){}
|
||||
};
|
||||
|
||||
class RichDynamicFloat : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichDynamicFloat(const QString nm,const float defval,const float minval,const float maxval,const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new DynamicFloatValue(defval),new DynamicFloatDecoration(new DynamicFloatValue(defval),minval,maxval,desc,tltip)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isDynamicFloat() &&(name == rb.name) && (val->getDynamicFloat() == rb.val->getDynamicFloat()));}
|
||||
~RichDynamicFloat(){}
|
||||
|
||||
};
|
||||
|
||||
class RichOpenFile : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichOpenFile(const QString nm,const QString defval,const QString ext = QString("*.*"),const QString desc=QString(),const QString tltip=QString())
|
||||
:RichParameter(nm,new FileValue(defval),new FileDecoration(new FileValue(defval),tltip,desc)){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isFileName() &&(name == rb.name) && (val->getFileName() == rb.val->getFileName()));}
|
||||
~RichOpenFile(){}
|
||||
};
|
||||
|
||||
class RichSaveFile : public RichParameter
|
||||
{
|
||||
public:
|
||||
RichSaveFile(const QString nm,FileValue* v,FileDecoration* prdec)
|
||||
:RichParameter(nm,v,prdec){}
|
||||
void accept(Visitor& v) {v.visit(*this);}
|
||||
bool operator==(const RichParameter& rb) {return (rb.val->isFileName() &&(name == rb.name) && (val->getFileName() == rb.val->getFileName()));}
|
||||
~RichSaveFile(){}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/******************************/
|
||||
|
||||
class RichParameterCopyConstructor : public Visitor
|
||||
{
|
||||
public:
|
||||
RichParameterCopyConstructor(){}
|
||||
|
||||
void visit(RichBool& pd);
|
||||
void visit(RichInt& pd);
|
||||
void visit(RichFloat& pd);
|
||||
void visit(RichString& pd);
|
||||
void visit(RichMatrix44f& pd);
|
||||
void visit(RichPoint3f& pd);
|
||||
void visit(RichColor& pd);
|
||||
void visit(RichColor4b& pd);
|
||||
void visit(RichAbsPerc& pd);
|
||||
|
||||
void visit(RichEnum& pd);
|
||||
void visit(RichFloatList& pd);
|
||||
|
||||
void visit(RichDynamicFloat& pd);
|
||||
|
||||
void visit(RichOpenFile& pd);
|
||||
void visit(RichSaveFile& pd);
|
||||
void visit(RichMesh& pd);
|
||||
|
||||
~RichParameterCopyConstructor() {}
|
||||
|
||||
RichParameter* lastCreated;
|
||||
};
|
||||
|
||||
class RichParameterSet
|
||||
{
|
||||
|
||||
public:
|
||||
RichParameterSet():paramList(){}
|
||||
RichParameterSet(const RichParameterSet& rps);
|
||||
// The data is just a list of Parameters
|
||||
//QMap<QString, FilterParameter *> paramMap;
|
||||
QList<RichParameter*> paramList;
|
||||
bool isEmpty() const {return paramList.isEmpty();}
|
||||
RichParameter* findParameter(QString name);
|
||||
const RichParameter* findParameter(QString name) const;
|
||||
bool hasParameter(QString name);
|
||||
|
||||
|
||||
RichParameterSet& operator=(const RichParameterSet& rps);
|
||||
RichParameterSet& copy(const RichParameterSet& rps);
|
||||
bool operator==(const RichParameterSet& rps);
|
||||
|
||||
RichParameterSet& addParam(RichParameter* pd);
|
||||
|
||||
//remove a parameter from the set by name
|
||||
RichParameterSet& removeParameter(QString name);
|
||||
|
||||
void clear() { paramList.clear(); }
|
||||
|
||||
void setValue(const QString name,const Value& val);
|
||||
|
||||
bool getBool(QString name) const;
|
||||
int getInt(QString name) const;
|
||||
float getFloat(QString name) const;
|
||||
@ -195,41 +670,21 @@ public:
|
||||
QColor getColor(QString name) const;
|
||||
vcg::Color4b getColor4b(QString name) const;
|
||||
float getAbsPerc(QString name) const;
|
||||
int getEnum(QString name) const;
|
||||
int getEnum(QString name) const;
|
||||
MeshModel* getMesh(QString name) const;
|
||||
QList<float> getFloatList(QString name) const;
|
||||
float getDynamicFloat(QString name) const;
|
||||
QString getOpenFileName(QString name) const;
|
||||
QString getSaveFileName(QString name) const;
|
||||
|
||||
void setBool(QString name, bool newVal) ;
|
||||
void setInt(QString name, int newVal) ;
|
||||
void setFloat(QString name, float newVal);
|
||||
void setString(QString name, QString newVal);
|
||||
void setMatrix44(QString name, vcg::Matrix44f newVal);
|
||||
void setPoint3f(QString name, vcg::Point3f newVal);
|
||||
void setColor(QString name, QColor newVal);
|
||||
void setAbsPerc(QString name, float newVal);
|
||||
void setEnum(QString name, int newVal);
|
||||
|
||||
//position is the position of this mesh in the MeshDocument, this is needed for saving this parameter to a script
|
||||
void setMesh(QString name, MeshModel* newVal, int position = 0);
|
||||
void setFloatList(QString name, QList<float> &newValue);
|
||||
void setDynamicFloat(QString name, float newVal);
|
||||
void setOpenFileName(QString name, QString newVal);
|
||||
void setSaveFileName(QString name, QString newVal);
|
||||
|
||||
//int getDynamicFloatMask();
|
||||
|
||||
FilterParameter *findParameter(QString name);
|
||||
const FilterParameter *findParameter(QString name) const;
|
||||
bool hasParameter(QString name);
|
||||
|
||||
//remove a parameter from the set by name
|
||||
void removeParameter(QString name);
|
||||
|
||||
void clear() { paramList.clear(); }
|
||||
|
||||
|
||||
~RichParameterSet();
|
||||
};
|
||||
|
||||
/****************************/
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -77,12 +77,12 @@ bool FilterScript::save(QString filename)
|
||||
{
|
||||
QDomElement tag = doc.createElement("filter");
|
||||
tag.setAttribute(QString("name"),(*ii).first);
|
||||
FilterParameterSet &par=(*ii).second;
|
||||
QList<FilterParameter>::iterator jj;
|
||||
RichParameterSet &par=(*ii).second;
|
||||
QList<RichParameter*>::iterator jj;
|
||||
for(jj=par.paramList.begin();jj!=par.paramList.end();++jj)
|
||||
{
|
||||
QDomElement parElem = (*jj).createElement(doc);
|
||||
tag.appendChild(parElem);
|
||||
//// QDomElement parElem = (*jj).createElement(doc);
|
||||
//// tag.appendChild(parElem);
|
||||
}
|
||||
root.appendChild(tag);
|
||||
}
|
||||
@ -123,12 +123,12 @@ bool FilterScript::open(QString filename)
|
||||
qDebug("FilterScript");
|
||||
for(QDomElement nf = root.firstChildElement("filter"); !nf.isNull(); nf = nf.nextSiblingElement("filter"))
|
||||
{
|
||||
FilterParameterSet par;
|
||||
RichParameterSet par;
|
||||
QString name=nf.attribute("name");
|
||||
qDebug("Reading filter with name %s",qPrintable(name));
|
||||
for(QDomElement np = nf.firstChildElement("Param"); !np.isNull(); np = np.nextSiblingElement("Param"))
|
||||
{
|
||||
FilterParameter::addQDomElement(par,np);
|
||||
//Guido// FilterParameter::addQDomElement(par,np);
|
||||
}
|
||||
actionList.append(qMakePair(name,par));
|
||||
}
|
||||
|
||||
@ -42,8 +42,8 @@ public:
|
||||
bool open(QString filename);
|
||||
bool save(QString filename);
|
||||
|
||||
QList< QPair< QString , FilterParameterSet> > actionList;
|
||||
typedef QList< QPair<QString, FilterParameterSet> >::iterator iterator;
|
||||
QList< QPair< QString , RichParameterSet> > actionList;
|
||||
typedef QList< QPair<QString, RichParameterSet> >::iterator iterator;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -90,8 +90,8 @@ void GLArea::initPreferences()
|
||||
{
|
||||
QSettings settings;
|
||||
prefs.clear();
|
||||
prefs.addColor("BackgroundTop", settings.value("BackgroundTop").value<QColor>(), "Top Background Color", "");
|
||||
prefs.addColor("BackgroundBottom", settings.value("BackgroundBottom").value<QColor>(), "Bottom Background Color", "");
|
||||
//GUIDO// prefs.addColor("BackgroundTop", settings.value("BackgroundTop").value<QColor>(), "Top Background Color", "");
|
||||
//GUIDO// prefs.addColor("BackgroundBottom", settings.value("BackgroundBottom").value<QColor>(), "Bottom Background Color", "");
|
||||
}
|
||||
|
||||
GLArea::~GLArea()
|
||||
@ -308,7 +308,7 @@ void GLArea::paintGL()
|
||||
|
||||
// Draw the selection
|
||||
if(rm.selectedFaces) mm()->RenderSelectedFaces();
|
||||
pair<QAction *,FilterParameterSet *> p;
|
||||
pair<QAction *,RichParameterSet *> p;
|
||||
foreach(p , iDecoratorsList)
|
||||
{
|
||||
MeshDecorateInterface * decorInterface = qobject_cast<MeshDecorateInterface *>(p.first->parent());
|
||||
|
||||
@ -204,7 +204,7 @@ public:
|
||||
void setLightModel();
|
||||
void setView();
|
||||
void resetTrackBall();
|
||||
std::list<std::pair<QAction *,FilterParameterSet *> > iDecoratorsList;
|
||||
std::list<std::pair<QAction *,RichParameterSet *> > iDecoratorsList;
|
||||
|
||||
void setRenderer(MeshRenderInterface *rend, QAction *shader){ iRenderer = rend; currentShader = shader;}
|
||||
MeshRenderInterface * getRenderer() { return iRenderer; }
|
||||
@ -306,7 +306,7 @@ public:
|
||||
bool suspendedEditor;
|
||||
protected:
|
||||
|
||||
FilterParameterSet prefs;
|
||||
RichParameterSet prefs;
|
||||
void initPreferences();
|
||||
void initializeGL();
|
||||
void initTexture();
|
||||
|
||||
@ -78,29 +78,29 @@ public:
|
||||
// This function is called by the framework, for each action at the loading of the plugins.
|
||||
// it allows to add a list of global persistent parameters that can be changed from the meshlab itself.
|
||||
// If your plugins/action has no GlobalParameter, do nothing.
|
||||
virtual void initGlobalParameterSet(QString /*format*/, FilterParameterSet & /*globalparam*/) {}
|
||||
virtual void initGlobalParameterSet(QString /*format*/, RichParameterSet & /*globalparam*/) {}
|
||||
|
||||
// This function is called to initialize the list of additional parameters that a OPENING filter could require
|
||||
// it is called by the framework BEFORE the actual mesh loading to perform to determine how parse the input file
|
||||
// The instanced parameters are then passed to the open at the loading time.
|
||||
// Typical example of use to decide what subportion of a mesh you have to load.
|
||||
// If you do not need any additional processing simply do not override this and ignore the parameterSet in the open
|
||||
virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, FilterParameterSet & /*par*/) {}
|
||||
virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/) {}
|
||||
|
||||
// This function is called to initialize the list of additional parameters that a OPENING filter could require
|
||||
// it is called by the framework AFTER the mesh is already loaded to perform more or less standard processing on the mesh.
|
||||
// typical example: unifying vertices in stl models.
|
||||
// If you do not need any additional processing do nothing.
|
||||
virtual void initOpenParameter(const QString &/*format*/, MeshModel &/*m*/, FilterParameterSet & /*par*/) {}
|
||||
virtual void initOpenParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterSet & /*par*/) {}
|
||||
|
||||
// This is the corresponding function that is called after the mesh is loaded with the initialized parameters
|
||||
virtual void applyOpenParameter(const QString &/*format*/, MeshModel &/*m*/, const FilterParameterSet &/*par*/){}
|
||||
virtual void applyOpenParameter(const QString &/*format*/, MeshModel &/*m*/, const RichParameterSet &/*par*/){}
|
||||
|
||||
// This function is called to initialize the list of additional parameters that a SAVING filter could require
|
||||
// it is called by the framework after the mesh is loaded to perform more or less standard processing on the mesh.
|
||||
// typical example: ascii or binary format for ply or stl
|
||||
// If you do not need any additional parameter simply do nothing.
|
||||
virtual void initSaveParameter(const QString &/*format*/, MeshModel &/*m*/, FilterParameterSet & /*par*/) {}
|
||||
virtual void initSaveParameter(const QString &/*format*/, MeshModel &/*m*/, RichParameterSet & /*par*/) {}
|
||||
|
||||
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const = 0;
|
||||
@ -110,7 +110,7 @@ public:
|
||||
const QString &fileName, // The name of the file to be opened
|
||||
MeshModel &m, // The mesh that is filled with the file content
|
||||
int &mask, // a bit mask that will be filled reporting what kind of data we have found in the file (per vertex color, texture coords etc)
|
||||
const FilterParameterSet & par, // The parameters that have been set up in the initPreOpenParameter()
|
||||
const RichParameterSet & par, // The parameters that have been set up in the initPreOpenParameter()
|
||||
vcg::CallBackPos *cb=0, // standard callback for reporting progress in the loading
|
||||
QWidget *parent=0)=0; // you should not use this...
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
const QString &fileName,
|
||||
MeshModel &m,
|
||||
const int mask, // a bit mask indicating what kind of the data present in the mesh should be saved (e.g. you could not want to save normals in ply files)
|
||||
const FilterParameterSet & par,
|
||||
const RichParameterSet & par,
|
||||
vcg::CallBackPos *cb=0,
|
||||
QWidget *parent= 0)=0 ;
|
||||
|
||||
@ -164,7 +164,7 @@ class MainWindowInterface
|
||||
{
|
||||
public:
|
||||
//isPreview tells whether this execution is being used to produce or preview a result
|
||||
virtual void executeFilter(QAction *, FilterParameterSet &, bool /* isPreview */){};
|
||||
virtual void executeFilter(QAction *, RichParameterSet &, bool /* isPreview */){};
|
||||
virtual ~MainWindowInterface(){};
|
||||
|
||||
// This function is to find the dir where all the deployed stuff reside.
|
||||
@ -276,7 +276,7 @@ public:
|
||||
// This function is called by the framework, for each action at the loading of the plugins.
|
||||
// it allows to add a list of global persistent parameters that can be changed from the meshlab itself.
|
||||
// If your plugins/action has no GlobalParameter, do nothing.
|
||||
virtual void initGlobalParameterSet(QAction *, FilterParameterSet & /*globalparam*/) {}
|
||||
virtual void initGlobalParameterSet(QAction *, RichParameterSet & /*globalparam*/) {}
|
||||
|
||||
// The FilterClass describes in which generic class of filters it fits.
|
||||
// This choice affect the submenu in which each filter will be placed
|
||||
@ -308,8 +308,8 @@ public:
|
||||
// this function will also be called by the commandline framework.
|
||||
// If you want report errors, use the errorMsg() string. It will displayed in case of filters returning false.
|
||||
|
||||
virtual bool applyFilter(QAction * /*filter*/, MeshModel &/*m*/, FilterParameterSet & /* par */, vcg::CallBackPos * /*cb*/) = 0;
|
||||
virtual bool applyFilter(QAction * filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
virtual bool applyFilter(QAction * /*filter*/, MeshModel &/*m*/, RichParameterSet & /* par */, vcg::CallBackPos * /*cb*/) = 0;
|
||||
virtual bool applyFilter(QAction * filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
return applyFilter(filter,*(md.mm()),par,cb);
|
||||
}
|
||||
@ -351,8 +351,8 @@ public:
|
||||
|
||||
// This function is called to initialized the list of parameters.
|
||||
// it is called by the auto dialog framework to know the list of parameters.
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*par*/) {}
|
||||
virtual void initParameterSet(QAction *filter,MeshDocument &md, FilterParameterSet &par)
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*par*/) {}
|
||||
virtual void initParameterSet(QAction *filter,MeshDocument &md, RichParameterSet &par)
|
||||
{initParameterSet(filter,*(md.mm()),par);}
|
||||
|
||||
// this function returns true if the filter has a personally customized dialog..
|
||||
@ -360,7 +360,7 @@ public:
|
||||
|
||||
// This function is invoked for filters with a custom dialog of a filter and when has the params
|
||||
// it notify it to the mainwindow with the collected parameters
|
||||
virtual bool getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &/*m*/, FilterParameterSet & params, MainWindowInterface *mw)
|
||||
virtual bool getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &/*m*/, RichParameterSet & params, MainWindowInterface *mw)
|
||||
{
|
||||
assert(mw);
|
||||
mw->executeFilter(action, params, false);
|
||||
@ -490,13 +490,13 @@ public:
|
||||
// This function is called by the framework, for each action at the loading of the plugins.
|
||||
// it allows to add a list of global persistent parameters that can be changed from the meshlab itself.
|
||||
// If your plugins/action has no GlobalParameter, do nothing.
|
||||
// The FilterParameterSet comes here already intialized with the values stored on the permanent storage.
|
||||
// The RichParameterSet comes here already intialized with the values stored on the permanent storage.
|
||||
// If a filter wants to save some permanent stuff should check its esistence here.
|
||||
|
||||
virtual void initGlobalParameterSet(QAction *, FilterParameterSet * /*globalparam*/) {}
|
||||
virtual void initGlobalParameterSet(QAction *, RichParameterSet * /*globalparam*/) {}
|
||||
|
||||
virtual bool StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/){assert(0); return false;};
|
||||
virtual void Decorate(QAction * /*mode*/, MeshModel &/*m*/, FilterParameterSet * /*param*/, GLArea * /*parent*/,QFont qf) = 0;
|
||||
virtual void Decorate(QAction * /*mode*/, MeshModel &/*m*/, RichParameterSet * /*param*/, GLArea * /*parent*/,QFont qf) = 0;
|
||||
virtual void EndDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/){};
|
||||
|
||||
virtual const QString ST(FilterIDType filter) const=0;
|
||||
|
||||
@ -207,7 +207,7 @@ class MainWindow : public QMainWindow, MainWindowInterface
|
||||
|
||||
public:
|
||||
// callback function to execute a filter
|
||||
void executeFilter(QAction *action, FilterParameterSet &srcpar, bool isPreview);
|
||||
void executeFilter(QAction *action, RichParameterSet &srcpar, bool isPreview);
|
||||
|
||||
MainWindow();
|
||||
static bool QCallBack(const int pos, const char * str);
|
||||
@ -301,6 +301,7 @@ private:
|
||||
void updateRecentFileActions();
|
||||
void setCurrentFile(const QString &fileName);
|
||||
void addToMenu(QList<QAction *>, QMenu *menu, const char *slot);
|
||||
//void saveHistory(QAction *action,const RichParameterSet ¶ms);
|
||||
//void LoadKnownFilters(QStringList &filters, QHash<QString, int> &allKnownFormats, int type);
|
||||
|
||||
|
||||
|
||||
@ -387,7 +387,7 @@ void MainWindow::updateMenus()
|
||||
|
||||
foreach (QAction *a,decoratorActionList){a->setChecked(false);a->setEnabled(true);}
|
||||
|
||||
pair<QAction *,FilterParameterSet *> p;
|
||||
pair<QAction *,RichParameterSet *> p;
|
||||
foreach (p,GLA()->iDecoratorsList){p.first->setChecked(true);}
|
||||
} // if active
|
||||
else
|
||||
@ -526,7 +526,7 @@ void MainWindow::startFilter()
|
||||
|
||||
// (2) Ask for filter parameters (e.g. user defined threshold that could require a widget)
|
||||
// bool ret=iFilter->getStdParameters(action, GLA(),*(GLA()->mm()), *par);
|
||||
FilterParameterSet parList;
|
||||
RichParameterSet parList;
|
||||
|
||||
//Hide the std dialog just in case to avoid that two different filters runs mixed
|
||||
//stddialog->hide();
|
||||
@ -556,14 +556,11 @@ void MainWindow::startFilter()
|
||||
from the automatic dialog
|
||||
from the user defined dialog
|
||||
*/
|
||||
void MainWindow::executeFilter(QAction *action, FilterParameterSet ¶ms, bool isPreview)
|
||||
void MainWindow::executeFilter(QAction *action, RichParameterSet ¶ms, bool isPreview)
|
||||
{
|
||||
|
||||
MeshFilterInterface *iFilter = qobject_cast< MeshFilterInterface *>(action->parent());
|
||||
|
||||
// (3) save the current filter and its parameters in the history
|
||||
if(!isPreview) GLA()->filterHistory.actionList.append(qMakePair(action->text(),params));
|
||||
|
||||
qb->show();
|
||||
iFilter->setLog(&(GLA()->log));
|
||||
|
||||
@ -575,6 +572,10 @@ void MainWindow::executeFilter(QAction *action, FilterParameterSet ¶ms, bool
|
||||
GLA()->mm()->updateDataMask(req);
|
||||
qApp->restoreOverrideCursor();
|
||||
|
||||
// (3) save the current filter and its parameters in the history
|
||||
if(!isPreview)
|
||||
GLA()->filterHistory.actionList.append(qMakePair(action->text(),params));
|
||||
|
||||
// (4) Apply the Filter
|
||||
bool ret;
|
||||
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
@ -716,7 +717,7 @@ void MainWindow::applyDecorateMode()
|
||||
MeshDecorateInterface *iDecorateTemp = qobject_cast<MeshDecorateInterface *>(action->parent());
|
||||
|
||||
bool found=false;
|
||||
pair<QAction *,FilterParameterSet *> p;
|
||||
pair<QAction *,RichParameterSet *> p;
|
||||
foreach(p,GLA()->iDecoratorsList)
|
||||
{
|
||||
if(p.first->text()==action->text()){
|
||||
@ -728,7 +729,7 @@ void MainWindow::applyDecorateMode()
|
||||
}
|
||||
|
||||
if(!found){
|
||||
FilterParameterSet * decoratorParams = new FilterParameterSet();
|
||||
RichParameterSet * decoratorParams = new RichParameterSet();
|
||||
iDecorateTemp->initGlobalParameterSet(action,decoratorParams);
|
||||
bool ret = iDecorateTemp->StartDecorate(action,*GLA()->mm(),GLA());
|
||||
if(ret) {
|
||||
@ -940,7 +941,7 @@ bool MainWindow::open(QString fileName, GLArea *gla)
|
||||
MeshIOInterface* pCurrentIOPlugin = meshIOPlugins[idx-1];
|
||||
pCurrentIOPlugin->setLog(&(GLA()->log));
|
||||
qb->show();
|
||||
FilterParameterSet prePar;
|
||||
RichParameterSet prePar;
|
||||
pCurrentIOPlugin->initPreOpenParameter(extension, fileName,prePar);
|
||||
if(!prePar.isEmpty())
|
||||
{
|
||||
@ -960,7 +961,7 @@ bool MainWindow::open(QString fileName, GLArea *gla)
|
||||
// requires some optional, or userdriven post-opening processing.
|
||||
// and in that case ask for the required parameters and then
|
||||
// ask to the plugin to perform that processing
|
||||
FilterParameterSet par;
|
||||
RichParameterSet par;
|
||||
pCurrentIOPlugin->initOpenParameter(extension, *mm, par);
|
||||
if(!par.isEmpty())
|
||||
{
|
||||
@ -1108,7 +1109,7 @@ bool MainWindow::saveAs(QString fileName)
|
||||
pCurrentIOPlugin->GetExportMaskCapability(extension,capability,defaultBits);
|
||||
|
||||
// optional saving parameters (like ascii/binary encoding)
|
||||
FilterParameterSet savePar;
|
||||
RichParameterSet savePar;
|
||||
|
||||
pCurrentIOPlugin->initSaveParameter(extension,*(this->GLA()->mm()),savePar);
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
#include "savemaskexporter.h"
|
||||
#include "changetexturename.h"
|
||||
|
||||
SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent,MeshModel *m,int capability,int defaultBits, FilterParameterSet *par,GLArea* glar):
|
||||
SaveMaskExporterDialog::SaveMaskExporterDialog(QWidget *parent,MeshModel *m,int capability,int defaultBits, RichParameterSet *par,GLArea* glar):
|
||||
QDialog(parent),m(m),capability(capability),defaultBits(defaultBits),par(par),glar(glar)
|
||||
{
|
||||
InitDialog();
|
||||
|
||||
@ -82,7 +82,7 @@ class SaveMaskExporterDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SaveMaskExporterDialog(QWidget *parent, MeshModel *m, int capability, int defaultBits, FilterParameterSet *par,GLArea* glar = NULL);
|
||||
SaveMaskExporterDialog(QWidget *parent, MeshModel *m, int capability, int defaultBits, RichParameterSet *par,GLArea* glar = NULL);
|
||||
|
||||
void InitDialog();
|
||||
void SetTextureName();
|
||||
@ -106,7 +106,7 @@ private:
|
||||
int type;
|
||||
int capability;
|
||||
int defaultBits;
|
||||
FilterParameterSet *par;
|
||||
RichParameterSet *par;
|
||||
StdParFrame *stdParFrame;
|
||||
GLArea* glar;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -90,49 +90,188 @@ Added standard plugin window support
|
||||
#include "meshmodel.h"
|
||||
#include "filterparameter.h"
|
||||
#include "interfaces.h"
|
||||
#include <cassert>
|
||||
|
||||
/// Widget to enter a color.
|
||||
class QColorButton : public QHBoxLayout
|
||||
class MeshLabWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MeshLabWidget(QWidget* p,RichParameter* rpar);
|
||||
|
||||
virtual void resetWidgetValue() = 0;
|
||||
virtual void collectWidgetValue() = 0;
|
||||
virtual ~MeshLabWidget();
|
||||
void resetValue();
|
||||
Value& getWidgetValue();
|
||||
|
||||
RichParameter* rp;
|
||||
QLabel* helpLab;
|
||||
signals:
|
||||
void parameterChanged();
|
||||
protected:
|
||||
QGridLayout* gridLay;
|
||||
void InitRichParameter(RichParameter* rpar);
|
||||
};
|
||||
|
||||
class BoolWidget : public MeshLabWidget
|
||||
{
|
||||
QCheckBox* cb;
|
||||
public:
|
||||
BoolWidget(QWidget* p,RichBool* rb);
|
||||
~BoolWidget();
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
|
||||
|
||||
class LineEditWidget : public MeshLabWidget
|
||||
{
|
||||
protected:
|
||||
QLabel* lab;
|
||||
QLineEdit* lned;
|
||||
public:
|
||||
|
||||
LineEditWidget(QWidget* p,RichParameter* rpar);
|
||||
~LineEditWidget();
|
||||
virtual void collectWidgetValue() = 0;
|
||||
virtual void resetWidgetValue() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class IntWidget : public LineEditWidget
|
||||
{
|
||||
public:
|
||||
IntWidget(QWidget* p,RichInt* rpar);
|
||||
~IntWidget(){}
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class FloatWidget : public LineEditWidget
|
||||
{
|
||||
public:
|
||||
FloatWidget(QWidget* p,RichFloat* rpar);
|
||||
~FloatWidget(){}
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class StringWidget : public LineEditWidget
|
||||
{
|
||||
public:
|
||||
StringWidget(QWidget* p,RichString* rpar);
|
||||
~StringWidget(){}
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
|
||||
//class Matrix44fWidget : public MeshLabWidget
|
||||
//{
|
||||
//public:
|
||||
// Matrix44fWidget(QWidget* p,RichMatrix44f* rpar);
|
||||
//
|
||||
// void collectWidgetValue();
|
||||
// void resetWidgetValue();
|
||||
//};
|
||||
|
||||
/*
|
||||
class FloatListWidget : public MeshLabWidget
|
||||
{
|
||||
public:
|
||||
FloatListWidget(QWidget* p,RichFloatList* rpar);
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
class OpenFileWidget : public MeshLabWidget
|
||||
{
|
||||
public:
|
||||
OpenFileWidget(QWidget* p,RichOpenFile* rpar);
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
class SaveFileWidget : public MeshLabWidget
|
||||
{
|
||||
public:
|
||||
SaveFileWidget(QWidget* p,RichSaveFile* rpar);
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
};
|
||||
|
||||
|
||||
/// Widget to enter a color.
|
||||
// public QHBoxLayout,
|
||||
class ColorWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QPushButton *colorButton;
|
||||
QLabel *colorLabel;
|
||||
QColor currentColor;
|
||||
QPushButton* colorButton;
|
||||
QLabel* colorLabel;
|
||||
QLabel* descLabel;
|
||||
QColor pickcol;
|
||||
|
||||
public:
|
||||
QColorButton(QWidget *p, QColor newColor);
|
||||
QColor getColor();
|
||||
void setColor(QColor newColor);
|
||||
|
||||
ColorWidget(QWidget *p, RichColor* newColor);
|
||||
~ColorWidget();
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
private:
|
||||
void updateColorInfo(const ColorValue& newColor);
|
||||
|
||||
signals:
|
||||
void dialogParamChanged();
|
||||
private slots:
|
||||
void pickColor();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Widget to enter a value as a percentage or as an absolute value.
|
||||
/// You have to specify the default value and the range of the possible values.
|
||||
/// The default value is expressed in ABSolute units (e.g. it should be in the min..max range.
|
||||
|
||||
class AbsPercWidget : public QGridLayout
|
||||
|
||||
//public QGridLayout
|
||||
class AbsPercWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AbsPercWidget(QWidget *p, double defaultv, double minVal, double maxVal);
|
||||
AbsPercWidget(QWidget *p,RichAbsPerc* rabs);
|
||||
~AbsPercWidget();
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
float getValue();
|
||||
private:
|
||||
void setValue(float val, float minV, float maxV);
|
||||
|
||||
public slots:
|
||||
|
||||
void on_absSB_valueChanged(double newv);
|
||||
void on_percSB_valueChanged(double newv);
|
||||
signals:
|
||||
void dialogParamChanged();
|
||||
|
||||
protected:
|
||||
QDoubleSpinBox *absSB;
|
||||
QDoubleSpinBox *percSB;
|
||||
QLabel* fieldDesc;
|
||||
float m_min;
|
||||
float m_max;
|
||||
};
|
||||
@ -143,15 +282,20 @@ protected:
|
||||
/// if at the creation you provide a pointer to a GLArea (the mesh viewing window)
|
||||
/// the widget exposes a button for getting the current view directiont
|
||||
|
||||
class Point3fWidget : public QHBoxLayout
|
||||
//public QHBoxLayout,
|
||||
class Point3fWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Point3fWidget(QWidget *p, vcg::Point3f defaultv, QString _paramName, QWidget *gla);
|
||||
Point3fWidget(QWidget *p, RichPoint3f* rpf, QWidget *gla);
|
||||
~Point3fWidget();
|
||||
QString paramName;
|
||||
vcg::Point3f getValue();
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
public slots:
|
||||
void getPoint();
|
||||
void setValue(QString name, vcg::Point3f val);
|
||||
@ -160,22 +304,30 @@ public:
|
||||
void askViewPos(QString);
|
||||
void askSurfacePos(QString);
|
||||
void askCameraPos(QString);
|
||||
|
||||
protected:
|
||||
QLineEdit * coordSB[3];
|
||||
QComboBox *getPoint3Combo;
|
||||
QPushButton *getPoint3Button;
|
||||
QLabel* descLab;
|
||||
};
|
||||
|
||||
class DynamicFloatWidget : public QGridLayout
|
||||
|
||||
|
||||
//public QGridLayout,
|
||||
class DynamicFloatWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DynamicFloatWidget(QWidget *p, double defaultv, double minVal, double maxVal, int mask);
|
||||
DynamicFloatWidget(QWidget *p, RichDynamicFloat* rdf);
|
||||
~DynamicFloatWidget();
|
||||
|
||||
float getValue();
|
||||
void setValue(float val, float minV, float maxV);
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
public slots:
|
||||
void setValue(int newv);
|
||||
@ -189,6 +341,7 @@ public:
|
||||
protected:
|
||||
QLineEdit *valueLE;
|
||||
QSlider *valueSlider;
|
||||
QLabel* fieldDesc;
|
||||
float minVal;
|
||||
float maxVal;
|
||||
int mask;
|
||||
@ -197,6 +350,138 @@ private :
|
||||
int floatToInt(float val);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ComboWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QComboBox *enumCombo;
|
||||
QLabel *enumLabel;
|
||||
public:
|
||||
ComboWidget(QWidget *p, RichParameter* rpar);
|
||||
~ComboWidget();
|
||||
void Init(QWidget *p,int newEnum, QStringList values);
|
||||
virtual void collectWidgetValue() = 0;
|
||||
virtual void resetWidgetValue() = 0;
|
||||
|
||||
int getIndex();
|
||||
void setIndex(int newEnum);
|
||||
|
||||
signals:
|
||||
void dialogParamChanged();
|
||||
};
|
||||
|
||||
/// Widget to select an entry from a list
|
||||
|
||||
//public QHBoxLayout
|
||||
class EnumWidget : public ComboWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EnumWidget(QWidget *p, RichEnum* rpar);
|
||||
~EnumWidget(){};
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
//returns the number of items in the list
|
||||
int getSize();
|
||||
};
|
||||
|
||||
|
||||
/// Widget to select a Layer the current one
|
||||
class MeshWidget : public ComboWidget
|
||||
{
|
||||
private:
|
||||
MeshDocument *md;
|
||||
int defaultMeshIndex;
|
||||
public:
|
||||
MeshWidget(QWidget *p, RichMesh* defaultMesh);
|
||||
~MeshWidget(){};
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
MeshModel * getMesh();
|
||||
void setMesh(MeshModel * newMesh);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
class QVariantListWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVariantListWidget(QWidget *parent, QList<QVariant> &values);
|
||||
|
||||
//get the values listed in this widget
|
||||
QList<QVariant> getList();
|
||||
|
||||
//set the values this widget lists
|
||||
void setList(QList<QVariant> &values);
|
||||
|
||||
public slots:
|
||||
//add a new row for input at the end
|
||||
void addRow();
|
||||
|
||||
//remove the last row of the table widget
|
||||
void removeRow();
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
|
||||
private:
|
||||
QTableWidget *tableWidget;
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
//public QVBoxLayout
|
||||
class GetFileNameWidget : public MeshLabWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GetFileNameWidget(QWidget *parent, QString &defaultString, bool getOpenFileName, QString fileExtension = QString("*.*"));
|
||||
|
||||
~GetFileNameWidget();
|
||||
|
||||
//set the values this widget lists
|
||||
QString getFileName();
|
||||
|
||||
//set the name to be something else
|
||||
void setFileName(QString newName);
|
||||
|
||||
public slots:
|
||||
//add a new row for input at the end
|
||||
void launchGetFileNameDialog();
|
||||
|
||||
void collectWidgetValue();
|
||||
void resetWidgetValue();
|
||||
private:
|
||||
|
||||
//open or save filename
|
||||
bool _getOpenFileName;
|
||||
|
||||
//label to display the current value of _filename
|
||||
QLabel *fileNameLabel;
|
||||
|
||||
//button to launch the get filename dialog
|
||||
QPushButton *launchFileNameDialogButton;
|
||||
|
||||
//the filename colected by the fileName dialog
|
||||
QString _fileName;
|
||||
|
||||
//the extension of the files to look for
|
||||
QString _fileExtension;
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
/*---------------------------------*/
|
||||
|
||||
/*
|
||||
This class is used to automatically create a frame from a set of parameters.
|
||||
it is used mostly for creating the main dialog of the filters, but it is used also
|
||||
@ -209,119 +494,24 @@ class StdParFrame : public QFrame
|
||||
public:
|
||||
StdParFrame(QWidget *p, QWidget *gla=0);
|
||||
|
||||
void loadFrameContent(FilterParameterSet &curParSet,MeshDocument *mdPt = 0);
|
||||
void readValues(FilterParameterSet &curParSet);
|
||||
void resetValues(FilterParameterSet &curParSet);
|
||||
void loadFrameContent(RichParameterSet &curParSet,MeshDocument *mdPt = 0);
|
||||
void readValues(RichParameterSet &curParSet);
|
||||
void resetValues(RichParameterSet &curParSet);
|
||||
|
||||
void toggleHelp();
|
||||
|
||||
QVector<void *> stdfieldwidgets;
|
||||
QVector<MeshLabWidget *> stdfieldwidgets;
|
||||
QVector<QLabel *> helpList;
|
||||
private:
|
||||
|
||||
QWidget *gla; // used for having a link to the glarea that spawned the parameter asking.
|
||||
|
||||
~StdParFrame();
|
||||
signals:
|
||||
|
||||
void dynamicFloatChanged(int mask);
|
||||
void parameterChanged();
|
||||
};
|
||||
|
||||
/// Widget to select an entry from a list
|
||||
class EnumWidget : public QHBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
QComboBox *enumCombo;
|
||||
QLabel *enumLabel;
|
||||
public:
|
||||
EnumWidget(){};
|
||||
EnumWidget(QWidget *p, int newEnum, QStringList values);
|
||||
void Init(QWidget *p, int newEnum, QStringList values);
|
||||
int getEnum();
|
||||
void setEnum(int newEnum);
|
||||
|
||||
//returns the number of items in the list
|
||||
int getSize();
|
||||
|
||||
signals:
|
||||
void dialogParamChanged();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Widget to select a Layer the current one
|
||||
class MeshEnumWidget : public EnumWidget
|
||||
{
|
||||
private:
|
||||
MeshDocument *md;
|
||||
public:
|
||||
MeshEnumWidget(QWidget *p, MeshModel *defaultMesh, MeshDocument &md);
|
||||
|
||||
MeshModel * getMesh();
|
||||
void setMesh(MeshModel * newMesh);
|
||||
};
|
||||
|
||||
|
||||
class QVariantListWidget : public QHBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVariantListWidget(QWidget *parent, QList<QVariant> &values);
|
||||
|
||||
//get the values listed in this widget
|
||||
QList<QVariant> getList();
|
||||
|
||||
//set the values this widget lists
|
||||
void setList(QList<QVariant> &values);
|
||||
|
||||
public slots:
|
||||
//add a new row for input at the end
|
||||
void addRow();
|
||||
|
||||
//remove the last row of the table widget
|
||||
void removeRow();
|
||||
|
||||
private:
|
||||
QTableWidget *tableWidget;
|
||||
|
||||
};
|
||||
|
||||
class GetFileNameWidget : public QVBoxLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GetFileNameWidget(QWidget *parent, QString &defaultString, bool getOpenFileName, QString fileExtension = QString("*.*"));
|
||||
|
||||
~GetFileNameWidget();
|
||||
|
||||
//set the values this widget lists
|
||||
QString getFileName();
|
||||
|
||||
//set the name to be something else
|
||||
void setFileName(QString newName);
|
||||
|
||||
public slots:
|
||||
//add a new row for input at the end
|
||||
void launchGetFileNameDialog();
|
||||
|
||||
private:
|
||||
|
||||
//open or save filename
|
||||
bool _getOpenFileName;
|
||||
|
||||
//label to display the current value of _filename
|
||||
QLabel *fileNameLabel;
|
||||
|
||||
//button to launch the get filename dialog
|
||||
QPushButton *launchFileNameDialogButton;
|
||||
|
||||
//the filename colected by the fileName dialog
|
||||
QString _fileName;
|
||||
|
||||
//the extension of the files to look for
|
||||
QString _fileExtension;
|
||||
|
||||
};
|
||||
|
||||
// This class provide a modal dialog box for asking a generic parameter set
|
||||
// It can be used by anyone needing for some values in a structred form and having some integrated help
|
||||
@ -329,9 +519,10 @@ class GenericParamDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GenericParamDialog(QWidget *p, FilterParameterSet *_curParSet, QString title=QString(), MeshDocument *_meshDocument = 0);
|
||||
|
||||
FilterParameterSet *curParSet;
|
||||
GenericParamDialog(QWidget *p, RichParameterSet *_curParSet, QString title=QString(), MeshDocument *_meshDocument = 0);
|
||||
~GenericParamDialog();
|
||||
|
||||
RichParameterSet *curParSet;
|
||||
StdParFrame *stdParFrame;
|
||||
|
||||
void createFrame();
|
||||
@ -359,6 +550,7 @@ class MeshlabStdDialog : public QDockWidget
|
||||
|
||||
public:
|
||||
MeshlabStdDialog(QWidget *p);
|
||||
~MeshlabStdDialog();
|
||||
|
||||
void clearValues();
|
||||
void createFrame();
|
||||
@ -375,24 +567,63 @@ private slots:
|
||||
void togglePreview();
|
||||
void applyDynamic();
|
||||
|
||||
protected:
|
||||
public:
|
||||
QFrame *qf;
|
||||
StdParFrame *stdParFrame;
|
||||
QAction *curAction;
|
||||
MeshModelState meshState;
|
||||
MeshModelState meshCacheState;
|
||||
QCheckBox *previewCB;
|
||||
|
||||
void closeEvent ( QCloseEvent * event );
|
||||
public:
|
||||
|
||||
int curmask;
|
||||
MeshModel *curModel;
|
||||
MeshDocument * curMeshDoc;
|
||||
MeshFilterInterface *curmfi;
|
||||
MainWindowInterface *curmwi;
|
||||
QWidget * curgla;
|
||||
FilterParameterSet curParSet;
|
||||
|
||||
RichParameterSet curParSet;
|
||||
RichParameterSet prevParSet;
|
||||
bool validcache;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//QWidget* parent parameter says to the class who will destroy the MeshLabWidget object that it had created
|
||||
//RichWidgetConstructor shouldn't destroy anything
|
||||
|
||||
class RichWidgetInterfaceConstructor : public Visitor
|
||||
{
|
||||
public:
|
||||
RichWidgetInterfaceConstructor(QWidget* parent):par(parent),lastCreated(NULL){}
|
||||
|
||||
void visit(RichBool& pd) {lastCreated = new BoolWidget(par,&pd);};
|
||||
void visit(RichInt& pd) {lastCreated = new IntWidget(par,&pd);};
|
||||
void visit(RichFloat& pd){lastCreated = new FloatWidget(par,&pd);};
|
||||
void visit(RichString& pd){lastCreated = new StringWidget(par,&pd);};
|
||||
void visit(RichMatrix44f& pd){assert(0);/*TO BE IMPLEMENTED*/ /*lastCreated = new Matrix44fWidget(par,&pd);*/};
|
||||
void visit(RichPoint3f& pd){lastCreated = new Point3fWidget(par,&pd,reinterpret_cast<StdParFrame*>(par)->gla);};
|
||||
void visit(RichColor& pd){lastCreated = new ColorWidget(par,&pd);};
|
||||
void visit(RichColor4b& pd){assert(0);/*TO BE IMPLEMENTED*/ /*lastCreated = new Color4bWidget(par,&pd);*/};
|
||||
void visit(RichAbsPerc& pd){lastCreated = new AbsPercWidget(par,&pd);};
|
||||
void visit(RichEnum& pd){lastCreated = new EnumWidget(par,&pd);};
|
||||
void visit(RichFloatList& pd){assert(0);/*TO BE IMPLEMENTED*/ /*lastCreated = new FloatListWidget(par,&pd);*/};
|
||||
void visit(RichDynamicFloat& pd){lastCreated = new DynamicFloatWidget(par,&pd);};
|
||||
void visit(RichOpenFile& pd){assert(0);/*TO BE IMPLEMENTED*/ /*lastCreated = new OpenFileWidget(par,&pd);*/};
|
||||
void visit(RichSaveFile& pd){lastCreated = new SaveFileWidget(par,&pd);};
|
||||
void visit(RichMesh& pd){lastCreated = new MeshWidget(par,&pd);};
|
||||
|
||||
~RichWidgetInterfaceConstructor() {}
|
||||
|
||||
void setParentWidget(QWidget* parent) {par = parent;}
|
||||
MeshLabWidget* lastCreated;
|
||||
private:
|
||||
QWidget* par;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -643,8 +643,8 @@ void PickPointsDialog::renameHighlightedPoint(){
|
||||
|
||||
const QString newName = "newName";
|
||||
|
||||
FilterParameterSet parameterSet;
|
||||
parameterSet.addString(newName, name, "New Name", "Enter the new name");
|
||||
RichParameterSet parameterSet;
|
||||
parameterSet.addParam(new RichString(newName, name, "New Name", "Enter the new name"));
|
||||
|
||||
GenericParamDialog getNameDialog(this,¶meterSet);
|
||||
getNameDialog.setWindowModality(Qt::WindowModal);
|
||||
|
||||
@ -27,8 +27,8 @@ using namespace vcg;
|
||||
|
||||
AlignParameter::AlignParameter(){}
|
||||
|
||||
// given a FilterParameterSet get back the alignment parameter (dual of the buildParemeterSet)
|
||||
void AlignParameter::buildAlignParameters(FilterParameterSet &fps , AlignPair::Param &app)
|
||||
// given a RichParameterSet get back the alignment parameter (dual of the buildParemeterSet)
|
||||
void AlignParameter::buildAlignParameters(RichParameterSet &fps , AlignPair::Param &app)
|
||||
{
|
||||
app.SampleNum=fps.getInt("SampleNum");
|
||||
app.MinDistAbs=fps.getFloat("MinDistAbs");
|
||||
@ -39,18 +39,18 @@ void AlignParameter::buildAlignParameters(FilterParameterSet &fps , AlignPair::P
|
||||
app.MatchMode=fps.getBool("MatchMode")? AlignPair::Param::MMRigid : AlignPair::Param::MMClassic;
|
||||
}
|
||||
|
||||
// given an alignment parameter builds the corresponding FilterParameterSet (dual of the retrieveParemeterSet)
|
||||
void AlignParameter::buildFilterParameterSet(AlignPair::Param &app, FilterParameterSet &fps)
|
||||
// given an alignment parameter builds the corresponding RichParameterSet (dual of the retrieveParemeterSet)
|
||||
void AlignParameter::buildRichParameterSet(AlignPair::Param &app, RichParameterSet &fps)
|
||||
{
|
||||
fps.clear();
|
||||
fps.addInt("SampleNum",app.SampleNum,"Sample Number","Number of samples that we try to choose at each ICP iteration");
|
||||
fps.addFloat("MinDistAbs",app.MinDistAbs,"Minimal Starting Distance","For all the chosen sample on one mesh we consider for ICP only the samples nearer than this value."
|
||||
fps.addParam(new RichInt("SampleNum",app.SampleNum,"Sample Number","Number of samples that we try to choose at each ICP iteration"));
|
||||
fps.addParam(new RichFloat("MinDistAbs",app.MinDistAbs,"Minimal Starting Distance","For all the chosen sample on one mesh we consider for ICP only the samples nearer than this value."
|
||||
"If MSD is too large outliers could be included, if it is too small convergence will be very slow. "
|
||||
"A good guess is needed here, suggested values are in the range of 10-100 times of the device scanning error."
|
||||
"This value is also dynamically changed by the 'Reduce Distance Factor'");
|
||||
fps.addFloat("TrgDistAbs",app.TrgDistAbs,"Target Distance","When 50% of the chosen samples are below this distance we consider the two mesh aligned. Usually it should be a value lower than the error of the scanning device. ");
|
||||
fps.addInt("MaxIterNum",app.MaxIterNum,"Max Iteration Num","The maximum number of iteration that the ICP is allowed to perform.");
|
||||
fps.addBool("SampleMode",app.SampleMode == AlignPair::Param::SMNormalEqualized,"Normal Equalized Sampling","if true (default) the sample points of icp are choosen with a distribution uniform with respect to the normals of the surface. Otherwise they are distributed in a spatially uniform way.");
|
||||
fps.addFloat("ReduceFactor",app.ReduceFactor,"MSD Reduce Factor","At each ICP iteration the Minimal Starting Distance is reduced to be 5 times the <Reduce Factor> percentile of the sample distances (e.g. if RF is 0.9 the new Minimal Starting Distance is 5 times the value <X> such that 90% of the sample lies at a distance lower than <X>.");
|
||||
fps.addBool("MatchMode",app.MatchMode == AlignPair::Param::MMRigid,"Rigid matching","If true the ICP is cosntrained to perform matching only throug roto-translations (no scaling allowed). If false a more relaxed transformation matrix is allowed (scaling and shearing can appear).");
|
||||
"This value is also dynamically changed by the 'Reduce Distance Factor'"));
|
||||
fps.addParam(new RichFloat("TrgDistAbs",app.TrgDistAbs,"Target Distance","When 50% of the chosen samples are below this distance we consider the two mesh aligned. Usually it should be a value lower than the error of the scanning device. "));
|
||||
fps.addParam(new RichInt("MaxIterNum",app.MaxIterNum,"Max Iteration Num","The maximum number of iteration that the ICP is allowed to perform."));
|
||||
fps.addParam(new RichBool("SampleMode",app.SampleMode == AlignPair::Param::SMNormalEqualized,"Normal Equalized Sampling","if true (default) the sample points of icp are choosen with a distribution uniform with respect to the normals of the surface. Otherwise they are distributed in a spatially uniform way."));
|
||||
fps.addParam(new RichFloat("ReduceFactor",app.ReduceFactor,"MSD Reduce Factor","At each ICP iteration the Minimal Starting Distance is reduced to be 5 times the <Reduce Factor> percentile of the sample distances (e.g. if RF is 0.9 the new Minimal Starting Distance is 5 times the value <X> such that 90% of the sample lies at a distance lower than <X>."));
|
||||
fps.addParam(new RichBool("MatchMode",app.MatchMode == AlignPair::Param::MMRigid,"Rigid matching","If true the ICP is cosntrained to perform matching only throug roto-translations (no scaling allowed). If false a more relaxed transformation matrix is allowed (scaling and shearing can appear)."));
|
||||
}
|
||||
|
||||
@ -29,10 +29,10 @@ class AlignParameter {
|
||||
|
||||
public:
|
||||
//translates the filter parameters into align parameters
|
||||
static void buildAlignParameters(FilterParameterSet &fps, vcg::AlignPair::Param &app);
|
||||
static void buildAlignParameters(RichParameterSet &fps, vcg::AlignPair::Param &app);
|
||||
|
||||
//translates the align parameters into filter parameters
|
||||
static void buildFilterParameterSet(vcg::AlignPair::Param &app, FilterParameterSet &fps);
|
||||
static void buildRichParameterSet(vcg::AlignPair::Param &app, RichParameterSet &fps);
|
||||
|
||||
private:
|
||||
//no need to have an instance of this class
|
||||
|
||||
@ -230,9 +230,9 @@ void EditAlignPlugin:: alignParamCurrent()
|
||||
{
|
||||
assert(currentArc());
|
||||
|
||||
FilterParameterSet alignParamSet;
|
||||
RichParameterSet alignParamSet;
|
||||
QString titleString=QString("Current Arc (%1 -> %2) Alignment Parameters").arg(currentArc()->MovName).arg(currentArc()->FixName);
|
||||
AlignParameter::buildFilterParameterSet(currentArc()->ap, alignParamSet);
|
||||
AlignParameter::buildRichParameterSet(currentArc()->ap, alignParamSet);
|
||||
|
||||
GenericParamDialog ad(alignDialog,&alignParamSet,titleString);
|
||||
int result=ad.exec();
|
||||
@ -244,8 +244,8 @@ void EditAlignPlugin:: alignParamCurrent()
|
||||
|
||||
void EditAlignPlugin:: alignParam()
|
||||
{
|
||||
FilterParameterSet alignParamSet;
|
||||
AlignParameter::buildFilterParameterSet(defaultAP, alignParamSet);
|
||||
RichParameterSet alignParamSet;
|
||||
AlignParameter::buildRichParameterSet(defaultAP, alignParamSet);
|
||||
|
||||
GenericParamDialog ad(alignDialog,&alignParamSet,"Default Alignment Parameters");
|
||||
int result=ad.exec();
|
||||
|
||||
@ -117,27 +117,27 @@ const int AmbientOcclusionPlugin::getRequirements(QAction *action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AmbientOcclusionPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void AmbientOcclusionPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_FACE_AMBIENT_OCCLUSION:
|
||||
case FP_VERT_AMBIENT_OCCLUSION:
|
||||
parlst.addFloat("dirBias",0,"Directional Bias [0..1]","The balance between a uniform and a directionally biased set of lighting direction<br>:"
|
||||
parlst.addParam(new RichFloat("dirBias",0,"Directional Bias [0..1]","The balance between a uniform and a directionally biased set of lighting direction<br>:"
|
||||
" - 0 means light came only uniformly from any direction<br>"
|
||||
" - 1 means that all the light cames from the specified cone of directions <br>"
|
||||
" - other values mix the two set of lighting directions ");
|
||||
parlst.addInt ("reqViews",AMBOCC_DEFAULT_NUM_VIEWS,"Requested views", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time");
|
||||
parlst.addPoint3f("coneDir",Point3f(0,1,0),"Lighting Direction", "Number of different views placed around the mesh. More views means better accuracy at the cost of increased calculation time");
|
||||
parlst.addFloat("coneAngle",30,"Cone amplitude", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time");
|
||||
parlst.addBool("useGPU",AMBOCC_USEGPU_BY_DEFAULT,"Use GPU acceleration","In order to use GPU-Mode, your hardware must support FBOs, FP32 Textures and Shaders. Normally increases the performance by a factor of 4x-5x");
|
||||
parlst.addBool("useVBO",AMBOCC_USEVBO_BY_DEFAULT,"Use VBO if supported","By using VBO, Meshlab loads all the vertex structure in the VRam, greatly increasing rendering speed (for both CPU and GPU mode). Disable it if problem occurs");
|
||||
parlst.addInt ("depthTexSize",AMBOCC_DEFAULT_TEXTURE_SIZE,"Depth texture size(should be 2^n)", "Defines the depth texture size used to compute occlusion from each point of view. Higher values means better accuracy usually with low impact on performance");
|
||||
" - other values mix the two set of lighting directions "));
|
||||
parlst.addParam(new RichInt ("reqViews",AMBOCC_DEFAULT_NUM_VIEWS,"Requested views", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
|
||||
parlst.addParam(new RichPoint3f("coneDir",Point3f(0,1,0),"Lighting Direction", "Number of different views placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
|
||||
parlst.addParam(new RichFloat("coneAngle",30,"Cone amplitude", "Number of different views uniformly placed around the mesh. More views means better accuracy at the cost of increased calculation time"));
|
||||
parlst.addParam(new RichBool("useGPU",AMBOCC_USEGPU_BY_DEFAULT,"Use GPU acceleration","In order to use GPU-Mode, your hardware must support FBOs, FP32 Textures and Shaders. Normally increases the performance by a factor of 4x-5x"));
|
||||
parlst.addParam(new RichBool("useVBO",AMBOCC_USEVBO_BY_DEFAULT,"Use VBO if supported","By using VBO, Meshlab loads all the vertex structure in the VRam, greatly increasing rendering speed (for both CPU and GPU mode). Disable it if problem occurs"));
|
||||
parlst.addParam(new RichInt ("depthTexSize",AMBOCC_DEFAULT_TEXTURE_SIZE,"Depth texture size(should be 2^n)", "Defines the depth texture size used to compute occlusion from each point of view. Higher values means better accuracy usually with low impact on performance"));
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
bool AmbientOcclusionPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool AmbientOcclusionPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
if(ID(filter)==FP_FACE_AMBIENT_OCCLUSION ) perFace=true;
|
||||
else perFace = false;
|
||||
|
||||
@ -86,10 +86,10 @@ public:
|
||||
|
||||
virtual void initParameterSet(QAction *,
|
||||
MeshModel &/*m*/,
|
||||
FilterParameterSet & /*parent*/);
|
||||
RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter (QAction *filter,
|
||||
MeshModel &m,
|
||||
FilterParameterSet & /*parent*/,
|
||||
RichParameterSet & /*parent*/,
|
||||
vcg::CallBackPos * cb) ;
|
||||
void initTextures (void);
|
||||
void initGL (vcg::CallBackPos *cb,
|
||||
|
||||
@ -84,8 +84,8 @@ const QString FilterAutoalign::filterInfo(FilterIDType filterId) const
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void FilterAutoalign::initParameterSet(QAction *action,MeshDocument & md/*m*/, FilterParameterSet & parlst)
|
||||
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void FilterAutoalign::initParameterSet(QAction *action,MeshDocument & md/*m*/, RichParameterSet & parlst)
|
||||
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
MeshModel *target;
|
||||
switch(ID(action)) {
|
||||
@ -94,19 +94,19 @@ void FilterAutoalign::initParameterSet(QAction *action,MeshDocument & md/*m*/, F
|
||||
foreach (target, md.meshList)
|
||||
if (target != md.mm()) break;
|
||||
|
||||
parlst.addMesh ("FirstMesh", md.mm(), "First Mesh",
|
||||
"The mesh were the coplanar bases are sampled (it will contain the trasformation)");
|
||||
parlst.addMesh ("SecondMesh", target, "Second Mesh",
|
||||
"The mesh were similar coplanar based are searched.");
|
||||
parlst.addFloat("overlapping",0.5f,"Estimated fraction of the\n first mesh overlapped by the second");
|
||||
parlst.addFloat("tolerance [0.0,1.0]",0.3f,"Error tolerance");
|
||||
parlst.addParam(new RichMesh ("FirstMesh", md.mm(),&md, "First Mesh",
|
||||
"The mesh were the coplanar bases are sampled (it will contain the trasformation)"));
|
||||
parlst.addParam(new RichMesh ("SecondMesh", target,&md, "Second Mesh",
|
||||
"The mesh were similar coplanar based are searched."));
|
||||
parlst.addParam(new RichFloat("overlapping",0.5f,"Estimated fraction of the\n first mesh overlapped by the second"));
|
||||
parlst.addParam(new RichFloat("tolerance [0.0,1.0]",0.3f,"Error tolerance"));
|
||||
break;
|
||||
default : assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
bool FilterAutoalign::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterAutoalign::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
vcg::tri::FourPCS<CMeshO> *fpcs ;
|
||||
bool res;
|
||||
|
||||
@ -53,9 +53,9 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) { assert(0); return false;} ;
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) { assert(0); return false;} ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -50,23 +50,23 @@ const QString AlignTools::MeshToMove = "MeshToMove";
|
||||
|
||||
AlignTools::AlignTools(){}
|
||||
|
||||
void AlignTools::buildParameterSet(FilterParameterSet & parlst)
|
||||
void AlignTools::buildParameterSet(MeshDocument &md,RichParameterSet & parlst)
|
||||
{
|
||||
vcg::AlignPair::Param ICPParameters;
|
||||
AlignParameter::buildFilterParameterSet(ICPParameters, parlst);
|
||||
AlignParameter::buildRichParameterSet(ICPParameters, parlst);
|
||||
|
||||
parlst.addBool(UseMarkers, true, "Use Markers for Alignment","if true (default), then use the user picked markers to do an alignment (or pre alignment if you also use ICP).");
|
||||
parlst.addBool(AllowScaling, false, "Scale the mesh","if true (false by default), in addition to the alignment, scale the mesh based on the points picked");
|
||||
parlst.addParam(new RichBool(UseMarkers, true, "Use Markers for Alignment","if true (default), then use the user picked markers to do an alignment (or pre alignment if you also use ICP)."));
|
||||
parlst.addParam(new RichBool(AllowScaling, false, "Scale the mesh","if true (false by default), in addition to the alignment, scale the mesh based on the points picked"));
|
||||
|
||||
parlst.addBool(UseICP, true, "Use ICP for Alignment","if true (default), then use the ICP to align the two meshes.");
|
||||
parlst.addParam(new RichBool(UseICP, true, "Use ICP for Alignment","if true (default), then use the ICP to align the two meshes."));
|
||||
|
||||
parlst.addMesh (StuckMesh, 0, "Stuck Mesh",
|
||||
"The mesh that will not move.");
|
||||
parlst.addMesh (MeshToMove, 1, "Mesh to Move",
|
||||
"The mesh that will move to fit close to the Stuck Mesh.");
|
||||
parlst.addParam(new RichMesh (StuckMesh, md.mm(), &md,"Stuck Mesh",
|
||||
"The mesh that will not move."));
|
||||
parlst.addParam(new RichMesh (MeshToMove, md.mm(), &md, "Mesh to Move",
|
||||
"The mesh that will move to fit close to the Stuck Mesh."));
|
||||
}
|
||||
|
||||
bool AlignTools::setupThenAlign(MeshModel &/*mm*/, FilterParameterSet & par)
|
||||
bool AlignTools::setupThenAlign(MeshModel &/*mm*/, RichParameterSet & par)
|
||||
{
|
||||
//mesh that wont move
|
||||
MeshModel *stuckModel = par.getMesh(StuckMesh);
|
||||
@ -163,7 +163,7 @@ bool AlignTools::setupThenAlign(MeshModel &/*mm*/, FilterParameterSet & par)
|
||||
bool AlignTools::align(MeshModel *stuckModel, PickedPoints *stuckPickedPoints,
|
||||
MeshModel *modelToMove, PickedPoints *modelToMovePickedPoints,
|
||||
GLArea *modelToMoveGLArea,
|
||||
FilterParameterSet &filterParameters,
|
||||
RichParameterSet &filterParameters,
|
||||
QWidget *parentWidget, bool confirm)
|
||||
{
|
||||
vcg::Matrix44f result;
|
||||
|
||||
@ -19,66 +19,66 @@
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This class will will hold useful things for doing alignment of meshes
|
||||
*
|
||||
* @author Oscar Barney
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ALIGN_TOOLS_H
|
||||
#define ALIGN_TOOLS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <meshlab/filterparameter.h>
|
||||
#include <meshlab/meshmodel.h>
|
||||
#include <meshlab/glarea.h>
|
||||
|
||||
#include <meshlabplugins/edit_pickpoints/pickedPoints.h>
|
||||
#include <meshlabplugins/editalign/align/AlignPair.h>
|
||||
|
||||
class AlignTools : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const QString FilterName;
|
||||
static const QString UseMarkers;
|
||||
static const QString AllowScaling;
|
||||
static const QString UseICP;
|
||||
static const QString StuckMesh;
|
||||
static const QString MeshToMove;
|
||||
|
||||
//make the default parameter set for this filter
|
||||
static void buildParameterSet(FilterParameterSet & parlst);
|
||||
|
||||
//setup all the parameters and then call align
|
||||
static bool setupThenAlign(MeshModel &mm, FilterParameterSet & par);
|
||||
|
||||
/*
|
||||
* stuckModel - the mesh one that stays put
|
||||
* modelToMove - the mesh to be moved into place
|
||||
* modelToMoveGLArea - so we can update the position of the model
|
||||
* parentWidget - the widget that should be the parent of the confirm dialog window
|
||||
* confirm - whether to ask the user if they want the alignment to stay put
|
||||
*
|
||||
* return value - true if align was accepted or successful
|
||||
*/
|
||||
static bool align(MeshModel *stuckModel, PickedPoints *stuckPickedPoints,
|
||||
MeshModel *modelToMove, PickedPoints *modelToMovePickedPoints,
|
||||
GLArea *modelToMoveGLArea,
|
||||
FilterParameterSet ¶meters,
|
||||
QWidget *parentWidget = 0, bool confirm = false);
|
||||
|
||||
//returns the key applied if this transform is stored to perMeshAttribute
|
||||
static const std::string getKey() { return "TransformAppliedKey"; }
|
||||
|
||||
protected:
|
||||
AlignTools();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* This class will will hold useful things for doing alignment of meshes
|
||||
*
|
||||
* @author Oscar Barney
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ALIGN_TOOLS_H
|
||||
#define ALIGN_TOOLS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <meshlab/filterparameter.h>
|
||||
#include <meshlab/meshmodel.h>
|
||||
#include <meshlab/glarea.h>
|
||||
|
||||
#include <meshlabplugins/edit_pickpoints/pickedPoints.h>
|
||||
#include <meshlabplugins/editalign/align/AlignPair.h>
|
||||
|
||||
class AlignTools : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const QString FilterName;
|
||||
static const QString UseMarkers;
|
||||
static const QString AllowScaling;
|
||||
static const QString UseICP;
|
||||
static const QString StuckMesh;
|
||||
static const QString MeshToMove;
|
||||
|
||||
//make the default parameter set for this filter
|
||||
static void buildParameterSet(MeshDocument &md,RichParameterSet & parlst);
|
||||
|
||||
//setup all the parameters and then call align
|
||||
static bool setupThenAlign(MeshModel &mm, RichParameterSet & par);
|
||||
|
||||
/*
|
||||
* stuckModel - the mesh one that stays put
|
||||
* modelToMove - the mesh to be moved into place
|
||||
* modelToMoveGLArea - so we can update the position of the model
|
||||
* parentWidget - the widget that should be the parent of the confirm dialog window
|
||||
* confirm - whether to ask the user if they want the alignment to stay put
|
||||
*
|
||||
* return value - true if align was accepted or successful
|
||||
*/
|
||||
static bool align(MeshModel *stuckModel, PickedPoints *stuckPickedPoints,
|
||||
MeshModel *modelToMove, PickedPoints *modelToMovePickedPoints,
|
||||
GLArea *modelToMoveGLArea,
|
||||
RichParameterSet ¶meters,
|
||||
QWidget *parentWidget = 0, bool confirm = false);
|
||||
|
||||
//returns the key applied if this transform is stored to perMeshAttribute
|
||||
static const std::string getKey() { return "TransformAppliedKey"; }
|
||||
|
||||
protected:
|
||||
AlignTools();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -232,62 +232,63 @@ const int CleanFilter::getRequirements(QAction *action)
|
||||
}
|
||||
|
||||
|
||||
void CleanFilter::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void CleanFilter::initParameterSet(QAction *action,MeshDocument &md, RichParameterSet & parlst)
|
||||
{
|
||||
pair<float,float> qualityRange;
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_BALL_PIVOTING :
|
||||
parlst.addAbsPerc("BallRadius",(float)maxDiag1,0,m.cm.bbox.Diag(),"Pivoting Ball radius (0 autoguess)","The radius of the ball pivoting (rolling) over the set of points. Gaps that are larger than the ball radius will not be filled; similarly the small pits that are smaller than the ball radius will be filled.");
|
||||
parlst.addFloat("Clustering",20.0f,"Clustering radius (% of ball radius)","To avoid the creation of too small triangles, if a vertex is found too close to a previous one, it is clustered/merged with it."); parlst.addFloat("CreaseThr", 90.0f,"Angle Threshold (degrees)","If we encounter a crease angle that is too large we should stop the ball rolling");
|
||||
parlst.addBool("DeleteFaces",false,"Delete intial set of faces","if true all the initial faces of the mesh are deleted and the whole surface is rebuilt from scratch, other wise the current faces are used as a starting point. Useful if you run multiple times the algorithm with an incrasing ball radius.");
|
||||
parlst.addParam(new RichAbsPerc("BallRadius",(float)maxDiag1,0,md.mm()->cm.bbox.Diag(),"Pivoting Ball radius (0 autoguess)","The radius of the ball pivoting (rolling) over the set of points. Gaps that are larger than the ball radius will not be filled; similarly the small pits that are smaller than the ball radius will be filled."));
|
||||
parlst.addParam(new RichFloat("Clustering",20.0f,"Clustering radius (% of ball radius)","To avoid the creation of too small triangles, if a vertex is found too close to a previous one, it is clustered/merged with it."));
|
||||
parlst.addParam(new RichFloat("CreaseThr", 90.0f,"Angle Threshold (degrees)","If we encounter a crease angle that is too large we should stop the ball rolling"));
|
||||
parlst.addParam(new RichBool("DeleteFaces",false,"Delete intial set of faces","if true all the initial faces of the mesh are deleted and the whole surface is rebuilt from scratch, other wise the current faces are used as a starting point. Useful if you run multiple times the algorithm with an incrasing ball radius."));
|
||||
break;
|
||||
case FP_REMOVE_ISOLATED_DIAMETER:
|
||||
parlst.addAbsPerc("MinComponentDiag",m.cm.bbox.Diag()/10.0,0,m.cm.bbox.Diag(),"Enter max diameter of isolated pieces","Delete all the connected components (floating pieces) with a diameter smaller than the specified one");
|
||||
parlst.addParam(new RichAbsPerc("MinComponentDiag",md.mm()->cm.bbox.Diag()/10.0,0,md.mm()->cm.bbox.Diag(),"Enter max diameter of isolated pieces","Delete all the connected components (floating pieces) with a diameter smaller than the specified one"));
|
||||
break;
|
||||
case FP_REMOVE_ISOLATED_COMPLEXITY:
|
||||
parlst.addInt("MinComponentSize",(int)minCC,"Enter minimum conn. comp size:","Delete all the connected components (floating pieces) composed by a number of triangles smaller than the specified one");
|
||||
parlst.addParam(new RichInt("MinComponentSize",(int)minCC,"Enter minimum conn. comp size:","Delete all the connected components (floating pieces) composed by a number of triangles smaller than the specified one"));
|
||||
break;
|
||||
case FP_REMOVE_WRT_Q:
|
||||
qualityRange=tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(m.cm);
|
||||
parlst.addAbsPerc("MaxQualityThr",(float)val1, qualityRange.first, qualityRange.second,"Delete all vertices with quality under:");
|
||||
qualityRange=tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(md.mm()->cm);
|
||||
parlst.addParam(new RichAbsPerc("MaxQualityThr",(float)val1, qualityRange.first, qualityRange.second,"Delete all vertices with quality under:"));
|
||||
break;
|
||||
case FP_ALIGN_WITH_PICKED_POINTS :
|
||||
AlignTools::buildParameterSet(parlst);
|
||||
AlignTools::buildParameterSet(md,parlst);
|
||||
break;
|
||||
case FP_SELECTBYANGLE :
|
||||
{
|
||||
parlst.addDynamicFloat("anglelimit",
|
||||
parlst.addParam(new RichDynamicFloat("anglelimit",
|
||||
75.0f, 0.0f, 180.0f,
|
||||
"angle threshold (deg)",
|
||||
"faces with normal at higher angle w.r.t. the view direction are selected");
|
||||
parlst.addBool ("usecamera",
|
||||
"faces with normal at higher angle w.r.t. the view direction are selected"));
|
||||
parlst.addParam(new RichBool ("usecamera",
|
||||
false,
|
||||
"Use ViewPoint from Mesh Camera",
|
||||
"Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs");
|
||||
parlst.addPoint3f("viewpoint",
|
||||
"Uses the ViewPoint from the camera associated to the current mesh\n if there is no camera, an error occurs"));
|
||||
parlst.addParam(new RichPoint3f("viewpoint",
|
||||
Point3f(0.0f, 0.0f, 0.0f),
|
||||
"ViewPoint",
|
||||
"if UseCamera is true, this value is ignored");
|
||||
"if UseCamera is true, this value is ignored"));
|
||||
}
|
||||
break;
|
||||
case FP_MERGE_CLOSE_VERTEX :
|
||||
parlst.addAbsPerc("Threshold",m.cm.bbox.Diag()/10000.0,0,m.cm.bbox.Diag()/100.0,"Merging distance","All the vertices that closer than this threshold are merged toghether. Use very small values, default values is 1/10000 of bounding box diagonal. ");
|
||||
parlst.addParam(new RichAbsPerc("Threshold",md.mm()->cm.bbox.Diag()/10000.0,0,md.mm()->cm.bbox.Diag()/100.0,"Merging distance","All the vertices that closer than this threshold are merged toghether. Use very small values, default values is 1/10000 of bounding box diagonal. "));
|
||||
break;
|
||||
|
||||
case FP_REMOVE_TVERTEX_COLLAPSE :
|
||||
case FP_REMOVE_TVERTEX_FLIP :
|
||||
parlst.addFloat(
|
||||
"Threshold", 40, "Ratio", "Detects faces where the base/height ratio is lower than this value");
|
||||
parlst.addBool(
|
||||
"Repeat", true, "Iterate until convergence", "Iterates the algorithm until it reaches convergence");
|
||||
parlst.addParam(new RichFloat(
|
||||
"Threshold", 40, "Ratio", "Detects faces where the base/height ratio is lower than this value"));
|
||||
parlst.addParam(new RichBool(
|
||||
"Repeat", true, "Iterate until convergence", "Iterates the algorithm until it reaches convergence"));
|
||||
break;
|
||||
|
||||
default: assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool CleanFilter::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * cb)
|
||||
bool CleanFilter::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * cb)
|
||||
{
|
||||
switch(ID(filter))
|
||||
{
|
||||
|
||||
@ -110,8 +110,8 @@ MeshFilterInterface::Remeshing;
|
||||
virtual const int getRequirements(QAction *);
|
||||
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -151,19 +151,20 @@ const int ExtraMeshColorizePlugin::getRequirements(QAction *action)
|
||||
}
|
||||
|
||||
|
||||
void ExtraMeshColorizePlugin::initParameterSet(QAction *a,MeshModel &m, FilterParameterSet & par) {
|
||||
void ExtraMeshColorizePlugin::initParameterSet(QAction *a,MeshModel &m, RichParameterSet & par) {
|
||||
switch(ID(a))
|
||||
{
|
||||
case CP_FACE_SMOOTH:
|
||||
case CP_VERTEX_SMOOTH:
|
||||
par.addInt("iteration",1,tr("Iteration"),tr("the number ofiteration of the smoothing algorithm"));
|
||||
//par.addInt("iteration",1,tr("Iteration"),tr("the number ofiteration of the smoothing algorithm"));
|
||||
par.addParam(new RichInt("iteration",1,tr("Iteration"),tr("the number ofiteration of the smoothing algorithm")));
|
||||
break;
|
||||
case CP_TRIANGLE_QUALITY: {
|
||||
QStringList metrics;
|
||||
metrics.push_back("area/max side");
|
||||
metrics.push_back("inradius/circumradius");
|
||||
metrics.push_back("mean ratio");
|
||||
par.addEnum("Metric", 0, metrics, tr("Metric:"), tr("Choose a metric to compute triangle quality."));
|
||||
par.addParam(new RichEnum("Metric", 0, metrics, tr("Metric:"), tr("Choose a metric to compute triangle quality.")));
|
||||
break;
|
||||
}
|
||||
case CP_DISCRETE_CURVATURE: {
|
||||
@ -172,19 +173,18 @@ void ExtraMeshColorizePlugin::initParameterSet(QAction *a,MeshModel &m, FilterPa
|
||||
curvNameList.push_back("Gaussian Curvature");
|
||||
curvNameList.push_back("RMS Curvature");
|
||||
curvNameList.push_back("ABS Curvature");
|
||||
par.addEnum("CurvatureType", 0, curvNameList, tr("Type:"), tr("Choose the curvatures. Mean and Gaussian curvature are computed according the technique described in the Desbrun et al. paper.<br>"
|
||||
"Absolute curvature is defined as |H|+|K| and RMS curvature as sqrt(4* H^2 - 2K) as explained in <br><i>Improved curvature estimation for watershed segmentation of 3-dimensional meshes </i> by S. Pulla, A. Razdan, G. Farin. "));
|
||||
par.addParam(new RichEnum("CurvatureType", 0, curvNameList, tr("Type:"), tr("Choose the curvatures. Mean and Gaussian curvature are computed according the technique described in the Desbrun et al. paper.<br>"
|
||||
"Absolute curvature is defined as |H|+|K| and RMS curvature as sqrt(4* H^2 - 2K) as explained in <br><i>Improved curvature estimation for watershed segmentation of 3-dimensional meshes </i> by S. Pulla, A. Razdan, G. Farin. ")));
|
||||
break;
|
||||
}
|
||||
case CP_MAP_QUALITY_INTO_COLOR :
|
||||
{
|
||||
pair<float,float> minmax = tri::Stat<CMeshO>::ComputePerVertexQualityMinMax(m.cm);
|
||||
|
||||
par.addFloat("minVal",minmax.first,"Min","The value that will be mapped with the lower end of the scale (blue)");
|
||||
par.addFloat("maxVal",minmax.second,"Max","The value that will be mapped with the upper end of the scale (red)");
|
||||
par.addDynamicFloat("perc",0,0,100,"Percentile Crop [0..100]","If not zero this value will be used for a percentile cropping of the quality values.<br> If this parameter is set to <i>P</i> the value <i>V</i> for which <i>P</i>% of the vertices have a quality <b>lower</b>(greater) than <i>V</i> is used as min (max) value.<br><br> The automated percentile cropping is very useful for automatically discarding outliers.");
|
||||
par.addBool("zeroSym",false,"Zero Simmetric","If true the min max range will be enlarged to be symmertic (so that green is always Zero)");
|
||||
|
||||
par.addParam(new RichFloat("minVal",minmax.first,"Min","The value that will be mapped with the lower end of the scale (blue)"));
|
||||
par.addParam(new RichFloat("maxVal",minmax.second,"Max","The value that will be mapped with the upper end of the scale (red)"));
|
||||
par.addParam(new RichDynamicFloat("perc",0,0,100,"Percentile Crop [0..100]","If not zero this value will be used for a percentile cropping of the quality values.<br> If this parameter is set to <i>P</i> the value <i>V</i> for which <i>P</i>% of the vertices have a quality <b>lower</b>(greater) than <i>V</i> is used as min (max) value.<br><br> The automated percentile cropping is very useful for automatically discarding outliers."));
|
||||
par.addParam(new RichBool("zeroSym",false,"Zero Simmetric","If true the min max range will be enlarged to be symmertic (so that green is always Zero)"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -192,7 +192,7 @@ void ExtraMeshColorizePlugin::initParameterSet(QAction *a,MeshModel &m, FilterPa
|
||||
}
|
||||
}
|
||||
|
||||
bool ExtraMeshColorizePlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool ExtraMeshColorizePlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
switch(ID(filter)) {
|
||||
case CP_MAP_QUALITY_INTO_COLOR :
|
||||
|
||||
@ -127,9 +127,9 @@ public:
|
||||
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -81,17 +81,17 @@ const QString FilterCreate::filterInfo(FilterIDType filterId) const
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void FilterCreate::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void FilterCreate::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
|
||||
case CR_BOX :
|
||||
parlst.addFloat("size",1,"Scale factor","Scales the new mesh");
|
||||
parlst.addParam(new RichFloat("size",1,"Scale factor","Scales the new mesh"));
|
||||
break;
|
||||
case CR_CONE:
|
||||
parlst.addFloat("r0",1,"Radius 1","Radius of the bottom circumference");
|
||||
parlst.addFloat("r1",2,"Radius 2","Radius of the top circumference");
|
||||
parlst.addFloat("h",3,"Height","Height of the Cone");
|
||||
parlst.addParam(new RichFloat("r0",1,"Radius 1","Radius of the bottom circumference"));
|
||||
parlst.addParam(new RichFloat("r1",2,"Radius 2","Radius of the top circumference"));
|
||||
parlst.addParam(new RichFloat("h",3,"Height","Height of the Cone"));
|
||||
break;
|
||||
default : return;
|
||||
}
|
||||
@ -99,7 +99,7 @@ void FilterCreate::initParameterSet(QAction *action,MeshModel &m, FilterParamete
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// Move Vertex of a random quantity
|
||||
bool FilterCreate::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterCreate::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
switch(ID(filter)) {
|
||||
case CR_TETRAHEDRON :
|
||||
|
||||
@ -43,8 +43,8 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const int getRequirements(QAction *action);
|
||||
};
|
||||
|
||||
|
||||
@ -97,40 +97,40 @@ const int FilterIsoParametrization::getRequirements(QAction *action)
|
||||
return MeshModel::MM_UNKNOWN;
|
||||
}
|
||||
|
||||
void FilterIsoParametrization::initParameterSet(QAction *a, MeshDocument& /*md*/, FilterParameterSet & par)
|
||||
void FilterIsoParametrization::initParameterSet(QAction *a, MeshDocument& /*md*/, RichParameterSet & par)
|
||||
{
|
||||
|
||||
switch(ID(a))
|
||||
{
|
||||
case ISOP_PARAM:
|
||||
{
|
||||
par.addInt("targetAbstractMinFaceNum",100,"Abstract Min Mesh Size",
|
||||
par.addParam(new RichInt("targetAbstractMinFaceNum",100,"Abstract Min Mesh Size",
|
||||
"This number and the following one indicate the range face number of the abstract mesh that is used for the parametrization process.<br>"
|
||||
"The algorithm will choose the abstract mesh with the best number of triangles within the specified interval.<br>"
|
||||
"If the mesh has a very simple structure this range can be very low and strict;"
|
||||
"for a roughly spherical object if you specify a range of [8,8] faces you get a octahedral abstract mesh, e.g. a geometry image.<br>"
|
||||
"Large numbers (greater than 400) are usually not of practical use.");
|
||||
par.addInt("targetAbstractMaxFaceNum",200,"Abstract Max Mesh Size", "See above.");
|
||||
"Large numbers (greater than 400) are usually not of practical use."));
|
||||
par.addParam(new RichInt("targetAbstractMaxFaceNum",200,"Abstract Max Mesh Size", "See above."));
|
||||
QStringList stopCriteriaList;
|
||||
stopCriteriaList.push_back("Best Heuristic");
|
||||
stopCriteriaList.push_back("Area + Angle");
|
||||
stopCriteriaList.push_back("Regularity");
|
||||
stopCriteriaList.push_back("L2");
|
||||
|
||||
par.addEnum("stopCriteria", 0, stopCriteriaList, tr("Optimization Criteria"),
|
||||
par.addParam(new RichEnum("stopCriteria", 0, stopCriteriaList, tr("Optimization Criteria"),
|
||||
tr("<p style=\'white-space:pre\'>"
|
||||
"Choose a metric to stop the parametrization within the interval<br>"
|
||||
"1: Best Heuristic : stop considering both isometry and number of faces of base domain<br>"
|
||||
"2: Area + Angle : stop at minimum area and angle distorsion<br>"
|
||||
"3: Regularity : stop at minimum number of irregular vertices<br>"
|
||||
"4: L2 : stop at minimum OneWay L2 Stretch Eff"));
|
||||
"4: L2 : stop at minimum OneWay L2 Stretch Eff")));
|
||||
|
||||
//par.addDynamicFloat("convergenceSpeed", 1, 1,4, "Convergence Speed", "This parameter controls the convergence speed/precision of the optimization of the texture coordinates. Larger the number slower the processing and ,eventually, slighly better results");
|
||||
par.addInt("convergenceSpeed",2, "Convergence Speed", "This parameter controls the convergence speed/precision of the optimization of the texture coordinates. Larger the number slower the processing and ,eventually, slighly better results");
|
||||
//par.addParam(new RichDynamicFloat("convergenceSpeed", 1, 1,4, "Convergence Speed", "This parameter controls the convergence speed/precision of the optimization of the texture coordinates. Larger the number slower the processing and ,eventually, slighly better results");
|
||||
par.addParam(new RichInt("convergenceSpeed",2, "Convergence Speed", "This parameter controls the convergence speed/precision of the optimization of the texture coordinates. Larger the number slower the processing and ,eventually, slighly better results"));
|
||||
break;
|
||||
}
|
||||
case ISOP_REMESHING :
|
||||
par.addInt("SamplingRate",10,"Sampling Rate", "This specify the sampling rate for remeshing.");
|
||||
par.addParam(new RichInt("SamplingRate",10,"Sampling Rate", "This specify the sampling rate for remeshing."));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void FilterIsoParametrization::PrintStats(CMeshO *mesh)
|
||||
Log("stdDev Edge:%d",stdEi);
|
||||
}
|
||||
|
||||
bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
(void) par;
|
||||
MeshModel* m = md.mm(); //get current mesh from document
|
||||
|
||||
@ -61,9 +61,9 @@ class FilterIsoParametrization : public QObject, public MeshFilterInterface
|
||||
virtual const int getRequirements(QAction *);
|
||||
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshDocument&, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument&, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb);
|
||||
virtual bool applyFilter(QAction *, MeshModel &, FilterParameterSet & , vcg::CallBackPos *) { assert(0); return false;}
|
||||
virtual void initParameterSet(QAction *,MeshDocument&, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument&, RichParameterSet & /*parent*/, vcg::CallBackPos * cb);
|
||||
virtual bool applyFilter(QAction *, MeshModel &, RichParameterSet & , vcg::CallBackPos *) { assert(0); return false;}
|
||||
int postCondition(QAction* filter) const;
|
||||
int getPreConditions(QAction *) const;
|
||||
void PrintStats(CMeshO *mesh);
|
||||
|
||||
@ -240,7 +240,8 @@ const int ExtraMeshFilterPlugin::getRequirements(QAction *action)
|
||||
// return
|
||||
// true if has some parameters
|
||||
// false is has no params
|
||||
void ExtraMeshFilterPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
|
||||
void ExtraMeshFilterPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
float maxVal;
|
||||
QStringList methods;
|
||||
@ -250,63 +251,63 @@ void ExtraMeshFilterPlugin::initParameterSet(QAction *action, MeshModel &m, Filt
|
||||
methods.push_back("Taubin approximation");
|
||||
methods.push_back("Principal Component Analysis");
|
||||
methods.push_back("Normal Cycles");
|
||||
parlst.addEnum("Method", 0, methods, tr("Method:"), tr("Choose a method"));
|
||||
parlst.addBool("Autoclean",true,QString("Remove Unreferenced Vertices"));
|
||||
parlst.addParam(new RichEnum("Method", 0, methods, tr("Method:"), tr("Choose a method")));
|
||||
parlst.addParam(new RichBool("Autoclean",true,QString("Remove Unreferenced Vertices")));
|
||||
break;
|
||||
case FP_QUADRIC_SIMPLIFICATION:
|
||||
parlst.addInt ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces", "The desired final number of faces.");
|
||||
parlst.addFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size.");
|
||||
parlst.addFloat("QualityThr",lastq_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n");
|
||||
parlst.addBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries");
|
||||
parlst.addBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface");
|
||||
parlst.addBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. ");
|
||||
parlst.addBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh.");
|
||||
parlst.addBool ("QualityWeight",lastq_QualityWeight,"Weighted Simplification","Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified.");
|
||||
parlst.addBool ("AutoClean",true,"Post-simplification cleaning","After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
|
||||
parlst.addParam(new RichInt ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces", "The desired final number of faces."));
|
||||
parlst.addParam(new RichFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size."));
|
||||
parlst.addParam(new RichFloat("QualityThr",lastq_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n"));
|
||||
parlst.addParam(new RichBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries"));
|
||||
parlst.addParam(new RichBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface"));
|
||||
parlst.addParam(new RichBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. "));
|
||||
parlst.addParam(new RichBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh."));
|
||||
parlst.addParam(new RichBool ("QualityWeight",lastq_QualityWeight,"Weighted Simplification","Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified."));
|
||||
parlst.addParam(new RichBool ("AutoClean",true,"Post-simplification cleaning","After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)"));
|
||||
parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!"));
|
||||
break;
|
||||
case FP_QUADRIC_TEXCOORD_SIMPLIFICATION:
|
||||
parlst.addInt ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces");
|
||||
parlst.addFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial mesh.");
|
||||
parlst.addFloat("QualityThr",lastqtex_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n");
|
||||
parlst.addFloat("Extratcoordw",lastqtex_extratw,"Texture Weight","Additional weight for each extra Texture Coordinates for every (selected) vertex");
|
||||
parlst.addBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries");
|
||||
parlst.addBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. ");
|
||||
parlst.addBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface");
|
||||
parlst.addBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!");
|
||||
parlst.addParam(new RichInt ("TargetFaceNum", (m.cm.sfn>0) ? m.cm.sfn/2 : m.cm.fn/2,"Target number of faces"));
|
||||
parlst.addParam(new RichFloat("TargetPerc", 0,"Percentage reduction (0..1)", "If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial mesh."));
|
||||
parlst.addParam(new RichFloat("QualityThr",lastqtex_QualityThr,"Quality threshold","Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n"));
|
||||
parlst.addParam(new RichFloat("Extratcoordw",lastqtex_extratw,"Texture Weight","Additional weight for each extra Texture Coordinates for every (selected) vertex"));
|
||||
parlst.addParam(new RichBool ("PreserveBoundary",lastq_PreserveBoundary,"Preserve Boundary of the mesh","The simplification process tries not to destroy mesh boundaries"));
|
||||
parlst.addParam(new RichBool ("OptimalPlacement",lastq_OptimalPlacement,"Optimal position of simplified vertices","Each collapsed vertex is placed in the position minimizing the quadric error.\n It can fail (creating bad spikes) in case of very flat areas. \nIf disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. "));
|
||||
parlst.addParam(new RichBool ("PreserveNormal",lastq_PreserveNormal,"Preserve Normal","Try to avoid face flipping effects and try to preserve the original orientation of the surface"));
|
||||
parlst.addParam(new RichBool ("PlanarQuadric",lastq_PlanarQuadric,"Planar Simplification","Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh."));
|
||||
parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Simplify only selected faces","The simplification is applied only to the selected set of faces.\n Take care of the target number of faces!"));
|
||||
break;
|
||||
case FP_CLOSE_HOLES:
|
||||
parlst.addInt ("MaxHoleSize",(int)30,"Max size to be closed ","The size is expressed as number of edges composing the hole boundary");
|
||||
parlst.addBool("Selected",m.cm.sfn>0,"Close holes with selected faces","Only the holes with at least one of the boundary faces selected are closed");
|
||||
parlst.addBool("NewFaceSelected",true,"Select the newly created faces","After closing a hole the faces that have been created are left selected. Any previous selection is lost. Useful for example for smoothing the newly created holes.");
|
||||
parlst.addBool("SelfIntersection",true,"Prevent creation of selfIntersecting faces","When closing an holes it tries to prevent the creation of faces that intersect faces adjacent to the boundary of the hole. It is an heuristic, non intersetcting hole filling can be NP-complete.");
|
||||
parlst.addParam(new RichInt ("MaxHoleSize",(int)30,"Max size to be closed ","The size is expressed as number of edges composing the hole boundary"));
|
||||
parlst.addParam(new RichBool("Selected",m.cm.sfn>0,"Close holes with selected faces","Only the holes with at least one of the boundary faces selected are closed"));
|
||||
parlst.addParam(new RichBool("NewFaceSelected",true,"Select the newly created faces","After closing a hole the faces that have been created are left selected. Any previous selection is lost. Useful for example for smoothing the newly created holes."));
|
||||
parlst.addParam(new RichBool("SelfIntersection",true,"Prevent creation of selfIntersecting faces","When closing an holes it tries to prevent the creation of faces that intersect faces adjacent to the boundary of the hole. It is an heuristic, non intersetcting hole filling can be NP-complete."));
|
||||
break;
|
||||
case FP_LOOP_SS:
|
||||
case FP_BUTTERFLY_SS:
|
||||
case FP_MIDPOINT:
|
||||
maxVal = m.cm.bbox.Diag();
|
||||
parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the edges <b>longer</b> than this threshold will be refined.<br>Setting this value to zero will force an uniform refinement.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the edges <b>longer</b> than this threshold will be refined.<br>Setting this value to zero will force an uniform refinement."));
|
||||
parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_REMOVE_FACES_BY_EDGE:
|
||||
maxVal = m.cm.bbox.Diag();
|
||||
parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the faces with an edge <b>longer</b> than this threshold will be deleted. Useful for removing long skinny faces obtained by bad triangulation of range maps.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Edge Threshold", "All the faces with an edge <b>longer</b> than this threshold will be deleted. Useful for removing long skinny faces obtained by bad triangulation of range maps."));
|
||||
parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_CLUSTERING:
|
||||
maxVal = m.cm.bbox.Diag();
|
||||
parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values."));
|
||||
parlst.addParam(new RichBool ("Selected",m.cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_CYLINDER_UNWRAP:
|
||||
parlst.addFloat("startAngle", 0,"Start angle (deg)", "The starting angle of the unrolling process.");
|
||||
parlst.addFloat("endAngle",360,"End angle (deg)","The ending angle of the unrolling process. Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n");
|
||||
parlst.addFloat("radius", 0,"Projection Radius", "If non zero, this parameter specifies the desired radius of the reference cylinder used for the projection. Changing this parameter affect the <b>X</b> horizontal scaling of the resulting mesh. If zero (default) the average distance of the mesh from the axis is chosen.");
|
||||
parlst.addParam(new RichFloat("startAngle", 0,"Start angle (deg)", "The starting angle of the unrolling process."));
|
||||
parlst.addParam(new RichFloat("endAngle",360,"End angle (deg)","The ending angle of the unrolling process. Quality threshold for penalizing bad shaped faces.<br>The value is in the range [0..1]\n 0 accept any kind of face (no penalties),\n 0.5 penalize faces with quality < 0.5, proportionally to their shape\n"));
|
||||
parlst.addParam(new RichFloat("radius", 0,"Projection Radius", "If non zero, this parameter specifies the desired radius of the reference cylinder used for the projection. Changing this parameter affect the <b>X</b> horizontal scaling of the resulting mesh. If zero (default) the average distance of the mesh from the axis is chosen."));
|
||||
|
||||
break;
|
||||
case FP_NORMAL_EXTRAPOLATION:
|
||||
parlst.addInt ("K",(int)10,"Number of neigbors","The number of neighbors used to estimate and propagate normals.");
|
||||
parlst.addParam(new RichInt ("K",(int)10,"Number of neigbors","The number of neighbors used to estimate and propagate normals."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -346,7 +347,7 @@ bool ExtraMeshFilterPlugin::customDialog(QAction *action)
|
||||
// It is called only for filters that have a not empty list of parameters and
|
||||
// that do not use the autogenerated dialog, but want a personalized dialog.
|
||||
|
||||
bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &m, FilterParameterSet & params, MainWindowInterface *mw)
|
||||
bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &m, RichParameterSet & params, MainWindowInterface *mw)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
@ -363,7 +364,7 @@ bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*par
|
||||
return false;
|
||||
|
||||
Matrix44f matrixDlg = transformDialog->getTransformation();
|
||||
params.addMatrix44("Transform",matrixDlg);
|
||||
params.addParam(new RichMatrix44f("Transform",matrixDlg));
|
||||
mw->executeFilter(action,params, false);
|
||||
break;
|
||||
}
|
||||
@ -372,7 +373,7 @@ bool ExtraMeshFilterPlugin::getCustomParameters(QAction *action, QWidget * /*par
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool ExtraMeshFilterPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
MeshModel &m=*md.mm();
|
||||
|
||||
|
||||
@ -134,11 +134,11 @@ class ExtraMeshFilterPlugin : public QObject, public MeshFilterInterface
|
||||
virtual bool autoDialog(QAction *) ;
|
||||
virtual bool customDialog(QAction *filter);
|
||||
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &/*m*/, FilterParameterSet & params, MainWindowInterface *mw);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool getCustomParameters(QAction *action, QWidget * /*parent*/, MeshModel &/*m*/, RichParameterSet & params, MainWindowInterface *mw);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -384,8 +384,8 @@ void TransformDialog::on_applyButton_clicked() {
|
||||
else matrix=matrix*currentMatrix;
|
||||
|
||||
Matrix44f matrixDlg = getTransformation();
|
||||
FilterParameterSet params;
|
||||
params.addMatrix44("Transform",matrixDlg);
|
||||
RichParameterSet params;
|
||||
params.addParam(new RichMatrix44f("Transform",matrixDlg));
|
||||
curmwi->executeFilter(curact,params, false);
|
||||
updateMatrixWidget();
|
||||
// accept();
|
||||
|
||||
@ -178,108 +178,108 @@ const QString MlsPlugin::filterInfo(FilterIDType filterId) const
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, FilterParameterSet& parlst)
|
||||
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, RichParameterSet& parlst)
|
||||
//void ExtraSamplePlugin::initParList(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
int id = ID(action);
|
||||
MeshModel *target = md.mm();
|
||||
|
||||
if (id == FP_SELECT_SMALL_COMPONENTS)
|
||||
{
|
||||
parlst.addFloat("NbFaceRatio",
|
||||
parlst.addParam(new RichFloat("NbFaceRatio",
|
||||
0.1f,
|
||||
"Small component ratio",
|
||||
"This ratio (between 0 and 1) defines the meaning of <i>small</i> as the threshold ratio between the number of faces"
|
||||
"of the largest component and the other ones. A larger value will select more components.");
|
||||
parlst.addBool( "NonClosedOnly",
|
||||
"of the largest component and the other ones. A larger value will select more components."));
|
||||
parlst.addParam(new RichBool( "NonClosedOnly",
|
||||
false,
|
||||
"Select only non closed components",
|
||||
"");
|
||||
""));
|
||||
return;
|
||||
}
|
||||
else if (id == FP_RADIUS_FROM_DENSITY)
|
||||
{
|
||||
parlst.addInt("NbNeighbors",
|
||||
parlst.addParam(new RichInt("NbNeighbors",
|
||||
16,
|
||||
"Number of neighbors",
|
||||
"Number of neighbors used to estimate the local density. Larger values lead to smoother variations.");
|
||||
"Number of neighbors used to estimate the local density. Larger values lead to smoother variations."));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((id & _PROJECTION_))
|
||||
{
|
||||
parlst.addMesh( "ControlMesh", target, "Point set",
|
||||
"The point set (or mesh) which defines the MLS surface.");
|
||||
parlst.addMesh( "ProxyMesh", target, "Proxy Mesh",
|
||||
"The mesh that will be projected/resampled onto the MLS surface.");
|
||||
parlst.addParam(new RichMesh( "ControlMesh", target,&md, "Point set",
|
||||
"The point set (or mesh) which defines the MLS surface."));
|
||||
parlst.addParam(new RichMesh( "ProxyMesh", target, &md, "Proxy Mesh",
|
||||
"The mesh that will be projected/resampled onto the MLS surface."));
|
||||
}
|
||||
if ((id & _PROJECTION_) || (id & _COLORIZE_))
|
||||
{
|
||||
parlst.addBool( "SelectionOnly",
|
||||
parlst.addParam(new RichBool( "SelectionOnly",
|
||||
target->cm.sfn>0,
|
||||
"Selection only",
|
||||
"If checked, only selected vertices will be projected.");
|
||||
"If checked, only selected vertices will be projected."));
|
||||
}
|
||||
|
||||
if ( (id & _APSS_) || (id & _RIMLS_) )
|
||||
{
|
||||
parlst.addFloat("FilterScale",
|
||||
parlst.addParam(new RichFloat("FilterScale",
|
||||
2.0,
|
||||
"MLS - Filter scale",
|
||||
"Scale of the spatial low pass filter.\n"
|
||||
"It is relative to the radius (local point spacing) of the vertices.");
|
||||
parlst.addFloat("ProjectionAccuracy",
|
||||
"It is relative to the radius (local point spacing) of the vertices."));
|
||||
parlst.addParam(new RichFloat("ProjectionAccuracy",
|
||||
1e-4f,
|
||||
"Projection - Accuracy (adv)",
|
||||
"Threshold value used to stop the projections.\n"
|
||||
"This value is scaled by the mean point spacing to get the actual threshold.");
|
||||
parlst.addInt( "MaxProjectionIters",
|
||||
"This value is scaled by the mean point spacing to get the actual threshold."));
|
||||
parlst.addParam(new RichInt( "MaxProjectionIters",
|
||||
15,
|
||||
"Projection - Max iterations (adv)",
|
||||
"Max number of iterations for the projection.");
|
||||
"Max number of iterations for the projection."));
|
||||
}
|
||||
|
||||
if (id & _APSS_)
|
||||
{
|
||||
parlst.addFloat("SphericalParameter",
|
||||
parlst.addParam(new RichFloat("SphericalParameter",
|
||||
1,
|
||||
"MLS - Spherical parameter",
|
||||
"Control the curvature of the fitted spheres: 0 is equivalent to a pure plane fit,"
|
||||
"1 to a pure spherical fit, values between 0 and 1 gives intermediate results,"
|
||||
"while others real values might give interresting results, but take care with extreme"
|
||||
"settings !");
|
||||
"settings !"));
|
||||
if (!(id & _COLORIZE_))
|
||||
parlst.addBool( "AccurateNormal",
|
||||
parlst.addParam(new RichBool( "AccurateNormal",
|
||||
true,
|
||||
"Accurate normals",
|
||||
"If checked, use the accurate MLS gradient instead of the local approximation"
|
||||
"to compute the normals.");
|
||||
"to compute the normals."));
|
||||
}
|
||||
|
||||
if (id & _RIMLS_)
|
||||
{
|
||||
parlst.addFloat("SigmaN",
|
||||
parlst.addParam(new RichFloat("SigmaN",
|
||||
0.75,
|
||||
"MLS - Sharpness",
|
||||
"Width of the filter used by the normal refitting weight."
|
||||
"This weight function is a Gaussian on the distance between two unit vectors:"
|
||||
"the current gradient and the input normal. Therefore, typical value range between 0.5 (sharp) to 2 (smooth).");
|
||||
parlst.addInt( "MaxRefittingIters",
|
||||
"the current gradient and the input normal. Therefore, typical value range between 0.5 (sharp) to 2 (smooth)."));
|
||||
parlst.addParam(new RichInt( "MaxRefittingIters",
|
||||
3,
|
||||
"MLS - Max fitting iterations",
|
||||
"Max number of fitting iterations. (0 or 1 is equivalent to the standard IMLS)");
|
||||
"Max number of fitting iterations. (0 or 1 is equivalent to the standard IMLS)"));
|
||||
}
|
||||
|
||||
if (id & _PROJECTION_)
|
||||
{
|
||||
parlst.addInt( "MaxSubdivisions",
|
||||
parlst.addParam(new RichInt( "MaxSubdivisions",
|
||||
0,
|
||||
"Refinement - Max subdivisions",
|
||||
"Max number of subdivisions.");
|
||||
parlst.addFloat("ThAngleInDegree",
|
||||
"Max number of subdivisions."));
|
||||
parlst.addParam(new RichFloat("ThAngleInDegree",
|
||||
2,
|
||||
"Refinement - Crease angle (degree)",
|
||||
"Threshold angle between two faces controlling the refinement.");
|
||||
"Threshold angle between two faces controlling the refinement."));
|
||||
}
|
||||
|
||||
if (id & _AFRONT_)
|
||||
@ -293,13 +293,13 @@ void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, FilterParame
|
||||
if (id & _APSS_)
|
||||
lst << "ApproxMean";
|
||||
|
||||
parlst.addEnum("CurvatureType", CT_MEAN,
|
||||
parlst.addParam(new RichEnum("CurvatureType", CT_MEAN,
|
||||
lst,
|
||||
"Curvature type",
|
||||
QString("The type of the curvature to plot.")
|
||||
+ ((id & _APSS_) ? "<br>ApproxMean uses the radius of the fitted sphere as an approximation of the mean curvature." : ""));
|
||||
+ ((id & _APSS_) ? "<br>ApproxMean uses the radius of the fitted sphere as an approximation of the mean curvature." : "")));
|
||||
// if ((id & _APSS_))
|
||||
// parlst.addBool( "ApproxCurvature",
|
||||
// parlst.addParam(new RichBool( "ApproxCurvature",
|
||||
// false,
|
||||
// "Approx mean curvature",
|
||||
// "If checked, use the radius of the fitted sphere as an approximation of the mean curvature.");
|
||||
@ -307,11 +307,11 @@ void MlsPlugin::initParameterSet(QAction* action, MeshDocument& md, FilterParame
|
||||
|
||||
if (id & _MCUBE_)
|
||||
{
|
||||
parlst.addInt( "Resolution",
|
||||
parlst.addParam(new RichInt( "Resolution",
|
||||
200,
|
||||
"Grid Resolution",
|
||||
"The resolution of the grid on which we run the marching cubes."
|
||||
"This marching cube is memory friendly, so you can safely set large values up to 1000 or even more.");
|
||||
"This marching cube is memory friendly, so you can safely set large values up to 1000 or even more."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ void UpdateFaceNormalFromVertex(MeshType& m)
|
||||
}
|
||||
}
|
||||
|
||||
bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, FilterParameterSet& par, vcg::CallBackPos* cb)
|
||||
bool MlsPlugin::applyFilter(QAction* filter, MeshDocument& md, RichParameterSet& par, vcg::CallBackPos* cb)
|
||||
{
|
||||
int id = ID(filter);
|
||||
|
||||
|
||||
@ -66,10 +66,10 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
const FilterClass getClass(QAction *a);
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshDocument &md, FilterParameterSet &parent);
|
||||
virtual void initParameterSet(QAction *,MeshDocument &md, RichParameterSet &parent);
|
||||
virtual const int getRequirements(QAction *action);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet &parent, vcg::CallBackPos *cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet &parent, vcg::CallBackPos *cb)
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet &parent, vcg::CallBackPos *cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet &parent, vcg::CallBackPos *cb)
|
||||
{assert(0); return false;}
|
||||
};
|
||||
|
||||
|
||||
@ -99,44 +99,44 @@ const QString PoissonPlugin::filterInfo(FilterIDType filterId) const
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void PoissonPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
//void PoissonPlugin::initParList(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void PoissonPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
//void PoissonPlugin::initParList(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_POISSON_RECON :
|
||||
//parlst.addBool ("RecomputeNormals",
|
||||
//parlst.addParam(new RichBool ("RecomputeNormals",
|
||||
// false,
|
||||
// "Recompute normals",
|
||||
// "Do not use the current normals, but recompute them from scratch considering the vertices of the mesh as an unstructured point cloud.");
|
||||
//parlst.addBool ("UseConfidence",
|
||||
//parlst.addParam(new RichBool ("UseConfidence",
|
||||
// true,
|
||||
// "Use Quality",
|
||||
// "Use the per vertex quality as a confidence value\n");
|
||||
parlst.addInt ("OctDepth",
|
||||
parlst.addParam(new RichInt ("OctDepth",
|
||||
6,
|
||||
"Octree Depth",
|
||||
"Set the depth of the Octree used for extracting the final surface. Suggested range 5..10. Higher numbers mean higher precision in the reconstruction but also higher processing times. Be patient.\n");
|
||||
parlst.addInt ("SolverDivide",
|
||||
"Set the depth of the Octree used for extracting the final surface. Suggested range 5..10. Higher numbers mean higher precision in the reconstruction but also higher processing times. Be patient.\n"));
|
||||
parlst.addParam(new RichInt ("SolverDivide",
|
||||
6,
|
||||
"Solver Divide",
|
||||
"This integer argument specifies the depth at which a block Gauss-Seidel solver is used to solve the Laplacian equation.\n"
|
||||
"Using this parameter helps reduce the memory overhead at the cost of a small increase in reconstruction time. \n"
|
||||
"In practice, the authors have found that for reconstructions of depth 9 or higher a subdivide depth of 7 or 8 can reduce the memory usage.\n"
|
||||
"The default value is 8.\n");
|
||||
parlst.addFloat ("SamplesPerNode",
|
||||
"The default value is 8.\n"));
|
||||
parlst.addParam(new RichFloat ("SamplesPerNode",
|
||||
1.0,
|
||||
"Samples per Node",
|
||||
"This floating point value specifies the minimum number of sample points that should fall within an octree node as the octree\n"
|
||||
"construction is adapted to sampling density. For noise-free samples, small values in the range [1.0 - 5.0] can be used.\n"
|
||||
"For more noisy samples, larger values in the range [15.0 - 20.0] may be needed to provide a smoother, noise-reduced, reconstruction.\n"
|
||||
"The default value is 1.0.");
|
||||
parlst.addFloat ("Offset",
|
||||
"The default value is 1.0."));
|
||||
parlst.addParam(new RichFloat ("Offset",
|
||||
1.0,
|
||||
"Surface offsetting",
|
||||
"This floating point value specifies a correction value for the isosurface threshold that is chosen.\n"
|
||||
"Values < 1 means internal offsetting, >1 external offsetting."
|
||||
"Good values are in the range 0.5 .. 2.\n"
|
||||
"The default value is 1.0 (no offsetting).");
|
||||
"The default value is 1.0 (no offsetting)."));
|
||||
|
||||
break;
|
||||
|
||||
@ -146,7 +146,7 @@ void PoissonPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParamet
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// Move Vertex of a random quantity
|
||||
bool PoissonPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool PoissonPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
MeshModel &m=*md.mm();
|
||||
MeshModel &pm =*md.addNewMesh("Poisson mesh");
|
||||
|
||||
@ -53,9 +53,9 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
|
||||
};
|
||||
|
||||
@ -425,78 +425,78 @@ const int FilterDocSampling::getRequirements(QAction *action)
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, FilterParameterSet & parlst)
|
||||
void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_MONTECARLO_SAMPLING :
|
||||
parlst.addInt ("SampleNum", md.mm()->cm.vn,
|
||||
parlst.addParam(new RichInt ("SampleNum", md.mm()->cm.vn,
|
||||
"Number of samples",
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt.");
|
||||
parlst.addBool("Weighted", false,
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt."));
|
||||
parlst.addParam(new RichBool("Weighted", false,
|
||||
"Quality Weighted Sampling",
|
||||
"Use per vertex quality to drive the vertex sampling. The number of samples falling in each face is proportional to the face area multiplied by the average quality of the face vertices.");
|
||||
"Use per vertex quality to drive the vertex sampling. The number of samples falling in each face is proportional to the face area multiplied by the average quality of the face vertices."));
|
||||
break;
|
||||
case FP_STRATIFIED_SAMPLING :
|
||||
parlst.addInt ("SampleNum", std::max(100000,md.mm()->cm.vn),
|
||||
parlst.addParam(new RichInt ("SampleNum", std::max(100000,md.mm()->cm.vn),
|
||||
"Number of samples",
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt.");
|
||||
parlst.addEnum("Sampling", 0,
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt."));
|
||||
parlst.addParam(new RichEnum("Sampling", 0,
|
||||
QStringList() << "Similar Triangle" << "Dual Similar Triangle" << "Long Edge Subdiv" ,
|
||||
tr("Element to sample:"),
|
||||
tr( "<b>Similar Triangle</b>: each triangle is subdivided into similar triangles and the internal vertices of these triangles are considered. This sampling leave space around edges and vertices for separate sampling of these entities.<br>"
|
||||
"<b>Dual Similar Triangle</b>: each triangle is subdivided into similar triangles and the internal vertices of these triangles are considered. <br>"
|
||||
"<b>Long Edge Subdiv</b> each triangle is recursively subdivided along the longest edge. <br>"
|
||||
));
|
||||
)));
|
||||
|
||||
parlst.addBool("Random", false,
|
||||
parlst.addParam(new RichBool("Random", false,
|
||||
"Random Sampling",
|
||||
"if true, for each (virtual) face we draw a random point, otherwise we pick the face midpoint.");
|
||||
"if true, for each (virtual) face we draw a random point, otherwise we pick the face midpoint."));
|
||||
break;
|
||||
case FP_CLUSTERED_SAMPLING :{
|
||||
float maxVal = md.mm()->cm.bbox.Diag();
|
||||
parlst.addAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values.");
|
||||
parlst.addParam(new RichAbsPerc("Threshold",maxVal*0.01,0,maxVal,"Cell Size", "The size of the cell of the clustering grid. Smaller the cell finer the resulting mesh. For obtaining a very coarse mesh use larger values."));
|
||||
|
||||
parlst.addEnum("Sampling", 1,
|
||||
parlst.addParam(new RichEnum("Sampling", 1,
|
||||
QStringList() << "Average" << "Closest to center",
|
||||
tr("Representative Strataegy:"),
|
||||
tr( "<b>Average</b>: for each cell we take the average of the sample falling into. The resulting point is a new point.<br>"
|
||||
"<b>Closes to center</b>: for each cell we take the sample that is closest to the center of the cell. Choosen vertices are a subset of the original ones. <br>"
|
||||
));
|
||||
parlst.addBool ("Selected", false, "Selected",
|
||||
"If true only for the filter is applied only on the selected subset of the mesh.");
|
||||
)));
|
||||
parlst.addParam(new RichBool ("Selected", false, "Selected",
|
||||
"If true only for the filter is applied only on the selected subset of the mesh."));
|
||||
|
||||
}
|
||||
break;
|
||||
case FP_ELEMENT_SUBSAMPLING :
|
||||
parlst.addEnum("Sampling", 0,
|
||||
parlst.addParam(new RichEnum("Sampling", 0,
|
||||
QStringList() << "Vertex" << "Edge" << "Face",
|
||||
tr("Element to sample:"),
|
||||
tr("Choose what mesh element has to be used for the subsampling. At most one point sample will be added for each one of the chosen elements"));
|
||||
parlst.addInt("SampleNum", md.mm()->cm.vn/10, "Number of samples", "The desired number of elements that must be chosen. Being a subsampling of the original elements if this number should not be larger than the number of elements of the original mesh.");
|
||||
tr("Choose what mesh element has to be used for the subsampling. At most one point sample will be added for each one of the chosen elements")));
|
||||
parlst.addParam(new RichInt("SampleNum", md.mm()->cm.vn/10, "Number of samples", "The desired number of elements that must be chosen. Being a subsampling of the original elements if this number should not be larger than the number of elements of the original mesh."));
|
||||
break;
|
||||
case FP_POISSONDISK_SAMPLING :
|
||||
parlst.addInt("SampleNum", 1000, "Number of samples", "The desired number of samples. The ray of the disk is calculated according to the sampling density.");
|
||||
parlst.addAbsPerc("Radius", 0, 0, md.mm()->cm.bbox.Diag(), "Explicit Radius", "If not zero this parameter override the previous parameter to allow exact radius specification");
|
||||
parlst.addInt("MontecarloRate", 20, "MonterCarlo OverSampling", "The over-sampling rate that is used to generate the intial Montecarlo samples (e.g. if this parameter is x means that x * <poisson sample> points will be used). The generated Poisson-disk samples are a subset of these initial Montecarlo samples. Larger this number slows the process but make it a bit more accurate.");
|
||||
parlst.addBool("Subsample", false, "Base Mesh Subsampling", "If true the original vertices of the base mesh are used as base set of points. In this case the SampleNum should be obviously much smaller than the original vertex number.");
|
||||
parlst.addParam(new RichInt("SampleNum", 1000, "Number of samples", "The desired number of samples. The ray of the disk is calculated according to the sampling density."));
|
||||
parlst.addParam(new RichAbsPerc("Radius", 0, 0, md.mm()->cm.bbox.Diag(), "Explicit Radius", "If not zero this parameter override the previous parameter to allow exact radius specification"));
|
||||
parlst.addParam(new RichInt("MontecarloRate", 20, "MonterCarlo OverSampling", "The over-sampling rate that is used to generate the intial Montecarlo samples (e.g. if this parameter is x means that x * <poisson sample> points will be used). The generated Poisson-disk samples are a subset of these initial Montecarlo samples. Larger this number slows the process but make it a bit more accurate."));
|
||||
parlst.addParam(new RichBool("Subsample", false, "Base Mesh Subsampling", "If true the original vertices of the base mesh are used as base set of points. In this case the SampleNum should be obviously much smaller than the original vertex number."));
|
||||
break;
|
||||
case FP_VARIABLEDISK_SAMPLING :
|
||||
parlst.addInt("SampleNum", 1000, "Number of samples", "The desired number of samples. The ray of the disk is calculated according to the sampling density.");
|
||||
parlst.addAbsPerc("Radius", 0, 0, md.mm()->cm.bbox.Diag(), "Explicit Radius", "If not zero this parameter override the previous parameter to allow exact radius specification");
|
||||
parlst.addFloat("RadiusVariance", 2, "Radius Variance", "The radius of the disk is allowed to vary between r/var and r*var. If this parameter is 1 the sampling is the same of the Poisson Disk Sampling");
|
||||
parlst.addInt("MontecarloRate", 20, "MonterCarlo OverSampling", "The over-sampling rate that is used to generate the intial Montecarlo samples (e.g. if this parameter is x means that x * <poisson sample> points will be used). The generated Poisson-disk samples are a subset of these initial Montecarlo samples. Larger this number slows the process but make it a bit more accurate.");
|
||||
parlst.addBool("Subsample", false, "Base Mesh Subsampling", "If true the original vertices of the base mesh are used as base set of points. In this case the SampleNum should be obviously much smaller than the original vertex number.");
|
||||
parlst.addParam(new RichInt("SampleNum", 1000, "Number of samples", "The desired number of samples. The ray of the disk is calculated according to the sampling density."));
|
||||
parlst.addParam(new RichAbsPerc("Radius", 0, 0, md.mm()->cm.bbox.Diag(), "Explicit Radius", "If not zero this parameter override the previous parameter to allow exact radius specification"));
|
||||
parlst.addParam(new RichFloat("RadiusVariance", 2, "Radius Variance", "The radius of the disk is allowed to vary between r/var and r*var. If this parameter is 1 the sampling is the same of the Poisson Disk Sampling"));
|
||||
parlst.addParam(new RichInt("MontecarloRate", 20, "MonterCarlo OverSampling", "The over-sampling rate that is used to generate the intial Montecarlo samples (e.g. if this parameter is x means that x * <poisson sample> points will be used). The generated Poisson-disk samples are a subset of these initial Montecarlo samples. Larger this number slows the process but make it a bit more accurate."));
|
||||
parlst.addParam(new RichBool("Subsample", false, "Base Mesh Subsampling", "If true the original vertices of the base mesh are used as base set of points. In this case the SampleNum should be obviously much smaller than the original vertex number."));
|
||||
break;
|
||||
case FP_TEXEL_SAMPLING :
|
||||
parlst.addInt ( "TextureW", 512, "Texture Width",
|
||||
parlst.addParam(new RichInt ( "TextureW", 512, "Texture Width",
|
||||
"A sample for each texel is generated, so the desired texture size is need, only samples for the texels falling inside some faces are generated.\n Setting this param to 256 means that you get at most 256x256 = 65536 samples).<br>"
|
||||
"If this parameter is 0 the size of the current texture is choosen.");
|
||||
parlst.addInt ( "TextureH", 512, "Texture Height",
|
||||
"A sample for each texel is generated, so the desired texture size is need, only samples for the texels falling inside some faces are generated.\n Setting this param to 256 means that you get at most 256x256 = 65536 samples)");
|
||||
parlst.addBool( "TextureSpace", false, "UV Space Sampling",
|
||||
"The generated texel samples have their UV coords as point positions. The resulting point set is has a square domain, the texels/points, even if on a flat domain retain the original vertex normal to help a better perception of the original provenience.");
|
||||
parlst.addBool( "RecoverColor", md.mm()->cm.textures.size()>0, "RecoverColor",
|
||||
"The generated point cloud has the current texture color");
|
||||
"If this parameter is 0 the size of the current texture is choosen."));
|
||||
parlst.addParam(new RichInt ( "TextureH", 512, "Texture Height",
|
||||
"A sample for each texel is generated, so the desired texture size is need, only samples for the texels falling inside some faces are generated.\n Setting this param to 256 means that you get at most 256x256 = 65536 samples)"));
|
||||
parlst.addParam(new RichBool( "TextureSpace", false, "UV Space Sampling",
|
||||
"The generated texel samples have their UV coords as point positions. The resulting point set is has a square domain, the texels/points, even if on a flat domain retain the original vertex normal to help a better perception of the original provenience."));
|
||||
parlst.addParam(new RichBool( "RecoverColor", md.mm()->cm.textures.size()>0, "RecoverColor",
|
||||
"The generated point cloud has the current texture color"));
|
||||
break;
|
||||
case FP_HAUSDORFF_DISTANCE :
|
||||
{
|
||||
@ -504,23 +504,23 @@ void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, Fil
|
||||
foreach (vertexMesh, md.meshList)
|
||||
if (vertexMesh != md.mm()) break;
|
||||
|
||||
parlst.addMesh ("SampledMesh", md.mm(), "Sampled Mesh",
|
||||
"The mesh whose surface is sampled. For each sample we search the closest point on the Target Mesh.");
|
||||
parlst.addMesh ("TargetMesh", vertexMesh, "Target Mesh",
|
||||
"The mesh that is sampled for the comparison.");
|
||||
parlst.addBool ("SaveSample", false, "Save Samples",
|
||||
"Save the position and distance of all the used samples on both the two surfaces, creating two new layers with two point clouds representing the used samples.");
|
||||
parlst.addBool ("SampleVert", true, "Sample Vertexes",
|
||||
parlst.addParam(new RichMesh ("SampledMesh", md.mm(),&md, "Sampled Mesh",
|
||||
"The mesh whose surface is sampled. For each sample we search the closest point on the Target Mesh."));
|
||||
parlst.addParam(new RichMesh ("TargetMesh", vertexMesh,&md, "Target Mesh",
|
||||
"The mesh that is sampled for the comparison."));
|
||||
parlst.addParam(new RichBool ("SaveSample", false, "Save Samples",
|
||||
"Save the position and distance of all the used samples on both the two surfaces, creating two new layers with two point clouds representing the used samples."));
|
||||
parlst.addParam(new RichBool ("SampleVert", true, "Sample Vertexes",
|
||||
"For the search of maxima it is useful to sample vertices and edges of the mesh with a greater care. "
|
||||
"It is quite probably the the farthest points falls along edges or on mesh vertexes, and with uniform montecarlo sampling approaches"
|
||||
"the probability of taking a sample over a vertex or an edge is theoretically null.<br>"
|
||||
"On the other hand this kind of sampling could make the overall sampling distribution slightly biased and slightly affects the cumulative results.");
|
||||
parlst.addBool ("SampleEdge", true, "Sample Edges", "See the above comment.");
|
||||
parlst.addBool ("SampleFace", true, "Sample Faces", "See the above comment.");
|
||||
parlst.addInt ("SampleNum", md.mm()->cm.vn, "Number of samples",
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt.");
|
||||
parlst.addAbsPerc("MaxDist", md.mm()->cm.bbox.Diag()/20.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Max Distance"), tr("Sample points for which we do not find anything whithin this distance are rejected and not considered neither for averaging nor for max."));
|
||||
"On the other hand this kind of sampling could make the overall sampling distribution slightly biased and slightly affects the cumulative results."));
|
||||
parlst.addParam(new RichBool ("SampleEdge", true, "Sample Edges", "See the above comment."));
|
||||
parlst.addParam(new RichBool ("SampleFace", true, "Sample Faces", "See the above comment."));
|
||||
parlst.addParam(new RichInt ("SampleNum", md.mm()->cm.vn, "Number of samples",
|
||||
"The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt."));
|
||||
parlst.addParam(new RichAbsPerc("MaxDist", md.mm()->cm.bbox.Diag()/20.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Max Distance"), tr("Sample points for which we do not find anything whithin this distance are rejected and not considered neither for averaging nor for max.")));
|
||||
} break;
|
||||
case FP_VERTEX_RESAMPLING:
|
||||
{
|
||||
@ -528,50 +528,50 @@ void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, Fil
|
||||
foreach (vertexMesh, md.meshList)
|
||||
if (vertexMesh != md.mm()) break;
|
||||
|
||||
parlst.addMesh ("SourceMesh", md.mm(), "Source Mesh",
|
||||
"The mesh that contains the source data that we want to transfer.");
|
||||
parlst.addMesh ("TargetMesh", vertexMesh, "Target Mesh",
|
||||
"The mesh whose vertexes will receive the data from the source.");
|
||||
parlst.addBool ("GeomTransfer", false, "Transfer Geometry",
|
||||
"if enabled, the position of each vertex of the target mesh will be snapped onto the corresponding closest point on the source mesh");
|
||||
parlst.addBool ("ColorTransfer", true, "Transfer Color",
|
||||
"if enabled, the color of each vertex of the target mesh will become the color of the corresponding closest point on the source mesh");
|
||||
parlst.addBool ("QualityTransfer", false, "Transfer quality",
|
||||
"if enabled, the quality of each vertex of the target mesh will become the quality of the corresponding closest point on the source mesh");
|
||||
parlst.addParam(new RichMesh ("SourceMesh", md.mm(),&md, "Source Mesh",
|
||||
"The mesh that contains the source data that we want to transfer."));
|
||||
parlst.addParam(new RichMesh ("TargetMesh", vertexMesh,&md, "Target Mesh",
|
||||
"The mesh whose vertexes will receive the data from the source."));
|
||||
parlst.addParam(new RichBool ("GeomTransfer", false, "Transfer Geometry",
|
||||
"if enabled, the position of each vertex of the target mesh will be snapped onto the corresponding closest point on the source mesh"));
|
||||
parlst.addParam(new RichBool ("ColorTransfer", true, "Transfer Color",
|
||||
"if enabled, the color of each vertex of the target mesh will become the color of the corresponding closest point on the source mesh"));
|
||||
parlst.addParam(new RichBool ("QualityTransfer", false, "Transfer quality",
|
||||
"if enabled, the quality of each vertex of the target mesh will become the quality of the corresponding closest point on the source mesh"));
|
||||
} break;
|
||||
case FP_UNIFORM_MESH_RESAMPLING :
|
||||
{
|
||||
|
||||
parlst.addAbsPerc("CellSize", md.mm()->cm.bbox.Diag()/50.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Precision"), tr("Size of the cell, the default is 1/50 of the box diag. Smaller cells give better precision at a higher computational cost. Remember that halving the cell size means that you build a volume 8 times larger."));
|
||||
parlst.addParam(new RichAbsPerc("CellSize", md.mm()->cm.bbox.Diag()/50.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Precision"), tr("Size of the cell, the default is 1/50 of the box diag. Smaller cells give better precision at a higher computational cost. Remember that halving the cell size means that you build a volume 8 times larger.")));
|
||||
|
||||
parlst.addAbsPerc("Offset", 0.0, -md.mm()->cm.bbox.Diag()/5.0f, md.mm()->cm.bbox.Diag()/5.0f,
|
||||
parlst.addParam(new RichAbsPerc("Offset", 0.0, -md.mm()->cm.bbox.Diag()/5.0f, md.mm()->cm.bbox.Diag()/5.0f,
|
||||
tr("Offset"), tr("Offset of the created surface (i.e. distance of the created surface from the original one).<br>"
|
||||
"If offset is zero, the created surface passes on the original mesh itself. "
|
||||
"Values greater than zero mean an external surface, and lower than zero mean an internal surface.<br> "
|
||||
"In practice this value is the threshold passed to the Marching Cube algorithm to extract the isosurface from the distance field representation."));
|
||||
parlst.addBool ("mergeCloseVert", false, "Clean Vertices",
|
||||
"If true the mesh generated by MC will be cleaned by unifying vertices that are almost coincident");
|
||||
parlst.addBool ("discretize", false, "Discretize",
|
||||
"In practice this value is the threshold passed to the Marching Cube algorithm to extract the isosurface from the distance field representation.")));
|
||||
parlst.addParam(new RichBool ("mergeCloseVert", false, "Clean Vertices",
|
||||
"If true the mesh generated by MC will be cleaned by unifying vertices that are almost coincident"));
|
||||
parlst.addParam(new RichBool ("discretize", false, "Discretize",
|
||||
"If true the position of the intersected edge of the marching cube grid is not computed by linear interpolation, "
|
||||
"but it is placed in fixed middle position. As a consequence the resampled object will look severely aliased by a stairstep appearance.<br>"
|
||||
"Useful only for simulating the output of 3D printing devices.");
|
||||
"Useful only for simulating the output of 3D printing devices."));
|
||||
|
||||
parlst.addBool ("multisample", false, "Multisample",
|
||||
"If true the distance field is more accurately compute by multisampling the volume (7 sample for each voxel). Much slower but less artifacts.");
|
||||
parlst.addBool ("absDist", false, "Absolute Distance",
|
||||
parlst.addParam(new RichBool ("multisample", false, "Multisample",
|
||||
"If true the distance field is more accurately compute by multisampling the volume (7 sample for each voxel). Much slower but less artifacts."));
|
||||
parlst.addParam(new RichBool ("absDist", false, "Absolute Distance",
|
||||
"If true a <b> not</b> signed distance field is computed. "
|
||||
"In this case you have to choose a not zero Offset and a double surface is built around the original surface, inside and outside. "
|
||||
"Is useful to convrt thin floating surfaces into <i> solid, thick meshes.</i>. t");
|
||||
"Is useful to convrt thin floating surfaces into <i> solid, thick meshes.</i>. t"));
|
||||
} break;
|
||||
case FP_VORONOI_CLUSTERING :
|
||||
{
|
||||
parlst.addInt ("SampleNum", md.mm()->cm.vn/100, "Target vertex number",
|
||||
"The final number of vertices.");
|
||||
parlst.addInt ("RelaxIter", 1, "Relaxing Iterations",
|
||||
"The final number of vertices.");
|
||||
parlst.addInt ("RandSeed", 1, "Random Seed",
|
||||
"The final number of vertices.");
|
||||
parlst.addParam(new RichInt ("SampleNum", md.mm()->cm.vn/100, "Target vertex number",
|
||||
"The final number of vertices."));
|
||||
parlst.addParam(new RichInt ("RelaxIter", 1, "Relaxing Iterations",
|
||||
"The final number of vertices."));
|
||||
parlst.addParam(new RichInt ("RandSeed", 1, "Random Seed",
|
||||
"The final number of vertices."));
|
||||
|
||||
} break;
|
||||
case FP_VORONOI_COLORING :
|
||||
@ -585,36 +585,36 @@ void FilterDocSampling::initParameterSet(QAction *action, MeshDocument & md, Fil
|
||||
foreach (vertexMesh, md.meshList) // Search another mesh
|
||||
if (vertexMesh != colorMesh) break;
|
||||
|
||||
parlst.addMesh ("ColoredMesh", colorMesh, "To be Colored Mesh",
|
||||
"The mesh whose surface is colored. For each vertex of this mesh we decide the color according the below parameters.");
|
||||
parlst.addMesh ("VertexMesh", vertexMesh, "Vertex Mesh",
|
||||
"The mesh whose vertexes are used as seed points for the color computation. These seeds point are projected onto the above mesh.");
|
||||
parlst.addParam(new RichMesh ("ColoredMesh", colorMesh,&md, "To be Colored Mesh",
|
||||
"The mesh whose surface is colored. For each vertex of this mesh we decide the color according the below parameters."));
|
||||
parlst.addParam(new RichMesh ("VertexMesh", vertexMesh,&md, "Vertex Mesh",
|
||||
"The mesh whose vertexes are used as seed points for the color computation. These seeds point are projected onto the above mesh."));
|
||||
if(ID(action) == FP_DISK_COLORING) {
|
||||
float Diag = md.mm()->cm.bbox.Diag();
|
||||
parlst.addDynamicFloat("Radius", Diag/10.0f, 0.0f, Diag/3.0f, tr("Radius"),
|
||||
"the radius of the spheres centered in the VertexMesh seeds ");
|
||||
parlst.addBool("SampleRadius", false, "Use sample radius", "Use the radius that is stored in each sample of the vertex mesh. Useful for displaing the variable disk sampling results");
|
||||
parlst.addParam(new RichDynamicFloat("Radius", Diag/10.0f, 0.0f, Diag/3.0f, tr("Radius"),
|
||||
"the radius of the spheres centered in the VertexMesh seeds "));
|
||||
parlst.addParam(new RichBool("SampleRadius", false, "Use sample radius", "Use the radius that is stored in each sample of the vertex mesh. Useful for displaing the variable disk sampling results"));
|
||||
} else {
|
||||
parlst.addBool ("backward", false, "BackDistance",
|
||||
"If true the mesh is colored according the distance from the frontier of the voonoi diagram induced by the VertexMesh seeds.");
|
||||
parlst.addParam(new RichBool ("backward", false, "BackDistance",
|
||||
"If true the mesh is colored according the distance from the frontier of the voonoi diagram induced by the VertexMesh seeds."));
|
||||
}
|
||||
} break;
|
||||
case FP_REGULAR_RECURSIVE_SAMPLING :
|
||||
{
|
||||
parlst.addAbsPerc("CellSize", md.mm()->cm.bbox.Diag()/50.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Precision"), tr("Size of the cell, the default is 1/50 of the box diag. Smaller cells give better precision at a higher computational cost. Remember that halving the cell size means that you build a volume 8 times larger."));
|
||||
parlst.addParam(new RichAbsPerc("CellSize", md.mm()->cm.bbox.Diag()/50.0, 0.0f, md.mm()->cm.bbox.Diag(),
|
||||
tr("Precision"), tr("Size of the cell, the default is 1/50 of the box diag. Smaller cells give better precision at a higher computational cost. Remember that halving the cell size means that you build a volume 8 times larger.")));
|
||||
|
||||
parlst.addAbsPerc("Offset", 0.0, -md.mm()->cm.bbox.Diag()/5.0f, md.mm()->cm.bbox.Diag()/5.0f,
|
||||
parlst.addParam(new RichAbsPerc("Offset", 0.0, -md.mm()->cm.bbox.Diag()/5.0f, md.mm()->cm.bbox.Diag()/5.0f,
|
||||
tr("Offset"), tr("Offset of the created surface (i.e. distance of the created surface from the original one).<br>"
|
||||
"If offset is zero, the created surface passes on the original mesh itself. "
|
||||
"Values greater than zero mean an external surface, and lower than zero mean an internal surface.<br> "
|
||||
"In practice this value is the threshold passed to the Marching Cube algorithm to extract the isosurface from the distance field representation."));
|
||||
"In practice this value is the threshold passed to the Marching Cube algorithm to extract the isosurface from the distance field representation.")));
|
||||
} break;
|
||||
default : assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool FilterDocSampling::applyFilter(QAction *action, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
|
||||
@ -67,10 +67,10 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const int getRequirements(QAction *action);
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual bool applyFilter(QAction * /* filter */, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
};
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ SelectionFilterPlugin::~SelectionFilterPlugin()
|
||||
delete actionList.at(i);
|
||||
}
|
||||
}
|
||||
void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet &parlst)
|
||||
void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
@ -95,27 +95,27 @@ void SelectionFilterPlugin::initParameterSet(QAction *action, MeshModel &m, Filt
|
||||
float minq=minmax.first;
|
||||
float maxq=minmax.second;
|
||||
|
||||
parlst.addDynamicFloat("minQ", minq*0.75+maxq*.25, minq, maxq, tr("Min Quality"), tr("Minimum acceptable quality value") );
|
||||
parlst.addDynamicFloat("maxQ", minq*0.25+maxq*.75, minq, maxq, tr("Max Quality"), tr("Maximum acceptable quality value") );
|
||||
parlst.addBool("Inclusive", true, "Inclusive Sel.", "If true only the faces with <b>all</b> the vertices within the specified range are selected. Otherwise any face with at least one vertex within the range is selected.");
|
||||
parlst.addParam(new RichDynamicFloat("minQ", minq*0.75+maxq*.25, minq, maxq, tr("Min Quality"), tr("Minimum acceptable quality value") ));
|
||||
parlst.addParam(new RichDynamicFloat("maxQ", minq*0.25+maxq*.75, minq, maxq, tr("Max Quality"), tr("Maximum acceptable quality value") ));
|
||||
parlst.addParam(new RichBool("Inclusive", true, "Inclusive Sel.", "If true only the faces with <b>all</b> the vertices within the specified range are selected. Otherwise any face with at least one vertex within the range is selected."));
|
||||
}
|
||||
break;
|
||||
case FP_SELECT_BY_COLOR:
|
||||
{
|
||||
parlst.addColor("Color",Color4b::Black, tr("Color To Select"), tr("Color that you want to be selected.") );
|
||||
parlst.addParam(new RichColor("Color",Color4b::Black, tr("Color To Select"), tr("Color that you want to be selected.") ));
|
||||
|
||||
QStringList colorspace;
|
||||
colorspace << "HSV" << "RGB";
|
||||
parlst.addEnum("ColorSpace", 0, colorspace, tr("Pick Color Space"), tr("The color space that the sliders will manipulate.") );
|
||||
parlst.addParam(new RichEnum("ColorSpace", 0, colorspace, tr("Pick Color Space"), tr("The color space that the sliders will manipulate.") ));
|
||||
|
||||
QStringList mode;
|
||||
mode << "Start Over" << "Add" << "Subtract";
|
||||
parlst.addEnum("Mode", 0, mode, tr("Mode:"), tr("The mode of this filter. Start Over clears the selection completely before selecting based on the color. Add just adds to the current selection bases on color and subtract takes away from the selection the triangles with a vertex matching the color.") );
|
||||
parlst.addParam(new RichEnum("Mode", 0, mode, tr("Mode:"), tr("The mode of this filter. Start Over clears the selection completely before selecting based on the color. Add just adds to the current selection bases on color and subtract takes away from the selection the triangles with a vertex matching the color.") ));
|
||||
|
||||
|
||||
parlst.addDynamicFloat("PercentRH", 0.2f, 0.0f, 1.0f, tr("Variation from Red or Hue"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") );
|
||||
parlst.addDynamicFloat("PercentGS", 0.2f, 0.0f, 1.0f, tr("Variation from Green or Saturation"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") );
|
||||
parlst.addDynamicFloat("PercentBV", 0.2f, 0.0f, 1.0f, tr("Variation from Blue or Value"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") );
|
||||
parlst.addParam(new RichDynamicFloat("PercentRH", 0.2f, 0.0f, 1.0f, tr("Variation from Red or Hue"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
|
||||
parlst.addParam(new RichDynamicFloat("PercentGS", 0.2f, 0.0f, 1.0f, tr("Variation from Green or Saturation"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
|
||||
parlst.addParam(new RichDynamicFloat("PercentBV", 0.2f, 0.0f, 1.0f, tr("Variation from Blue or Value"), tr("A float between 0 and 1 that represents the percent variation from this color that will be selected. For example if the R was 200 and you put 0.1 then any color with R 200+-25.5 will be selected.") ));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -134,7 +134,7 @@ bool SelectionFilterPlugin::autoDialog(QAction *action)
|
||||
}
|
||||
|
||||
|
||||
bool SelectionFilterPlugin::applyFilter(QAction *action, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * cb)
|
||||
bool SelectionFilterPlugin::applyFilter(QAction *action, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * cb)
|
||||
{
|
||||
CMeshO::FaceIterator fi;
|
||||
CMeshO::VertexIterator vi;
|
||||
|
||||
@ -62,11 +62,11 @@ class SelectionFilterPlugin : public QObject, public MeshFilterInterface
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
|
||||
virtual const FilterClass getClass(QAction *) {return MeshFilterInterface::Selection;};
|
||||
void initParameterSet(QAction *action, MeshModel &m, FilterParameterSet &parlst);
|
||||
void initParameterSet(QAction *action, MeshModel &m, RichParameterSet &parlst);
|
||||
bool autoDialog(QAction *action);
|
||||
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -88,17 +88,17 @@ bool FilterSplitterPlugin::autoDialog(QAction *action)
|
||||
}
|
||||
|
||||
// This function define the needed parameters for each filter.
|
||||
void FilterSplitterPlugin::initParameterSet(QAction *action, MeshDocument &/*m*/, FilterParameterSet & parlst)
|
||||
void FilterSplitterPlugin::initParameterSet(QAction *action, MeshDocument &/*m*/, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_SPLITSELECT :
|
||||
{
|
||||
parlst.addBool ("DeleteOriginal",
|
||||
parlst.addParam(new RichBool ("DeleteOriginal",
|
||||
true,
|
||||
"Delete original selection",
|
||||
"Deletes the original selected faces, thus splitting the mesh among layers. \n\n"
|
||||
"if false, the selected faces are duplicated in the new layer");
|
||||
"if false, the selected faces are duplicated in the new layer"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -107,7 +107,7 @@ void FilterSplitterPlugin::initParameterSet(QAction *action, MeshDocument &/*m*/
|
||||
}
|
||||
|
||||
// Core Function doing the actual mesh processing.
|
||||
bool FilterSplitterPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *)
|
||||
bool FilterSplitterPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *)
|
||||
{
|
||||
CMeshO::FaceIterator fi;
|
||||
int numFacesSel,numVertSel;
|
||||
|
||||
@ -43,9 +43,9 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *, MeshModel &, FilterParameterSet &, vcg::CallBackPos * ) { assert(0); return false;} ;
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *, MeshModel &, RichParameterSet &, vcg::CallBackPos * ) { assert(0); return false;} ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -290,90 +290,92 @@ bool FilterUnsharp::autoDialog(QAction *action)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void FilterUnsharp::initParameterSet(QAction *action, MeshModel &m, FilterParameterSet & parlst)
|
||||
|
||||
void FilterUnsharp::initParameterSet(QAction *action, MeshDocument &md, RichParameterSet & parlst)
|
||||
//void FilterUnsharp::initParameterSet(QAction *action, MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_CREASE_CUT :
|
||||
parlst.addFloat("angleDeg", 90.f, tr("Crease Angle (degree)"), tr("If the angle between the normals of two adjacent faces is <b>larger</b> that this threshold the edge is considered a creased and the mesh is cut along it."));
|
||||
parlst.addParam(new RichFloat("angleDeg", 90.f, tr("Crease Angle (degree)"), tr("If the angle between the normals of two adjacent faces is <b>larger</b> that this threshold the edge is considered a creased and the mesh is cut along it.")));
|
||||
break;
|
||||
case FP_UNSHARP_NORMAL:
|
||||
parlst.addBool("recalc", false, tr("Recompute Normals"), tr("Recompute normals from scratch before the unsharp masking"));
|
||||
parlst.addFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>"));
|
||||
parlst.addFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation.<br> Usually you should not need to change the default 1.0 value."));
|
||||
parlst.addInt("iterations", 5, "Smooth Iterations", tr("number of laplacian face smooth iterations in every run"));
|
||||
parlst.addParam(new RichBool("recalc", false, tr("Recompute Normals"), tr("Recompute normals from scratch before the unsharp masking")));
|
||||
parlst.addParam(new RichFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>")));
|
||||
parlst.addParam(new RichFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation.<br> Usually you should not need to change the default 1.0 value.")));
|
||||
parlst.addParam(new RichInt("iterations", 5, "Smooth Iterations", tr("number of laplacian face smooth iterations in every run")));
|
||||
break;
|
||||
case FP_UNSHARP_GEOMETRY:
|
||||
parlst.addFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>"));
|
||||
parlst.addFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value."));
|
||||
parlst.addInt("iterations", 5, "Smooth Iterations", tr("number ofiterations of laplacian smooth in every run"));
|
||||
parlst.addParam(new RichFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>")));
|
||||
parlst.addParam(new RichFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value.")));
|
||||
parlst.addParam(new RichInt("iterations", 5, "Smooth Iterations", tr("number ofiterations of laplacian smooth in every run")));
|
||||
break;
|
||||
case FP_UNSHARP_VERTEX_COLOR:
|
||||
parlst.addFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>"));
|
||||
parlst.addFloat("weightOrig", 1.f, tr("Original Color Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value."));
|
||||
parlst.addInt("iterations", 5, "Smooth Iterations", tr("number of iterations of laplacian smooth in every run"));
|
||||
parlst.addParam(new RichFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>")));
|
||||
parlst.addParam(new RichFloat("weightOrig", 1.f, tr("Original Color Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value.")));
|
||||
parlst.addParam(new RichInt("iterations", 5, "Smooth Iterations", tr("number of iterations of laplacian smooth in every run")));
|
||||
break;
|
||||
case FP_UNSHARP_QUALITY:
|
||||
parlst.addFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>"));
|
||||
parlst.addFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value."));
|
||||
parlst.addInt("iterations", 5, "Smooth Iterations", tr("number of iterations of laplacian smooth in every run"));
|
||||
parlst.addParam(new RichFloat("weight", 0.3f, tr("Unsharp Weight"), tr("the unsharp weight <i>w<sub><big>u</big></sub></i> in the unsharp mask equation: <br> <i>w<sub><big>o</big></sub>orig + w<sub><big>u</big></sub> (orig - lowpass)<i><br>")));
|
||||
parlst.addParam(new RichFloat("weightOrig", 1.f, tr("Original Weight"), tr("How much the original signal is used, e.g. the weight <i>w<sub><big>o</big></sub></i> in the above unsharp mask equation<br> Usually you should not need to change the default 1.0 value.")));
|
||||
parlst.addParam(new RichInt("iterations", 5, "Smooth Iterations", tr("number of iterations of laplacian smooth in every run")));
|
||||
break;
|
||||
case FP_TWO_STEP_SMOOTH:
|
||||
parlst.addInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated.");
|
||||
parlst.addFloat("normalThr", (float) 60,"Feature Angle Threshold (deg)", "Specify a threshold angle (0..90) for features that you want to be preserved.<br>Features forming angles LARGER than the specified threshold will be preserved. <br> 0 -> no smoothing <br> 90 -> all faces will be smoothed");
|
||||
parlst.addInt ("stepNormalNum", (int) 20,"Normal Smoothing steps", "Number of iterations of normal smoothing step. The larger the better and (the slower)");
|
||||
parlst.addInt ("stepFitNum", (int) 20,"Vertex Fitting steps", "Number of iterations of the vertex fitting procedure. )");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
|
||||
parlst.addParam(new RichFloat("normalThr", (float) 60,"Feature Angle Threshold (deg)", "Specify a threshold angle (0..90) for features that you want to be preserved.<br>Features forming angles LARGER than the specified threshold will be preserved. <br> 0 -> no smoothing <br> 90 -> all faces will be smoothed"));
|
||||
parlst.addParam(new RichInt ("stepNormalNum", (int) 20,"Normal Smoothing steps", "Number of iterations of normal smoothing step. The larger the better and (the slower)"));
|
||||
parlst.addParam(new RichInt ("stepFitNum", (int) 20,"Vertex Fitting steps", "Number of iterations of the vertex fitting procedure. )"));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_LAPLACIAN_SMOOTH:
|
||||
parlst.addInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated.");
|
||||
parlst.addBool ("Boundary",true,"1D Boundary Smoothing", "if true the boundary edges are smoothed only by themselves (e.g. the polyline forming the boundary of the mesh is independently smoothed). Can reduce the shrinking on the border but can have strange effects on very small boundaries.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
|
||||
parlst.addParam(new RichBool ("Boundary",true,"1D Boundary Smoothing", "if true the boundary edges are smoothed only by themselves (e.g. the polyline forming the boundary of the mesh is independently smoothed). Can reduce the shrinking on the border but can have strange effects on very small boundaries."));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_DEPTH_SMOOTH:
|
||||
parlst.addInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated.");
|
||||
parlst.addPoint3f ("viewPoint", Point3f(0,0,0),"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
|
||||
parlst.addParam(new RichPoint3f ("viewPoint", Point3f(0,0,0),"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_DIRECTIONAL_PRESERVATION:
|
||||
parlst.addEnum("step", 0,
|
||||
parlst.addParam(new RichEnum("step", 0,
|
||||
QStringList() << "Store Vertex Position" << "Blend Vertex Position",
|
||||
tr("Step:"),
|
||||
tr("The purpose of this filter is to <b>constrain</b> any smoothing algorithm to moving vertices only along a give line of sight.<br> First you should store current vertex position, than after applying one of the many smoothing algorithms you should re start this filter and blend the original positions with the smoothed results.<br>"
|
||||
"Given a view point <i>vp</i> , the smoothed vertex position <i>vs</i> and the original position <i>v</i>, The new vertex position is computed as the projection of <i>vs</i> on the line connecting <i>v</i> and <i>vp</i>."));
|
||||
parlst.addPoint3f ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction.");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
"Given a view point <i>vp</i> , the smoothed vertex position <i>vs</i> and the original position <i>v</i>, The new vertex position is computed as the projection of <i>vs</i> on the line connecting <i>v</i> and <i>vp</i>.")));
|
||||
parlst.addParam(new RichPoint3f ("viewPoint", Point3f(0,0,0),"Viewpoint", "The position of the view point that is used to get the constraint direction."));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_TAUBIN_SMOOTH:
|
||||
parlst.addFloat("lambda", (float) 0.5,"Lambda", "The lambda parameter of the Taubin Smoothing algorithm");
|
||||
parlst.addFloat("mu", (float) -0.53,"mu", "The mu parameter of the Taubin Smoothing algorithm");
|
||||
parlst.addInt ("stepSmoothNum", (int) 10,"Smoothing steps", "The number of times that the taubin smoothing is iterated. Usually it requires a larger number of iteration than the classical laplacian");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichFloat("lambda", (float) 0.5,"Lambda", "The lambda parameter of the Taubin Smoothing algorithm"));
|
||||
parlst.addParam(new RichFloat("mu", (float) -0.53,"mu", "The mu parameter of the Taubin Smoothing algorithm"));
|
||||
parlst.addParam(new RichInt ("stepSmoothNum", (int) 10,"Smoothing steps", "The number of times that the taubin smoothing is iterated. Usually it requires a larger number of iteration than the classical laplacian"));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
break;
|
||||
case FP_SD_LAPLACIAN_SMOOTH:
|
||||
{
|
||||
parlst.addInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated.");
|
||||
float maxVal = m.cm.bbox.Diag()/10;
|
||||
parlst.addAbsPerc("delta",maxVal*0.01,0,maxVal,"delta", "");
|
||||
parlst.addBool ("Selected",m.cm.sfn>0,"Affect only selected faces");
|
||||
parlst.addParam(new RichInt ("stepSmoothNum", (int) 3,"Smoothing steps", "The number of times that the whole algorithm (normal smoothing + vertex fitting) is iterated."));
|
||||
float maxVal = md.mm()->cm.bbox.Diag()/10;
|
||||
parlst.addParam(new RichAbsPerc("delta",maxVal*0.01,0,maxVal,"delta", ""));
|
||||
parlst.addParam(new RichBool ("Selected",md.mm()->cm.sfn>0,"Affect only selected faces"));
|
||||
}
|
||||
break;
|
||||
case FP_LINEAR_MORPH :
|
||||
{
|
||||
parlst.addMesh ("TargetMesh", 1, "Target Mesh", "The mesh that is the morph target.");
|
||||
parlst.addParam(new RichMesh ("TargetMesh", md.mm(), &md,"Target Mesh", "The mesh that is the morph target."));
|
||||
|
||||
parlst.addDynamicFloat("PercentMorph", 0.0, -150, 250,
|
||||
parlst.addParam(new RichDynamicFloat("PercentMorph", 0.0, -150, 250,
|
||||
"% Morph", "The percent you want to morph toward (or away from) the target. <br>"
|
||||
"0 means current mesh <br>"
|
||||
"100 means targe mesh <br>"
|
||||
"<0 and >100 linearly extrapolate between the two mesh <br>");
|
||||
"<0 and >100 linearly extrapolate between the two mesh <br>"));
|
||||
}
|
||||
break;
|
||||
default : assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool FilterUnsharp::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * cb)
|
||||
bool FilterUnsharp::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * cb)
|
||||
{
|
||||
switch(ID(filter))
|
||||
{
|
||||
|
||||
@ -76,8 +76,8 @@ class FilterUnsharp : public QObject, public MeshFilterInterface
|
||||
virtual bool autoDialog(QAction *);
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *action, MeshModel &/*m*/, FilterParameterSet & parlst);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *action, MeshDocument &/*m*/, RichParameterSet & parlst);
|
||||
virtual int postCondition( QAction* ) const;
|
||||
virtual int getPreConditions(QAction *) const;
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ using namespace vcg;
|
||||
|
||||
|
||||
|
||||
bool ExtraMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
bool ExtraMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
// initializing mask
|
||||
mask = 0;
|
||||
@ -160,7 +160,7 @@ bool ExtraMeshIOPlugin::open(const QString &formatName, const QString &fileName,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExtraMeshIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool ExtraMeshIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exporting file %1:\n%2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
|
||||
@ -44,8 +44,8 @@ public:
|
||||
QList<Format> exportFormats() const;
|
||||
|
||||
void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -85,22 +85,23 @@
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
// initialize importing parameters
|
||||
void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, const QString &/*filename*/, FilterParameterSet &parlst)
|
||||
void BaseMeshIOPlugin::initPreOpenParameter(const QString &formatName, const QString &/*filename*/, RichParameterSet &parlst)
|
||||
{
|
||||
if (formatName.toUpper() == tr("PTX"))
|
||||
{
|
||||
parlst.addInt("meshindex",0,"Index of Range Map to be Imported","PTX files may contain more than one range map. 0 is the first range map. If the number if higher than the actual mesh number, the import will fail");
|
||||
parlst.addBool("anglecull",true,"Cull faces by angle","short");
|
||||
parlst.addFloat("angle",85.0,"Angle limit for face culling","short");
|
||||
parlst.addBool("usecolor",true,"import color","Read color from PTX, if color is not present, uses reflectance instead");
|
||||
parlst.addBool("pointcull",true,"delete unsampled points","Deletes unsampled points in the grid that are normally located in [0,0,0]");
|
||||
parlst.addBool("pointsonly",false,"Keep only points","Just import points, without triangulation");
|
||||
parlst.addBool("switchside",false,"Swap rows/columns","On some PTX, the rows and columns number are switched over");
|
||||
parlst.addBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles");
|
||||
parlst.addParam(new RichInt("meshindex",0,"Index of Range Map to be Imported",
|
||||
"PTX files may contain more than one range map. 0 is the first range map. If the number if higher than the actual mesh number, the import will fail"));
|
||||
parlst.addParam(new RichBool("anglecull",true,"Cull faces by angle","short"));
|
||||
parlst.addParam(new RichFloat("angle",85.0,"Angle limit for face culling","short"));
|
||||
parlst.addParam(new RichBool("usecolor",true,"import color","Read color from PTX, if color is not present, uses reflectance instead"));
|
||||
parlst.addParam(new RichBool("pointcull",true,"delete unsampled points","Deletes unsampled points in the grid that are normally located in [0,0,0]"));
|
||||
parlst.addParam(new RichBool("pointsonly",false,"Keep only points","Just import points, without triangulation"));
|
||||
parlst.addParam(new RichBool("switchside",false,"Swap rows/columns","On some PTX, the rows and columns number are switched over"));
|
||||
parlst.addParam(new RichBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles"));
|
||||
}
|
||||
}
|
||||
|
||||
bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &parlst, CallBackPos *cb, QWidget * /*parent*/)
|
||||
bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget * /*parent*/)
|
||||
{
|
||||
bool normalsUpdated = false;
|
||||
|
||||
@ -171,14 +172,14 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
|
||||
{
|
||||
tri::io::ImporterPTX<CMeshO>::Info importparams;
|
||||
|
||||
importparams.meshnum = parlst.getInt("meshindex");
|
||||
importparams.anglecull =parlst.getBool("anglecull");
|
||||
importparams.angle = parlst.getFloat("angle");
|
||||
importparams.savecolor = parlst.getBool("usecolor");
|
||||
importparams.pointcull = parlst.getBool("pointcull");
|
||||
importparams.pointsonly = parlst.getBool("pointsonly");
|
||||
importparams.switchside = parlst.getBool("switchside");
|
||||
importparams.flipfaces = parlst.getBool("flipfaces");
|
||||
importparams.meshnum = parlst.findParameter("meshindex")->val->getInt();
|
||||
importparams.anglecull =parlst.findParameter("anglecull")->val->getBool();
|
||||
importparams.angle = parlst.findParameter("angle")->val->getFloat();
|
||||
importparams.savecolor = parlst.findParameter("usecolor")->val->getBool();
|
||||
importparams.pointcull = parlst.findParameter("pointcull")->val->getBool();
|
||||
importparams.pointsonly = parlst.findParameter("pointsonly")->val->getBool();
|
||||
importparams.switchside = parlst.findParameter("switchside")->val->getBool();
|
||||
importparams.flipfaces = parlst.findParameter("flipfaces")->val->getBool();
|
||||
|
||||
// if color, add to mesh
|
||||
if(importparams.savecolor)
|
||||
@ -239,7 +240,7 @@ bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseMeshIOPlugin::save(const QString &formatName,const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet & par, CallBackPos *cb, QWidget */*parent*/)
|
||||
bool BaseMeshIOPlugin::save(const QString &formatName,const QString &fileName, MeshModel &m, const int mask, const RichParameterSet & par, CallBackPos *cb, QWidget */*parent*/)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exportering file %1:\n%2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
@ -247,7 +248,7 @@ bool BaseMeshIOPlugin::save(const QString &formatName,const QString &fileName, M
|
||||
string ex = formatName.toUtf8().data();
|
||||
bool binaryFlag = false;
|
||||
if(formatName.toUpper() == tr("STL") || formatName.toUpper() == tr("PLY"))
|
||||
binaryFlag = par.getBool("Binary");
|
||||
binaryFlag = par.findParameter("Binary")->val->getBool();
|
||||
|
||||
if(formatName.toUpper() == tr("PLY"))
|
||||
{
|
||||
@ -359,22 +360,22 @@ void BaseMeshIOPlugin::GetExportMaskCapability(QString &format, int &capability,
|
||||
|
||||
}
|
||||
|
||||
void BaseMeshIOPlugin::initOpenParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet &par)
|
||||
void BaseMeshIOPlugin::initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterSet &par)
|
||||
{
|
||||
if(format.toUpper() == tr("STL"))
|
||||
par.addBool("Unify",true, "Unify Duplicated Vertices",
|
||||
"The STL format is not an vertex-indexed format. Each triangle is composed by independent vertices, so, usually, duplicated vertices should be unified");
|
||||
par.addParam(new RichBool("Unify",true, "Unify Duplicated Vertices",
|
||||
"The STL format is not an vertex-indexed format. Each triangle is composed by independent vertices, so, usually, duplicated vertices should be unified"));
|
||||
}
|
||||
void BaseMeshIOPlugin::initSaveParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet &par)
|
||||
void BaseMeshIOPlugin::initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterSet &par)
|
||||
{
|
||||
if(format.toUpper() == tr("STL") || format.toUpper() == tr("PLY"))
|
||||
par.addBool("Binary",true, "Binary encoding",
|
||||
"Save the mesh using a binary encoding. If false the mesh is saved in a plain, readable ascii format");
|
||||
par.addParam(new RichBool("Binary",true, "Binary encoding",
|
||||
"Save the mesh using a binary encoding. If false the mesh is saved in a plain, readable ascii format"));
|
||||
}
|
||||
void BaseMeshIOPlugin::applyOpenParameter(const QString &format, MeshModel &m, const FilterParameterSet &par)
|
||||
void BaseMeshIOPlugin::applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par)
|
||||
{
|
||||
if(format.toUpper() == tr("STL"))
|
||||
if(par.getBool("Unify"))
|
||||
if(par.findParameter("Unify")->val->getBool())
|
||||
tri::Clean<CMeshO>::RemoveDuplicateVertex(m.cm);
|
||||
}
|
||||
|
||||
|
||||
@ -54,13 +54,13 @@ public:
|
||||
|
||||
void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const FilterParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet & par);
|
||||
virtual void applyOpenParameter(const QString &format, MeshModel &m, const FilterParameterSet &par);
|
||||
void initPreOpenParameter(const QString &formatName, const QString &filename, FilterParameterSet &parlst);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterSet & par);
|
||||
virtual void applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par);
|
||||
void initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterSet &parlst);
|
||||
|
||||
virtual void initSaveParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet & par);
|
||||
virtual void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterSet & par);
|
||||
//const QString filterInfo(FilterIDType filter);
|
||||
//const QString filterName(FilterIDType filter);
|
||||
};
|
||||
|
||||
@ -104,7 +104,7 @@
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
bool ColladaIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
bool ColladaIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
// initializing mask
|
||||
mask = 0;
|
||||
@ -153,7 +153,7 @@ bool ColladaIOPlugin::open(const QString &formatName, const QString &fileName, M
|
||||
return true;
|
||||
}
|
||||
|
||||
void ColladaIOPlugin::initPreOpenParameter(const QString &/*format*/, const QString &filename, FilterParameterSet & parlst)
|
||||
void ColladaIOPlugin::initPreOpenParameter(const QString &/*format*/, const QString &filename, RichParameterSet & parlst)
|
||||
{
|
||||
QTime t;
|
||||
t.start();
|
||||
@ -178,13 +178,13 @@ void ColladaIOPlugin::initPreOpenParameter(const QString &/*format*/, const QStr
|
||||
idList.push_back(idVal);
|
||||
qDebug("Node %i geom id = '%s'",i,qPrintable(idVal));
|
||||
}
|
||||
parlst.addEnum("geomnode", 0, idList, tr("geometry nodes"), tr("dsasdfads"));
|
||||
parlst.addParam(new RichEnum("geomnode",0, idList, tr("geometry nodes"), tr("dsasdfads")));
|
||||
qDebug("Time elapsed: %d ms", t.elapsed());
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ColladaIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool ColladaIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exportering file %1:\n%2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
|
||||
@ -63,9 +63,9 @@ class ColladaIOPlugin : public QObject, public MeshIOInterface
|
||||
QList<Format> exportFormats() const;
|
||||
|
||||
void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, FilterParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -558,7 +558,7 @@ EpochIO::EpochIO()
|
||||
delete epochDialog;
|
||||
}
|
||||
|
||||
bool EpochIO::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const FilterParameterSet & /*par*/, CallBackPos *cb, QWidget *parent)
|
||||
bool EpochIO::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterSet & /*par*/, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
EpochReconstruction er;
|
||||
|
||||
@ -755,7 +755,7 @@ bool EpochIO::open(const QString &formatName, const QString &fileName, MeshModel
|
||||
}
|
||||
|
||||
|
||||
bool EpochIO::save(const QString &/*formatName*/,const QString &/*fileName*/, MeshModel &/*m*/, const int /*mask*/, const FilterParameterSet &, vcg::CallBackPos * /*cb*/, QWidget *parent)
|
||||
bool EpochIO::save(const QString &/*formatName*/,const QString &/*fileName*/, MeshModel &/*m*/, const int /*mask*/, const RichParameterSet &, vcg::CallBackPos * /*cb*/, QWidget *parent)
|
||||
{
|
||||
QMessageBox::warning(parent, "Unknown type", "file's extension not supported!!!");
|
||||
return false;
|
||||
|
||||
@ -66,8 +66,8 @@ public:
|
||||
QString lastFileName;
|
||||
void GetExportMaskCapability(QString &, int &, int &) const {assert(0); return ;}
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const FilterParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ win32-msvc2008:LIBS += ../../external/lib/win32-msvc2008/bz2.lib
|
||||
win32-g++:LIBS += ../../external/lib/win32-gcc/libbz2.a
|
||||
linux-g++:LIBS += ../../external/lib/linux-g++/libbz2.a
|
||||
|
||||
win32-msvc2005:INCLUDEPATH -= ../../external/bzip2-1.0.5
|
||||
win32-msvc2005:INCLUDEPATH += ../../external/bzip2-1.0.5
|
||||
win32-msvc2008:INCLUDEPATH += ../../external/bzip2-1.0.5
|
||||
win32-g++:INCLUDEPATH += ../../external/bzip2-1.0.5
|
||||
linux-g++:INCLUDEPATH += ../../external/bzip2-1.0.5
|
||||
|
||||
@ -44,10 +44,11 @@
|
||||
//#include "epoch.h"
|
||||
//#include "radial_distortion.h"
|
||||
//#include "epoch_camera.h"
|
||||
#include <bzlib.h>
|
||||
#include <vector>
|
||||
#include "scalar_image.h"
|
||||
|
||||
#include <bzlib.h>
|
||||
|
||||
|
||||
using namespace std;
|
||||
/*
|
||||
|
||||
@ -42,14 +42,14 @@ using namespace vcg;
|
||||
|
||||
|
||||
// initialize importing parameters
|
||||
// void ExpeIOPlugin::initPreOpenParameter(const QString &formatName, const QString &filename, FilterParameterSet &parlst)
|
||||
// void ExpeIOPlugin::initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterSet &parlst)
|
||||
// {
|
||||
// parlst.addBool("pointsonly",false,"Keep only points","Just import points, without triangulation");
|
||||
// parlst.addBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles");
|
||||
// }
|
||||
|
||||
|
||||
bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
// initializing mask
|
||||
mask = 0;
|
||||
@ -107,7 +107,7 @@ bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, Mesh
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExpeIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool ExpeIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exporting file %1:\n%2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
|
||||
@ -40,9 +40,9 @@ public:
|
||||
QList<Format> exportFormats() const;
|
||||
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
// void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, FilterParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
// void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -41,14 +41,14 @@ using namespace vcg;
|
||||
|
||||
|
||||
// initialize importing parameters
|
||||
// void GtsIOPlugin::initPreOpenParameter(const QString &formatName, const QString &filename, FilterParameterSet &parlst)
|
||||
// void GtsIOPlugin::initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterSet &parlst)
|
||||
// {
|
||||
// parlst.addBool("pointsonly",false,"Keep only points","Just import points, without triangulation");
|
||||
// parlst.addBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles");
|
||||
// }
|
||||
|
||||
|
||||
bool GtsIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
bool GtsIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
// initializing mask
|
||||
mask = 0;
|
||||
@ -96,7 +96,7 @@ bool GtsIOPlugin::open(const QString &formatName, const QString &fileName, MeshM
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GtsIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool GtsIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exporting file %1:\n%2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
|
||||
@ -40,9 +40,9 @@ public:
|
||||
QList<Format> exportFormats() const;
|
||||
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
// void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, FilterParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
// void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -53,31 +53,31 @@ using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
// initialize importing parameters
|
||||
void PDBIOPlugin::initPreOpenParameter(const QString &formatName, const QString &/*filename*/, FilterParameterSet &parlst)
|
||||
void PDBIOPlugin::initPreOpenParameter(const QString &formatName, const QString &/*filename*/, RichParameterSet &parlst)
|
||||
{
|
||||
if (formatName.toUpper() == tr("PDB"))
|
||||
{
|
||||
parlst.addBool("usecolors",true,"Use Atoms colors","Atoms are colored according to atomic type");
|
||||
parlst.addBool("justpoints",false,"SURFACE: Atoms as Points","Atoms are created as points, no surface is built. Overrides all subsequential surface parameters");
|
||||
parlst.addBool("justspheres",true,"SURFACE: Atoms as Spheres","Atoms are created as intersecting spheres, no interpolation surface is built. Overrides all subsequential surface parameters");
|
||||
parlst.addBool("interpspheres",false,"SURFACE: Atoms as Jointed Spheres","Atoms are created as spheres, joining surface is built. Overrides all subsequential surface parameters");
|
||||
parlst.addBool("metaballs",false,"SURFACE: Atoms as Metaballs","Atoms are created as blobby interpolation surface, refer to BLINN Metaballs article. Overrides all subsequential surface parameters");
|
||||
parlst.addFloat("voxelsize",0.25,"Surface Resolution","is used by Jointed Spheres and Metaball");
|
||||
parlst.addFloat("blobby",2.0,"Blobbyness factor","is used by Metaball");
|
||||
parlst.addParam(new RichBool("usecolors",true,"Use Atoms colors","Atoms are colored according to atomic type"));
|
||||
parlst.addParam(new RichBool("justpoints",false,"SURFACE: Atoms as Points","Atoms are created as points, no surface is built. Overrides all subsequential surface parameters"));
|
||||
parlst.addParam(new RichBool("justspheres",true,"SURFACE: Atoms as Spheres","Atoms are created as intersecting spheres, no interpolation surface is built. Overrides all subsequential surface parameters"));
|
||||
parlst.addParam(new RichBool("interpspheres",false,"SURFACE: Atoms as Jointed Spheres","Atoms are created as spheres, joining surface is built. Overrides all subsequential surface parameters"));
|
||||
parlst.addParam(new RichBool("metaballs",false,"SURFACE: Atoms as Metaballs","Atoms are created as blobby interpolation surface, refer to BLINN Metaballs article. Overrides all subsequential surface parameters"));
|
||||
parlst.addParam(new RichFloat("voxelsize",0.25,"Surface Resolution","is used by Jointed Spheres and Metaball"));
|
||||
parlst.addParam(new RichFloat("blobby",2.0,"Blobbyness factor","is used by Metaball"));
|
||||
/*
|
||||
parlst.addInt("meshindex",0,"Index of Range Map to be Imported","PTX files may contain more than one range map. 0 is the first range map. If the number if higher than the actual mesh number, the import will fail");
|
||||
parlst.addBool("anglecull",true,"Cull faces by angle","short");
|
||||
parlst.addFloat("angle",85.0,"Angle limit for face culling","short");
|
||||
parlst.addBool("usecolor",true,"import color","Read color from PTX, if color is not present, uses reflectance instead");
|
||||
parlst.addBool("pointcull",true,"delete unsampled points","Deletes unsampled points in the grid that are normally located in [0,0,0]");
|
||||
parlst.addBool("pointsonly",false,"Keep only points","Just import points, without triangulation");
|
||||
parlst.addBool("switchside",false,"Swap rows/columns","On some PTX, the rows and columns number are switched over");
|
||||
parlst.addBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles");
|
||||
parlst.addParam(new RichInt("meshindex",0,"Index of Range Map to be Imported","PTX files may contain more than one range map. 0 is the first range map. If the number if higher than the actual mesh number, the import will fail");
|
||||
parlst.addParam(new RichBool("anglecull",true,"Cull faces by angle","short");
|
||||
parlst.addParam(new RichFloat("angle",85.0,"Angle limit for face culling","short");
|
||||
parlst.addParam(new RichBool("usecolor",true,"import color","Read color from PTX, if color is not present, uses reflectance instead");
|
||||
parlst.addParam(new RichBool("pointcull",true,"delete unsampled points","Deletes unsampled points in the grid that are normally located in [0,0,0]");
|
||||
parlst.addParam(new RichBool("pointsonly",false,"Keep only points","Just import points, without triangulation");
|
||||
parlst.addParam(new RichBool("switchside",false,"Swap rows/columns","On some PTX, the rows and columns number are switched over");
|
||||
parlst.addParam(new RichBool("flipfaces",false,"Flip all faces","Flip the orientation of all the triangles");
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
bool PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &parlst, CallBackPos *cb, QWidget * /*parent*/)
|
||||
bool PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget * /*parent*/)
|
||||
{
|
||||
bool normalsUpdated = false;
|
||||
|
||||
@ -144,7 +144,7 @@ bool PDBIOPlugin::open(const QString &formatName, const QString &fileName, MeshM
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PDBIOPlugin::save(const QString &formatName,const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet & par, CallBackPos *cb, QWidget */*parent*/)
|
||||
bool PDBIOPlugin::save(const QString &formatName,const QString &fileName, MeshModel &m, const int mask, const RichParameterSet & par, CallBackPos *cb, QWidget */*parent*/)
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
@ -182,7 +182,7 @@ void PDBIOPlugin::GetExportMaskCapability(QString &format, int &capability, int
|
||||
return;
|
||||
}
|
||||
|
||||
void PDBIOPlugin::initOpenParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet &par)
|
||||
void PDBIOPlugin::initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterSet &par)
|
||||
{
|
||||
/*
|
||||
if(format.toUpper() == tr("STL"))
|
||||
@ -190,7 +190,7 @@ void PDBIOPlugin::initOpenParameter(const QString &format, MeshModel &/*m*/, Fil
|
||||
"The STL format is not an vertex-indexed format. Each triangle is composed by independent vertices, so, usually, duplicated vertices should be unified");
|
||||
*/
|
||||
}
|
||||
void PDBIOPlugin::initSaveParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet &par)
|
||||
void PDBIOPlugin::initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterSet &par)
|
||||
{
|
||||
/*
|
||||
if(format.toUpper() == tr("STL") || format.toUpper() == tr("PLY"))
|
||||
@ -198,7 +198,7 @@ void PDBIOPlugin::initSaveParameter(const QString &format, MeshModel &/*m*/, Fil
|
||||
"Save the mesh using a binary encoding. If false the mesh is saved in a plain, readable ascii format");
|
||||
*/
|
||||
}
|
||||
void PDBIOPlugin::applyOpenParameter(const QString &format, MeshModel &m, const FilterParameterSet &par)
|
||||
void PDBIOPlugin::applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par)
|
||||
{
|
||||
/*
|
||||
if(format.toUpper() == tr("STL"))
|
||||
@ -211,7 +211,7 @@ Q_EXPORT_PLUGIN(PDBIOPlugin)
|
||||
|
||||
|
||||
//---------- PDB READER -----------//
|
||||
bool PDBIOPlugin::parsePDB(const std::string &filename, CMeshO &m, const FilterParameterSet &parlst, CallBackPos *cb)
|
||||
bool PDBIOPlugin::parsePDB(const std::string &filename, CMeshO &m, const RichParameterSet &parlst, CallBackPos *cb)
|
||||
{
|
||||
int atomNumber=0;
|
||||
int atomIndex;
|
||||
|
||||
@ -41,16 +41,16 @@ public:
|
||||
|
||||
void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const FilterParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet & par);
|
||||
virtual void applyOpenParameter(const QString &format, MeshModel &m, const FilterParameterSet &par);
|
||||
void initPreOpenParameter(const QString &formatName, const QString &filename, FilterParameterSet &parlst);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet & par, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
virtual void initOpenParameter(const QString &format, MeshModel &/*m*/, RichParameterSet & par);
|
||||
virtual void applyOpenParameter(const QString &format, MeshModel &m, const RichParameterSet &par);
|
||||
void initPreOpenParameter(const QString &formatName, const QString &filename, RichParameterSet &parlst);
|
||||
|
||||
virtual void initSaveParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet & par);
|
||||
virtual void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterSet & par);
|
||||
|
||||
//---------- PDB READER -----------//
|
||||
bool parsePDB(const std::string &filename, CMeshO &m, const FilterParameterSet &parlst, vcg::CallBackPos *cb=0);
|
||||
bool parsePDB(const std::string &filename, CMeshO &m, const RichParameterSet &parlst, vcg::CallBackPos *cb=0);
|
||||
void mysscanf(const char* st, const char* format, float *f);
|
||||
float getAtomRadius(const char* atomicElementCharP);
|
||||
vcg::Color4b getAtomColor(const char* atomicElementCharP);
|
||||
|
||||
@ -39,16 +39,16 @@ using namespace vcg;
|
||||
|
||||
bool parseTRI(const std::string &filename, CMeshO &m);
|
||||
|
||||
void TriIOPlugin::initPreOpenParameter(const QString &format, const QString &/*fileName*/, FilterParameterSet & parlst)
|
||||
void TriIOPlugin::initPreOpenParameter(const QString &format, const QString &/*fileName*/, RichParameterSet & parlst)
|
||||
{
|
||||
if(format.toUpper() == tr("ASC"))
|
||||
{
|
||||
parlst.addInt("rowToSkip",0,"Header Row to be skipped","The number of lines that must be skipped at the beginning of the file.");
|
||||
parlst.addBool("triangulate", true, "Grid triangulation", "if true it assumes that the points are arranged in a complete xy grid and it tries to perform a naive height field triangulation of the input data. Lenght of the lines is detected automatically by searching x jumps. If the input point cloud data is not arranged as a xy regular height field, no triangles are created.");
|
||||
parlst.addParam(new RichInt("rowToSkip",0,"Header Row to be skipped","The number of lines that must be skipped at the beginning of the file."));
|
||||
parlst.addParam(new RichBool("triangulate", true, "Grid triangulation", "if true it assumes that the points are arranged in a complete xy grid and it tries to perform a naive height field triangulation of the input data. Lenght of the lines is detected automatically by searching x jumps. If the input point cloud data is not arranged as a xy regular height field, no triangles are created."));
|
||||
}
|
||||
}
|
||||
|
||||
bool TriIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
bool TriIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
bool result;
|
||||
if(formatName.toUpper() == tr("TRI"))
|
||||
@ -75,7 +75,7 @@ bool TriIOPlugin::open(const QString &formatName, const QString &fileName, MeshM
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TriIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool TriIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
|
||||
@ -44,10 +44,10 @@ public:
|
||||
QList<Format> importFormats() const;
|
||||
QList<Format> exportFormats() const;
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, FilterParameterSet & /*par*/);
|
||||
virtual void initPreOpenParameter(const QString &/*format*/, const QString &/*fileName*/, RichParameterSet & /*par*/);
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -46,7 +46,7 @@ U3DIOPlugin::U3DIOPlugin()
|
||||
|
||||
}
|
||||
|
||||
bool U3DIOPlugin::open(const QString & /*formatName*/, const QString &/*fileName*/, MeshModel &/*m*/, int& /*mask*/, const FilterParameterSet &, CallBackPos */*cb*/, QWidget */*parent*/)
|
||||
bool U3DIOPlugin::open(const QString & /*formatName*/, const QString &/*fileName*/, MeshModel &/*m*/, int& /*mask*/, const RichParameterSet &, CallBackPos */*cb*/, QWidget */*parent*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ QString U3DIOPlugin::computePluginsPath()
|
||||
}
|
||||
|
||||
|
||||
bool U3DIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet & par, vcg::CallBackPos */*cb*/, QWidget *parent)
|
||||
bool U3DIOPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet & par, vcg::CallBackPos */*cb*/, QWidget *parent)
|
||||
{
|
||||
vcg::tri::Allocator<CMeshO>::CompactVertexVector(m.cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(m.cm);
|
||||
@ -191,22 +191,22 @@ void U3DIOPlugin::GetExportMaskCapability(QString &format, int &capability, int
|
||||
// avoidExponentialNotation(p.Z(),bboxdiag));
|
||||
//}
|
||||
|
||||
void U3DIOPlugin::initSaveParameter(const QString &format, MeshModel &m, FilterParameterSet &par)
|
||||
void U3DIOPlugin::initSaveParameter(const QString &format, MeshModel &m, RichParameterSet &par)
|
||||
{
|
||||
_param._campar = new vcg::tri::io::u3dparametersclasses::Movie15Parameters::CameraParameters(m.cm.bbox.Center(),m.cm.bbox.Diag());
|
||||
//vcg::Point3f pos = avoidExponentialNotation(_param._campar->_obj_pos,_param._campar->_obj_bbox_diag);
|
||||
vcg::Point3f pos = _param._campar->_obj_pos;
|
||||
vcg::Point3f dir(0.0f,0.0f,-1.0f * _param._campar->_obj_bbox_diag);
|
||||
par.addPoint3f("position_val",dir, "Camera Position",
|
||||
"The position in which the camera is set. The default value is derived by the 3d mesh's bounding box.");
|
||||
par.addParam(new RichPoint3f("position_val",dir, "Camera Position",
|
||||
"The position in which the camera is set. The default value is derived by the 3d mesh's bounding box."));
|
||||
//vcg::Point3f dir(0.0f,0.0f,avoidExponentialNotation(-1.0f * _param._campar->_obj_bbox_diag,_param._campar->_obj_bbox_diag));
|
||||
par.addPoint3f("target_val",pos, "Camera target point",
|
||||
"The point towards the camera is seeing. The default value is derived by the 3d mesh's bounding box.");
|
||||
par.addFloat("fov_val",60.0f,"Camera's FOV Angle 0..180","Camera's FOV Angle. The values' range is between 0-180 degree. The default value is 60.");
|
||||
par.addInt("compression_val",500,"U3D quality 0..1000","U3D mesh's compression ratio. The values' range is between 0-1000 degree. The default value is 500.");
|
||||
par.addParam(new RichPoint3f("target_val",pos, "Camera target point",
|
||||
"The point towards the camera is seeing. The default value is derived by the 3d mesh's bounding box."));
|
||||
par.addParam(new RichFloat("fov_val",60.0f,"Camera's FOV Angle 0..180","Camera's FOV Angle. The values' range is between 0-180 degree. The default value is 60."));
|
||||
par.addParam(new RichInt("compression_val",500,"U3D quality 0..1000","U3D mesh's compression ratio. The values' range is between 0-1000 degree. The default value is 500."));
|
||||
}
|
||||
|
||||
void U3DIOPlugin::saveParameters(const FilterParameterSet &par)
|
||||
void U3DIOPlugin::saveParameters(const RichParameterSet &par)
|
||||
{
|
||||
vcg::Point3f from_target_to_camera = vcg::Point3f(- par.getPoint3f(QString("position_val")) + par.getPoint3f(QString("target_val")));
|
||||
vcg::tri::io::u3dparametersclasses::Movie15Parameters::CameraParameters* sw = _param._campar;
|
||||
|
||||
@ -47,16 +47,16 @@ class U3DIOPlugin : public QObject, public MeshIOInterface
|
||||
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent= 0);
|
||||
|
||||
void initSaveParameter(const QString &format, MeshModel &/*m*/, FilterParameterSet &par);
|
||||
void initSaveParameter(const QString &format, MeshModel &/*m*/, RichParameterSet &par);
|
||||
|
||||
private:
|
||||
QString computePluginsPath();
|
||||
|
||||
|
||||
void saveParameters(const FilterParameterSet &par);
|
||||
void saveParameters(const RichParameterSet &par);
|
||||
vcg::tri::io::u3dparametersclasses::Movie15Parameters _param;
|
||||
|
||||
};
|
||||
|
||||
@ -79,7 +79,7 @@
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
// initializing mask
|
||||
mask = 0;
|
||||
@ -170,7 +170,7 @@ bool IoX3DPlugin::open(const QString &formatName, const QString &fileName, MeshM
|
||||
}
|
||||
|
||||
|
||||
bool IoX3DPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
bool IoX3DPlugin::save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent)
|
||||
{
|
||||
QString errorMsgFormat = "Error encountered while exportering file:\n%1\n\nError details: %2";
|
||||
string filename = QFile::encodeName(fileName).constData ();
|
||||
|
||||
@ -49,8 +49,8 @@ public:
|
||||
|
||||
virtual void GetExportMaskCapability(QString &format, int &capability, int &defaultBits) const;
|
||||
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const FilterParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const FilterParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
bool open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &, vcg::CallBackPos *cb=0, QWidget *parent=0);
|
||||
bool save(const QString &formatName, const QString &fileName, MeshModel &m, const int mask, const RichParameterSet &, vcg::CallBackPos *cb, QWidget *parent);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -76,7 +76,7 @@ const QString ExtraMeshDecoratePlugin::ST(FilterIDType filter) const
|
||||
return QString("error!");
|
||||
}
|
||||
|
||||
void ExtraMeshDecoratePlugin::Decorate(QAction *a, MeshModel &m, FilterParameterSet */*rm*/, GLArea *gla, QFont qf)
|
||||
void ExtraMeshDecoratePlugin::Decorate(QAction *a, MeshModel &m, RichParameterSet */*rm*/, GLArea *gla, QFont qf)
|
||||
{
|
||||
glPushMatrix();
|
||||
glMultMatrix(m.cm.Tr);
|
||||
|
||||
@ -178,7 +178,7 @@ public:
|
||||
|
||||
QHash<MeshModel *, bool> isMeshOk;
|
||||
|
||||
virtual void Decorate(QAction *a, MeshModel &m, FilterParameterSet *, GLArea *gla,QFont qf);
|
||||
virtual void Decorate(QAction *a, MeshModel &m, RichParameterSet *, GLArea *gla,QFont qf);
|
||||
virtual bool StartDecorate(QAction * /*mode*/, MeshModel &/*m*/, GLArea * /*parent*/);
|
||||
|
||||
};
|
||||
|
||||
@ -132,7 +132,7 @@ bool Open(MeshModel &mm, QString fileName)
|
||||
|
||||
int mask = 0;
|
||||
|
||||
FilterParameterSet prePar;
|
||||
RichParameterSet prePar;
|
||||
pCurrentIOPlugin->initPreOpenParameter(extension, fileName,prePar);
|
||||
|
||||
if (!pCurrentIOPlugin->open(extension, fileName, mm ,mask,prePar))
|
||||
@ -174,7 +174,7 @@ bool Save(MeshModel *mm, int mask, QString fileName)
|
||||
MeshIOInterface* pCurrentIOPlugin = meshIOPlugins[idx-1];
|
||||
|
||||
// optional saving parameters (like ascii/binary encoding)
|
||||
FilterParameterSet savePar;
|
||||
RichParameterSet savePar;
|
||||
pCurrentIOPlugin->initSaveParameter(extension, *mm, savePar);
|
||||
|
||||
if (!pCurrentIOPlugin->save(extension, fileName, *mm ,mask, savePar))
|
||||
@ -203,8 +203,9 @@ bool Script(MeshDocument &meshDocument, QString scriptfile){
|
||||
scriptPtr.open(scriptfile);
|
||||
printf("Starting Script of %i actions",scriptPtr.actionList.size());
|
||||
FilterScript::iterator ii;
|
||||
for(ii = scriptPtr.actionList.begin();ii!= scriptPtr.actionList.end();++ii){
|
||||
FilterParameterSet &par = (*ii).second;
|
||||
for(ii = scriptPtr.actionList.begin();ii!= scriptPtr.actionList.end();++ii)
|
||||
{
|
||||
RichParameterSet &par = (*ii).second;
|
||||
QString &name = (*ii).first;
|
||||
printf("filter: %s\n",qPrintable((*ii).first));
|
||||
|
||||
@ -213,31 +214,6 @@ bool Script(MeshDocument &meshDocument, QString scriptfile){
|
||||
iFilter->setLog(NULL);
|
||||
int req = iFilter->getRequirements(action);
|
||||
mm.updateDataMask(req);
|
||||
|
||||
|
||||
|
||||
//make sure the PARMESH parameters are initialized
|
||||
FilterParameterSet ¶meterSet = (*ii).second;
|
||||
for(int i = 0; i < parameterSet.paramList.size(); i++)
|
||||
{
|
||||
//get a modifieable reference
|
||||
FilterParameter ¶meter = parameterSet.paramList[i];
|
||||
|
||||
//if this is a mesh paramter and the index is valid
|
||||
if(parameter.fieldType == FilterParameter::PARMESH)
|
||||
{
|
||||
if( parameter.fieldVal.toInt() < meshDocument.size() &&
|
||||
parameter.fieldVal.toInt() >= 0 )
|
||||
{
|
||||
parameter.pointerVal = meshDocument.getMesh(parameter.fieldVal.toInt());
|
||||
} else
|
||||
{
|
||||
printf("Meshes loaded: %i, meshes asked for: %i \n", meshDocument.size(), parameter.fieldVal.toInt() );
|
||||
printf("One of the filters in the script needs more meshes than you have loaded.\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ret = iFilter->applyFilter( action, meshDocument, (*ii).second, NULL);
|
||||
//iFilter->applyFilter( action, mm, (*ii).second, QCallBack );
|
||||
|
||||
4264
src/sample/block.off
4264
src/sample/block.off
File diff suppressed because it is too large
Load Diff
@ -97,14 +97,14 @@ const int FilterBorder::getRequirements(QAction *action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FilterBorder::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void FilterBorder::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
pair<float,float> qualityRange;
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_REMOVE_BORDER_FACE :
|
||||
parlst.addInt("IterationNum",1,"Iteration","Number of times that the removal of face border is iterated.");
|
||||
parlst.addBool("DeleteVertices",true,"Delete unreferenced vertices","Remove the vertexes that remains unreferneced after the face removal.");
|
||||
parlst.addParam(new RichInt("IterationNum",1,"Iteration","Number of times that the removal of face border is iterated."));
|
||||
parlst.addParam(new RichBool("DeleteVertices",true,"Delete unreferenced vertices","Remove the vertexes that remains unreferneced after the face removal."));
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
@ -112,7 +112,7 @@ void FilterBorder::initParameterSet(QAction *action,MeshModel &m, FilterParamete
|
||||
|
||||
|
||||
|
||||
bool FilterBorder::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * cb)
|
||||
bool FilterBorder::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * cb)
|
||||
{
|
||||
CMeshO::FaceIterator fi;
|
||||
CMeshO::VertexIterator vi;
|
||||
|
||||
@ -65,8 +65,8 @@ class FilterBorder : public QObject, public MeshFilterInterface
|
||||
virtual const int getRequirements(QAction *);
|
||||
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -96,7 +96,7 @@ const int FilterCreateIso::getRequirements(QAction *action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool FilterCreateIso::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * cb)
|
||||
bool FilterCreateIso::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * cb)
|
||||
{
|
||||
CMeshO::FaceIterator fi;
|
||||
CMeshO::VertexIterator vi;
|
||||
@ -127,13 +127,13 @@ bool FilterCreateIso::applyFilter(QAction *filter, MeshModel &m, FilterParameter
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void FilterCreateIso::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void FilterCreateIso::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
pair<float,float> qualityRange;
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_CREATEISO :
|
||||
parlst.addInt("Resolution",64,"Grid Resolution","Resolution of the side of the cubic grid used for the volume creation");
|
||||
parlst.addParam(new RichInt("Resolution",64,"Grid Resolution","Resolution of the side of the cubic grid used for the volume creation"));
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
|
||||
@ -64,9 +64,9 @@ class FilterCreateIso : public QObject, public MeshFilterInterface
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ const int FilterGeodesic::getRequirements(QAction *action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool FilterGeodesic::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos * /*cb*/)
|
||||
bool FilterGeodesic::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos * /*cb*/)
|
||||
{
|
||||
CMeshO::FaceIterator fi;
|
||||
CMeshO::VertexIterator vi;
|
||||
@ -189,12 +189,12 @@ bool FilterGeodesic::applyFilter(QAction *filter, MeshModel &m, FilterParameterS
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterGeodesic::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void FilterGeodesic::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action))
|
||||
{
|
||||
case FP_QUALITY_POINT_GEODESIC :
|
||||
parlst.addPoint3f("startPoint",m.cm.bbox.min,"Starting point","The starting point from which geodesic distance has to be computed. If it is not a surface vertex, the closest vertex to the specified point is used as starting seed point.");
|
||||
parlst.addParam(new RichPoint3f("startPoint",m.cm.bbox.min,"Starting point","The starting point from which geodesic distance has to be computed. If it is not a surface vertex, the closest vertex to the specified point is used as starting seed point."));
|
||||
break;
|
||||
default: assert(0);
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ class FilterGeodesic : public QObject, public MeshFilterInterface
|
||||
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual const int getRequirements(QAction *);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool autoDialog(QAction *) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ const QString SampleMeshDecoratePlugin::Info(QAction *action)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void SampleMeshDecoratePlugin::initGlobalParameterSet(QAction *, FilterParameterSet *parset)
|
||||
void SampleMeshDecoratePlugin::initGlobalParameterSet(QAction *, RichParameterSet *parset)
|
||||
{
|
||||
if(parset->findParameter("CubeMapPath")!= NULL)
|
||||
{
|
||||
@ -63,7 +63,7 @@ void SampleMeshDecoratePlugin::initGlobalParameterSet(QAction *, FilterParameter
|
||||
QString cubemapDirPath = MainWindowInterface::getBaseDirPath() + QString("/textures/cubemaps/uffizi.jpg");
|
||||
|
||||
//parset->addString("CubeMapPath", "/Users/cignoni/devel/meshlab/src/meshlab/textures/cubemaps/uffizi.jpg");
|
||||
parset->addString("CubeMapPath", cubemapDirPath);
|
||||
parset->addParam(new RichString("CubeMapPath", cubemapDirPath));
|
||||
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ const QString SampleMeshDecoratePlugin::ST(FilterIDType filter) const
|
||||
return QString("error!");
|
||||
}
|
||||
|
||||
void SampleMeshDecoratePlugin::Decorate(QAction *a, MeshModel &m, FilterParameterSet *par, GLArea *gla, QFont /*qf*/)
|
||||
void SampleMeshDecoratePlugin::Decorate(QAction *a, MeshModel &m, RichParameterSet *par, GLArea *gla, QFont /*qf*/)
|
||||
{
|
||||
assert(par);
|
||||
static QString lastname("unitialized");
|
||||
|
||||
@ -72,8 +72,8 @@ public:
|
||||
|
||||
QList<QAction *> actions () const {return actionList;}
|
||||
|
||||
virtual void Decorate(QAction *a, MeshModel &m, FilterParameterSet * /*parent*/ par, GLArea *gla,QFont qf);
|
||||
virtual void initGlobalParameterSet(QAction *, FilterParameterSet * /*globalparam*/);
|
||||
virtual void Decorate(QAction *a, MeshModel &m, RichParameterSet * /*parent*/ par, GLArea *gla,QFont qf);
|
||||
virtual void initGlobalParameterSet(QAction *, RichParameterSet * /*globalparam*/);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -102,19 +102,19 @@ const ExtraSamplePlugin::FilterClass ExtraSamplePlugin::getClass(QAction *a)
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a possibly long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void ExtraSamplePlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void ExtraSamplePlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_MOVE_VERTEX :
|
||||
parlst.addBool ("UpdateNormals",
|
||||
parlst.addParam(new RichBool ("UpdateNormals",
|
||||
true,
|
||||
"Recompute normals",
|
||||
"Toggle the recomputation of the normals after the random displacement.\n\n"
|
||||
"If disabled the face normals will remains unchanged resulting in a visually pleasant effect.");
|
||||
parlst.addAbsPerc("Displacement",
|
||||
"If disabled the face normals will remains unchanged resulting in a visually pleasant effect."));
|
||||
parlst.addParam(new RichAbsPerc("Displacement",
|
||||
m.cm.bbox.Diag()/100.0,0,m.cm.bbox.Diag(),
|
||||
"Max displacement",
|
||||
"The vertex are displaced of a vector whose norm is bounded by this value");
|
||||
"The vertex are displaced of a vector whose norm is bounded by this value"));
|
||||
break;
|
||||
|
||||
default : assert(0);
|
||||
@ -123,7 +123,7 @@ void ExtraSamplePlugin::initParameterSet(QAction *action,MeshModel &m, FilterPar
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// Move Vertex of a random quantity
|
||||
bool ExtraSamplePlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool ExtraSamplePlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
//MeshModel &m=*md->mm();
|
||||
srand(time(NULL));
|
||||
|
||||
@ -52,8 +52,8 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual int postCondition( QAction* ) const {return MeshModel::MM_VERTCOORD | MeshModel::MM_FACENORMAL | MeshModel::MM_VERTNORMAL;};
|
||||
const FilterClass getClass(QAction *a);
|
||||
|
||||
|
||||
@ -83,24 +83,24 @@ const QString SampleFilterDocPlugin::filterInfo(FilterIDType filterId) const
|
||||
// - the string shown in the dialog
|
||||
// - the default value
|
||||
// - a long string describing the meaning of that parameter (shown as a popup help in the dialog)
|
||||
void SampleFilterDocPlugin::initParameterSet(QAction *action,MeshDocument & /*m*/, FilterParameterSet & parlst)
|
||||
void SampleFilterDocPlugin::initParameterSet(QAction *action,MeshDocument & /*m*/, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_FLATTEN :
|
||||
parlst.addBool ("MergeVisible",
|
||||
parlst.addParam(new RichBool ("MergeVisible",
|
||||
true,
|
||||
"Merge Only Visible Layers",
|
||||
"Merge the vertices that are duplicated among different layers. <br>"
|
||||
"Very useful when the layers are spliced portions of a single big mesh.");
|
||||
parlst.addBool ("DeleteLayer",
|
||||
"Very useful when the layers are spliced portions of a single big mesh."));
|
||||
parlst.addParam(new RichBool ("DeleteLayer",
|
||||
true,
|
||||
"Delete Layers ",
|
||||
"Delete all the merged layers. <br>If all layers are visible only a single layer will remain after the invocation of this filter");
|
||||
parlst.addBool ("MergeVertices",
|
||||
"Delete all the merged layers. <br>If all layers are visible only a single layer will remain after the invocation of this filter"));
|
||||
parlst.addParam(new RichBool ("MergeVertices",
|
||||
true,
|
||||
"Merge duplicate vertices",
|
||||
"Merge the vertices that are duplicated among different layers. \n\n"
|
||||
"Very useful when the layers are spliced portions of a single big mesh.");
|
||||
"Very useful when the layers are spliced portions of a single big mesh."));
|
||||
break;
|
||||
|
||||
default : assert(0);
|
||||
@ -108,7 +108,7 @@ void SampleFilterDocPlugin::initParameterSet(QAction *action,MeshDocument & /*m*
|
||||
}
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
bool SampleFilterDocPlugin::applyFilter(QAction *filter, MeshDocument &md, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool SampleFilterDocPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
|
||||
switch(ID(filter)) {
|
||||
|
||||
@ -53,9 +53,9 @@ public:
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, FilterParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
virtual void initParameterSet(QAction *,MeshDocument &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual bool applyFilter(QAction *filter, MeshDocument &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction */*filter*/, MeshModel &, RichParameterSet & /*parent*/, vcg::CallBackPos *) { assert(0); return false;} ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -96,24 +96,24 @@ const MeshFilterInterface::FilterClass ExtraSampleDynPlugin::getClass(QAction *)
|
||||
// when the user press apply the current stored state is updated.
|
||||
// when the user press close the mesh state is restored to the one before the startup of the filter.
|
||||
|
||||
void ExtraSampleDynPlugin::initParameterSet(QAction *action,MeshModel &m, FilterParameterSet & parlst)
|
||||
void ExtraSampleDynPlugin::initParameterSet(QAction *action,MeshModel &m, RichParameterSet & parlst)
|
||||
{
|
||||
switch(ID(action)) {
|
||||
case FP_VERTEX_COLOR_NOISE :
|
||||
parlst.addColor ("baseColor",
|
||||
parlst.addParam(new RichColor ("baseColor",
|
||||
Color4b::Black,
|
||||
"BaseColor",
|
||||
"The base color that is added to the mesh.");
|
||||
"The base color that is added to the mesh."));
|
||||
|
||||
parlst.addDynamicFloat("percentage",
|
||||
parlst.addParam(new RichDynamicFloat("percentage",
|
||||
0.5, 0, 1,
|
||||
"Alpha",
|
||||
"The random color is blended with the current one with the specified alpha");
|
||||
"The random color is blended with the current one with the specified alpha"));
|
||||
|
||||
parlst.addDynamicFloat("frequency",
|
||||
parlst.addParam(new RichDynamicFloat("frequency",
|
||||
20, 1, 200,
|
||||
"Noisy Frequency",
|
||||
"The frequency of the Noise on the mesh. Higher numbers means smaller spots.");
|
||||
"The frequency of the Noise on the mesh. Higher numbers means smaller spots."));
|
||||
break;
|
||||
|
||||
default : assert(0);
|
||||
@ -122,7 +122,7 @@ void ExtraSampleDynPlugin::initParameterSet(QAction *action,MeshModel &m, Filter
|
||||
|
||||
// The Real Core Function doing the actual mesh processing.
|
||||
// It changes the color of the mesh according to a perlin noise function
|
||||
bool ExtraSampleDynPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & par, vcg::CallBackPos *cb)
|
||||
bool ExtraSampleDynPlugin::applyFilter(QAction *filter, MeshModel &m, RichParameterSet & par, vcg::CallBackPos *cb)
|
||||
{
|
||||
const Color4b baseColor = par.getColor4b("baseColor");
|
||||
const float percentage = par.getDynamicFloat("percentage");
|
||||
|
||||
@ -42,9 +42,9 @@ public:
|
||||
virtual const QString filterName(FilterIDType filter) const;
|
||||
virtual const QString filterInfo(FilterIDType filter) const;
|
||||
virtual bool autoDialog(QAction *) {return true;}
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, FilterParameterSet & /*parent*/);
|
||||
virtual void initParameterSet(QAction *,MeshModel &/*m*/, RichParameterSet & /*parent*/);
|
||||
virtual int postCondition( QAction* ) const {return MeshModel::MM_VERTCOLOR;};
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual bool applyFilter(QAction *filter, MeshModel &m, RichParameterSet & /*parent*/, vcg::CallBackPos * cb) ;
|
||||
virtual const FilterClass getClass(QAction *);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user