Sun, 12 Sep 2021 12:14:32 +0300
Moved automatic grid adjusting into a new action
#include <QBrush> #include <QFont> #include "object.h" #include "widgets/vec3editor.h" #include "modeleditcontext.h" static std::int32_t getIdForNewObject() { static std::int32_t id = 0; id += 1; return id; } ldraw::Object::Object() : id {getIdForNewObject()} { } ldraw::Object::~Object() { } bool ldraw::Object::hasColor() const { return false; } QVariant ldraw::Object::getProperty(Property id) const { Q_UNUSED(id); return {}; } void ldraw::Object::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { Q_UNUSED(result) Q_UNUSED(pair) } /** * @brief public interface to setProperty */ ldraw::Object::SetPropertyResult ldraw::Object::setProperty(const PropertyKeyValue& pair) { SetPropertyResult result; this->setProperty(&result, pair); return result; } QBrush ldraw::Object::textRepresentationForeground() const { return {}; } QBrush ldraw::Object::textRepresentationBackground() const { return {}; } QFont ldraw::Object::textRepresentationFont() const { return {}; } void ldraw::Object::getPolygons(std::vector<gl::Polygon>& polygons, GetPolygonsContext* context) const { Q_UNUSED(polygons) Q_UNUSED(context) } const glm::vec3& ldraw::Object::getPoint(int index) const { Q_UNUSED(index); throw BadPointIndex{}; } ldraw::ColoredObject::ColoredObject(const Color color_index) : colorIndex{color_index} { } bool ldraw::ColoredObject::hasColor() const { return true; } QVariant ldraw::ColoredObject::getProperty(Property id) const { switch (id) { case Property::Color: return QVariant::fromValue<Color>(colorIndex); default: return Object::getProperty(id); } } void ldraw::ColoredObject::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { LDRAW_OBJECT_HANDLE_SET_PROPERTY(Color, {colorIndex = value;}); Object::setProperty(result, pair); } QString ldraw::Empty::textRepresentation() const { return ""; }