Commit Graph

1364 Commits (3d80062b66b1547657d0b5e022fc74c2ef7e92df)

Author SHA1 Message Date
whitequark 3d80062b66 GTK: delete all gtkmm objects before destrying Gtk::Main.
Otherwise this results in harmless but annoying spam on applciation
shutdown.

See https://gitlab.gnome.org/GNOME/gtkmm/issues/22.
2019-05-31 23:07:04 +00:00
whitequark 359697990a Update q3d submodule. 2019-05-31 23:07:04 +00:00
ruevs 9ac55f392a Win32: fix build with -DOPENGL=1. 2019-05-29 15:06:25 +00:00
whitequark 6352405206 Deselect entities with Ctrl-LMB.
In other words, Ctrl inverts the normal action of LMB. It is already
possible to deselect entities through the context menu, but that
can be very awkward on laptop touchpads with a crowded sketch; with
Ctrl, a misclick is easily corrected without moving cursor at all.
2019-05-24 19:11:56 +00:00
whitequark bd84bc1ae9 Replace entity map implementation with std::unordered_map.
On a single load benchmark this provides about 25% speedup.
2019-05-24 18:19:10 +00:00
whitequark 406c55e8b9 Instead of creating an exact copy of existing constraint, select it. 2019-05-24 16:21:55 +00:00
whitequark 09ca442715 Commit missing parts of cf2f0e5d. 2019-05-24 16:02:01 +00:00
whitequark eb7e12b829 Make sure file from a recent menu exists before using it.
Otherwise it can result in a very confusing error that does not
suggest at all that the file is missing.
2019-05-24 15:57:43 +00:00
whitequark beea4444ab Move logic for handling allowRedundant out of System. NFC. 2019-05-24 15:43:20 +00:00
whitequark cf2f0e5d44 In TryConstrain(), reject redundant constraints in overconstrained groups.
This keeps groups with allowed redundant constraints cleaner when
they are used together with automatic constraints.
2019-05-24 15:40:18 +00:00
whitequark 549565958f Skip creating an automatic H/V constraint if it would be redundant.
This means that automatically added H/V constraints now will never
cause the sketch to become overconstrained, which currently makes
that feature almost unusable.
2019-05-24 15:06:53 +00:00
whitequark 394c1f62d8 Remove forceDofCheck parameter from SolveRank(). NFC.
It makes no sense to solve by substitution (therefore weakening rank
check) in SolveRank(), since that's the whole point of SolveRank().

In addition, because SolveRank() is currently always called right
after AddConstraint(), forceDofCheck would always be true anyway.

In addition, it makes no sense to have TestRankForGroup() dependent
on the result of the previous solve. (For SolveGroup(), solving by
substitution after we know that rank test succeeds makes dragging
points much faster.)
2019-05-24 14:07:48 +00:00
whitequark 88879d352e Show Degrees of Freedom → Show Underconstrained Points
Clarify the name of the command, as the old name is not strictly
correct. E.g. consider a vertical line with a midpoint constraint to
origin has 1 DOF, but 2 highlights are shown. Conversely, a single
datum point has 2 DOF, but 1 highlight is shown.
2019-05-24 12:34:42 +00:00
EvilSpirit 9d1c295495 Add a setting to format constraint labels using SI prefixes.
Supported metric units: km, m, cm, mm, µm, nm.
Supported USCS units: in, mil, µin.

Also, use the newly introduced unit formatting machinery in tools for
measuring perimeter, area and volume, so that e.g. volume is not
displayed in millions of cubic millimeters.
2019-05-24 12:31:41 +00:00
whitequark 9faa7cb0ca Fix commit cc107887. 2019-05-24 03:39:34 +00:00
whitequark 6c167db602 Add an explicit mirror checkbox for Paste Transformed.
This has always been possible by using negative scale, so this just
adds a checkbox controlling the sign.
2019-05-24 02:16:01 +00:00
whitequark df6777aaf3 Warn on broken extrusions, like on broken polygons.
It's not very obvious if the extrusion failed because in a later
group, the solid (by default) uses a very dark gray color that blends
into the black background.

