Sun, 18 Mar 2018 12:33:29 +0200
fixed infinite recursion and integrated the subfilereference editor
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
1 | /* | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
2 | * LDForge: LDraw parts authoring CAD | 
| 1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
4 | * | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
5 | * This program is free software: you can redistribute it and/or modify | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
6 | * it under the terms of the GNU General Public License as published by | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
7 | * the Free Software Foundation, either version 3 of the License, or | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
8 | * (at your option) any later version. | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
9 | * | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
10 | * This program is distributed in the hope that it will be useful, | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
13 | * GNU General Public License for more details. | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
14 | * | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
15 | * You should have received a copy of the GNU General Public License | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
17 | */ | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
18 | |
| 
1082
 
1738bdaf36d6
The "all objects have valid models" invariant seems to be holding up now. At least basic drawing works again.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1081 
diff
changeset
 | 
19 | #include <assert.h> | 
| 
1147
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
20 | #include "../documentmanager.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
21 | #include "../linetypes/modelobject.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
22 | #include "../lddocument.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
23 | #include "../miscallenous.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
24 | #include "../mainwindow.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
25 | #include "../editHistory.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
26 | #include "../canvas.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
27 | #include "../colors.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
28 | #include "../glcompiler.h" | 
| 
 
a26568aa3cce
Renamed ldObject.cpp → linetypes/modelobject.cpp
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1146 
diff
changeset
 | 
29 | #include "edgeline.h" | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
30 | #include "triangle.h" | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
31 | #include "quadrilateral.h" | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
32 | #include "conditionaledge.h" | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
33 | #include "comment.h" | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
34 | #include "empty.h" | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
35 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
36 | // List of all LDObjects | 
| 
1135
 
8e0691be0b6f
Removed the intXX type aliases and removed uses of intXX_t in favor of qintXX
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1125 
diff
changeset
 | 
37 | QMap<qint32, LDObject*> g_allObjects; | 
| 
943
 
af81220741d9
Commit work done on code cleanup
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
920 
diff
changeset
 | 
38 | |
| 
 
af81220741d9
Commit work done on code cleanup
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
920 
diff
changeset
 | 
39 | enum { MAX_LDOBJECT_IDS = (1 << 24) }; | 
| 
769
 
8bb3bed44570
- improved shared pointer behavior, still not there yet
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
768 
diff
changeset
 | 
40 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
41 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
42 | // LDObject constructors | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
43 | // | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
44 | LDObject::LDObject() : | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
45 | m_isHidden {false} | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
46 | { | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
47 | m_randomColor = QColor::fromHsv (rand() % 360, rand() % 256, rand() % 96 + 128); | 
| 
770
 
b04c1e6ca1fb
- hopefully stabilized the entire shared pointers deal now
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
769 
diff
changeset
 | 
48 | } | 
| 
769
 
8bb3bed44570
- improved shared pointer behavior, still not there yet
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
768 
diff
changeset
 | 
49 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
50 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
51 | // | 
| 
1011
 
4fdd74a04790
Rename LDSubfile to LDSubfileReference
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1008 
diff
changeset
 | 
