Commit Graph

104240 Commits

Author SHA1 Message Date
Sergey Sharybin 0dd9a4a576 Cleanup: Libmv, clang-format
Is based on Google style which was used in the Libmv project before,
but is now consistently applied for the sources of the library itself
and to C-API. With some time C-API will likely be removed, and it
makes it easier to make it follow Libmv style, hence the diversion
from Blender's style.

There are quite some exceptions (clang-format off) in the code around
Eigen matrix initialization. It is rather annoying, and there could be
some neat way to make initialization readable without such exception.

Could be some places where loss of readability in matrix initialization
got lost as the change is quite big. If this has happened it is easier
to address readability once actually working on the code.

This change allowed to spot some missing header guards, so that's nice.

Doing it in bundled version, as the upstream library needs to have some
of the recent development ported over from bundle to upstream.

There should be no functional changes.
2021-03-05 15:05:08 +01:00
Julian Eisel e0442a955b UI Code Quality: Port Outliner Grease Pencil layers to new design
Continuation of work in 2e221de4ce and 249e4df110. Now the tree-element
types have to be ported one by one. This is probably the most straight forward
type to port.
2021-03-05 14:45:46 +01:00
Jeroen Bakker a592f7e6cb Cleanup: COM_convert_data_types parameters. 2021-03-05 13:46:25 +01:00
Jeroen Bakker b12be5a872 Cleanup: Remove static struct without data. 2021-03-05 13:46:25 +01:00
Philipp Oeser f3fb1df192 Fix T86293: crash undoing after executing the python console in certain
scenarios

In general, I could not find a reason executing from the python console
should not do an Undo push. Running a script from the Text Editor does
this as well and this seems generally useful.

Without an Undo push, one can easily run into situations were IDs have
been added or removed and undo on would then cause trouble (e.g. first
selection then bpy.ops.object.duplicate() -- this crashed as reported in
T86293 -- duplicate does not get its own undo push because it is not the
last op in the list, wm->op_undo_depth is not zero). This has changed
with the Undo refactor, so in essence the root cause is the same as
T77557, Legacy Undo does not suffer from the crash (but misses
the generally useful undo push from the console still)

Now add Undo to CONSOLE_OT_execute bl_options ('UNDO_GROUPED' seems more
appropriate than plain 'UNDO' since pasting multiple lines of code will
call CONSOLE_OT_execute multiple times in a row).

Maniphest Tasks: T86293

Differential Revision: https://developer.blender.org/D10625
2021-03-05 12:50:55 +01:00
Campbell Barton 5668901ced Cleanup: remove redundant NULL window checks handling events 2021-03-05 21:30:16 +11:00
Jeroen Bakker 6bc01222c6 Cleanup: Sync header+implementaiton definition.
Gave warning on Windows platform. There are more of these cases.
2021-03-05 09:48:49 +01:00
Antonio Vazquez 99e1866712 Cleanup: Use boolean in WM_cursor_wait 2021-03-05 10:36:57 +01:00
Campbell Barton b5d154f400 Cleanup: move check_drag & check_click out of wmEvent
These variables track the wmWindow.event_queue state,
however they were used in a way that wasn't correct.

- check_drag & check_click from wmWindow.eventstate
  were used to track the click/drag status of events handled in
  wmWindow.event_queue.
- Event's in the queue read from wmEvent.check_drag.
- Once a drag action was detected, wmWindow.eventstate.check_drag
  was disabled.

Disabling drag in the event state would not change the drag state
for values already in the event queue.

