Commit Graph

32102 Commits

Author SHA1 Message Date
Uwe
eb24cf2638 [Core] add missing velocity property
- fixes compilation because declared in header but no code
- also sort the properties to keep the overview
2023-02-26 16:38:02 +01:00
wmayer
a16073c91d Gui: add function View3DSettings::stopAnimatingIfDeactivated() 2023-02-26 16:20:58 +01:00
Oliver Oxtoby
806c47311e [App] [Base] Add missing Property classes for all Units (#6717)
- Add missing Property classes for all Units
- Add missing units to unit calculator, as well as some missing string representations
- also change units used for dynamic viscosity to the customary Pa*s
2023-02-26 15:28:28 +01:00
wmayer
64ce9ec0a4 Gui: refactor View3DInventor and move handling of settings to separate classes 2023-02-26 15:17:39 +01:00
Chris Hennes
07dbe74c34 Sketcher: Silence Coverity warning
Coverity CID 350580: Uninitialized scalar variable. The analyzer doesn't like the incomplete construction of the ConstraintId object (the 'Type' field was uninitialized).
2023-02-26 13:48:48 +01:00
wmayer
c7f2b67d14 App: fix several Lint warnings:
* ignore bugprone-easily-swappable-parameters
* handle bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions
* handle readability-uppercase-literal-suffix
* handle readability-braces-around-statements
2023-02-26 13:30:44 +01:00
wmayer
42e055f9c7 Gui: use Color::fromPackedRGBA to simplify client code 2023-02-26 13:30:44 +01:00
wmayer
201faebb99 Tests: fix Lint issue cppcoreguidelines-init-variables 2023-02-26 13:30:44 +01:00
wmayer
191b477d75 App: fix some Lint issues:
* readability-identifier-length
* cppcoreguidelines-pro-type-member-init
2023-02-26 13:30:44 +01:00
wmayer
fb4af78cdc Import: enable multi-threading support of RWGltf_CafWriter for OCCT 7.7 2023-02-26 13:30:44 +01:00
Uwe
17b3b24e62 modernize usage of connect() 2023-02-26 10:38:28 +01:00
Uwe
4074578044 [Widgets] register transparency property of Gui::ColorButton
- at the moment it is not possible to set the property "allowTransparency" in Qt Designer
2023-02-26 10:38:28 +01:00
Chris Hennes
cabb88019f Gui: Eliminate variable reuse
Coverity complains about USE_AFTER_FREE here, and it was difficult to reason about the code. To help address this, use different variables for the different parameter groups.
2023-02-26 10:36:16 +01:00
Uwe
b846722f3a [TD] fix compiler about a variable redefinition 2023-02-26 10:31:36 +01:00
Chris Hennes
05837719f6 Spreadsheet: Fix possible null dereference
Fixes Coverity CID 184299.
2023-02-26 10:22:37 +01:00
wmayer
9604f94fdc Core: add functions setPackedARGB and fromPackedRGBA 2023-02-26 10:11:53 +01:00
wmayer
337991cbc7 Gui: use Color::asPackedRGB<QColor>() 2023-02-26 10:11:53 +01:00
wmayer
c19f00fc89 Points: use Color::getPackedARGB() for pcl colors 2023-02-26 10:11:53 +01:00
wmayer
92b1774961 App: move Color class to its own sources 2023-02-26 10:11:53 +01:00
wmayer
6df33e89fb Import: [skip ci] fix some minor Lint issues 2023-02-26 09:04:26 +01:00
wmayer
2d629d7e1e Import: support to export to glTF file in headless mode 2023-02-26 09:04:26 +01:00
wmayer
910f1e2481 Test: add unit tests for expressions with operator 2023-02-26 09:00:27 +01:00
wmayer
5aabb718b6 Tests: add unit tests for expression tokenizer 2023-02-26 09:00:27 +01:00
wmayer
62c05414d1 App: split tokenizer handling of ExpressionCompleter to its own class 2023-02-26 09:00:27 +01:00
wmayer
946588fed8 Tests: exclude some lint warnings 2023-02-26 08:58:51 +01:00
wmayer
67b14d83a0 Tests: add unit tests for Matrix4D and Rotation 2023-02-26 08:58:51 +01:00
Chris Hennes
46131a3696 Part: SectionCutting cutTransparency initialization
Addresses Coverity CID 356563: Uninitialized scalar.
2023-02-26 05:40:32 +01:00
Uwe
93600f2447 [Gui] fix initialization of NaviCube colors
- the color is stored in for RRGGBBAA and must be passed in form AARRGGBB to QColor. In NaviCube.cpp this is already done right and the same is necessary for View3DInventor.cpp
2023-02-26 05:35:39 +01:00
Uwe
8ccc9aa266 [Sketch] [skip ci] fix UI file
- compiler stumbles over inexisting tabstop target
 the fix was automatically done Qt Designer
2023-02-26 04:59:27 +01:00
Chris Hennes
b4d10f29c2 App: Add None=0 to enumeration
Addresses Coverity CID 356649, uninitialized scalar.
2023-02-25 21:53:01 -06:00
Uwe
7eb560bdab [Material] add new card to CMake 2023-02-26 04:21:32 +01:00
Vladimir
d9950a5e4e [Material] Add Titanium alloy to materials (#8636)
* Add Titanium alloy
2023-02-26 03:53:39 +01:00
Abdullah Tahiri
87a412f951 Part/Sketcher: Grid - set grid orientation
==========================================

Extend ViewProviderGridExtension so that it is aware of the absolute direction of the XY plane on which the grid is to be drawn.

Fix the calculation of the cam origin.
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
82e9a49ab3 Sketcher: Grid - Imperial
=========================

Fix grid calculation in Imperial units in Auto mode (wrong scaling).

Remove observer as unit does not need to be observed.
2023-02-25 23:13:55 +01:00
0penBrain
f1bd743b1b Sketcher/Grid: fix error in parameter function call
Sketcher/Grid: fix algorithm computing the automatic grid spacing

Sketcher/Grid: forcefully redraw grid when one of its parameter is changed

Sketcher/Grid: always authorize user to change grid spacing, even if 'auto spacing' is enabled

Sketcher/Grid: apply a default factor of 10 for 'auto spacing' if number of subdivision is 1
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
f486ee74a4 Sketcher: Grid - correction of design decisions
===============================================

Removal of ViewProviderGridExtension properties:
-GridStyle
-GridSnap

Improvement of ViewProviderGridExtension API:
- color via App::Color

Toolbar grid command:
- Conversion of Snapping to edit parameter
- Snap gets a class enum to support future Snapping functionalities as edit parameter

Sketcher Settings:
- Removal of snap preference

Behaviour:
- ShowGrid, GridAuto, GridSize preferences do not change any existing VP. They apply to any newly created sketch.
- Do not limit grid to hardcoded values

Snap to grid:
- Code updated to use closestpoint functionality provided by the extension,

Several other fixes
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
1d9298590f Sketcher/Part: Grid - Architecture
==================================

- Move all grid specific code out of ViewProviderSketch and EditModeCoinManager.
- The code in made into a new extension in Part - ViewProviderGridExtension
- ViewProviderSketch starts deriving from this new extension
- ViewProviderSketch configures the extension according to its Grid preferences
- Grid code refactored to remove hardcoded sketcher preference parameters.
- ViewProviderGridExtension handles property name/type changes within its competence.
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
b073d9ab43 Sketcher: Add QtAll to PCH 2023-02-25 23:13:55 +01:00
Abdullah Tahiri
772a06b5d6 App: Extension/ExtensionContainer - handle property change
==========================================================

Currently changes of name or type of properties in a property container are handled by:
void PropertyContainer::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName)
void PropertyContainer::changedPropertyType(Base::XMLReader &reader, const char * TypeName, Property * prop)

There is no mechanism for handling property changes by extensions. Sometimes the solution is to explicitly call the extension
from the container. However, this is a breach of the SRP, as the container should not be in a position to decide whether the
extension needs or not handle property changes. The handling code of the container changes for two different reasons, for
adapting the container to a property change of its own, and for adapting that of a property of the extension.

Illustrating it with an example, following inheritance, it goes like this:
PropertyContainer => ExtensionContainer => TransactionalObject => ViewProvider
App::Extension => ViewProviderExtension

The extension is currently not notified by the ExtensionContainer that a property needs handling. So a change in a property of
a ViewProviderExtension needs code at the ViewProvider it was added to.

This commit provides a mechanism in ExtensionContainer to call the extensions so that they can handle property changes. This
functions:

  virtual bool extensionHandleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName);
  virtual bool extensionHandleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, Property * prop);