52 | QString LDSubfileReference::asText() const | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
53 | { | 
| 
789
 
4b7306f52bb5
- String -> QString
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
787 
diff
changeset
 | 
54 | QString val = format ("1 %1 %2 ", color(), position()); | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
55 | val += transformationMatrix().toString(); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
56 | val += ' '; | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
57 | val += m_referenceName; | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
58 | return val; | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
59 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
60 | |
| 
1000
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
61 | QString LDBezierCurve::asText() const | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
62 | { | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
63 | QString result = format ("0 !LDFORGE BEZIER_CURVE %1", color()); | 
| 
1008
 
74cb432812d3
Fixed circle, rectangle and line path modes not working anymore. Add blip coordinates to curve and line path modes. Circle mode for now only can show the coordinates of the initial blip
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1006 
diff
changeset
 | 
64 | |
| 
1000
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
65 | // Add the coordinates | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
66 | for (int i = 0; i < 4; ++i) | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
67 | result += format (" %1", vertex (i)); | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
68 | |
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
69 | return result; | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
70 | } | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
71 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
72 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
73 | // | 
| 
789
 
4b7306f52bb5
- String -> QString
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
787 
diff
changeset
 | 
74 | QString LDError::asText() const | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
75 | { | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
76 | return contents(); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
77 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
78 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
79 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
80 | // | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
81 | QString LDBfc::asText() const | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
82 | { | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
83 | return format ("0 BFC %1", statementToString()); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
84 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
85 | |
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
86 | int LDObject::triangleCount(DocumentManager*) const | 
| 
1015
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
87 | { | 
| 
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
88 | return 0; | 
| 
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
89 | } | 
| 
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
90 | |
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
91 | int LDSubfileReference::triangleCount(DocumentManager* context) const | 
| 
1015
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
92 | { | 
| 1290 | 93 | LDDocument* file = fileInfo(context); | 
| 94 | if (file) | |
| 95 | return file->triangleCount(); | |
| 96 | else | |
| 97 | return 0; | |
| 
1015
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
98 | } | 
| 
 
92c6ec099075
Added triangle count to viewport, added compile-time line length check
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1014 
diff
changeset
 | 
99 | |
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
100 | int LDObject::numVertices() const | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
101 | { | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
102 | return 0; | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
103 | } | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
104 | |
| 
1251
 
e75cc5bff076
Converted magic wand mode and other selection stuff to mvc
 
Santeri Piippo 
parents: 
1236 
diff
changeset
 | 
105 | int LDObject::numPolygonVertices() const | 
| 
 
e75cc5bff076
Converted magic wand mode and other selection stuff to mvc
 
Santeri Piippo 
parents: 
1236 
diff
changeset
 | 
106 | { | 
| 
 
e75cc5bff076
Converted magic wand mode and other selection stuff to mvc
 
Santeri Piippo 
parents: 
1236 
diff
changeset
 | 
107 | return this->numVertices(); | 
| 
 
e75cc5bff076
Converted magic wand mode and other selection stuff to mvc
 
Santeri Piippo 
parents: 
1236 
diff
changeset
 | 
108 | } | 
| 
 
e75cc5bff076
Converted magic wand mode and other selection stuff to mvc
 
Santeri Piippo 
parents: 
1236 
diff
changeset
 | 
109 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
110 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
111 | // | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
112 | LDBezierCurve::LDBezierCurve(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3) | 
| 
1000
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
113 | { | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
114 | setVertex(0, v0); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
115 | setVertex(1, v1); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
116 | setVertex(2, v2); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
117 | setVertex(3, v3); | 
| 
1000
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
118 | } | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
119 | |
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
120 | // ============================================================================= | 
| 
 
c064cc048f14
Begin work on Bézier curve support. They can be drawn but don't render in 3D and they load as comments.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
998 
diff
changeset
 | 
121 | // | 
| 
945
 
c310073e4f22
More sharedpointer removal
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
944 
diff
changeset
 | 
122 | static void TransformObject (LDObject* obj, Matrix transform, Vertex pos, LDColor parentcolor) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
123 | { | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
124 | switch (obj->type()) | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
125 | { | 
| 
1139
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
126 | case LDObjectType::EdgeLine: | 
| 
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
127 | case LDObjectType::ConditionalEdge: | 
| 
1123
 
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1117 
diff
changeset
 | 
128 | case LDObjectType::Triangle: | 
| 
1139
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
129 | case LDObjectType::Quadrilateral: | 
| 944 | 130 | for (int i = 0; i < obj->numVertices(); ++i) | 
| 131 | { | |
| 132 | Vertex v = obj->vertex (i); | |
| 133 | v.transform (transform, pos); | |
| 134 | obj->setVertex (i, v); | |
| 135 | } | |
| 136 | break; | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
137 | |
| 
1123
 
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1117 
diff
changeset
 | 
138 | case LDObjectType::SubfileReference: | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
139 | { | 
| 
1011
 
4fdd74a04790
Rename LDSubfile to LDSubfileReference
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1008 
diff
changeset
 | 
140 | LDSubfileReference* ref = static_cast<LDSubfileReference*> (obj); | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
141 | Matrix newMatrix = transform * ref->transformationMatrix(); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
142 | Vertex newpos = ref->position(); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
143 | newpos.transform (transform, pos); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
144 | ref->setPosition (newpos); | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
145 | ref->setTransformationMatrix (newMatrix); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
146 | } | 
| 944 | 147 | break; | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
148 | |
| 944 | 149 | default: | 
| 150 | break; | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
151 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
152 | |
| 946 | 153 | if (obj->color() == MainColor) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
154 | obj->setColor (parentcolor); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
155 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
156 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
157 | // ============================================================================= | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
158 | // ----------------------------------------------------------------------------- | 
| 
1262
 
f6b253c17643
removed use of model() in LDSubfileReference::inlineContents
 
Santeri Piippo 
parents: 
1261 
diff
changeset
 | 
159 | void LDSubfileReference::inlineContents(DocumentManager* context, Model& model, bool deep, bool render) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
160 | { | 
| 
1262
 
f6b253c17643
removed use of model() in LDSubfileReference::inlineContents
 
Santeri Piippo 
parents: 
1261 
diff
changeset
 | 
161 | Model inlined {context}; | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
162 | fileInfo(context)->inlineContents(inlined, deep, render); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
163 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
164 | // Transform the objects | 
| 
1073
 
a0a0d581309b
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1072 
diff
changeset
 | 
165 | for (LDObject* object : inlined) | 
| 
 
a0a0d581309b
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1072 
diff
changeset
 | 
166 | TransformObject(object, transformationMatrix(), position(), color()); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
167 | |
| 
1073
 
a0a0d581309b
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1072 
diff
changeset
 | 
168 | model.merge(inlined); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
169 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
170 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
171 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
172 | // | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
173 | LDPolygon* LDObject::getPolygon() | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
174 | { | 
| 
786
 
71d786ce0dcc
- LDObject::Type moved back to global namespace
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
784 
diff
changeset
 | 
175 | LDObjectType ot = type(); | 
| 
1139
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
176 | int num = (ot == LDObjectType::EdgeLine) ? 2 | 
| 
1123
 
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1117 
diff
changeset
 | 
177 | : (ot == LDObjectType::Triangle) ? 3 | 
| 
1139
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
178 | : (ot == LDObjectType::Quadrilateral) ? 4 | 
| 
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
179 | : (ot == LDObjectType::ConditionalEdge) ? 5 | 
| 847 | 180 | : 0; | 
| 181 | ||
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
182 | if (num == 0) | 
| 984 | 183 | return nullptr; | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
184 | |
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
185 | LDPolygon* data = new LDPolygon; | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
186 | data->num = num; | 
| 
806
 
4240f47aa2d4
- moved most of LDColorData API into LDColor
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
805 
diff
changeset
 | 
187 | data->color = color().index(); | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
188 | |
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
189 | for (int i = 0; i < data->numVertices(); ++i) | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
190 | data->vertices[i] = vertex (i); | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
191 | |
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
192 | return data; | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
193 | } | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
194 | |
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
195 | LDColor LDObject::defaultColor() const | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
196 | { | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
197 | return MainColor; | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
198 | } | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
199 | |
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
200 | bool LDObject::isColored() const | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
201 | { | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
202 | return true; | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
203 | } | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
204 | |
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
205 | bool LDObject::isScemantic() const | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
206 | { | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
207 | return true; | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
208 | } | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
209 | |
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
210 | bool LDObject::hasMatrix() const | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
211 | { | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
212 | return false; | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
213 | } | 
| 
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
214 | |
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
215 | // ============================================================================= | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
216 | // | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
217 | QList<LDPolygon> LDSubfileReference::inlinePolygons(DocumentManager* context) | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
218 | { | 
| 1290 | 219 | LDDocument* file = fileInfo(context); | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
220 | |
| 1290 | 221 | if (file) | 
| 847 | 222 | { | 
| 1290 | 223 | QList<LDPolygon> data = fileInfo(context)->inlinePolygons(); | 
| 224 | ||
| 225 | for (LDPolygon& entry : data) | |
| 226 | { | |
| 227 | for (int i = 0; i < entry.numVertices(); ++i) | |
| 228 | entry.vertices[i].transform (transformationMatrix(), position()); | |
| 229 | } | |
| 230 | ||
| 231 | return data; | |
| 847 | 232 | } | 
| 1290 | 233 | else | 
| 234 | { | |
| 235 | return {}; | |
| 236 | } | |
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
237 | } | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
238 | |
| 
1297
 
389516787a4c
added subfile reference editor
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1290 
diff
changeset
 | 
239 | void LDSubfileReference::setReferenceName(const QString& newReferenceName) | 
| 
 
389516787a4c
added subfile reference editor
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1290 
diff
changeset
 | 
240 | { | 
| 
 
389516787a4c
added subfile reference editor
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1290 
diff
changeset
 | 
241 | changeProperty(&this->m_referenceName, newReferenceName); | 
| 
 
389516787a4c
added subfile reference editor
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1290 
diff
changeset
 | 
242 | } | 
| 
 
389516787a4c
added subfile reference editor
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1290 
diff
changeset
 | 
243 | |
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
244 | // ============================================================================= | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
245 | // | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
246 | // Moves this object using the given vertex as a movement List | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
247 | // | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
248 | void LDObject::move (Vertex vect) | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
249 | { | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
250 | if (hasMatrix()) | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
251 | { | 
| 
943
 
af81220741d9
Commit work done on code cleanup
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
920 
diff
changeset
 | 
252 | LDMatrixObject* mo = static_cast<LDMatrixObject*> (this); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
253 | mo->setPosition (mo->position() + vect); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
254 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
255 | else | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
256 | { | 
| 
767
 
44f0d5322628
- slight refactor in ldobject methods
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
764 
diff
changeset
 | 
257 | for (int i = 0; i < numVertices(); ++i) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
258 | setVertex (i, vertex (i) + vect); | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
259 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
260 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
261 | |
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
262 | bool LDObject::isHidden() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
263 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
264 | return m_isHidden; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
265 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
266 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
267 | void LDObject::setHidden (bool value) | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
268 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
269 | m_isHidden = value; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
270 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
271 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
272 | LDColor LDObject::color() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
273 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
274 | return m_color; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
275 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
276 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
277 | QColor LDObject::randomColor() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
278 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
279 | return m_randomColor; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
280 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
281 | |
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
282 | LDObject* LDObject::newFromType(LDObjectType type) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
283 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
284 | switch (type) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
285 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
286 | case LDObjectType::SubfileReference: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
287 | return new LDSubfileReference {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
288 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
289 | case LDObjectType::Quadrilateral: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
290 | return new LDQuadrilateral {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
291 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
292 | case LDObjectType::Triangle: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
293 | return new LDTriangle {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
294 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
295 | case LDObjectType::EdgeLine: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
296 | return new LDEdgeLine {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
297 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
298 | case LDObjectType::ConditionalEdge: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
299 | return new LDConditionalEdge {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
300 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
301 | case LDObjectType::Bfc: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
302 | return new LDBfc {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
303 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
304 | case LDObjectType::Comment: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
305 | return new LDComment {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
306 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
307 | case LDObjectType::Error: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
308 | return new LDError {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
309 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
310 | case LDObjectType::Empty: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
311 | return new LDEmpty {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
312 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
313 | case LDObjectType::BezierCurve: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
314 | return new LDBezierCurve {}; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
315 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
316 | case LDObjectType::_End: | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
317 | break; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
318 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
319 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
320 | return nullptr; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
321 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
322 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
323 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
324 | // | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
325 | void LDObject::setColor (LDColor color) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
326 | { | 
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
327 | changeProperty(&m_color, color); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
328 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
329 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
330 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
331 | // | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
332 | // Get a vertex by index | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
333 | // | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
334 | const Vertex& LDObject::vertex (int i) const | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
335 | { | 
| 
805
 
d88c0354de97
- refactor. got rid of the LDSharedVertex nonsense, fixed up split lines action
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
795 
diff
changeset
 | 
336 | return m_coords[i]; | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
337 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
338 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
339 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
340 | // | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
341 | // Set a vertex to the given value | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
342 | // | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
343 | void LDObject::setVertex (int i, const Vertex& vert) | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
344 | { | 
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
345 | changeProperty(&m_coords[i], vert); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
346 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
347 | |
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
348 | LDMatrixObject::LDMatrixObject (const Matrix& transform, const Vertex& pos) : | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
349 | m_position (pos), | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
350 | m_transformationMatrix (transform) {} | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
351 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
352 | void LDMatrixObject::setCoordinate (const Axis ax, double value) | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
353 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
354 | Vertex v = position(); | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
355 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
356 | switch (ax) | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
357 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
358 | case X: v.setX (value); break; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
359 | case Y: v.setY (value); break; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
360 | case Z: v.setZ (value); break; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
361 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
362 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
363 | setPosition (v); | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
364 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
365 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
366 | const Vertex& LDMatrixObject::position() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
367 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
368 | return m_position; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
369 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
370 | |
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
371 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
372 | // | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
373 | void LDMatrixObject::setPosition (const Vertex& a) | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
374 | { | 
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
375 | changeProperty(&m_position, a); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
376 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
377 | |
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
378 | // ============================================================================= | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
379 | // | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
380 | const Matrix& LDMatrixObject::transformationMatrix() const | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
381 | { | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
382 | return m_transformationMatrix; | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
383 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
384 | |
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
385 | void LDMatrixObject::setTransformationMatrix (const Matrix& val) | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
386 | { | 
| 
1117
 
efcb47c64a72
Moved LDComment and LDEmpty into their own source file pairs.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1103 
diff
changeset
 | 
387 | changeProperty(&m_transformationMatrix, val); | 
| 
655
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
388 | } | 
| 
 
b376645315ab
- renamed files to camelCase
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents:  
diff
changeset
 | 
389 | |
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
390 | LDError::LDError (QString contents, QString reason) : | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
391 | m_contents (contents), | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
392 | m_reason (reason) {} | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
393 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
394 | QString LDError::reason() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
395 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
396 | return m_reason; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
397 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
398 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
399 | QString LDError::contents() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
400 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
401 | return m_contents; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
402 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
403 | |
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
404 | LDBfc::LDBfc (const BfcStatement type) : | 
| 
1078
 
c72e3115a297
Removed uses of LDSpawn in the algorithm toolset
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1077 
diff
changeset
 | 
405 | m_statement {type} {} | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
406 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
407 | BfcStatement LDBfc::statement() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
408 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
409 | return m_statement; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
410 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
411 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
412 | void LDBfc::setStatement (BfcStatement value) | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
413 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
414 | m_statement = value; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
415 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
416 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
417 | QString LDBfc::statementToString() const | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
418 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
419 | return LDBfc::statementToString (statement()); | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
420 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
421 | |
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
422 | QString LDBfc::statementToString (BfcStatement statement) | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
423 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
424 | static const char* statementStrings[] = | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
425 | { | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
426 | "CERTIFY CCW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
427 | "CCW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
428 | "CERTIFY CW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
429 | "CW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
430 | "NOCERTIFY", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
431 | "INVERTNEXT", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
432 | "CLIP", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
433 | "CLIP CCW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
434 | "CLIP CW", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
435 | "NOCLIP", | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
436 | }; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
437 | |
| 
1065
 
c8ecddbd99e9
Actually, let's call it countof(). Makes more sense.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1063 
diff
changeset
 | 
438 | if ((int) statement >= 0 and (int) statement < countof (statementStrings)) | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
439 | return QString::fromLatin1 (statementStrings[(int) statement]); | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
440 | else | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
441 | return ""; | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
442 | } | 
| 
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
443 | |
| 
1002
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
444 | Vertex LDBezierCurve::pointAt (qreal t) const | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
445 | { | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
446 | if (t >= 0.0 and t <= 1.0) | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
447 | { | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
448 | Vertex result; | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
449 | result += pow (1.0 - t, 3) * vertex (0); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
450 | result += (3 * pow (1.0 - t, 2) * t) * vertex (2); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
451 | result += (3 * (1.0 - t) * pow (t, 2)) * vertex (3); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
452 | result += pow (t, 3) * vertex (1); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
453 | return result; | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
454 | } | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
455 | else | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
456 | return Vertex(); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
457 | } | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
458 | |
| 
1073
 
a0a0d581309b
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1072 
diff
changeset
 | 
459 | void LDBezierCurve::rasterize(Model& model, int segments) | 
| 
1002
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
460 | { | 
| 
1023
 
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1017 
diff
changeset
 | 
461 | QVector<LDPolygon> polygons = rasterizePolygons(segments); | 
| 
1004
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
462 | |
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
463 | for (LDPolygon& poly : polygons) | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
464 | { | 
| 
1139
 
51303023d651
LDObject subclass renaming:
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1135 
diff
changeset
 | 
465 | LDEdgeLine* line = model.emplace<LDEdgeLine>(poly.vertices[0], poly.vertices[1]); | 
| 
1004
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
466 | line->setColor (poly.color); | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
467 | } | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
468 | } | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
469 | |
| 
1023
 
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1017 
diff
changeset
 | 
470 | QVector<LDPolygon> LDBezierCurve::rasterizePolygons(int segments) | 
| 
1004
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
471 | { | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
472 | QVector<LDPolygon> result; | 
| 
1002
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
473 | QVector<Vertex> parms; | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
474 | parms.append (pointAt (0.0)); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
475 | |
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
476 | for (int i = 1; i < segments; ++i) | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
477 | parms.append (pointAt (double (i) / segments)); | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
478 | |
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
479 | parms.append (pointAt (1.0)); | 
| 
1004
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
480 | LDPolygon poly; | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
481 | poly.color = color().index(); | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
482 | poly.num = 2; | 
| 
1002
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
483 | |
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
484 | for (int i = 0; i < segments; ++i) | 
| 
1003
 
31873c3cbdbc
Bézier curves are now parsed correctly
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1002 
diff
changeset
 | 
485 | { | 
| 
1004
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
486 | poly.vertices[0] = parms[i]; | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
487 | poly.vertices[1] = parms[i + 1]; | 
| 
 
ba4200437179
Bézier curves now render in 3D
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1003 
diff
changeset
 | 
488 | result << poly; | 
| 
1003
 
31873c3cbdbc
Bézier curves are now parsed correctly
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1002 
diff
changeset
 | 
489 | } | 
| 
1002
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
490 | |
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
491 | return result; | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
492 | } | 
| 
 
a3ee23db8393
Bézier curves may now be serialized down using the "Demote" function. I need to rename that now.
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1000 
diff
changeset
 | 
493 | |
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
494 | LDSubfileReference::LDSubfileReference( | 
| 
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
495 | QString referenceName, | 
| 
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
496 | const Matrix& transformationMatrix, | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
497 | const Vertex& position | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
498 | ) : | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
499 | LDMatrixObject {transformationMatrix, position}, | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
500 | m_referenceName {referenceName} {} | 
| 
1073
 
a0a0d581309b
Major overhaul of object→document relationship: added the Model class which models the object buffer. Each object is to be included in a model (an invariant that currently does not hold). A document is a subclass of a model. The LDObject is also now agnostic about selection, and the selection is now a set. A lot of things are probably broken now but it's a major step forward.
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1072 
diff
changeset
 | 
501 | |
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
502 | // ============================================================================= | 
| 
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
503 | // | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
504 | LDDocument* LDSubfileReference::fileInfo(DocumentManager* context) const | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
505 | { | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
506 | return context->getDocumentByName(m_referenceName); | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
507 | } | 
| 
706
 
d79083b9f74d
Merge ../ldforge into gl
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
655 
diff
changeset
 | 
508 | |
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
509 | QString LDSubfileReference::referenceName() const | 
| 
988
 
ac4a2ae54f76
Refactor LDObject API
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
987 
diff
changeset
 | 
510 | { | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
511 | return m_referenceName; | 
| 
1084
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
512 | } | 
| 
725
 
37b71daf4cb5
- added ability to draw with random colors
 
Santeri Piippo <crimsondusk64@gmail.com> 
parents: 
724 
diff
changeset
 | 
513 | |
| 1268 | 514 | void LDObject::getVertices(DocumentManager*, QSet<Vertex>& verts) const | 
| 
835
 
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
806 
diff
changeset
 | 
515 | { | 
| 
 
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
806 
diff
changeset
 | 
516 | for (int i = 0; i < numVertices(); ++i) | 
| 
1031
 
55c0d3beea0d
removed removeDuplicates in favor of QSet, and the unused ObjectList class
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
1028 
diff
changeset
 | 
517 | verts.insert(vertex(i)); | 
| 
835
 
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
806 
diff
changeset
 | 
518 | } | 
| 
 
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
806 
diff
changeset
 | 
519 | |
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
520 | void LDSubfileReference::getVertices (DocumentManager* context, QSet<Vertex>& verts) const | 
| 
835
 
268413885cb1
- reimplemented vertex tracking using a method similar to what the GL compiler uses
 
Teemu Piippo <crimsondusk64@gmail.com> 
parents: 
806 
diff
changeset
 | 
521 | { | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
522 | verts.unite(fileInfo(context)->inlineVertices()); | 
| 
1045
 
f726f8f49c7e
Unabbreviate "transform" to "transformationMatrix"
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1031 
diff
changeset
 | 
523 | } | 
| 
1084
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
524 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
525 | QString LDObject::objectListText() const | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
526 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
527 | if (numVertices() > 0) | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
528 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
529 | QString result; | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
530 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
531 | for (int i = 0; i < numVertices(); ++i) | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
532 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
533 | if (i != 0) | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
534 | result += ", "; | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
535 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
536 | result += vertex(i).toString (true); | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
537 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
538 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
539 | return result; | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
540 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
541 | else | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
542 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
543 | return typeName(); | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
544 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
545 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
546 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
547 | QString LDError::objectListText() const | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
548 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
549 | return "ERROR: " + asText(); | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
550 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
551 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
552 | QString LDSubfileReference::objectListText() const | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
553 | { | 
| 
1263
 
0256edecda54
LDSubfileReference now contains the name of the subfile and not a pointer anymore. Some methods now require a DocumentManager* for context on resolving the name.
 
Santeri Piippo 
parents: 
1262 
diff
changeset
 | 
554 | QString result = format ("%1 %2, (", referenceName(), position().toString(true)); | 
| 
1084
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
555 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
556 | for (int i = 0; i < 9; ++i) | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
557 | result += format("%1%2", transformationMatrix().value(i), (i != 8) ? " " : ""); | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
558 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
559 | result += ')'; | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
560 | return result; | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
561 | } | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
562 | |
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
563 | QString LDBfc::objectListText() const | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
564 | { | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
565 | return statementToString(); | 
| 
 
63daaf652454
Split object list representation into virtual methods
 
Teemu Piippo <teemu@hecknology.net> 
parents: 
1082 
diff
changeset
 | 
566 | } | 
| 
1236
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
567 | |
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
568 | bool LDObject::isInverted() const | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
569 | { | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
570 | return m_hasInvertNext; | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
571 | } | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
572 | |
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
573 | void LDObject::setInverted(bool value) | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
574 | { | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
575 | changeProperty(&m_hasInvertNext, value); | 
| 
 
861bf8ebb8ec
BFC INVERTNEXT objects are no longer individual objects
 
Santeri Piippo 
parents: 
1161 
diff
changeset
 | 
576 | } | 
| 
1269
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
577 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
578 | void LDObject::serialize(Serializer& serializer) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
579 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
580 | serializer << m_hasInvertNext; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
581 | serializer << m_isHidden; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
582 | serializer << m_color; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
583 | serializer << m_randomColor; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
584 | serializer << m_coords[0]; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
585 | serializer << m_coords[1]; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
586 | serializer << m_coords[2]; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
587 | serializer << m_coords[3]; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
588 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
589 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
590 | void LDMatrixObject::serialize(Serializer& serializer) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
591 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
592 | LDObject::serialize(serializer); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
593 | serializer << m_position; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
594 | serializer << m_transformationMatrix; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
595 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
596 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
597 | void LDBfc::serialize(Serializer& serializer) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
598 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
599 | LDObject::serialize(serializer); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
600 | serializer << m_statement; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
601 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
602 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
603 | void LDError::serialize(Serializer& serializer) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
604 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
605 | LDObject::serialize(serializer); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
606 | serializer << m_contents; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
607 | serializer << m_reason; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
608 | } | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
609 | |
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
610 | void LDSubfileReference::serialize(Serializer& serializer) | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
611 | { | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
612 | LDMatrixObject::serialize(serializer); | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
613 | serializer << m_referenceName; | 
| 
 
ec691d9472b3
Added LDObject serialization and refactored the internal resource managing to use it. No more tearing objects from one model into another, and this provides a stable way to keep an object's state in memory such as the edit history.
 
Santeri Piippo 
parents: 
1268 
diff
changeset
 | 
614 | } |