--- a/src/linetypes/triangle.cpp Wed Mar 18 17:11:23 2020 +0200 +++ b/src/linetypes/triangle.cpp Thu Mar 19 21:06:06 2020 +0200 @@ -26,34 +26,23 @@ { switch (id) { + case Property::Point0: + return QVariant::fromValue(points[0]); case Property::Point1: - return QVariant::fromValue(points[0]); + return QVariant::fromValue(points[1]); case Property::Point2: - return QVariant::fromValue(points[1]); - case Property::Point3: return QVariant::fromValue(points[2]); default: return ColoredObject::getProperty(id); } } -auto ldraw::Triangle::setProperty(Property id, const QVariant& value) - -> SetPropertyResult +void ldraw::Triangle::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { - switch (id) - { - case Property::Point1: - points[0] = value.value<glm::vec3>(); - return SetPropertyResult::Success; - case Property::Point2: - points[1] = value.value<glm::vec3>(); - return SetPropertyResult::Success; - case Property::Point3: - points[2] = value.value<glm::vec3>(); - return SetPropertyResult::Success; - default: - return ColoredObject::setProperty(id, value); - } + LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point0, {points[0] = value;}) + LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point1, {points[1] = value;}) + LDRAW_OBJECT_HANDLE_SET_PROPERTY(Point2, {points[2] = value;}) + ColoredObject::setProperty(result, pair); } QString ldraw::Triangle::textRepresentation() const