src/modeleditcontext.cpp

changeset 89
7abaf1d64719
parent 87
93ec4d630346
child 112
5760cbb32bc0
--- a/src/modeleditcontext.cpp	Mon May 11 12:18:04 2020 +0300
+++ b/src/modeleditcontext.cpp	Mon May 11 12:18:59 2020 +0300
@@ -17,6 +17,8 @@
  */
 
 #include "modeleditcontext.h"
+#include "linetypes/triangle.h"
+#include "linetypes/quadrilateral.h"
 
 Model::EditContext::EditContext(Model& model) :
 	storedModel{model}
@@ -45,6 +47,25 @@
 	this->model().remove(position);
 }
 
+auto Model::EditContext::setObjectProperty(
+	const ldraw::id_t id,
+	const ldraw::Property property,
+	const QVariant& value)
+	-> ldraw::Object::SetPropertyResult
+{
+	ldraw::Object* const object = this->model().objectAt(id);
+	if (object != nullptr)
+	{
+		const ldraw::Object::SetPropertyResult result = object->setProperty(ldraw::PropertyKeyValue{property, value});
+		modifiedObjects.insert(id);
+		return result;
+	}
+	else
+	{
+		return ldraw::Object::SetPropertyResult::PropertyNotHandled;
+	}
+}
+
 void Model::EditContext::setObjectPoint(ldraw::id_t id, int pointId, const glm::vec3& value)
 {
 	ldraw::Object* object = this->model().objectAt(id);

mercurial