Simplify logic by moving these values into the window,
so there is one place these variables are tracked.
2021-03-05 17:10:11 +11:00
Campbell Barton 663b0bb04c UI: minor changes to preset sorting
- Only sort by the preset name (not it's directory).
- Remove redundant string conversion.
- Only call lower() once on the input.
- Don't assign the lambda to a variable for single use.
2021-03-05 17:10:11 +11:00
Aaron Carlisle 511ff8b6b4 UI: Add Presets for high framerate video
It is quite common to high framerate video with modern cameras. To make
it easier to edit this footage new framerate presets are added and the
soft limit increased.

Note there is a bug with preset ordering, Blender thinks "120" goes
before "24" this bug needs to be fixed before these changes can be
merged.

Differential Revision: https://developer.blender.org/D10553
2021-03-04 23:22:47 -05:00
Aaron Carlisle c2a8676544 Presets: Improve sort order of presets
Pythons sort function does not sort naturally,
to solve this a custom sort key is used.

This issue is apparent when trying D10553
2021-03-04 23:22:47 -05:00
Campbell Barton 78bd155f5c Cleanup: disambiguate 'queue' struct members
The term queue isn't very descruptive on it's own, use:

- wmWindow.event_queue
- wmWindowManager.notifier_queue
2021-03-05 14:59:38 +11:00
Campbell Barton c2e73a1225 UI: save-preview tip now states that it's used for blend thumbnails 2021-03-05 14:44:39 +11:00
Campbell Barton 23dfcc5ac7 Cleanup: rename event to event_type
Reserve `event` for wmEvent.
2021-03-05 14:44:28 +11:00
Campbell Barton aa86710242 Cleanup: spelling 2021-03-05 14:44:28 +11:00
Campbell Barton b9833860e5 Cleanup: maintain include order without disabling clang format 2021-03-05 14:08:00 +11:00
Campbell Barton e0ba6a4411 Cleanup: rename evt to event
Following naming convention of most operators.
2021-03-05 14:04:22 +11:00
Campbell Barton 59889d9b4f Cleanup: rename variables in wm_event_add_ghostevent
Using both evt and event together was confusing.

Renamed:

- event_state          <- evt
- event_state_other    <- oevt
- event_other          <- oevent
- win_other            <- owin
2021-03-05 14:03:54 +11:00
Harley Acheson 97fabc3c1c Fix T86185: Win32 Multiple Monitor Window Position
Because of D10469 we can now not force child windows onto parent's monitor and allow them to go where they wish.

Differential Revision: https://developer.blender.org/D10593

Reviewed by Ray Molenkamp
2021-03-04 17:54:46 -08:00
Jacob Møller 57812c7e4f Windows/CLog: Support color logging on Win 10
Windows 10 supports V100 on all consoles given
you enable the ENABLE_VIRTUAL_TERMINAL_PROCESSING
flag for the console.

This patch enables color logging only on windows
10 and only if the log is not being redirected
to a file.

Differential Revision: https://developer.blender.org/D10546
2021-03-04 18:20:52 -07:00
Antonio Vazquez 6a662ffda8 GPencil: Implement Autokey button for Draw/Edit and Sculpt mode
Now, if the Autokey is not enabled, a new frame is not created and it is used the last active one. If no active frame, a message is displayed and the operation is canceled.

This is a common request for 2D artists.

Also, grease pencil was not working as Blender does in other areas.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D10557
2021-03-04 21:32:37 +01:00
Philipp Oeser 1668f883fb Fix T59376: UV project modifier not working after modifiers that dont provide a UVMap
This was reported for remesh and skin modifiers.
These dont preserve UV layers (and probably cannot in a reasonable way),
so instead let the UV Project modifier create a new (equally named) UV
layer (as was suggested by @brecht in T59376).

Maniphest Tasks: T59376

Differential Revision: https://developer.blender.org/D10617
2021-03-04 20:20:05 +01:00
Bastien Montagne 63b7ff9f4e Cleanup: Main `foreach ID` code: Remove `MAX_LIBARRAY` and improve comments.
The `MAX_LIBARRAY` define was an annoying doublon to the `INDEX_ID_MAX` enum value
now defined in `DNA_ID.h`, and it is no more useful.

And comments were somewhat outdated. Also added an explanation about
chosen order for the `INDEX_ID_<IDTYPE>` order.
2021-03-04 18:43:30 +01:00
Jacques Lucke f951aa063f UI: prefer shorter search items in fuzzy search
This is a simple heuristic that seems to improve the search results in many cases.

Differential Revision: https://developer.blender.org/D10618
2021-03-04 18:39:31 +01:00
Jacques Lucke 7d685391a0 Nodes: improve NodeTreeRef
This adds a couple more utility methods to various node tree ref types.
Also `InternalLinkRef` has been added to get simpler access to internal links.
2021-03-04 18:15:22 +01:00
Jacques Lucke bb1f02510b BLI: support mutable lookup from multi value map 2021-03-04 17:38:01 +01:00
Corbin Dunn d09b874244 macOS/Ghost: Opt out of AppKit’s automatic window tabbing
Since Blender is single-tabbed, this will prevent extraneous
tab-related options from appearing in "Window" menu in case AppKit's
internals change.

Reviewed By: #platform_macos, sebbas, ankitm
Differential Revision: https://developer.blender.org/D10606
2021-03-04 21:53:27 +05:30
Jacques Lucke 3de5fbba3a Fix T86050: use material count from correct data block
See comment in code for more details.

Differential Revision: https://developer.blender.org/D10615
2021-03-04 15:27:33 +01:00
Jacques Lucke a988099ee4 Fix T86172: tag relations update when pasting nodes
Pasting nodes can create new id relations, because nodes can reference IDs.
Therefore the depsgraph has to be updated when nodes are pasted.
We could somehow check if the pasted nodes referenced IDs, but I'm not sure
if this complexity is worth it.
2021-03-04 13:33:03 +01:00
Campbell Barton 386e3dd842 PyAPI: use methods for bpy.data.libraries.load & write
Replace static methods with regular methods.
Now the 'Main' value is taken from the collection.

Needed to support multiple 'Main' instances in Python, see T86183.
2021-03-04 23:13:07 +11:00
Campbell Barton d9e567d365 PyAPI: support methods for collection properties
Previously only static methods were supported.

Now C/API functions added to collections can receive a 'self' argument.
2021-03-04 23:09:11 +11:00
Jacques Lucke 7fd6c7f371 Fix T86204: support multiple group inputs in node group
Note that this still does not work when in the node group directly referenced
by the modifier, only in sub-node-groups. This limitation will be removed
at some point.
2021-03-04 12:50:23 +01:00
Bastien Montagne bda95ac0f9 Fix T86209: Preference Defaults "Relative Paths" tooltip could be improved.
This UserPref setting is only used when no path is set yet.
2021-03-04 12:20:10 +01:00
Campbell Barton 06d33a6876 Fix Saving startup file changing paths of the current file
Saving the startup file now uses "Save Copy", so paths are preserved.
2021-03-04 20:56:17 +11:00
Campbell Barton 9fffb78343 Fix T86231: Saving startup file always remaps relative 2021-03-04 20:52:03 +11:00
Campbell Barton ef7efc3751 Tests: don't write thumbnails when running tests
Also replace WM_OT_read_factory_settings with WM_OT_read_homefile
so the preferences don't have to be reloaded.
2021-03-04 17:43:12 +11:00
Campbell Barton 753a2a34ce Cleanup: include '--open-last' in "Misc Options"
This was using fall-back category "Other Options"
which should be kept empty.
2021-03-04 17:43:11 +11:00
Campbell Barton 12b529b3a6 Cleanup: redundant struct declarations 2021-03-04 17:17:19 +11:00
Campbell Barton 2df2f1c908 Cleanup: use non-zero comparisons for event modifiers
Use event modifier checks that follow most of Blender's code.
2021-03-04 17:10:56 +11:00
Campbell Barton abaa6c3ace Cleanup: use BM_mesh_copy_init_customdata utility function 2021-03-04 17:06:50 +11:00
Campbell Barton be627ab9e2 Cleanup: comments 2021-03-04 17:00:42 +11:00
Campbell Barton 39b86a989d Cleanup: use const arrays 2021-03-04 16:58:03 +11:00
Campbell Barton d10700a3ac Cleanup: number literals 2021-03-04 16:55:50 +11:00
Campbell Barton 24f0807550 Cleanup: replace Py_CLEAR with Py_DECREF in bpy.app modules
In this case, there is no benefit to using Py_CLEAR
as the value will never be NULL and can't be used later on.
2021-03-04 15:46:07 +11:00
Campbell Barton a40ccde405 Fix logic for calling PyObject_GC_UnTrack
All tracked objects need a matching un-track,
also remove redundant Py_XDECREF call.
2021-03-04 15:18:10 +11:00
Campbell Barton 0d28e2a334 PyAPI: correct garbage collection for StructRNA types
By default objects are no longer GC tracked, this removes some overhead
although it's not significant in my own testing.

- Only enable GC for StructRNA when 'WITH_PYTHON_SAFETY' is on.
- Only track StructRNA when their 'reference' is set.
- Add missing NULL check when 'WITH_PYTHON_SAFETY' is on
  and objects new objects be created.
2021-03-04 15:18:10 +11:00
Ankit Meel 67856d8c4a macOS/GTests: add_dependencies to fix build error
When building `install`, linking blender_test fails because
test libraries do not exist. This happened on lite + Xcode. Error in
{rBdcb2821292f962951e88f146cb304160f21f73da}.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D10607
2021-03-04 08:04:17 +05:30
Hans Goudey e4a55b46c4 UI: Remove extra blank space for decorators in FCurve modifiers
None of these properties can be animated, so it doesn't make sense
to leave space for decorators on the right side of the panels. In fact
that is what was intended, but they were not manually disabled
in all of the panels.
2021-03-03 16:32:55 -06:00
Clément Foucault b450d2d148 Fix T86042 EEVEE: incorrect irradiance bake
The environment (world) irradiance wasn't correctly skipped.
2021-03-03 23:14:06 +01:00