Mesh: [skip ci] fixes #0004430: Mesh_BuildRegularSolid: parametric mesh props have no units in Property editor
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
|
||||
|
||||
namespace Mesh {
|
||||
const App::PropertyIntegerConstraint::Constraints intSampling = {0,1000,1};
|
||||
const App::PropertyFloatConstraint::Constraints floatRange = {0.0,1000.0,1.0};
|
||||
const App::PropertyIntegerConstraint::Constraints intSampling = {0,INT_MAX,1};
|
||||
const App::PropertyLength::Constraints floatRange = {0.0,FLT_MAX,1.0};
|
||||
}
|
||||
|
||||
using namespace Mesh;
|
||||
@@ -72,6 +72,18 @@ App::DocumentObjectExecReturn *Sphere::execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Sphere::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if (prop == &Radius && strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
Radius.setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Mesh::Ellipsoid, Mesh::Feature)
|
||||
@@ -108,6 +120,19 @@ App::DocumentObjectExecReturn *Ellipsoid::execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Ellipsoid::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if ((prop == &Radius1 || prop == &Radius2) &&
|
||||
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Mesh::Cylinder, Mesh::Feature)
|
||||
@@ -150,6 +175,19 @@ App::DocumentObjectExecReturn *Cylinder::execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Cylinder::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if ((prop == &Radius || prop == &Length || prop == &EdgeLength) &&
|
||||
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Mesh::Cone, Mesh::Feature)
|
||||
@@ -195,6 +233,19 @@ App::DocumentObjectExecReturn *Cone::execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Cone::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if ((prop == &Radius1 || prop == &Radius2 || prop == &Length || prop == &EdgeLength) &&
|
||||
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Mesh::Torus, Mesh::Feature)
|
||||
@@ -231,6 +282,19 @@ App::DocumentObjectExecReturn *Torus::execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Torus::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if ((prop == &Radius1 || prop == &Radius2) &&
|
||||
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
|
||||
PROPERTY_SOURCE(Mesh::Cube, Mesh::Feature)
|
||||
@@ -266,3 +330,16 @@ App::DocumentObjectExecReturn *Cube::execute(void)
|
||||
return new App::DocumentObjectExecReturn("Cannot create cube", this);
|
||||
}
|
||||
}
|
||||
|
||||
void Cube::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
|
||||
{
|
||||
if ((prop == &Length || prop == &Width || prop == &Height) &&
|
||||
strcmp(TypeName, "App::PropertyFloatConstraint") == 0) {
|
||||
App::PropertyFloatConstraint r;
|
||||
r.Restore(reader);
|
||||
static_cast<App::PropertyLength*>(prop)->setValue(r.getValue());
|
||||
}
|
||||
else {
|
||||
Mesh::Feature::handleChangedPropertyType(reader, TypeName, prop);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user