Sun, 29 Jan 2017 15:05:14 +0200
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.
The LDObject::destroy method is also now gone. The model decides when objects are destroyed and calls the destructor directly. The end result removes a lot of cruft and adds structure to LDObject relations.
Notes:
- Inlining does not currently work (nothing simply gets inlined in)
- More work is required to ensure that each object actually goes into a model
1006
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
1 | /* |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo |
1006
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
4 | * |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
8 | * (at your option) any later version. |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
9 | * |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
13 | * GNU General Public License for more details. |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
14 | * |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
17 | */ |
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
18 | |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "abstractEditMode.h" |
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
876
f040f0fb3795
- renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents:
875
diff
changeset
|
22 | class LinePathMode : public AbstractDrawMode |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | { |
876
f040f0fb3795
- renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents:
875
diff
changeset
|
24 | DEFINE_CLASS (LinePathMode, AbstractDrawMode) |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | public: |
876
f040f0fb3795
- renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents:
875
diff
changeset
|
27 | LinePathMode (GLRenderer* renderer); |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | void render (QPainter& painter) const override; |
876
f040f0fb3795
- renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents:
875
diff
changeset
|
30 | EditModeType type() const override { return EditModeType::LinePath; } |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | bool mouseReleased (MouseEventData const& data) override; |
875
ce8e9b37d44f
- finished line loop mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
874
diff
changeset
|
32 | bool preAddVertex (Vertex const& pos) override; |
ce8e9b37d44f
- finished line loop mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
874
diff
changeset
|
33 | bool keyReleased (QKeyEvent*) override; |
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:
876
diff
changeset
|
34 | void endDraw() override; |
874
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | }; |
ba75c789667e
- added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 |