This needs to be done separately because, while we already warn on
broken polygons in workplanes, many more groups can be extruded, e.g.
the canonical way (for now) to mirror a group is to use a rotation,
and that doesn't get checked for closed contour, since most rotations
won't get extruded.
2019-05-23 23:42:57 +00:00
whitequark 43a59e212f Work around MSVC bug 746973.
MSVC has a long history of value initialization bugs, and this one is
no exception. In this case, when some MSVC versions (at least up to
2013) are instructed to value-initialize a non-POD class with
a compiler generated non-trivial constructor, it does not zero out
the POD members.
2019-05-23 20:50:04 +00:00
whitequark 9f2077b1f3 Explain how forceDofCheck in System::Solve works. NFC. 2019-05-23 19:40:32 +00:00
whitequark cc107887e7 Remove the last use of memmove. NFC.
Much clearer!
2019-05-23 19:30:33 +00:00
whitequark fabffbab79 Get rid of FreeTemporary. NFC.
Its only use was in a context where it was completely equivalent to
MemFree, so just use that instead, and keep the temporary heap as
purely an arena allocator, that could use something like bump
pointer.
2019-05-23 19:30:31 +00:00
whitequark ac7b82d7c1 Allow configuring the amount of digits displayed after decimal point.
This is useful in niche cases, like making angular measurement tools.

Also, use simpler and more principled code for numeric precision
while editing constraints: don't special-case angles, but use up to
10 digits after the decimal point for everything.
2019-05-23 17:53:53 +00:00
whitequark d01f715ebf CLI: accept --chord-tol as an option to regenerate.
This is currently necessary to get repeatable results when exporting
assemblies as a part of a batch process, since the mesh geometry in
imported files is not regenerated for export.
2019-05-23 16:31:08 +00:00
whitequark 50c004b679 Add a button to hide construction entities.
Also, mark not just curves, but also points and normals derived from
construction requests as construction.

Also, don't always mark arc center point as construction just to
exclude it from chord tolerance bounding box calculation; instead,
special-case it there.
2019-05-23 16:29:00 +00:00
Dynamo Dan e67f967933 Implement turntable (SketchUp-like) mouse navigation. 2019-05-23 15:45:15 +00:00
Werner Almesberger c2c26e95ad Make minor errors visible at a glance in the group list.
If a sketch has a "minor" problem, such as being self-intersecting,
this can cause considerably confusion in subsequent groups, yet is
not indicated in the group list.

This commit makes the "err" yellow in such cases. Note that the
indication may not change immediately when a change leading to
trouble is made, since the dependent groups are not recalculated
on all changes.
2019-05-23 15:23:18 +00:00
Ruevski 260769c03b Win32: Restore Windows XP Compatibility
By setting WINVER=0x0501 (Windows XP) in CMakeLists.txt and adding a few
missing defines in guiwin.cpp and configuring OPENGL=1 in CMake
Solvespace (3.0~25b6eba1) compiles and works perfectly on Windows XP.
Tested with MinGW GCC-6.3.0-1
2019-05-23 14:42:55 +00:00
Ryan Pavlik 31f58738f2 Add a few asserts. NFC. 2019-05-23 14:31:44 +00:00
nabijaczleweli e243396c6f Three.js: with a window-sized canvas, resize canvas with the window. 2019-05-23 14:28:10 +00:00
Ryan Pavlik ffef006b31 Add a .clang-format file - not for bulk use!
This would add a lot of noise to the history, etc. if applied all
over now. Use git clang-format to apply it solely to your changes.
2019-05-23 14:16:00 +00:00
EvilSpirit c9397eaa07 Make help text for image and TTF request creation reflect reality.
Before this commit it would prompt for top left and bottom left
corner, neither of which was what in fact was being used. Those two
specific points cannot be used because of the way equations are
written, so instead change that to top left and bottom right, which
is more convenient anyway.
2019-05-23 14:05:09 +00:00
whitequark 3296474c15 Rework tooltip implementation to track tip area.
This fixes an elusive GTK issue where tooltips would be spuriously
displayed, and makes tooltips behave nicer on Windows.

