Wed, 20 Jul 2022 12:59:07 +0300
Fix crashing
Add option to set tool button style
24 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2020 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
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/>. | |
17 | */ | |
18 | ||
3 | 19 | #pragma once |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
20 | #include <QAbstractListModel> |
3 | 21 | #include <memory> |
264
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
262
diff
changeset
|
22 | #include "src/basics.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
262
diff
changeset
|
23 | #include "src/colors.h" |
200 | 24 | |
333
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
328
diff
changeset
|
25 | #include <QTextDocument> |
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
328
diff
changeset
|
26 | using Model = QTextDocument; |
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
328
diff
changeset
|
27 | |
200 | 28 | struct SubfileReference |
29 | { | |
30 | QString name; | |
31 | glm::mat4 transformation; | |
32 | }; | |
33 | ||
34 | template<typename T> | |
35 | struct Colored : T | |
36 | { | |
37 | ldraw::Color color; | |
38 | }; | |
39 | ||
40 | struct Comment | |
41 | { | |
42 | QString text; | |
43 | }; | |
3 | 44 | |
200 | 45 | struct ParseError |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
46 | { |
200 | 47 | QString code; |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
48 | }; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
49 | |
200 | 50 | struct Empty {}; |
51 | ||
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
52 | struct CircularFraction |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
53 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
54 | unsigned int segments; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
55 | unsigned int divisions; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
56 | }; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
57 | |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
58 | constexpr bool operator<(const CircularFraction& p, const CircularFraction& q) |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
59 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
60 | // a/b < c/d |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
61 | // a < c * b / d |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
62 | // a * d < c * b |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
63 | return p.segments * q.divisions < q.segments / p.divisions; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
64 | } |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
65 | |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
66 | struct CircularPrimitive |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
67 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
68 | enum Type |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
69 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
70 | Circle, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
71 | Disc, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
72 | Cylinder, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
73 | CylinderOpen, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
74 | CylinderClosed, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
75 | DiscNegative, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
76 | Chord, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
77 | } type; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
78 | static constexpr int NUM_TYPES = Chord + 1; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
79 | CircularFraction fraction; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
80 | glm::mat4 transformation; |
249
37d3c819cafa
Done some work on object editor
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
242
diff
changeset
|
81 | bool inverted = false; |
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
82 | }; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
83 | |
242
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
84 | constexpr char circularPrimitiveStems[CircularPrimitive::NUM_TYPES][5] = { |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
85 | "edge", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
86 | "disc", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
87 | "cyli", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
88 | "cylo", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
89 | "cylc", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
90 | "ndis", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
91 | "chrd", |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
92 | }; |
16855456992d
Substitute circular primitives in during file parsing
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
233
diff
changeset
|
93 | |
233 | 94 | Q_DECLARE_METATYPE(CircularPrimitive::Type) |
95 | ||
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
96 | struct CircleToolOptions |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
97 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
98 | CircularFraction fraction; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
99 | CircularPrimitive::Type type; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
100 | }; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
101 | |
200 | 102 | using ModelElement = std::variant< |
103 | Colored<SubfileReference>, | |
104 | Colored<LineSegment>, | |
105 | Colored<Triangle>, | |
106 | Colored<Quadrilateral>, | |
107 | Colored<ConditionalEdge>, | |
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
108 | Colored<CircularPrimitive>, |
200 | 109 | Comment, |
110 | Empty, | |
111 | ParseError>; | |
112 | ||
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
113 | using PlainPolygonElement = std::variant< |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
114 | LineSegment, |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
115 | Triangle, |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
116 | Quadrilateral, |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
117 | ConditionalEdge>; |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
118 | |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
119 | using PolygonElement = Colored<PlainPolygonElement>; |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
120 | |
211 | 121 | template<typename Ret, typename Fn1, typename Fn2, typename Fn3, typename Fn4, typename T> |
122 | constexpr auto visitPolygon(Fn1&& f1, Fn2&& f2, Fn3&& f3, Fn4&& f4, T&& element) | |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
123 | { |
211 | 124 | if (std::holds_alternative<LineSegment>(element)) { |
125 | return f1(std::get<LineSegment>(element)); | |
126 | } | |
127 | else if (std::holds_alternative<Triangle>(element)) { | |
128 | return f2(std::get<Triangle>(element)); | |
129 | } | |
130 | else if (std::holds_alternative<Quadrilateral>(element)) { | |
131 | return f3(std::get<Quadrilateral>(element)); | |
132 | } | |
133 | else { | |
134 | return f4(std::get<ConditionalEdge>(element)); | |
135 | } | |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
136 | } |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
137 | |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
138 | template<typename T, typename Fn> |
211 | 139 | constexpr void visitPoints(Fn&& func, T&& element) |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
140 | { |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
141 | visitPolygon<void>( |
218
63125c36de73
Replace config collector with a simpler system
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
212
diff
changeset
|
142 | [&func](transfer_cvref_t<T&&, LineSegment> edge) |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
143 | { |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
144 | func(edge.p1); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
145 | func(edge.p2); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
146 | }, |
218
63125c36de73
Replace config collector with a simpler system
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
212
diff
changeset
|
147 | [&func](transfer_cvref_t<T&&, Triangle>& tri) |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
148 | { |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
149 | func(tri.p1); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
150 | func(tri.p2); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
151 | func(tri.p3); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
152 | }, |
218
63125c36de73
Replace config collector with a simpler system
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
212
diff
changeset
|
153 | [&func](transfer_cvref_t<T&&, Quadrilateral>& quad) |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
154 | { |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
155 | func(quad.p1); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
156 | func(quad.p2); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
157 | func(quad.p3); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
158 | func(quad.p4); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
159 | }, |
218
63125c36de73
Replace config collector with a simpler system
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
212
diff
changeset
|
160 | [&func](transfer_cvref_t<T&&, ConditionalEdge>& cedge) |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
161 | { |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
162 | func(cedge.p1); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
163 | func(cedge.p2); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
164 | func(cedge.c1); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
165 | func(cedge.c2); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
166 | }, |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
167 | element); |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
168 | } |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
169 | |
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
170 | constexpr Colored<LineSegment> edge(const glm::vec3& p1, const glm::vec3& p2) |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
171 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
172 | return Colored<LineSegment>{{.p1 = p1, .p2 = p2}, EDGE_COLOR}; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
173 | } |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
174 | |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
175 | constexpr Colored<Triangle> triangle(const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3) |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
176 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
177 | return Colored<Triangle>{{.p1 = p1, .p2 = p2, .p3 = p3}, MAIN_COLOR}; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
178 | } |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
179 | |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
180 | constexpr Colored<Quadrilateral> quadrilateral( |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
181 | const glm::vec3& p1, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
182 | const glm::vec3& p2, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
183 | const glm::vec3& p3, |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
184 | const glm::vec3& p4) |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
185 | { |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
186 | return Colored<Quadrilateral>{{.p1 = p1, .p2 = p2, .p3 = p3, .p4 = p4}, MAIN_COLOR}; |
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
218
diff
changeset
|
187 | } |
262
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
188 | |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
189 | struct AppendToModel |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
190 | { |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
191 | ModelElement newElement; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
192 | }; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
193 | |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
194 | struct DeleteFromModel |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
195 | { |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
196 | std::size_t position; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
197 | }; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
198 | |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
199 | struct ModifyModel |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
200 | { |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
201 | std::size_t position; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
202 | ModelElement newElement; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
203 | }; |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
204 | |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
205 | using ModelAction = std::variant< |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
206 | AppendToModel, |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
207 | DeleteFromModel, |
dc33f8a707c4
Add action to make a model unofficial (modifies the !LDRAW_ORG line)
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
208 | ModifyModel>; |