Containers should always call the base class for any unhandled property change. If a sub-class container of ExtensionContainer
handles property changes itself, but not the ones of the extensions, this call to the base class ultimately ensures that if the
property was not handled by the container hierarchy, any extension is given an opportunity to handle it.

Some examples:

* A container handles the extension property change or its own:

void ContainerSubClass::handleChangedPropertyType(...)
{
    if (prop == &PropertyOfExt) {

    }
    else if (prop == &PropertyOfCont) {

    }
    else {
        ContainerBaseClass::handleChangedPropertyType(...);
    }
}

* A container and the extension handle their own:

void ContainerSubClass::handleChangedPropertyType(...)
{
    if (prop == &PropertyOfCont) {

    }
    else {
        // This will call ExtensionContainer::handleChangedPropertyType
        ContainerBaseClass::handleChangedPropertyType(...);
    }
}

bool ExtensionSubClass::extensionHandleChangedPropertyType(...)
{
    if (prop == &PropertyOfCont) {

        return true;
    }
    return false;
}
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
127bc9f57b Sketcher: Grid settings - disable spacing when auto mode selected and vice versa 2023-02-25 23:13:55 +01:00
Abdullah Tahiri
42a08a5cf5 Sketcher: Resources - remove unnecessary resources 2023-02-25 23:13:55 +01:00
Abdullah Tahiri
0f6ac5e40a Sketcher: command - review code improvements 2023-02-25 23:13:55 +01:00
Abdullah Tahiri
279b684e56 Sketcher: Grid Command - Correct dependencies 2023-02-25 23:13:55 +01:00
Abdullah Tahiri
18046c1277 Sketcher: Rewrite grid command
==============================