Unfortunately the macOS code is unchanged as the macOS tooltip
implementation seems seriously broken in ways I do not understand.
2019-05-23 13:54:24 +00:00
whitequark f6484c78e7 macOS: fix a crash at startup introduced in 75a09c8b. 2019-05-23 12:40:40 +00:00
whitequark e9b9dca2ca Win32: use native OpenGL drivers, if available.
After this commit, if the target system does have modern OpenGL
drivers installed, ANGLE is configured to use them, bypassing most
translation (shaders still have to be translated from ESSL to GLSL).

If there are no OpenGL drivers, such as if the graphics drivers were
installed via Windows Update, DirectX translation is still used. This
results in a very noticeable startup delay and minor performance
degradation.

In addition it is no longer necessary to build with -DOPENGL=1 to be
able to run the binary in wine; everything works out of the box.
Before, wine's incomplete HLSL translator would crash.

This change required renaming the variable `texture` in shaders,
since it shadows the Core GLSL function with the same name, and ANGLE
translates texture2D() calls to texture() calls.
2019-05-23 10:58:31 +00:00
whitequark 09212963ed Update copyright statement in about box.
Also, make sure it's localized properly.
2019-05-23 07:43:29 +00:00
whitequark 25b6eba148 Adjust angle label margin similarly to eda294ef. 2019-05-21 23:05:05 +00:00
whitequark 9500487a3f Fix an edge case with fps measured as infinite.
If the timer is not sufficiently high resolution but the graphics
card is fast, we can get renderTime.count() == 0.
2019-05-21 22:51:28 +00:00
Ryan Pavlik 39c348090b Add CountIf method to IdList to simplify some call sites. NFC.
This also changes GetNumConstraints to return size_t.
2019-05-21 01:19:11 +00:00
Ryan Pavlik 43c9cba7dd Reduce Vector::Element calls in SKdNode::SnapToVertex. NFC. 2019-05-21 01:19:09 +00:00
Ryan Pavlik f885daf752 Simplify. NFC. 2019-05-21 01:14:42 +00:00
whitequark 75a09c8b67 Minor cleanups. NFC.
A few code style changes extracted from the Emscripten port.
2019-05-21 00:48:20 +00:00
whitequark 7f75148671 Win32: ignore WM_MOUSEWHEEL events that are forwarded to other window.
Before this commit, scrolling the property browser positioned on top
of a face in the main window would highlight the face.
2019-05-20 22:58:07 +00:00
whitequark 5dbe090098 Win32: do not insert windows with parents after HWND_TOPMOST.
It is not clear why this code was added (I don't remember) and
the normal parent-child relationship should be sufficient for
the task of keeping property browser on top of the main window.

With SetWindowPos(hwnd, HWND_TOPMOST) though, the property browser
window stays on top of *anything*, even if the user switches to
an entirely different application.
2019-05-20 22:43:29 +00:00
whitequark be0dc7e2cb Win32: silence a GetProcAddress-related warning. 2019-05-20 22:12:45 +00:00
whitequark e11e23483d Win32: remove dead code in keyboard event handling.
The forwarding is now performed explicitly in the text window setup
code, so this branch never has a chance to run.
2019-05-20 21:52:06 +00:00
whitequark bda3b80609 GTK: fix last remains of legacy event handling code. 2019-05-20 21:42:37 +00:00
whitequark f43954cc29 Adjust GL1 and GL3 ReadFrame to take pixel ratio into account.
Currently, on HiDPI screens the Export Image command would return
a cropped screenshot.
2019-05-20 19:09:40 +00:00
whitequark 11c5cdc7b0 Adjust GL3 ReadFrame() for GL ES 2.1 compatibility.
Currently on Win32 this errors out and renders a black rectangle.
2019-05-20 19:09:40 +00:00
Ryan Pavlik c18deb2d81 test harness: Identify build host system in CMake to use for path separator.
Before, would guess incorrectly if the CMake source tree was specified
via a relative path (since then the path would not start with /).
Now, directly asks CMake if building on Windows or something else,
and sets a define.
2019-05-20 16:47:38 +00:00
Ryan Pavlik 62aba398f7 Move two members of Vector to be inline.
Performance change: moved since they show up disproportionately
in profiling.
2019-05-15 19:53:38 +00:00