src/modeleditcontext.cpp

changeset 89
7abaf1d64719
parent 87
93ec4d630346
child 112
5760cbb32bc0
equal deleted inserted replaced
88:14e51640c189 89:7abaf1d64719
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #include "modeleditcontext.h" 19 #include "modeleditcontext.h"
20 #include "linetypes/triangle.h"
21 #include "linetypes/quadrilateral.h"
20 22
21 Model::EditContext::EditContext(Model& model) : 23 Model::EditContext::EditContext(Model& model) :
22 storedModel{model} 24 storedModel{model}
23 { 25 {
24 } 26 }
41 } 43 }
42 44
43 void Model::EditContext::remove(int position) 45 void Model::EditContext::remove(int position)
44 { 46 {
45 this->model().remove(position); 47 this->model().remove(position);
48 }
49
50 auto Model::EditContext::setObjectProperty(
51 const ldraw::id_t id,
52 const ldraw::Property property,
53 const QVariant& value)
54 -> ldraw::Object::SetPropertyResult
55 {
56 ldraw::Object* const object = this->model().objectAt(id);
57 if (object != nullptr)
58 {
59 const ldraw::Object::SetPropertyResult result = object->setProperty(ldraw::PropertyKeyValue{property, value});
60 modifiedObjects.insert(id);
61 return result;
62 }
63 else
64 {
65 return ldraw::Object::SetPropertyResult::PropertyNotHandled;
66 }
46 } 67 }
47 68
48 void Model::EditContext::setObjectPoint(ldraw::id_t id, int pointId, const glm::vec3& value) 69 void Model::EditContext::setObjectPoint(ldraw::id_t id, int pointId, const glm::vec3& value)
49 { 70 {
50 ldraw::Object* object = this->model().objectAt(id); 71 ldraw::Object* object = this->model().objectAt(id);

mercurial