Fix unresolved issues:
https://github.com/FreeCAD/FreeCAD/pull/7754/files#r1025493443
https://github.com/FreeCAD/FreeCAD/pull/7754/files#r1019077589
https://github.com/FreeCAD/FreeCAD/pull/7754/files#r1025502204

Summary:
- EventFilter unnecessary in light of new implemented signal aboutToshow. The data of the drop-down action is updated only when necessary (when it is going to be shown).
- Structure of individual commands under drop-down simplified to a single action, rendering the need for groupcommands obsolete, while keeping all the grid related controls and
the logic for controlling the grid in a single action class.
- Reduce the complexity and overload of isActive to the bare minimum (determining if it is active and updating the icon to the right icon if so).

Refactor:
- Better name for utils functions, as when a DSH is active, the edit mode VPSketch is a data member of DSH, sketchgui (so this function is not really necessary when the DSH is active).
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
93f646ff25 Gui: ActionGroup - aboutToShow and aboutToHide
==============================================

ActionGroup may integrate a drop down menu (internally a QMenu).

QMenu has signals aboutToShow and aboutToHide, which are called just before showing/hiding the menu.

This commit extends ActionGroup by providing corresponding signals.

An ActionGroup can be added to more than one toolbar and thus creates more than one menu. So, it can theoretically
happen that you have opened a menu and click on another menu. For this reason, the menu is passed as argument:

void aboutToHideMenu(QMenu*);
void aboutToShowMenu(QMenu*);
2023-02-25 23:13:55 +01:00
Abdullah Tahiri
fe405fcefb Sketcher: Refactor miscelaneous command isActive() 2023-02-25 23:13:55 +01:00
Paddle
fbbadde9fe Sketcher: Grid coin manager: fix includes 2023-02-25 23:13:55 +01:00
Paddle
40271a29ea Sketcher: Grid rework. Include:
- Adding 'auto spacing' option.
    - Drawing grid dynamically on viewer area only.
    - Moving code to coinManager.
    - Adding a 'grid tool' to sketcher-edit-mode toolbar.
2023-02-25 23:13:55 +01:00
Paddle
a1d0d1dd76 Sketcher: Remove grid settings from Edit Control widget. 2023-02-25 23:13:55 +01:00
Paddle
e0b1117701 Core: View3DInventorViewer, add 3 functions:
- getDimensions
- getMaxDimension()
- getCenterPointOnFocalPlane()
2023-02-25 23:13:55 +01:00