Commit Graph

44 Commits

Author SHA1 Message Date
David Carter
8b5a3b1124 Material: Appearance Updates 2
Improves the use of the ShapeAppearance property for the Part workbench.

    removes DiffuseColor property
        adds Python compatibility using custom attributes
        transitions DiffuseColor to ShapeAppearance on open
    Improved UI elements for setting object appearance, and appearance per face
    Lays the foundation for future texture support
2024-06-01 19:57:16 -05:00
wmayer
780481f6ed PD: fix shape appearance of datum features, shape binder and sub-shape binder 2024-04-09 22:15:51 +02:00
David Carter
495a96a0f5 Material: Material appearance
Uses new material system for appearance

Each feature object now has a property called ShapeMaterial that
describes its physical properties. If it has a shape, it has a
material.

The ShapeColor attribute is replaced by a ShapeAppearance attribute.
This is a material list that describes all appearance properties, not
just diffuse color. As a list in can be used for all elements of a
shape, such as edges and faces.

A new widget is provided to allow the user to select materials in a
consistent fashion. It can also launch the material editor with its
more advanced capabilities.
2024-04-04 07:39:58 -05:00
André Caldas
560898907b Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
Florian Foinant-Willig
6adc675a12 PartDesign: modernize type checking 2023-10-23 18:08:16 +02:00
wmayer
ca1cb21498 PD: modernize C++: use equals default 2023-08-22 13:31:17 +02:00
wmayer
0d854a56cd Part: modernize C++: return braced init list 2023-08-19 11:35:41 +02:00
wmayer
899932cec0 Part/PD: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
berniev
b796a0d376 Mod: use empty 2022-08-06 19:30:13 +02:00
wmayer
88accdb421 PD: [skip ci] Fix several clazy issues:
* Maybe you meant to call base method instead [-Wclazy-skipped-base-method]
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference]
* Mixing iterators with const_iterators [-Wclazy-strict-iterators]
* Unused QByteArray [-Wclazy-unused-non-trivial-variable]
* C++11 range-loop might detach Qt container (QList) [-Wclazy-range-loop-detach]
2022-07-25 13:40:19 +02:00
Uwe
35f75064a0 [PD] remove superfluous nullptr checks 2022-07-17 18:12:41 +02:00
Uwe
19530b337f [Part] [PD] add preferences setting for transparency
- allow to specify the default transparency for new shapes
2022-07-09 23:24:17 +02:00
wmayer
d81b016b2a PD: several fixes of shape binder:
* add action to context-menu to remove an element
* use an exclusive button group to avoid to have several buttons pressed at the same time
* allow to completely clear the support
* when pressing OK/Cancel then operate on the document the shape binder is part of (which isn't necessarily the active document)
* remove obsolete parameter from ViewProviderShapeBinder::highlightReferences()
2022-06-12 14:03:42 +02:00
wmayer
d0f98bf45c Conda: ssize_t is a POSIX type and thus not necessarily defined on Windows. Currently this causes build failures with Conda + Py3.10.
The solution is to get rid off all occurrences of ssize_t in FreeCAD code
2022-05-17 11:43:40 +02:00
wmayer
9eac35cf5d Gui: clean-up Selection API
Replace the int of the 'resolve' argument of several functions with a proper enum class.
* This avoids the inconsistencies in client code where often true/false is passed when an int is expected
* This avoids the use of magic numbers like 0, 1, 2 or the undocumented 3
2022-04-09 17:03:43 +02:00
Chris Hennes
6f230d7404 PD: PR6497 move return statement to new line 2022-03-29 12:37:21 -05:00
Uwe
c27e016521 [PD] shape binder: code style improvements
all done by MSVC
2022-03-27 21:48:09 +02:00
wmayer
3608ee7f51 PD: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
fd19d1a7b0 [PD] more work to remove unused includes 2022-02-21 02:18:17 +01:00
Zheng, Lei
d286a54fc1 PartDesign: show error on SubShapeBinder CopyOnChange failure
The failure is not obivous as it would have been occurred in a
hidden temporary document.
2021-12-21 21:41:02 -07:00
Zheng, Lei
2bd4404afb PartDesign: expose SubShapeBinderPython 2021-12-21 21:41:02 -07:00
Zheng, Lei
39c04e4877 PartDesign: support CopyOnChange in SubShapeBinder 2021-12-21 21:41:02 -07:00
wmayer
e71051f4f0 PD: 0004742: Editing features by context menu may not be undoable 2021-12-06 14:11:10 +01:00
Ajinkya Dahale
bc90f4480b [PD] Use compare to compare strings instead of substr
Used when finding subelements of a feature. Many of the comparisons used to also
check for string lengths, but as far as I can tell they are not strictly
necessary (see https://www.cplusplus.com/reference/string/string/substr/) and
just `substr` can be used without them. However, `compare` explicitly is for
comparing, and does not make a new object that `substr` does.
2021-11-28 22:05:46 +01:00
Zheng, Lei
d949447f89 PartDesign: change SubShapeBinder claim children behavior 2020-03-20 15:02:20 +01:00
Zheng, Lei
c9f6e5c37f PartDesign: improve SubShapeBinder transformation cache 2019-12-30 17:17:14 +01:00
wmayer
d0d92b0801 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
luz.paz
039d6eac01 Fix typos in various src/Mod directories 2019-08-17 15:32:49 +02:00
Zheng, Lei
11a93a0578 PartDesign changes
* Mostly for supporting in-place editing

* Add new SubShapeBinder that support cross coordinate system,
  external, and sub-object binding
2019-08-17 15:15:47 +02:00
wmayer
18183bc79b extend ShapeBinder to also handle Origin features 2019-06-15 15:07:52 +02:00
luz.paz
7c1490c046 Misc. typo and whitespace fixes
Found via `codespell`
2019-05-30 19:56:12 +02:00
wmayer
14985a8b0b fix typos 2017-09-25 22:36:31 +02:00
wmayer
664cf65d26 fix -Wextra in PartDesign 2016-09-22 18:34:56 +02:00
wmayer
63ad26491f fix Coverity issues 2016-08-22 15:02:18 +02:00
wmayer
de47702b17 + fix typos + improve whitespaces 2016-04-24 18:11:02 +02:00
Stefan Tröger
e9b9d285ac PartDesign: Unify datum and shapebuilder visuals 2016-04-12 18:12:23 +02:00
Stefan Tröger
d7e52f11a7 PartDesign: Fix context menus 2016-04-12 18:12:23 +02:00
Stefan Tröger
e7d8a1a9a4 Remove ShapeBinder2D
As profile based features can work with faces and wires now ShapeBinder can do everything that needed ShapeBinder2D before.
2016-04-12 18:12:23 +02:00
Stefan Tröger
7d30833349 PartDesign: Adopt to new property status bits 2016-04-12 18:12:22 +02:00
Alexander Golubev
0cfc0cd424 Fix warnings introduced in new PartDesign
Mostly unused wariables and compare of signed & unsigned
2016-04-12 18:12:21 +02:00
Stefan Tröger
655bf961be add task for datum shape features 2016-04-12 18:12:19 +02:00
Stefan Tröger
e58ae2b616 Setup ShapeBinder Viewprovider and command 2016-04-12 18:12:19 +02:00
Stefan Tröger
9969aac671 fix dependent copy references
to make them work with sketches an additional Part2DObject reference needed to be created
2016-04-12 18:12:19 +02:00