# HG changeset patch # User Teemu Piippo # Date 1440898914 -10800 # Node ID 737245eee4331d062a62d9840e7d359d9253afe0 # Parent 1dc890c73e01443a7d67e2f9a760e2d21574713f Remove the vertex object type diff -r 1dc890c73e01 -r 737245eee433 src/actionsEdit.cpp --- a/src/actionsEdit.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/actionsEdit.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -294,33 +294,6 @@ // ============================================================================= // -void MainWindow::slot_actionCornerVerts() -{ - int num = 0; - - for (LDObject* obj : Selection()) - { - if (obj->numVertices() < 2) - continue; - - int ln = obj->lineNumber(); - - for (int i = 0; i < obj->numVertices(); ++i) - { - LDVertex* vertex = new LDVertex(); - vertex->pos = obj->vertex (i); - vertex->setColor (obj->color()); - CurrentDocument()->insertObj (++ln, vertex); - ++num; - } - } - - print (tr ("Added %1 vertices"), num); - refresh(); -} - -// ============================================================================= -// static void MoveSelection (MainWindow* win, bool up) { LDObjectList objs = Selection(); diff -r 1dc890c73e01 -r 737245eee433 src/addObjectDialog.cpp --- a/src/addObjectDialog.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/addObjectDialog.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -360,13 +360,6 @@ bfc->setStatement (BFCStatement (dlg.rb_bfcType->value())); } break; - case OBJ_Vertex: - { - LDVertex* vert = InitObject (obj); - vert->pos.apply ([&](Axis ax, double& value) { value = dlg.dsb_coords[ax]->value(); }); - } - break; - case OBJ_Subfile: { QString name = dlg.le_subfileName->text(); diff -r 1dc890c73e01 -r 737245eee433 src/editmodes/drawMode.cpp --- a/src/editmodes/drawMode.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/editmodes/drawMode.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -53,7 +53,9 @@ { if (vert == pos) { - endDraw(); + if (m_drawedVerts.size() >= 2) + endDraw(); + return true; } } @@ -90,16 +92,6 @@ switch (verts.size()) { - case 1: - { - // 1 vertex - add a vertex object - LDVertex* obj = LDSpawn(); - obj->pos = verts[0]; - obj->setColor (MainColor); - objs << obj; - break; - } - case 2: { // 2 verts - make a line @@ -129,10 +121,10 @@ finishDraw (objs); } -template -_Type IntervalClamp (_Type a, _Type interval) +template +T IntervalClamp (T a, T interval) { - _Type remainder = a % interval; + T remainder = a % interval; if (remainder >= float (interval / 2)) a += interval; diff -r 1dc890c73e01 -r 737245eee433 src/ldDocument.cpp --- a/src/ldDocument.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/ldDocument.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -875,19 +875,7 @@ if (tokens.size() > 2 and tokens[1] == "!LDFORGE") { // Handle LDForge-specific types, they're embedded into comments too - if (tokens[2] == "VERTEX") - { - // Vertex (0 !LDFORGE VERTEX) - CheckTokenCount (tokens, 7); - CheckTokenNumbers (tokens, 3, 6); - - LDVertex* obj = LDSpawn(); - obj->setColor (StringToNumber (tokens[3])); - obj->pos.apply ([&](Axis ax, double& value) - { value = tokens[4 + ax].toDouble(); }); - return obj; - } - elif (tokens[2] == "OVERLAY") + if (tokens[2] == "OVERLAY") { CheckTokenCount (tokens, 9); CheckTokenNumbers (tokens, 5, 8); diff -r 1dc890c73e01 -r 737245eee433 src/ldObject.cpp --- a/src/ldObject.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/ldObject.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -72,7 +72,6 @@ LDOBJ_DEFAULT_CTOR (LDTriangle, LDObject) LDOBJ_DEFAULT_CTOR (LDCondLine, LDLine) LDOBJ_DEFAULT_CTOR (LDQuad, LDObject) -LDOBJ_DEFAULT_CTOR (LDVertex, LDObject) LDOBJ_DEFAULT_CTOR (LDOverlay, LDObject) LDOBJ_DEFAULT_CTOR (LDBFC, LDObject) LDOBJ_DEFAULT_CTOR (LDComment, LDObject) @@ -179,13 +178,6 @@ // ============================================================================= // -QString LDVertex::asText() const -{ - return format ("0 !LDFORGE VERTEX %1 %2", color(), pos); -} - -// ============================================================================= -// QString LDEmpty::asText() const { return ""; @@ -590,11 +582,6 @@ LDMatrixObject* mo = static_cast (this); mo->setPosition (mo->position() + vect); } - else if (type() == OBJ_Vertex) - { - // ugh - static_cast (this)->pos += vect; - } else { for (int i = 0; i < numVertices(); ++i) @@ -617,7 +604,6 @@ case OBJ_Quad: return LDSpawn(); case OBJ_Empty: return LDSpawn(); case OBJ_Error: return LDSpawn(); - case OBJ_Vertex: return LDSpawn(); case OBJ_Overlay: return LDSpawn(); case OBJ_NumTypes: break; } @@ -746,8 +732,6 @@ setVertex (1, tmp); } -void LDVertex::invert() {} - // ============================================================================= // LDLine* LDCondLine::toEdgeLine() @@ -917,9 +901,4 @@ void LDSubfile::getVertices (QVector& verts) const { verts << fileInfo()->inlineVertices(); -} - -void LDVertex::getVertices (QVector& verts) const -{ - verts.append (pos); -} +} \ No newline at end of file diff -r 1dc890c73e01 -r 737245eee433 src/ldObject.h --- a/src/ldObject.h Sun Aug 30 04:21:44 2015 +0300 +++ b/src/ldObject.h Sun Aug 30 04:41:54 2015 +0300 @@ -488,29 +488,6 @@ }; // -// LDVertex -// -// The vertex is an LDForce-specific extension which represents a single -// vertex which can be used as a parameter to tools or to store coordinates -// with. Vertices are a part authoring tool and they should not appear in -// finished parts. -// -class LDVertex : public LDObject -{ - LDOBJ (Vertex) - LDOBJ_NAME (vertex) - LDOBJ_VERTICES (0) // TODO: move pos to m_vertices[0] - LDOBJ_COLORED - LDOBJ_DEFAULTCOLOR (MainColor) - LDOBJ_NON_SCEMANTIC - LDOBJ_NO_MATRIX - -public: - Vertex pos; - virtual void getVertices (QVector& verts) const override; -}; - -// // LDOverlay // // Overlay image meta, stored in the header of parts so as to preserve overlay diff -r 1dc890c73e01 -r 737245eee433 src/ldObjectMath.cpp --- a/src/ldObjectMath.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/ldObjectMath.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -78,12 +78,5 @@ // Transform the matrix mo->setTransform (transform * mo->transform()); } - elif (obj->type() == OBJ_Vertex) - { - LDVertex* vert = static_cast (obj); - Vertex v = vert->pos; - RotateVertex (v, rotpoint, transform); - vert->pos = v; - } } } diff -r 1dc890c73e01 -r 737245eee433 src/mainWindow.cpp --- a/src/mainWindow.cpp Sun Aug 30 04:21:44 2015 +0300 +++ b/src/mainWindow.cpp Sun Aug 30 04:41:54 2015 +0300 @@ -373,12 +373,6 @@ break; } - case OBJ_Vertex: - { - descr = static_cast (obj)->pos.toString (true); - break; - } - case OBJ_Subfile: { LDSubfile* ref = static_cast (obj); diff -r 1dc890c73e01 -r 737245eee433 src/mainWindow.h --- a/src/mainWindow.h Sun Aug 30 04:21:44 2015 +0300 +++ b/src/mainWindow.h Sun Aug 30 04:41:54 2015 +0300 @@ -238,7 +238,6 @@ void slot_actionSplitQuads(); void slot_actionEditRaw(); void slot_actionBorders(); - void slot_actionCornerVerts(); void slot_actionRoundCoordinates(); void slot_actionVisibilityHide(); void slot_actionVisibilityReveal(); diff -r 1dc890c73e01 -r 737245eee433 ui/ldforge.ui --- a/ui/ldforge.ui Sun Aug 30 04:21:44 2015 +0300 +++ b/ui/ldforge.ui Sun Aug 30 04:41:54 2015 +0300 @@ -14,7 +14,7 @@ - + :/icons/ldforge.png:/icons/ldforge.png @@ -47,8 +47,8 @@ 0 0 - 237 - 414 + 234 + 402 @@ -75,8 +75,8 @@ 0 0 - 237 - 414 + 234 + 402 @@ -157,8 +157,8 @@ 0 0 - 237 - 414 + 234 + 402 @@ -194,19 +194,19 @@ 0 0 1010 - 26 + 30 - File + Fi&le - Open Recent... + Open &Recent... - + :/icons/open-recent.png:/icons/open-recent.png @@ -234,7 +234,7 @@ - View + &View @@ -254,7 +254,7 @@ - Insert + I&nsert @@ -314,7 +314,6 @@ - @@ -328,7 +327,7 @@ - External Tools + E&xternal Tools @@ -348,11 +347,11 @@ - Move + &Move - Grids + &Grids @@ -360,7 +359,7 @@ - Move Objects + &Move Objects @@ -371,14 +370,14 @@ - Object List + &Object List - Rotate + &Rotate @@ -517,7 +516,6 @@ - @@ -571,11 +569,11 @@ - + :/icons/brick.png:/icons/brick.png - New Part + &New Part Create a new part model. @@ -586,11 +584,11 @@ - + :/icons/file-open.png:/icons/file-open.png - Open + &Open Load a part model from a file. @@ -601,11 +599,11 @@ - + :/icons/file-save.png:/icons/file-save.png - Save + &Save Save the part model. @@ -619,11 +617,11 @@ - + :/icons/file-save-as.png:/icons/file-save-as.png - Save As.. + Sa&ve As.. Save the part model to a specific file. @@ -634,29 +632,29 @@ - + :/icons/file-import.png:/icons/file-import.png - Insert From.. + &Insert From.. - + :/icons/file-export.png:/icons/file-export.png - Export To.. + &Export To.. - + :/icons/settings.png:/icons/settings.png - Settings + Settin&gs Edit the settings of LDForge. @@ -667,11 +665,11 @@ - + :/icons/settings.png:/icons/settings.png - Set LDraw Path + Set &LDraw Path Change the LDraw directory path. @@ -679,11 +677,11 @@ - + :/icons/radial.png:/icons/radial.png - Scan Primitives + Scan &Primitives Scan the primitives folder for primitive info. Use this if you add new primitives. @@ -691,11 +689,11 @@ - + :/icons/exit.png:/icons/exit.png - Exit + E&xit Ctrl+Q @@ -703,7 +701,7 @@ - Reset View + &Reset View @@ -714,11 +712,11 @@ true - + :/icons/axes.png:/icons/axes.png - Draw Axes + &Draw Axes @@ -726,11 +724,11 @@ true - + :/icons/wireframe.png:/icons/wireframe.png - Wireframe + &Wireframe @@ -738,11 +736,11 @@ true - + :/icons/bfc-view.png:/icons/bfc-view.png - BFC Red/Green View + &BFC Red/Green View Shift+B @@ -750,34 +748,34 @@ - + :/icons/overlay.png:/icons/overlay.png - Set Overlay Image + &Set Overlay Image - + :/icons/overlay-clear.png:/icons/overlay-clear.png - Clear Overlay Image + &Clear Overlay Image - + :/icons/screencap.png:/icons/screencap.png - Screenshot + Screens&hot - LDraw Code.. + &LDraw Code.. @@ -786,7 +784,7 @@ :/icons/add-line.png:/icons/add-line.png - New Line + N&ew Line @@ -795,7 +793,7 @@ :/icons/add-subfile.png:/icons/add-subfile.png - New Subfile Reference + &New Subfile Reference @@ -804,7 +802,7 @@ :/icons/add-triangle.png:/icons/add-triangle.png - New Triangle + Ne&w Triangle @@ -813,7 +811,7 @@ :/icons/add-quad.png:/icons/add-quad.png - New Quadrilateral + New &Quadrilateral @@ -822,7 +820,7 @@ :/icons/add-condline.png:/icons/add-condline.png - New Conditional Line + New &Conditional Line @@ -831,7 +829,7 @@ :/icons/add-comment.png:/icons/add-comment.png - New Comment + New C&omment @@ -840,7 +838,7 @@ :/icons/add-bfc.png:/icons/add-bfc.png - New BFC Statement + New &BFC Statement @@ -849,16 +847,16 @@ :/icons/add-vertex.png:/icons/add-vertex.png - New Vertex + New &Vertex - + :/icons/undo.png:/icons/undo.png - Undo + &Undo Undo a step. @@ -869,11 +867,11 @@ - + :/icons/redo.png:/icons/redo.png - Redo + &Redo Redo a step. @@ -884,11 +882,11 @@ - + :/icons/cut.png:/icons/cut.png - Cut + &Cut Cut the current selection to clipboard. @@ -899,11 +897,11 @@ - + :/icons/copy.png:/icons/copy.png - Copy + C&opy Copy the current selection to clipboard. @@ -917,11 +915,11 @@ - + :/icons/paste.png:/icons/paste.png - Paste + &Paste Paste clipboard contents. @@ -932,11 +930,11 @@ - + :/icons/delete.png:/icons/delete.png - Delete + &Delete Delete the selection @@ -947,11 +945,11 @@ - + :/icons/select-all.png:/icons/select-all.png - Select All + &Select All Ctrl+A @@ -959,20 +957,20 @@ - + :/icons/select-color.png:/icons/select-color.png - Select by Color + Select &by Color - + :/icons/select-type.png:/icons/select-type.png - Select by Type + Select b&y Type @@ -983,7 +981,7 @@ true - + :/icons/mode-select.png:/icons/mode-select.png @@ -998,11 +996,11 @@ true - + :/icons/mode-draw.png:/icons/mode-draw.png - Draw Mode + Dra&w Mode D @@ -1010,16 +1008,16 @@ - Set Draw Depth + Set Draw Dept&h - + :/icons/palette.png:/icons/palette.png - Set Color + &Set Color Set the color on given objects. @@ -1030,11 +1028,11 @@ - + :/icons/autocolor.png:/icons/autocolor.png - Auto-color + &Auto-color Set the color of the given object to the first found unused color. @@ -1045,11 +1043,11 @@ - + :/icons/uncolorize.png:/icons/uncolorize.png - Uncolor + &Uncolor Uncolor @@ -1060,11 +1058,11 @@ - + :/icons/inline.png:/icons/inline.png - Inline + I&nline Inline selected subfiles. @@ -1075,11 +1073,11 @@ - + :/icons/inline-deep.png:/icons/inline-deep.png - Deep Inline + &Deep Inline Recursively inline selected subfiles down to polygons only. @@ -1090,11 +1088,11 @@ - + :/icons/invert.png:/icons/invert.png - Invert + &Invert Ctrl+Shift+W @@ -1102,20 +1100,20 @@ - + :/icons/radial.png:/icons/radial.png - Generate Primitive + &Generate Primitive - + :/icons/quad-split.png:/icons/quad-split.png - Split Quads + Split &Quads Split quads into triangles. @@ -1123,11 +1121,11 @@ - + :/icons/set-contents.png:/icons/set-contents.png - Edit LDraw Code + &Edit LDraw Code Edit the LDraw code of this object. @@ -1135,35 +1133,23 @@ - + :/icons/make-borders.png:/icons/make-borders.png - Make Borders + &Make Borders Add borders around given polygons. - - - - :/icons/corner-verts.png:/icons/corner-verts.png - - - Make Corner Vertices - - - Adds vertex objects to the corners of the given polygons - - - + :/icons/round-coords.png:/icons/round-coords.png - Round Coordinates + &Round Coordinates Round coordinates down to 3/4 decimals @@ -1171,11 +1157,11 @@ - + :/icons/visibility-toggle.png:/icons/visibility-toggle.png - Toggle Visibility + &Toggle Visibility Toggles visibility/hiding on objects. @@ -1183,11 +1169,11 @@ - + :/icons/replace-coords.png:/icons/replace-coords.png - Replace Coordinates + Re&place Coordinates Find and replace coordinate values. @@ -1195,11 +1181,11 @@ - + :/icons/flip.png:/icons/flip.png - Flip + &Flip Flip coordinates. @@ -1218,11 +1204,11 @@ - + :/icons/ytruder.png:/icons/ytruder.png - Ytruder + &Ytruder Extrude selected lines to a given plane @@ -1230,11 +1216,11 @@ - + :/icons/rectifier.png:/icons/rectifier.png - Rectifier + &Rectifier Optimizes quads into rect primitives. @@ -1242,11 +1228,11 @@ - + :/icons/intersector.png:/icons/intersector.png - Intersector + &Intersector Perform clipping between two input groups. @@ -1254,11 +1240,11 @@ - + :/icons/isecalc.png:/icons/isecalc.png - Isecalc + I&secalc Compute intersection edgelines between two input groups. @@ -1266,11 +1252,11 @@ - + :/icons/coverer.png:/icons/coverer.png - Coverer + &Coverer Fill the space between two line shapes @@ -1278,7 +1264,7 @@ - Edger 2 + &Edger 2 @@ -1286,11 +1272,11 @@ false - + :/icons/help.png:/icons/help.png - Help + &Help F1 @@ -1298,16 +1284,16 @@ - + :/icons/ldforge.png:/icons/ldforge.png - About LDForge + &About LDForge - About Qt + About &Qt @@ -1315,11 +1301,11 @@ true - + :/icons/grid-coarse.png:/icons/grid-coarse.png - Coarse Grid + &Coarse Grid @@ -1330,11 +1316,11 @@ true - + :/icons/grid-medium.png:/icons/grid-medium.png - Medium Grid + &Medium Grid @@ -1342,16 +1328,16 @@ true - + :/icons/grid-fine.png:/icons/grid-fine.png - Fine Grid + &Fine Grid - Edit Selected Object + &Edit Selected Object @@ -1360,7 +1346,7 @@ :/icons/arrow-up.png:/icons/arrow-up.png - Move Up + &Move Up PgUp @@ -1372,7 +1358,7 @@ :/icons/arrow-down.png:/icons/arrow-down.png - Move Down + Move &Down PgDown @@ -1380,11 +1366,11 @@ - + :/icons/move-x-neg.png:/icons/move-x-neg.png - Move -X + &Move -X Left @@ -1392,11 +1378,11 @@ - + :/icons/move-x-pos.png:/icons/move-x-pos.png - Move +X + Move +&X Right @@ -1404,11 +1390,11 @@ - + :/icons/move-y-neg.png:/icons/move-y-neg.png - Move -Y + Move -&Y Home @@ -1416,11 +1402,11 @@ - + :/icons/move-y-pos.png:/icons/move-y-pos.png - Move +Y + M&ove +Y End @@ -1428,11 +1414,11 @@ - + :/icons/move-z-neg.png:/icons/move-z-neg.png - Move -Z + Move -&Z Down @@ -1440,11 +1426,11 @@ - + :/icons/move-z-pos.png:/icons/move-z-pos.png - Move +Z + Mo&ve +Z Up @@ -1452,7 +1438,7 @@ - Rotate -X + &Rotate -X Ctrl+Left @@ -1460,7 +1446,7 @@ - Rotate +X + Rotate +&X Ctrl+Right @@ -1468,7 +1454,7 @@ - Rotate -Y + Rotate -&Y Ctrl+End @@ -1476,7 +1462,7 @@ - Rotate +Y + R&otate +Y Ctrl+Home @@ -1484,7 +1470,7 @@ - Rotate -Z + Rotate -&Z Ctrl+Down @@ -1492,7 +1478,7 @@ - Rotate +Z + Rotat&e +Z Ctrl+Up @@ -1500,7 +1486,7 @@ - Set Rotation Point + &Set Rotation Point @@ -1510,7 +1496,7 @@ - Close + &Close Ctrl+W @@ -1526,11 +1512,11 @@ - + :/icons/file-new.png:/icons/file-new.png - New File + New &File Ctrl+N @@ -1538,7 +1524,7 @@ - Download From... + &Download From... @@ -1548,7 +1534,7 @@ - Go to Line... + &Go to Line... Ctrl+G @@ -1559,11 +1545,11 @@ true - + :/icons/mode-circle.png:/icons/mode-circle.png - Circle Mode + C&ircle Mode C @@ -1571,11 +1557,11 @@ - + :/icons/visibility-hide.png:/icons/visibility-hide.png - Hide + &Hide Hides objects from view @@ -1583,11 +1569,11 @@ - + :/icons/visibility-show.png:/icons/visibility-show.png - Reveal + Re&veal Reveals objects. Undoes hiding. @@ -1603,11 +1589,11 @@ true - + :/icons/mode-angle.png:/icons/mode-angle.png - Draw Angles + Draw An&gles Draw angle information when drawing lines @@ -1618,11 +1604,11 @@ true - + :/icons/random-colors.png:/icons/random-colors.png - Random colors + Ra&ndom colors Shift+R @@ -1630,7 +1616,7 @@ - Open Subfiles for Editing + &Open Subfiles for Editing Opens the documents used by the selected subparts for editing. @@ -1638,7 +1624,7 @@ - Split Lines... + Split &Lines... @@ -1646,7 +1632,7 @@ true - Draw surfaces + Draw s&urfaces Render surfaces (i.e. quads and triangles) on the viewport. @@ -1657,7 +1643,7 @@ true - Draw edgelines + Draw &edgelines Render edgelines on the viewport @@ -1668,7 +1654,7 @@ true - Draw conditional lines + Draw conditional &lines Render conditional lines on the viewport. @@ -1679,11 +1665,11 @@ true - + :/icons/mode-magicwand.png:/icons/mode-magicwand.png - Magic wand + &Magic wand W @@ -1694,11 +1680,11 @@ true - + :/icons/mode-rectangle.png:/icons/mode-rectangle.png - Rectangle Mode + Recta&ngle Mode R @@ -1709,11 +1695,11 @@ true - + :/icons/line.png:/icons/line.png - Line Path Mode + &Line Path Mode P