Commit Graph

44 Commits

Author SHA1 Message Date
David Carter
5feb963f9d 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
5d451b1486 PD: fix shape appearance of datum features, shape binder and sub-shape binder 2024-04-09 22:15:51 +02:00
David Carter
ba20441935 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
89dbab9b0e 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
24934d7843 PartDesign: modernize type checking 2023-10-23 18:08:16 +02:00
wmayer
622e46771e PD: modernize C++: use equals default 2023-08-22 13:31:17 +02:00
wmayer
c8abd4a6d4 Part: modernize C++: return braced init list 2023-08-19 11:35:41 +02:00
wmayer
22e6e2cd40 Part/PD: modernize C++: redundant void arg 2023-08-05 16:50:31 +02:00
berniev
53ba98d636 Mod: use empty 2022-08-06 19:30:13 +02:00
wmayer
a93082bc06 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
16b25c5dab [PD] remove superfluous nullptr checks 2022-07-17 18:12:41 +02:00
Uwe
030aba9b92 [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
86df83b7a9 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
72e464b1cc 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
0b2c73cf32 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
65aa374083 PD: PR6497 move return statement to new line 2022-03-29 12:37:21 -05:00
Uwe
153fa35bdb [PD] shape binder: code style improvements
all done by MSVC
2022-03-27 21:48:09 +02:00
wmayer
d1d4b996e7 PD: modernize C++11
* use nullptr
2022-03-23 19:26:14 +01:00
wmayer
8f786ea6ef Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
19bdfc16b8 [PD] more work to remove unused includes 2022-02-21 02:18:17 +01:00
Zheng, Lei
a349765893 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
73d0de60ae PartDesign: expose SubShapeBinderPython 2021-12-21 21:41:02 -07:00
Zheng, Lei
11f9d1c472 PartDesign: support CopyOnChange in SubShapeBinder 2021-12-21 21:41:02 -07:00
wmayer
d360917583 PD: 0004742: Editing features by context menu may not be undoable 2021-12-06 14:11:10 +01:00
Ajinkya Dahale
5e3ad45ef4 [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
4364efca47 PartDesign: change SubShapeBinder claim children behavior 2020-03-20 15:02:20 +01:00
Zheng, Lei
3b8ed7a791 PartDesign: improve SubShapeBinder transformation cache 2019-12-30 17:17:14 +01:00
wmayer
b1dd1e61a7 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
luz.paz
b869b6e29e Fix typos in various src/Mod directories 2019-08-17 15:32:49 +02:00
Zheng, Lei
cd2b7e297c 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
741a7bc016 extend ShapeBinder to also handle Origin features 2019-06-15 15:07:52 +02:00
luz.paz
2b02659010 Misc. typo and whitespace fixes
Found via `codespell`
2019-05-30 19:56:12 +02:00
wmayer
14f6de974b fix typos 2017-09-25 22:36:31 +02:00
wmayer
dd7c91ddcf fix -Wextra in PartDesign 2016-09-22 18:34:56 +02:00
wmayer
17de4e2efa fix Coverity issues 2016-08-22 15:02:18 +02:00
wmayer
9ae9e3d380 + fix typos + improve whitespaces 2016-04-24 18:11:02 +02:00
Stefan Tröger
103ed524f5 PartDesign: Unify datum and shapebuilder visuals 2016-04-12 18:12:23 +02:00
Stefan Tröger
8cbf27dbd6 PartDesign: Fix context menus 2016-04-12 18:12:23 +02:00
Stefan Tröger
815a8e4d30 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
3c39410002 PartDesign: Adopt to new property status bits 2016-04-12 18:12:22 +02:00
Alexander Golubev
27667cf5e6 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
6f8dc62297 add task for datum shape features 2016-04-12 18:12:19 +02:00
Stefan Tröger
00b230fdf8 Setup ShapeBinder Viewprovider and command 2016-04-12 18:12:19 +02:00
Stefan Tröger
b610dcc97c 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