Compare commits

...

3072 Commits

Author SHA1 Message Date
889c4ca9c2 Merge branch 'asset-uuid--archived' into asset-engine--archived 2020-07-01 17:25:04 +02:00
0829cebeb0 Merge branch 'master' into asset-uuid--archived 2020-07-01 17:13:57 +02:00
42be3964eb Cloth: correctly use the rest shape to compute the initial pressure volume.
Computing the original volume should use the rest positions of vertices,
like is done for initializing other parts of the simulation like springs.
Otherwise, features like rest shape key don't work correctly.
2020-07-01 17:42:05 +03:00
b5660f71fe Fix missing GPU image free in background mode
This is legacy code from before Eevee and Workbench rendering in background
mode was supported. Avoid memory leak by only queueing GPU textures to be
freed when we know they have been allocated.

Differential Revision: https://developer.blender.org/D8172
2020-07-01 16:05:54 +02:00
Yevgeny Makarov
5db82be980 Fix file-selector entering the directory on Ctrl-Click 2020-07-01 23:32:51 +10:00
6f0aca7973 Fix T78264: Auto Render stops working after rendering manually
Was caused by weird and feedback-loop based issue from a long time ago.

The auto-render was only happening for nodes which are tagged for exec.
This tag is assigned by edit operations on the tree (for example, when
adding or removing links). It is also set in the render pipeline for
nodes which are to be executed.

The issues comes from the fact that "life updates" during editing did
not clear the need_exec flag, ever. This made it so Auto Render was
working as expected. However, rendering the scene resets need_exec
flags at the end of rendering using ntreeCompositClearTags().
The actual need of such clear is not very clear, but it was making it
so Auto Render does not work after render.

To my knowledge the flag didn't really meant that the node is connected
to the output, so it couldn't have acted as attempt to ignore rendering
of an unused scene. It also should be possible to auto-render even if
node tree itself was never altered.

Long story short: lets ignore need_exec flag in auto-render check and
render scene node if the scene is used by the node.

Differential Revision: https://developer.blender.org/D8171
2020-07-01 15:08:16 +02:00
6a302e6845 UI: Fix alignment in kinematic constraint layout 2020-07-01 09:06:50 -04:00
9324e1117a LibOverride: Tweak more poll functions to prevent illegal operations.
We are likely still missing a lot of things, but most operators that
should not be allowed on liboverrides should now be properly disabled.
2020-07-01 14:45:27 +02:00
23cc2a2628 Fix ID reference counting asserts when freeing COW pose channels.
Take the do_id_user flag into account when freeing custom properties
attached to pose channels, so that pointer properties don't cause
assertion failures when DEG frees its COW instances.
2020-07-01 14:42:55 +03:00
323c5e1e0b Fix T78494: Edge slide crashes
Introduced in recent commit 9c29803255.
2020-07-01 21:28:27 +10:00
86e41ca775 UI: remove internal names (custom-data & loops) from tool-tip 2020-07-01 20:17:19 +10:00
ab0d02b704 UI: use term 'Current Frame' instead of 'Playhead'
Keep terminology consistent, 'Current Frame' is used nearly everywhere.
2020-07-01 20:16:27 +10:00
4387aff99e Transform: generalized custom-data correction support
Support custom-data correction based on surrounding geometry for all
transformation modes of the mesh transform operators.

The is the same logic used in Vert and Edge Slide.

In order not to change the current default behavior,
this property does not affect Vert and Edge Slide modes.
2020-07-01 17:49:38 +10:00
8d3c4aa2d7 Nodes: add utility method to access bsocket 2020-07-01 09:33:35 +02:00
6c7d0aebcb Fix T75483: 3D Text selection obscures text
This avoids logic op and having to draw on the render frame-buffer.
2020-07-01 16:55:20 +10:00
9f634a195d Fix crash drawing non-mesh objects with vertex color
Missing NULL check in f7bbc7cdbb
2020-07-01 16:50:28 +10:00
Stefan Werner
8c4703127a GPU: Apple/Nvidia Proxy check
Apple's Nvidia driverPROXY check also fails. Now the
configuration Apple/Nvidia will also bypass the
Proxy test.

Maniphest Tasks: T78175

Differential Revision: https://developer.blender.org/D8160
2020-07-01 07:55:10 +02:00
d885b1141c DRW: optimize mesh data extraction
Change extraction callbacks to take index ranges instead of calling them
for each mesh element (poly, loop, vert & edge).

This gives a minor overall performance gain in my tests, ~5% on average.

Details:

- Use typed parameter structs and macros for looping over elements.
  Without this, changes to these callbacks is time consuming as changes
  need to be made in many places.
- Avoid iterating over polygon-loops when iterating over polygons
  is sufficient.
- Simplify logic to access adjacent loops for faster line extraction.
- Rename 'loop' iterators to 'poly' (as they take polygon ranges)
  the iterator callbacks can operator on either polygon or loop data.
- Use term 'last' for the last index (inclusive),
  use 'end' when this value (not inclusive).
2020-07-01 14:56:39 +10:00
36d6aa428f Cleanup: spelling 2020-07-01 13:12:24 +10:00
63b8cf4518 Cleanup: python enum quoting 2020-07-01 13:11:39 +10:00
38bbd783b3 Cleanup: undeclared functions (make static) 2020-07-01 13:03:22 +10:00
039bfe0e05 UI: Constraints: Use single column for IK constraint 2020-06-30 22:11:11 -04:00
aeb4792044 Fix T77641 Sculpt mode performance regression in 2.83 2020-07-01 02:11:58 +02:00
a3e6b7c2ce Sculpt: Refactor persistent base to make it usable from other tools
This renames the layer persistent base and adds new API functions to get
the mesh state from the base, so it can be used from other tools and
replaced in the future with a better system.

Reviewed By: sergey

Maniphest Tasks: T77738

Differential Revision: https://developer.blender.org/D8003
2020-06-30 22:02:17 +02:00
981d7381cd Fix T77069 EEVEE: Mix shader with holdout & transparent BSDF fails
This follows Cycles closer.
2020-06-30 21:12:44 +02:00
3562be2bda UI: Cycles: Use Split layout for object motion blur 2020-06-30 13:23:12 -04:00
db7d370657 Fix T78201: Paint color not matching the UI and color picker
The color picker and brush->rgb values are in srgb, but sculpt vertex
colors works in linear, so they need to be converted.

Reviewed By: sergey

Maniphest Tasks: T78201

Differential Revision: https://developer.blender.org/D8111
2020-06-30 19:13:45 +02:00
7dbfc864e6 Outliner: Add auto scrolling during drag and drop
Pan the view when dragging elements near the borders. This uses the same
operator that scrolls the region during modifiers drag and drop.
2020-06-30 10:57:27 -06:00
21c2a64e79 Sculpt: Color filter fill mode
This implements a fill mode in the Color Filter tool, which fills the
entire mesh with a specific color.
As this functionality is part of the color filter, this allows to control
the blending of the fill color with the filter strength.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8158
2020-06-30 18:50:13 +02:00
0949140d36 Fix compile error
This is the same issue as in rBbcf49d13e53454.
2020-06-30 18:32:38 +02:00
8262e37d22 Outliner/UI: Show library state icons for data-blocks in "Data API" mode
Previously it was not possible to tell appart a linked data-block from its
override copy. In fact you couldn't tell appart any data-blocks with the same
name (which is possible with linking).
Now we show the library state icon as we do for data-blocks in other display
modes.

Old/new comparison (note the overriden "GEO-head"):
{F8608835} {F8608836}
2020-06-30 18:26:21 +02:00
9693163e2f Pointcache: store owner_id instead of object in PTCacheID
The new simulation type can also reference a point cache, but it is not an object.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8097
2020-06-30 18:25:08 +02:00
9d80e6a6bb Fix T76480 UI: Proportional Editing Color too Shallow on 2.9a
This changes the drawing by drawing 2 circles with different intensity to
avoid any readability issues. This removes the need for Logic OP which is
implementation dependent.
2020-06-30 18:21:45 +02:00
c2ebf3edb4 Functions: provide dummy multi function
Sometimes it is convenient to be able to return a reference to some
dummy function.
2020-06-30 18:18:48 +02:00
67da2bd23a Functions: add methods to multi-function network classes
Those are necessary to query and modify the network.
2020-06-30 18:18:48 +02:00
d67b7f3b52 Functions: use raw allocator for function signature
This allows multi-functions to have static storage duration.
2020-06-30 18:18:48 +02:00
613f62d15c Functions: add two more customizable multi-functions 2020-06-30 18:18:48 +02:00
d92e5f8950 BLI: support constructing Color4f from float pointer 2020-06-30 18:18:48 +02:00
5c9c3a3234 Nodes: add some utility methods to DerivedNodeTree 2020-06-30 18:18:47 +02:00
e60b6f586b Build: disable OpenXR in make deps for macOS, it's not supported 2020-06-30 18:12:08 +02:00
95ee06d068 Fix T77825: autosave missed too often while sculpting
Previously if a modal operator is active, which might leave Blender in a state
where it's not safe to autosave, it would try again in 10s. Now try again in
10ms so it's much less likely to be missed, since overhead of such a timer is
negligble anyway.

Also remove the debug print that was added to investigate a bug at some point.
2020-06-30 18:12:08 +02:00
d4b9b2c020 Cycles: bump version to 1.13, matching Blender 2.90 release cycle 2020-06-30 18:12:08 +02:00
Miguel Porces
03b8173059 Python API: support setting properties in nested data in node add operator
Differential Revision: https://developer.blender.org/D8093
2020-06-30 18:04:25 +02:00
6add0cc88a LibOverride: Fix lots of poll functions for Object operators.
Prevent operators that should not perform on override data to be
callable in those cases.
2020-06-30 17:52:36 +02:00
438bd82371 Sculpt: Pose Brush option to affect loose parts
This option allows posing meshes with different disconnected elements
using the Pose Brush.

This is achieved by doing the following:
- Creating an ID per vertex that stores the connected component of that vertex.
- By using those IDs, one fake topology connection is created per vertex to the nearest vertex in a different ID. The maximum distance to create that connection is determined by the "Max Element Distance" property. These fake connectivity neighbors are used in the Sculpt API functions iterators, so all the algorithms of the Pose Brush can run without modifications as if everything was part of the same mesh.

In order to make this work, the "Connected only" property of the Pose Brush needs to be disabled. This will add an extra performance cost to the Pose Brush and its preview. To achieve optimal results, max element distance should be as low as possible.

Reviewed By: sergey, campbellbarton

Differential Revision: https://developer.blender.org/D7282
2020-06-30 17:43:37 +02:00
6ac235a6f7 Fix T78038: Cycles crash rendering with volume object and motion blur 2020-06-30 17:36:02 +02:00
27783b4ac7 Fix T78358: random crash editing shader nodes with textures 2020-06-30 16:59:40 +02:00
26cdab02a8 Cleanup: move tests into their corresponding namespace 2020-06-30 16:46:52 +02:00
e0ef574c40 Fix T76337 Overlay: Wireframe: x-ray doesn't deactivate when set to 0
Also fix an issue with antialiasing when xray opacity is set to 0.
2020-06-30 16:12:12 +02:00
49d05687be LibOverride: Add most of Object properties as overridable. 2020-06-30 16:06:32 +02:00
37820651bb BLI: add Array constructor that does not initialize non-trivial types
This should rarely be necessary, but I have a use case coming up soon.
2020-06-30 15:58:29 +02:00
Demeter Dzadik
5b03f49302 Custom Properties: support default values for strings
Differential Revision: https://developer.blender.org/D8102
2020-06-30 15:06:33 +02:00
Vincent Blankfield
e93663363e Fix T77734: random crash when rendering animation
Differential Revision: https://developer.blender.org/D7986
2020-06-30 14:58:50 +02:00
4e9ed1dae9 Fix T78447: Cycles vertex color node not working with hair 2020-06-30 14:36:52 +02:00
8aaca88402 Fix missing relation in compositor depsgraph
This is a fix for c7694185c9. An object without base can still be in the
depsgraph, and then the `VIEW_LAYER_EVAL` node does not exist.

This popped up while @Sergey was looking into T78264.
2020-06-30 14:26:12 +02:00
2a1af5fa48 Cleanup: add missing extern "C" 2020-06-30 14:01:46 +02:00
bdbfdce766 Transform: Reduce the alpha in the Edge Slide drawing
It was very intense and could be confused with the `Even` option.
2020-06-30 09:00:22 -03:00
602cfdeac7 Transform: Add constraint intersection support
Snap to faces and edges is now enhanced in the Edge Slide.

It works in the same way that it already works in the Vert Slide.

Basically it now snaps to the intersection of the slid edge with the
face plane or the edge line.
2020-06-30 08:58:47 -03:00
84901f2eda Nodes: store nodes by bNodeType instead of idname
This is more efficient in most cases.
2020-06-30 13:35:45 +02:00
a6775efb4f Alembic exporter: Fix Windows build errors
Some Windows-specific code needed adjustment after 2917df21ad.
2020-06-30 13:09:44 +02:00
b838a51803 Cleanup: spelling 2020-06-30 20:54:31 +10:00
84f8b47c4c Cleanup: clang-format 2020-06-30 20:50:37 +10:00
0291039079 LibOverride: Add minimal support of liboverrides to shapekeys. 2020-06-30 12:19:11 +02:00
4c3d51326e LibOverride: Refactor 'make override' 3DView operator.
This one now uses a generic 'dependency detection' process to decide
which IDs should be overridden.

This will e.g. allow to override mesh and shapekeys when those have some
values controlled by drivers using an armature bone...
2020-06-30 12:19:11 +02:00
f6394e66ed LibOverride: Fix handling of owned ID pointers in diffing process. 2020-06-30 12:19:11 +02:00
a94a05ec19 LibOverride: Add proper handling of shapekeys to core override code itself. 2020-06-30 12:19:11 +02:00
24c4d3f1f7 LibOverride: Add necessary bits in RNA to deal with embedded IDs paths.
Note that this code is rather rough and slightly hacky, a proper
solution needs to be designed at some point probably, but for now this
should work fine.

As usual, master collections and root node trees remain TODO for now.
2020-06-30 12:19:11 +02:00
7556530bac LibOverride: properly tag owner ID for override refresh, when embedded one is affected.
Note that this is partially WIP code, we only take care of shapekeys
here for now.

Also, move this tagging for liboverride refresh into same chack as the
one for tagging editors, sounds more logical that way.
2020-06-30 12:19:11 +02:00
deb01eb199 LibOverride: Add concept of 'embedded'/'virtual' override.
IDs like embedded ones (master collections, root node trees) cannot be
linked, and thus cannot be real override themselves.

Since they are managed by their owner ID, that one will also have the
overrides for their locally edited properties.

We still need a way to mark them as overridden though, for various UI
and override-internal purposes, this is done using a new ID flag.

Note that since Shae Keys are not linkable, and their pointers are not
editable in RNA, they are also considered as embedded from override
point of view.
2020-06-30 12:19:11 +02:00
34027506f8 Cleanup: ID macros: cast to const ID * instead of ID *.
Allows to pass const pointers without getting complains from the
compiler.
2020-06-30 12:19:11 +02:00
737b0fd762 Cleanup: Use unsigned int when for enum values, instead of signed int. 2020-06-30 12:19:11 +02:00
906d93110e Cleanup: LibOverride: Naming. 2020-06-30 12:19:11 +02:00
fa7d990f10 LibOverride: Fix improper update of depsgraph relations. 2020-06-30 12:19:11 +02:00
0b3313e532 Cleanup: LibOverride: Replace raw pointers checks by proper macros.
This is cleaner, but also crucial to avoid weird issues when behaviors
of those checks are modified...
2020-06-30 12:19:11 +02:00
4783520bfa Cleanup (from clang format)... 2020-06-30 12:19:11 +02:00
2d8c59ccb9 Fix T77095: fix Cycles performance regression with AMD RX cards
Apply the workaround only for known problematic drivers. The latest pro driver
appears to work correctly, hopefully the regular driver will as well once it
is updated to the same OpenCL driver version (3075.13).
2020-06-30 12:01:40 +02:00
9dbe0f9c04 Fix T78367: triangulate modifier does not preserve sculpt vertex colors 2020-06-30 12:00:44 +02:00
2917df21ad Alembic: new exporter based on the USD exporter structure
The Alembic exporter has been restructured by leverages the
`AbstractHierarchyIterator` introduced by the USD exporter. The produced
Alembic files have not changed much (details below), as the Alembic
writing code has simply been moved from the old exporter to the new. How
the export hierarchy is handled changed a lot, though, and also the way
in which transforms are computed. As a result, T71395 is fixed.

Differences between the old and new exporter, in terms of the produced
Alembic file:
- Duplicated objects now have a unique numerical suffix.
- Matrices are computed differently, namely by simply computing the
  evaluated transform of the object relative to the evaluated transform
  of its export-parent. This fixes {T71395}, but otherwise should
  produce the same result as before (but with simpler code).

Compared to the old Alembic exporter, Subdivision modifiers are now
disabled in a cleaner, more efficient way (they are disabled when
exporting with the "Apply Subdivisions" option is unchecked). Previously
the exporter would move to a new frame, disable the modifier, evaluate
the object, and enable the modifier again. This is now done before
exporting starts, and modifiers are only restored when exporting ends.

Some issues with the old Alembic exporter that have NOT been fixed in
this patch:
- Exporting NURBS patches and curves (see T49114 for example).
- Exporting flattened hierarchy in combination with dupli-objects. This
  seems to be broken in the old Alembic exporter as well, but nobody
  reported this yet.

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

Reviewed By: Sergey
2020-06-30 11:38:46 +02:00
a2b7c84ae8 Cleanup: unused arguments 2020-06-30 19:35:32 +10:00
7860fc9539 Codesign: Wait for unsigned directory to appear
Solves problem with different order of codesign server startup and
mount of network shares: avoids exception happening when server is
started prior to the mounts are ready.
2020-06-30 11:21:00 +02:00
53799d3ed2 Codesign: CLeanup, redundant semicolon 2020-06-30 11:20:37 +02:00
4176adaf96 Fix T78455: Failed assert when opening a viewport panel
Mistake from 1fa40c9f8a.
2020-06-30 10:47:49 +02:00
55ae55af66 Cleanup: remove unnecessary namespace specifiers 2020-06-30 10:35:50 +02:00
5d2005cbb5 UI: Add shortcuts for grease pencil modifier panels
See rB1fa40c9f8a81 for more details. The implementation is the same.
The only difference to the mesh modifier  commit is a slight rework of
edit_modifier_invoke_properties in order to pass through to check for
other keymap items with the same shortcut.
2020-06-29 21:04:45 -04:00
Adrian Newton
1d29822fa9 UI: Alphabetize grease pencil modifier list
The Texture Mapping Modifier was out of place

Differential Revision: https://developer.blender.org/D7474
2020-06-29 19:47:38 -04:00
062a843bfb EEVEE: Fix undefined behavior when using BSDF nodes inside volume shaders
This should fix T76171 Eevee bsdf shaders glitches
2020-06-30 01:32:00 +02:00
Adrian Newton
f28e59bd74 UI: Use single column for cycles ray visibility checkboxes
Differential Revision: https://developer.blender.org/D7612
2020-06-29 17:12:19 -04:00
b29fd7bab8 GPencil: Cleanup - Replace gp_ prefix with gpencil_
This was missing in previous cleanup commits.
2020-06-29 22:37:11 +02:00
421ac266d0 UI: Tweak Cache File Template Layout
The template was disorganized and didn't fit with the new layout style.

|          Old         |         New          |
| {F8641166 size=full} | {F8641167 size=full} |

Differential Revision: https://developer.blender.org/D8113
2020-06-29 16:36:19 -04:00
a71d3bd2df UI: Don't show modifier operation reports on button press
The reports should only show when using shortcuts.
2020-06-29 15:06:13 -04:00
1fa40c9f8a UI: Add shortcuts for modifier panels
The shortcuts act on the modifier with its panel under the mouse.
The following shortcuts are enabled by default:
  - Remove modifier: X, Delete
  - Apply modifier: Ctrl A
  - Duplicate modifier: Shift D
More shortcuts can be added in the keymap.

Each panel can now store a custom data RNA pointer, and a new
function is added to get the custom data for the panel under the
cursor. This custom data could be used to refactor the "List Panel
System" to generalize it and integrate it further with RNA.

The same functionality will be added  in further commits where it
applies to constraints, grease pencil modifiers, and effects.

Differential Revision: https://developer.blender.org/D8031
2020-06-29 15:00:25 -04:00
4f8a881715 Fix T78444: Duplicate "From Radius" in Cast Modifier UI
This button was meant to be "Use Transform"
2020-06-29 14:41:46 -04:00
5d31ef0820 Remove Threaded Sculpt option
Threaded Sculpt is now always enabled by default. If it causes
performance problems compared single threaded sculpt it should be
considered a bug.

Reviewed By: sergey

Maniphest Tasks: T77638

Differential Revision: https://developer.blender.org/D7960
2020-06-29 18:20:09 +02:00
3aced11d79 Nodes: rename node_socket.c to node_socket.cc
I have to add some C++ code in callbacks for socket types
for the new particle system.
2020-06-29 17:36:21 +02:00
bcf49d13e5 Fix compile error on Apple Clang
Needs to compile with `CMAKE_OSX_DEPLOYMENT_TARGET` of 10.14 at least to
have `std::optional<>::value()` available. So we have to increase the
minimum required compiler version, but that requires more changes. Just
fix the build error for now.
2020-06-29 17:28:37 +02:00
937d89afba UI: Show library status icons in search menus, rather than letter prefix
Rather than a `L` (linked), `O` (overridden) or `M` (missing) prefix for the
name, show the existing library status icons. See D7999 for screenshots.

Note that when using preview icons, or if the search menu contains items with
own icons (e.g. brush icons), we still fallback to the prefix solution.

Zero or fake user is still indicated with a prefix.

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

Reviewed by: Bastien Montagne, William Reynish
2020-06-29 17:28:37 +02:00
5024c54271 RNA: properly tag 'embedded' ID pointers as owned.
This is important at several level, mainly for overrides currently.

Note that this also includes shape keys, since from RNA point of view
those are also 'embedded' (they are not editable, not linkable, ...).
2020-06-29 17:28:04 +02:00
583cfe2596 LibOverride: ignore all data arrays of meshes.
Those are not overridable, and comparing them is... costly.
2020-06-29 17:28:04 +02:00
28f4e5cd6b RNA: Add a way to prevent automatic addition of 'no ownership' flag for ID pointer properties.
Since makesrna runs after all properties have been defined, we have to
remember with a new internal flag when we explicitely disable the
'PROP_PTR_NO_OWNERSHIP' flag for a property.

Otherwise there was no way to do so for ID pointer properties...
2020-06-29 17:28:04 +02:00
febb2351ad Fix ShapeKeys not being deleted together with their owner ID.
Consistency with e.g. copying (copying a mesh also duplicates its
shapekey typically).

Baby step towards getting rid of this horrible ID, some day...

Note that for now we only do that when taking BMain into account, fancy
code dealing with non-main IDs and such has to deal with those itself.
2020-06-29 17:28:04 +02:00
dcdffe719f Fix ID_swap not keeping original recalc flags.
Note that we might be missing more things there still, maybe some tags
e.g. should also be swapped?
2020-06-29 17:28:04 +02:00
b723d38812 Add utils to remove an ID from the relations runtime data in Main. 2020-06-29 17:28:04 +02:00
cff688ce7b Cleanup: make some type casts explicit
Doing this so that I turn this into a .cc file.
2020-06-29 17:27:03 +02:00
bf87df3485 Fix T78323: Enable Unified and Secondary colors for Scultp Vertex Colors
The report does not include any file, but probably that file is using the
settings for unified colors, which are currently not available in the UI,
so it always paints black. This enables unified colors and secondary
colors for sculpt vertex colors, so it should solve that issue.

Unified color does not make much sense now as the Paint tool is the only
one that has paint capabilities, but it will do in the future when
sculpt and paint at the same time is enabled and the paint capability is
added to more tools.

Reviewed By: sergey

Maniphest Tasks: T78323

Differential Revision: https://developer.blender.org/D8136
2020-06-29 17:25:27 +02:00
3118636f81 Fix Smear Tool too weak on high poly meshes
The defaults for the Smear tool were making it too weak in high poly
meshes, specially the alpha/pressure option enabled by default. Now this
option is disabled, it has a linear pressure curve and less spacing.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8134
2020-06-29 17:23:43 +02:00
9c29803255 Transform: Draw edge considered in the slide value
Useful for identifying how the value is used and which edge
is considered in the snap.
2020-06-29 12:18:59 -03:00
7f1fd1818a Fix T77946: Problem snapping with "Project onto Self" on a curve with generated geometry 2020-06-29 11:38:35 -03:00
164a49f047 GPencil: Cleanup function names replace gp_ by gpencil_ prefix (cont) 2020-06-29 15:47:49 +02:00
a351eb0726 GPencil: Cleanup function names replace gp_ by gpencil_ prefix 2020-06-29 15:47:43 +02:00
399dbb1aa3 GPencil: Cleanup - Rename some functions from gp_ to gpencil_ 2020-06-29 15:47:38 +02:00
1cda374906 GPencil: Cleanup - Rename annotation function to new prefix
These functions were using the old gpencil or gp prefix.
2020-06-29 15:47:24 +02:00
13e2337da7 Fix T78361: Crash When Modelling
Forgot to free the tangent layer for bmesh in the drawing code.
2020-06-29 15:38:17 +02:00
cb5bfb32ba Depsgraph: introduce blender::deg namespace
Reviewers: sergey

Differential Revision: https://developer.blender.org/D8150
2020-06-29 15:21:30 +02:00
81fb08ad57 Fix T74290 Face Dots in front (X-ray) Visual Glitch
This is not likely to be the silver bullet but it fix the common case.
2020-06-29 15:02:29 +02:00
76e252ead3 Cleanup: use blender::bke namespace in simulation.cc 2020-06-29 14:47:00 +02:00
85cde12bff Cleanup: reduce code indentation and simplify some code flow 2020-06-29 09:33:57 -03:00
2476c47d75 VSE: Fix type mismatch introduced in rB8bcfa0d1fb9f
Pass `IMB_Proxy_Size` to `seq_can_use_proxy` and remove duplicate check.
2020-06-29 14:32:00 +02:00
18bff53c99 BLI: remove blender::Optional in favor of std::optional
`std::optional` can be used now, because we switched to C++17.
2020-06-29 14:30:06 +02:00
4fc5233467 Fix T78401: Convert Mesh to Grease Pencil with empty material slot crashes
Also create the 'simple fill' in case there are only empty material
slots.

Maniphest Tasks: T78401

Differential Revision: https://developer.blender.org/D8151
2020-06-29 14:23:10 +02:00
9feb0d5f2e Fix T74220 Mantaflow Color Mapping not ignoring alpha value
And also remove some sRGB hack.
2020-06-29 14:19:52 +02:00
bd6cc282d2 Fix T61573 GPencil: Annotation thickness doesn't work with on OSX
This fixes the issue by using the polyline shader but this does not gives
the best results.

A better way would be to have a dedicated shader for the lines to avoid
the line break at every angle change.
2020-06-29 14:19:52 +02:00
Stefan Werner
0d2e628964 Build: Point ISPC explicitly to the location of LLVM libraries.
Sometimes the ISPC build could pick up the system LLVM librareis
instead of the ones in the Blender lib directory.
2020-06-29 14:06:00 +02:00
9afad1de44 Fix compiler warning for deprecated variable use 2020-06-29 13:13:03 +02:00
8e494f7a45 Cleanup: minor change missed last commit 2020-06-29 21:03:42 +10:00
5a6145f32c Cleanup: use designated initializes for mesh extract structs
Better readability and allows adding new struct members without
adding empty slots to every 'MeshExtract' struct.
2020-06-29 20:52:19 +10:00
38c9deeb5a Cleanup: use std::make_unique instead of blender::make_unique
This is possible, because we use C++17 now.
2020-06-29 12:35:27 +02:00
2def6f5568 Fix T78415: Particle Edit mode Add brush with a radius > 181px crashes
Caused by short overflow, change to int instead.

Maniphest Tasks: T78415

Differential Revision: https://developer.blender.org/D8148
2020-06-29 12:03:39 +02:00
784911a4a0 Cleanup: rename namespace DotExport to dot 2020-06-29 11:53:17 +02:00
b51d6e8012 Cleanup: Use blender namespace in blenkernel 2020-06-29 11:48:22 +02:00
Jeroen Bakker
0baa000b85 Fix T73892: EEVEE Viewport Render Ignores Render As Wire
In the viewport an object can be set to be displayed as wire. When
rendering the viewport this setting is ignored and follows the
path or doing a final render. This patch will add an exception
when rendering a viewport render.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8043
2020-06-29 08:19:14 +02:00
3b630bd563 Fix T78229: Playhead not refreshing when area is maximized
No other areas were tagged for redraw.
2020-06-29 08:13:48 +02:00
41bfdeaa53 Fix T78176: Sequencer renders playhead line twice 2020-06-29 07:37:40 +02:00
b21ba5e579 GPencil: Cleanup - replace loop with LISTBASE_FOREACH 2020-06-28 17:13:10 +02:00
3bdfd8c916 Fix T78353: GPencil: Make Circle select only select points inside circle
Now, instead of select the section of the stroke that is below circle, only the points inside circle are selected.

Also fixed a bug when segment selection mode is enabled.

Differential Revision: https://developer.blender.org/D8141
2020-06-28 16:51:28 +02:00
Tuomo Keskitalo
fa2c7709ff Deps Builder: Fix OSL build error.
When there is no system python OSL will fail to build the documentation.
Given we don't ship the documentation, this is safe to disable.

Originally part of D8123
2020-06-28 08:00:28 -06:00
6d8b6aec18 Fix T74024 Faces missing, weird faces added
Workaround by adding a special case for that driver in gpu_extensions.c
2020-06-28 15:51:15 +02:00
Ankit
340130719f Use const in nodeFindSocket
Since the function only iterates over the input members,
and matches their identifiers, `bNode *`can be `const`.

All other usages of the `nodeFindSocket` use it with
other functions that modify the node. (e.g.: ``nodeAddLink` )
But an exporter needs the node to be a `const`, so this
creates unnecessary and slightly unsafe design changes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D8142
2020-06-28 15:27:29 +05:30
df8847de6d Fix T77549 GPUTexture: Crash caused by NULL parameter to glBindTextures...
... or glBindSamplers.
2020-06-28 01:44:17 +02:00
59d2dd2237 UI: Remove duplicate modifier error message
Thanks to J. Fran Matheu for pointing this out.
2020-06-27 17:56:29 -04:00
4ea92f775e Fix compile error in recent commit
This was introduced in rBd7b10e5b740fe2.
2020-06-27 21:07:20 +02:00
ff82049642 Functions: add MutableAttributesRef data structure
This will be used to reference the content of a CustomData structure
in C++ code, that does not need to know who owns the data but only
works with it.
2020-06-27 20:58:35 +02:00
e91d581167 Fix T78259: Proportional editing does not work in particle editing
And better identify what is bool and what is flag in the
proportional edit properties.
2020-06-27 14:19:59 -03:00
a55eac5107 UI: Better Grouping of FFmpeg audio settings
Some audio render settings were hidden in the scene properties. These 
settomgs belong in the render properties as they affect the output when 
using ffmpeg video.

Fixes T49241

Differential Revision: https://developer.blender.org/D8137
2020-06-27 12:00:38 -04:00
9f5fae1f2c Revert "Fix T78259: Proportional editing does not work in particle editing"
This reverts commit 5c48592ccd.
Ii introduced a stupid error.

Fix T78352
2020-06-27 11:13:02 -03:00
d7b10e5b74 Fix T78337: Fix crash when use GPencil merge without materials
If the object hadn't material, the index of material was negative.
2020-06-27 15:59:38 +02:00
2350159101 Cleanup: make it easier to check if a CPPType is a specific compile time type 2020-06-27 13:28:46 +02:00
563670ff9e Fix T78336: Gpencil selection unstable
The selection with the tweak tool was inprecise because it was using the bounding box and if the point was in a straight line in the border or in the corners it was very hard to select.

For this tool is better don't use the bounding box check.
2020-06-27 10:55:33 +02:00
fec2b2a809 Palettes: Remove threshold parameter when extract from images
Using a number greater than 1 produce a huge number of entries in the palette because any small variation in the color create a new entry.

Remove the threshold reduce the precision of the color extracted, but always is better than having a palette with thounsands of colors.

Related to T78317

Still pending the memory crash when it's impossible to allocate memory for the palette in the popover, but with this change I don't think we get this error again.
2020-06-27 10:40:37 +02:00
4b96f47831 Docs: correct invalid doxygen params & references 2020-06-27 15:43:20 +10:00
c1c5dff7c0 Doc: correct bpy.msgbus arguments 2020-06-27 13:48:18 +10:00
b7b57e7155 PyDoc: Update Python Package Requirements 2020-06-26 13:24:53 -04:00
daa815d7fc UI: Use term 'Blend Mode' 2020-06-26 13:24:53 -04:00
84e1e0cf95 Fix T78170: Mantaflow Crash | Whitewater Particles Baking
Fixed issue in the upstream Mantaflow repository.
2020-06-26 18:29:43 +02:00
fb68a30af6 Fix crash compiling Cycles OpenCL, after recent TBB changes 2020-06-26 17:44:24 +02:00
9c1d85117c Cleanup: Fix strict compiler warning about variable shadowing
Thanks Howard for double-checking!
2020-06-26 17:29:50 +02:00
06e24f6c91 Fix sample color operator not updating the color in the UI
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8110
2020-06-26 17:20:12 +02:00
4817426b3e Fix Color Filter not updating during modal operator
The code for tagging the updates was wrong

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8109
2020-06-26 17:18:10 +02:00
0c98bb75cb Fix Edit Voxel Size label rotation and scale in rotated objects
Previously, the text rotation was always calculated in object space, so
the text rotation always had the object rotation applied. Now the
rotation is calculated in world space, so it always aligns correctly to
the view. Same applies to text scale not taking into account the object
position.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8068
2020-06-26 17:17:00 +02:00
5c48592ccd Fix T78259: Proportional editing does not work in particle editing
This is a long-standing bug, possibly proportional editing never worked
in particle mode.

Some parameter definitions in the transform code are scattered and
sometimes duplicated.

Proportional editing is a parameter that depends only on the Convert
type and not `spacetype`, `CTX_` or `obedit_type`.
2020-06-26 12:03:04 -03:00
e6e67da4ea Fix T78129: No audio playback with sound strip pasted to a new scene
Add DEG_relations_tag_update(bmain).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8130
2020-06-26 17:00:47 +02:00
4006cd2d2c Refactor: use new api for expand in blenloader
This is part of T76372.
2020-06-26 16:53:10 +02:00
9b4e621db0 Fix T77410: Effects doesn't update when Offset property is set
Enabling offset property caused strip to produce `SEQ_CACHE_STORE_RAW`
type image, which is kept in temp cache and is not invalidated.

Change update functions for all properties of effect strips that affect image
to `rna_Sequence_invalidate_raw_update`.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8132
2020-06-26 16:30:03 +02:00
26b428186a Fix T78295: reload scripts disables Cycles render passes in the compositor
Don't auto update render passes in nodes when unregistering render passes or
quitting Blender, this should only happen on explicit user action to change the
engine or passes.
2020-06-26 16:18:46 +02:00
d10990af79 Refactor: use new api for lib linking id properties 2020-06-26 16:04:09 +02:00
5f4a66c0e8 Fix T78049: Wrong icon for add cone tool 2020-06-26 09:53:27 -04:00
d33e715259 Fix T77669: Copy-pasting strip twice crashes Blender
In rBeaee2b411935 I removed BKE_sequencer_base_clipboard_pointers_store from
paste function, because I wanted pasted strip to always reference copied
strip, not recently pasted one. This worked well with ordinary strips, but not
if they reference ID.

Add back BKE_sequencer_base_clipboard_pointers_store call.

I thought that always referencing original strip would be more correct approach,
but it doesn't matter now. Referencing recently pasted seems to be cleanest way
to do this.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8129
2020-06-26 15:51:08 +02:00
8bcfa0d1fb Fix detecting proxy images.
Pass is_proxy_image to functions where images are loaded instead of comparing
image size to render size.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8128
2020-06-26 15:51:08 +02:00
f26d7268bf Silence warning introduced in f7f3b2d318
Call function `BKE_scene_multiview_view_prefix_get` to ensure ext is not
NULL.

This already should happen in `seq_image_strip_is_multiview_render` though.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8081
2020-06-26 15:51:08 +02:00
ea4fa8abb0 Refactor: use new api for lib linking gpencil, palette, key, simulation, ipo and library 2020-06-26 15:44:56 +02:00
14e313bbb2 Refactor: use new api for lib linking hair, pointclout, volume, material, texture and image 2020-06-26 15:39:04 +02:00
26d0fb3aef Fix T78269: Mirror modifier lost UV offset only
Also fixed an issue with a decorator in the same subpanel
2020-06-26 09:37:50 -04:00
96d657cb84 Refactor: use new api for lib linking curve, mesh, cachefiles, armature and vfont 2020-06-26 15:30:43 +02:00
8b070b8a71 Fix T78199: reload scripts error when icon is used multiple times in toolbar 2020-06-26 15:26:51 +02:00
65f07a39b5 Refactor: use new api for lib linking sound, text, camera, light, latt and mball 2020-06-26 15:24:20 +02:00
9ec6b69ed1 Refactor: use new api for lib linking movieclip, world, lightprobe, speaker, paint curve and brush 2020-06-26 15:05:25 +02:00
1ce2457551 Refactor: use new api for lib linking linestyle, object, nodetree and action 2020-06-26 14:52:57 +02:00
0e75aa44fb Fix T78304: Scaling without a constraint axis shows wrong parameters in Adjust Last operator panel
Caused by {rB600fd1c6f0ed}
2020-06-26 09:14:51 -03:00
25eb0c9cf4 Fix T78151: Vertex/Edge Slide after enabling 'Even' doesn't cancel properly
Problem introduced by rBcf42721f
2020-06-26 09:14:51 -03:00
ede6e739dd Refactor: use new api for lib linking collection, scene and workspaces 2020-06-26 13:56:27 +02:00
e707ed43ef Build: show helpful error when accidentally using GNUMakefile on Windows 2020-06-26 11:55:34 +02:00
e1da4f09fc Fixed typo in previous commit (UV fix); had nonsensical self-test. 2020-06-26 07:35:50 -04:00
8b119a5524 Fix T76996: Don't allow baking when domain is not in object mode
This does not work, because the fluid modifier is not called when the
object is e.g. in edit mode. Another possible fix would be to switch
to object mode when baking starts automatically. However, I think it
is reasonable to simply not allow baking while the domain is in edit mode.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7848
2020-06-26 13:29:15 +02:00
da2e71be2f Fix T78310: tweak layout in denoising panel to have more spacing 2020-06-26 13:19:34 +02:00
74c49492c2 Cycles: add experimental preference to replace magic debug value 256
Previously you'd have to run with --debug-value 256, now just make it
a preference so the Debug panel can be always available for developers.
2020-06-26 13:19:34 +02:00
d865ad59fc Cleanup: Depsgraph, remove unused Base * parameter
The `Base *` parameter of `DepsgraphRelationBuilder::build_object()` was
made redundant by c7694185c9. This commit actually removes it.

No functional changes.
2020-06-26 12:56:33 +02:00
e3a420c477 Fix T76199 Bevel materials "bleed" over faces.
When there is an odd number of segments, bevel has an ambiguous
choice as to which side face to use to copy face attributes from
and to use for UV (and other loops that have math function) interpolation.
We used to make choice arbitrarily, which led to visually inconsistent
results. Now there is tie-breaking code, face with lexicographic lowest
value in vector with these elements:
  (1) connected component (in math-layer space) id
  (2) selected (0) vs unselected (1)
  (3) material index
  (4,5,6): z,x,y components of face center, in that order.
2020-06-26 06:43:01 -04:00
c7694185c9 Fix T78071: Drivers reading object visibility not updating automatically
A driver reading `Object.hide_viewport` would break when that object was
hidden. Hidden objects don't have the `OBJECT_BASE_FLAGS` node in the
depsgraph, but that node was required for the driver to work.

Now the `OBJECT_FROM_LAYER` component (which optionally contains the
`OBJECT_FROM_LAYER` node) has explicit `ENTRY` and `EXIT` nodes, which
are used for relations with other components. These relations now remain
valid, even when the `OBJECT_FROM_LAYER` node is absent.

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

Reviewed By: sergey
2020-06-26 12:34:38 +02:00
2a72421cfb Fix error when filtering in Outliner "Blender File" mode with libraries
Steps to reproduce were:
* Load factory settings
* Link any library
* Change to "Blender File" display mode in Outliner
* Enable filtering
* -> Assert fails

This may have had further side-effects for linked IDs.
Checked with Bastien, the NULL-check seems reasonable. It was initially there
but removed in d74f9c4b7b.

Fine to backport.
2020-06-26 12:30:59 +02:00
2036b9771e Fluid: Fix typos from OpenVDB update
Some typos that were not noticed in 9951858942.
2020-06-26 11:48:02 +02:00
646ef49e19 Cleanup: use percentage formatting
`str.format` and `f-string` use was minimal.
Prefer using a single style of string formatting
unless an alternative is more widely adopted.
2020-06-26 12:33:19 +10:00
2db4a81fe4 deps: Fix build issue with USD on windows.
When doing a release build the TBB debug libs are not
set which was causing an error during the configure
phase of USD, so always set them even if not used.
2020-06-25 18:50:28 -06:00
c9d94c2aba Fix T71539 EEVEE: Still redraw during playback when it shouldn't 2020-06-26 01:36:44 +02:00
46815753cf Fix T78237 UI: NLA colors black and broken
This was caused by missing GL blend. This patch also fix the broken
strip appearance under timeline zoom.
2020-06-26 01:27:36 +02:00
62aa103d48 Fix for T78191: Timeline lines changing thickness
Fixes issue where lines in timeline are sometimes double-width when hovering in area.

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

Reviewed by Brecht Van Lommel
2020-06-25 14:53:59 -07:00
af4e68357b UI: Slightly simplify box style panel margin offset
A small cleanup to use fewer if statements.
2020-06-25 16:16:29 -04:00
fd0d8c710b Fix T77878: Hard minimum for voxel size of the remesh modifier
This patch fixes T77878 in the same way that T72747 was fixed.
A hard minimum for the voxel size was added to avoid an arithmetics error.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8027
2020-06-25 18:42:43 +02:00
31ad8bda74 Fix T77204: Mantaflow Initial velocity bugged?
Always initialize the particle velocity of newly sampled particles to 0 if there are no initial velocities. Clearing the grid source makes sure that new particles will get a 0 velocity - and not interpolated from the associated grid.
2020-06-25 18:03:08 +02:00
Cody Winchester
2dad5a9754 Fix: Displace Modifier UV Layer UI not a pointer
The displace modifier's uv_layer property should be a pointer in the new
UI like the other modifiers use.

Differential Revision: https://developer.blender.org/D7990
2020-06-25 11:57:06 -04:00
230b9eac69 Fix T70193 Overlay: Grid floor disappears for orthographic camera
The fix is to disable the fading for in the +Z direction in this case.
2020-06-25 18:01:47 +02:00
47ff54b008 GPencil: Ensure previous brush is set when change mode
In some situations, the previous brush is not set. This usually happens with previous version files.

Related to T78155.
2020-06-25 17:13:34 +02:00
495b0eff9a Fix T77285: Incorrect Mantaflow fluid border interaction when collision is turned off
Incorrect boolean for 'open' domain borders.
2020-06-25 16:49:47 +02:00
b77fc70d13 Cleanup: Don't use "Use" in boolean names 2020-06-25 16:38:50 +02:00
dd9c0dbf5e Experimental Features: Use different "categories" for different features
Right now not all the features available there have the same level of
polishing. So I split the existing options in:

* New Features [Particles Nodes]
* Prototypes [Hair]
* Debugging [Undo]

Differential Revision: https://developer.blender.org/D8121
2020-06-25 16:33:19 +02:00
79c2581bfa Fix T78238: issue loading existing .blend files with Optix viewport denoiser
Also add additional validation to ensure the denoiser is supported before
trying to use it.
2020-06-25 15:39:10 +02:00
2b9ac1de49 Fix incorrect Python API description for bpy.data.version
Ref T76058
2020-06-25 15:39:10 +02:00
d0693c160a Revert "Fix T78071: Drivers reading object visibility not updating automatically"
This reverts commit baa0da3e69.

The commit causes some issues I didn't foresee, I'd rather take the time
to do it properly than hastily try and commit a fix for it.
2020-06-25 15:18:59 +02:00
fd5c185beb Cleanup: spelling 2020-06-25 23:14:36 +10:00
baa0da3e69 Fix T78071: Drivers reading object visibility not updating automatically
An object can be targeted by a driver that reads its `hide_viewport` or
`hide_render` property. The existence of such a driver will create a
relation between the 'sync base flags' depsgrpah node, and the datablock
containing the driver. When the object is hidden, however, it has no
base, and thus it had no 'sync base flags' depsgraph node. To support
such a driver, that depsgraph node is now always added, but for hidden
objects it will just be a no-op. If the node is not used by anything, it
will be automatically disconnected and have a negligible effect on
performance.
2020-06-25 14:33:56 +02:00
8903368490 Cycles: add support for rendering sculpt vertex colors
Ref T78041
2020-06-25 13:54:05 +02:00
d69bb06db8 Build: remove unused lapack/hidapi/mingw32 build infrastructure
Ref T76184
2020-06-25 13:15:55 +02:00
d3283ef121 Build: upgrade OpenImageDenoise to 1.2.1
This requires ISPC for building OpenImageDenoise, so that is now added as
a dependency as well. Blender itself does not need ISPC for building so it
is not included as part of the precompiled libraries.

Differential Revision: https://developer.blender.org/D7641
2020-06-25 13:00:58 +02:00
6431b11381 Build: upgrade a few smaller Linux/macOS only libraries to latest versions
* jemalloc 5.2.1
* xml2 2.9.10
* bzip2 1.0.8
* ffi 3.3
* lzma 5.2.5
* ssl 1.1.1g
* sqlite 3.31.1

Ref T78252
2020-06-25 13:00:58 +02:00
b30df982d2 Fix viewport denoising not working if start samples higher than total samples 2020-06-25 13:00:58 +02:00
64a584b38a Python API: add methods to allow copying of constraints.
Blender has an operator to do Copy & Paste of constraints between
objects and bones, but no simple method to do that directly via
the Python API is provided. This adds a copy() method to object
and pose bone constraint collections.

Differential Revision: https://developer.blender.org/D8112
2020-06-25 12:10:18 +03:00
6b53e0adbc Better fix for crash ( with gpu only ) on render end/abort introduced in 0dced1a 2020-06-25 11:06:56 +02:00
cdb69c20e1 Cleanup: spelling 2020-06-25 16:57:52 +10:00
0c4f4de23b Edit Mesh: minor drawing optimization extracting loop data
Gives around ~5% speedup on high poly meshes.
2020-06-25 16:57:52 +10:00
bcc086584f Fix unreported 1 pixel offset when drawing with GPencil
This bug was introduced in d82c3d8615

Reviewers: @fclem
2020-06-25 08:17:23 +02:00
ec776f18ff Fix crashing on render end/abort introduced in 0dced1a 2020-06-24 23:51:57 +02:00
eace5903cb Fix T67741 EEVEE: World update don't update lightcache if one viewport uses lookdev
Just a matter of not clearing the updating flag in this case.
2020-06-24 22:12:09 +02:00
2ad8e16c2d Fix T78215 EEVEE: incorrect Render Passes results when using motion blur
This was caused by a missing DRWPass initialization.

Now we create the passes for every timestep but avoid clearing the
buffer after the first sample.
2020-06-24 21:34:29 +02:00
0dced1af34 Fix T78149: Cycles memory leak rendering animation with Embree 2020-06-24 18:48:16 +02:00
b468023aa1 VR: Properly support outputting sRGB swapchain buffers
Latest SteamVR OpenXR updates brought OpenGL support, but only with sRGB
buffers. I think for DirectX it's the same now.
It's not a big issue for us to use sRGB buffers, so that's what I will
do for now. That way we shouldn't need hardcoded exceptions for specific
runtimes that don't transform linear buffers correctly.
2020-06-24 18:42:53 +02:00
5cfbc722d0 Fix T78047: Fix failing denoiser tests on windows
When we switched to MSVC2019 and C++17 we seemingly
managed to trigger a code-gen bug with MSVC in the
AVX code-path.

This change works around the issue by (hopefully
temporary) disabling the optimizer for the fast_exp2f4
function, given it is only used in a single pass
of the denoiser and nowhere else, this is luckily
not as bad as it could have been.

Once the compiler is fixed or a different fix is
available we'll have to revisit this.

Details and link to the repro posted to MS is
available in T78047
2020-06-24 10:42:00 -06:00
c2ab069dfc Fluid: Use OpenVDB as the default cache format for liquids too
With the updated OpenVDB setup, it is now perfectly fine to use OpenVDB for liquid domains.
2020-06-24 18:38:56 +02:00
ac0852cea0 Fluid: Fix OpenVDB compiler warnings
Kudos to brecht for noticing the issue
2020-06-24 18:36:42 +02:00
ba380fc0bf Fix T78213: Windows 10 Build Errors: Extern_Manaflow error messages
Kudos to LazyDodo for figuring this out
2020-06-24 18:01:34 +02:00
baff05ad1c UI: Add Free Handle Types to CurveProfile Widget
Under the hood the CurveProfile widget (used for bevel custom profiles)
uses a bezier curve, but right now though it only supports two of the
bezier curve handle types, vector and auto. This patch adds support for
free handles and adds all of the logic for editing them.

This is the first step to the ability to import and export curve objects
in the widget.

There's some code cleanup in curveprofile.c. Movement for handles and
control points is abstracted to functions there rather than happening
in interface_handlers.c.

An "Apply Preset" button is also added, which solves a confusing issue
where you apply a preset, then change the number of samples and the
preset doesn't change. The button makes it clear that the preset needs
to be reapplied.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D6470
2020-06-24 11:50:01 -04:00
ec7510b458 Fix T67319 DRW: Large objects gets incorrectly culled
To avoid this we just bypass culling if the object is too big to avoid
float precision issues.
2020-06-24 17:44:57 +02:00
560a73610b Fix artifact in Clay Strips when producing large deformations
The clay strips brush tip tests distances against a cube with beveled Z
aligned edges. This cube was positioned with its center in the surface
of the mesh, so when producing large deformation, some vertices that
should be deformed were positioned further than the cube's Z dimension,
so they were left behind, producing artifacts.
This displaces and deforms the local space to position the brush tip
cube (now a prism) towards the deformation direction, so more vertices
can be included, removing most of these artifacts.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8004
2020-06-24 17:29:58 +02:00
255638d223 Fix Surface Smooth not taking the sculpt mask into account
The sculpt mask was hardcoded to 0.0

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8071
2020-06-24 17:28:51 +02:00
2b522e3345 Fix T78188: Sculpt mask glitching after using sculpt vertex colors
The face sets color copy to the GPU was done outside of the loop,
probably after a merge error in a rebase.

Also, the default color was initialized using the wrong type.

Reviewed By: sergey

Maniphest Tasks: T78188

Differential Revision: https://developer.blender.org/D8106
2020-06-24 17:27:53 +02:00
0f7851ee79 Fix T78192: Draw Face Sets tool not updating the viewport color
The draw face set tool always needs to redraw the nodes, but it only
needs the full update when in smooth mode because it moves the vertices.

Reviewed By: sergey

Maniphest Tasks: T78192

Differential Revision: https://developer.blender.org/D8108
2020-06-24 17:27:01 +02:00
b4e1571d0b Cleanup: compiler warnings 2020-06-24 17:25:44 +02:00
c78b831e69 Fix T78073 EEVEE: new motion blur and overscan produce wrong render
This was caused by the override viewport size not being maintained after
DRW_cache_restart().

Also this fixes issue with the inv_size not being updated correctly.
2020-06-24 17:22:31 +02:00
e761d0bdc9 Fix T78080: group node has incorrect sockets after changing group
It was only checking for the identifier, but the type has to be equivalent as well.

Reviewers: mano-wii, brecht

Differential Revision: https://developer.blender.org/D8101
2020-06-24 16:53:46 +02:00
ff0df7c546 UI: Add Extrude Manifold Icon
Differential Revision: https://developer.blender.org/D8016
2020-06-24 11:32:06 -03:00
9951858942 Fluid: Improved OpenVDB support for fluid caches
This commit makes uses of the new OpenVDB IO in Mantaflow (introduced in 781f783a66ac).

From now on, fluid cache files in OpenVDB format will contain a list of grids per frame (before: one .vdb file per grid per frame). Besides regular grids, particle systems are also stored using OpenVDBs PointGrid data structures.

All older cache formats will remain fully functional:
- Uni caches (.uni) files are still available from the UI and can be used as before
- Raw caches (.raw) are no longer available from the UI, but loading them is still possible
- Old OpenVDB caches (one .vdb per grid) can no longer be baked either, but loading them is still possible.

It is also no longer possible to choose file formats for 'Noise' and 'Particles'. Instead there are now options to set the file format for 'Volumetric' and for 'Mesh' data.

Known issues (planned to be resolved soon):
- OpenVDB files are currently not taking into consideration the clipping value (FluidDomainSettings). Empty cells are therefore being written too. Depending on the scene, this can make file sizes unnecessarily large.
- Domains are not being exported at their world position. Instead they are always clipped to the origin.
2020-06-24 16:07:35 +02:00
9fe64948ab Fluid: Updated Mantaflow source with latest OpenVDB changes
This updated set of Mantaflow files includes the improved  OpenVDB file IO. With this update it is finally possible to store multiple grids per file. It is also possible to save particle systems and particle data to OpenVDB files.
2020-06-24 16:07:35 +02:00
6fec2e4db0 Cleanup: fix typo in denoiser menu 2020-06-24 16:01:47 +02:00
d645525dae Fix missing WITH_CYCLES_EMBREE in the build configurations 2020-06-24 15:51:08 +02:00
3cfb687b55 Cleanup: make it possible to include util_tbb.h in any order 2020-06-24 15:28:00 +02:00
23b5e10dbd Fix T78112: VSE Sequencer/Preview crash after fullscreen
The region refresh callback wasn't called, which in the VSE ensures valid
region sizes and removes handlers of invisible regions.
2020-06-24 15:22:01 +02:00
669befdfbe Cycles: add Intel OpenImageDenoise support for viewport denoising
Compared to Optix denoise, this is usually slower since there is no GPU
acceleration. Some optimizations may still be possible, in avoid copies
to the GPU and/or denoising less often.

The main thing is that this adds viewport denoising support for computers
without an NVIDIA GPU (as long as the CPU supports SSE 4.1, which is nearly
all of them).

Ref T76259
2020-06-24 15:17:36 +02:00
0a3bde6300 Cycles: add denoising settings to the render properties
Enabling render and viewport denoising is now both done from the render
properties. View layers still can individually be enabled/disabled for
denoising and have their own denoising parameters.

Note that the denoising engine also affects how denoising data passes are
output even if no denoising happens on the render itself, to make the passes
compatible with the engine.

This includes internal refactoring for how denoising parameters are passed
along, trying to avoid code duplication and unclear naming.

Ref T76259
2020-06-24 15:17:36 +02:00
88157b9efb Python API: support integer default for bpy.props.EnumProperty
This must match the specified number in enum items, and is supported for both
static and dynamic enums. Previously dynamic enums did not support a default
value at all.
2020-06-24 15:17:36 +02:00
073ab4703e Fix build error on Windows after recent changes 2020-06-24 15:17:36 +02:00
756e664e4f Fix T77913: Incorrect handling of negative-scale bit in DRWResourceHandle
Reviewers: fclem

Differential Revision: https://developer.blender.org/D8103
2020-06-24 14:42:46 +02:00
e59712b7c8 Sculpt: rename default vertex color layer name from Col to Color
No need for abbreviation here, and helps avoid conflicts with old vertex
color layers.

Ref T76659
2020-06-24 14:32:06 +02:00
e389c05410 Cleanup: move TBB includes into own header 2020-06-24 14:32:06 +02:00
a6c59863d3 EEVEE: Fix crash when using motion blur without postfx blur 2020-06-24 14:27:47 +02:00
dd328be0f0 Fix memory leak calculating deform modifiers in edit-mode
This bug goes back to 2.80 but doesn't seem to have been reported.
2020-06-24 22:13:27 +10:00
074929d1c5 MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE
'const' arrays couldn't use this macro with GNUC.
2020-06-24 22:13:27 +10:00
9b3dfbe651 Fix T77672 EEVEE: Reflections with reflection plane broken (regression) 2020-06-24 13:50:20 +02:00
be0622533d Fix T78190 EEVEE: Render passes broken in final render
This was caused by the step motion blur implementation.
`DRW_cache_restart` was reseting the cache and cause
`EEVEE_renderpasses_postprocess` to not work inside
`EEVEE_render_read_result`.
2020-06-24 13:23:43 +02:00
6f5a9dd8de Fix T78172: Undo crash due to IDTemplate operations missing undo push.
This should be included in 2.83 as well.
2020-06-24 12:51:08 +02:00
5c8e349c28 Cleanup: Replace GSet with Edgeset in Cloth Brush 2020-06-24 15:31:10 +10:00
d295261330 Text: add replace all operator
D8032 by @Poulpator with minor edits
2020-06-24 15:00:12 +10:00
be8f2c698e Cleanup: redundant self assignment 2020-06-24 14:30:18 +10:00
1daaac75b5 Cleanup: clang-format 2020-06-24 14:23:54 +10:00
31dd80e0de Cleanup: unused struct members 2020-06-24 14:19:25 +10:00
a9e5e58e16 Cleanup: unused functions 2020-06-24 14:19:24 +10:00
5b9bb688e7 UI: ShaderFX: Manually add X/Z labels for rim lighting
These need to be labeled manually  because offset is a #PROP_PIXEL.

Matches other changes made in rBbb4cef71eeaf36aa61187d47b8a8ae06ba55f7c0
2020-06-23 19:21:06 -04:00
49234c15e2 UI: Cycles: Use Title Case 2020-06-23 17:54:09 -04:00
c26abd1c29 Fix T66934 Overlay: "Outline Selected" overlay doesnt affect armatures
This is a really small fix. Could be included in 2.83 LTS branch.
2020-06-23 23:45:46 +02:00
b0449cac66 API Docs: Small edits to recent commit
- Revert string formatting change
- Add missing text edit
2020-06-23 17:10:07 -04:00
d82c3d8615 Fix T62961 EEVEE: Viewport refresh when hovering widgets
We now bypass EEVEE's rendering if the TAA accumulation has ended.
2020-06-23 22:59:55 +02:00
5fbbe1fca9 UI: Remove unnecessary ellipsis 2020-06-23 16:56:37 -04:00
65006bfaf4 Snapping: Snap to the origin of Light and Camera objects
I see no reason to ignore them.
This is not a limitation.
2020-06-23 16:18:01 -03:00
ede1a247d8 Fix camera snapping in camera View
The `T_CAMERA` flag was being set in the wrong place.
2020-06-23 16:14:06 -03:00
11a390e85e GPencil: Implement antialiasing parameter to Pixel FX
Related to T78153

Differential Revision: https://developer.blender.org/D8100
2020-06-23 19:20:02 +02:00
f3a8192ef7 Refactor: use new api for lib linking mask, windowmanager and screen
This is part of T76372.
2020-06-23 17:55:23 +02:00
2dd60e6c2c Fix T77830: Crash in VR session when opening material preview
Draw-manager mutex has to be set before activating OpenGL/GPU context.
Otherwise, parallel jobs (like preview rendering) may try to activate
the context from another thread.

Also: Use WM wrappers for activating/releasing OpenGL context, which
have an additional assert check.

Suggest to backport this for 2.83.1.
2020-06-23 17:28:53 +02:00
1e0426da7c Refactor: move more modifier specific code out of readfile.c 2020-06-23 17:25:44 +02:00
9ef5cc44a6 Refactor: move blenloader code of bevel modifier 2020-06-23 17:08:39 +02:00
56f9529775 Refactor: move blenloader code of curve profile to blenkernel 2020-06-23 17:08:39 +02:00
f345625ded Fix T77712: Crash on proxied rig, custom bone shape, driver targeting rig
It turns out that
`DepsgraphNodeBuilder::build_object_data_geometry(Object *object, bool
is_object_visible)` was called for the custom shape with
`is_object_visible=false` when there are drivers, and
`is_object_visible=true` when there aren't any.
2020-06-23 17:03:36 +02:00
adcb7a2ce7 Refactor: move blenloader code of surface deform modifier 2020-06-23 16:51:43 +02:00
8b59b97c10 Refactor: move more blenloader code into modifier files 2020-06-23 16:42:08 +02:00
f7bbc7cdbb Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.

This commit includes:
  - SCULPT_UNDO_COLOR for undo support in sculpt mode
  - SCULPT_UPDATE_COLOR and PBVH flags and rendering
  - Sculpt Color API functions
  - Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
  - Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
  - Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
  - Remesher reprojection in the Voxel Remehser
  - Paint Brush and Smear Brush with color smoothing in alt-smooth mode
  - Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
  - Color Filter
  - Color picker (uses S shortcut, replaces smooth)
  - Color selector in the top bar

Reviewed By: brecht

Maniphest Tasks: T72866

Differential Revision: https://developer.blender.org/D5975
2020-06-23 16:28:50 +02:00
27972c4225 UI: Don't expand bevel active tool setting 2020-06-23 10:16:28 -04:00
4284ddefab Fix mistake in bevel versioning
Use the correct modifier struct name
2020-06-23 10:07:22 -04:00
bab2b02507 Cleanup: style, raw multi-line string sphinx updater 2020-06-23 23:32:47 +10:00
6d639a606c Docs: quiet deprecation warning, add missing context members 2020-06-23 23:32:36 +10:00
Tobias Heinke
23f8ab4250 API docs: intro overhaul
- Update terminology, spelling, formatting.
- Rename screen to workspace.
- Update for 2.8 UI changes.
2020-06-23 23:13:10 +10:00
Jeroen Bakker
0aa7c11788 Fix T77803: IK Degrees of freedom drawing glitch
Forgot to update the lineOutput what resulted in that the sphere was not
rendered on all platforms.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8098
2020-06-23 14:51:15 +02:00
Jeroen Bakker
8f97a64dec Fix T77893: Crash drawmanager threading custom data
Tangent normals were temporarily saved in the original given layers but
the typeinfo wasn't updated. This lead to several issues since we
changed the threading of the mesh extraction.

This patch stores the tangent normals in a temporary custom data on the
stack this way the typemap doesn't need to be updated.

Still need to run the tests for an hour to see if it is fixed

Reviewed By: Clément Foucault, Philipp Oeser

Differential Revision: https://developer.blender.org/D8095
2020-06-23 14:33:26 +02:00
439b40e601 EEVEE: Motion Blur: Add accumulation motion blur for better precision
This revisit the render pipeline to support time slicing for better motion
blur.

We support accumulation with or without the Post-process motion blur.

If using the post-process, we reuse last step next motion data to avoid
another scene reevaluation.

This also adds support for hair motion blur which is handled in a similar
way as mesh motion blur.

The total number of samples is distributed evenly accross all timesteps to
avoid sampling weighting issues. For this reason, the sample count is
(internally) rounded up to the next multiple of the step count.

Only FX Motion BLur: {F8632258}

FX Motion Blur + 4 time steps: {F8632260}

FX Motion Blur + 32 time steps: {F8632261}

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D8079
2020-06-23 14:04:41 +02:00
Jeroen Bakker
cc3e808ab4 Animation: Only update timeline header during playback
The header of all SPACE_ACTIONs are tagged for redraw. Only when the
action editor is showing the timeline it is needed. No noticeable
performance increase. But better to save some CPU cycles.

Reviewed By: Sybren Stüvel

Differential Revision: https://developer.blender.org/D8074
2020-06-23 13:19:45 +02:00
072a224a28 Cleanup: remove some dead code 2020-06-23 12:23:46 +02:00
ef8aca65d8 Cleanup: renamed do_draw_overlay to do_draw_paintcursor
To make a better distinction with region overlay.
2020-06-23 12:07:50 +02:00
Jeroen Bakker
bbb2e0614f Performance: Draw play head as an overlay
When playing back animations a playhead is updated in all the animation editors.
The drawing of the playhead is part of the drawing of the main region
`RGN_TYPE_WINDOW` that redraws the whole region.

This change will draw the play head and window scrollers when updating the
screen. This affects the Action editor, Timeline, Graph editor, NLA editor and
Sequence editor. There is noticeable speedup when using complex animation files.

Spring 02_020_A.anim.blend fps went from 11.8 to 12.5 when showing a timeline
and a action editor on a Ryzen 1700.

* When playing back animation the markers don't jump up/down when near the
  frame. This could be added back.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D8066
2020-06-23 12:03:17 +02:00
87ceff3d1b Preferences: New experimental settings for particle system and hair
This replaces the cmake options `WITH_NEW_OBJECT_TYPES` and
`WITH_NEW_SIMULATION_TYPE` with two experimental userpref settings:

* `use_new_particle_system`: Enables the point cloud type and the simulation editor.
* `use_new_hair_type`: Only displays the add-operator in the add menu for now.

Note, in the current state you can't do anything productive with the new particle
system or the new hair type. Features will be added step by step in the upcoming
weeks and months.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8096
2020-06-23 11:30:46 +02:00
13a5b954c3 Cleanup: USD, move code from USD to blender::io::usd namespace
No functional changes.
2020-06-23 11:07:52 +02:00
309cfbceaa Transform: default to median center instead of bounds
When neither bounds or median is selected, snapping the cursor to
the selection was using bounds which often doesn't give useful results.

Resolves T78135
2020-06-23 18:35:06 +10:00
3a3708cefb Functions: Multi Function Network
A multi-function network is a graph data structure, where nodes are
multi-functions (or dummies) and links represent data flow.
New multi-functions can be derived from such a network. For that
one just has to specify two sets of sockets in the network that
represent the inputs and outputs of the new function.

It is possible to do optimizations like constant folding on this
data structure, but that is not implemented in this patch yet.

In a next step, user generated node trees are converted into a
MFNetwork, so that they can be evaluated efficiently for many particles.

This patch also includes some tests that cover the majority of the code.
However, this seems to be the kind of code that is best tested by some
.blend files. Building graph structures in code is possible, but is
not easy to understand afterwards.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8049
2020-06-23 10:16:14 +02:00
Yevgeny Makarov
c24b1c060d Fix T77743: Number pad key-map items missing from search 2020-06-23 17:55:36 +10:00
4040cb438f Cleanup: use doxy sections for BLI read/write headers
Add reference between the read/write functions too.
2020-06-23 16:38:52 +10:00
ed68fee665 Fix T78146: Crash using scroll bars
Regression in 2fdca5bd19
2020-06-23 15:22:59 +10:00
374e412813 Correct recent 'name' -> 'filepath' rename (missed Collada) 2020-06-23 14:58:38 +10:00
3f6f89a06b Cleanup: move text.c comments to the struct/flag declarations
Also update/correct some of the comments.
2020-06-23 14:09:13 +10:00
3f89322f08 Cleanup: remove Text.nlines
This isn't needed and wasn't properly updated when new-lines were added.
2020-06-23 13:48:19 +10:00
bdb49890cb Cleanup: use static sets instead of tuples 2020-06-23 13:30:21 +10:00
fd65055b69 Cleanup: A few small comment & naming changes in bevel 2020-06-22 22:41:02 -04:00
6703c7f7f1 Bevel: Refactor profile type input to use an enum
This will allow the easier addition of a constant radius mode in the
future and some changes in the UI to mirror the recent similar change
from "Only Vertices" to the "Affect" enum.
2020-06-22 22:25:55 -04:00
716a8241d3 Cleanup: rename 'name' to 'filepath' for DNA types
Using 'name' for the full path of a file reads badly,
especially when id.name is used in related code.
2020-06-23 11:29:36 +10:00
a573d7e8a1 Cleanup: rename Library.filepath to filepath_abs
Make it clear that this is the absolute path,
allow the 'name' to be renamed to 'filepath'.

Rename is safe since this is only for run-time.
2020-06-23 11:22:30 +10:00
58f3fabb97 Cleanup: unused argument 2020-06-23 09:53:11 +10:00
51bf04383a Fix T78045: CTL-ALT-S does nothing in pose mode and crashes when called from the menu 2020-06-22 19:06:24 -03:00
Jeroen Bakker
2fdca5bd19 Refactoring: View2DScrollers memory allocation
View2DScrollers used the memory manager to allocate memory. This isn't a
problem but in a upcoming change the scrollers will be drawn more often
than it used to (See {D8066}). To limit the number of allocations and
frees this patch will use the stack for allocation.

Reviewed By: Campbell Barton

Differential Revision: https://developer.blender.org/D8076
2020-06-22 21:46:04 +02:00
9335daac2a Trasnform: Support for other snapping types on Edge Slide
This completes T66426.

Since Vert Slide supports these other snapping types (since rBe2fc9a88bc),
it would be easy to miss this on Edge Slide.

So add support for Edge Slide too.
2020-06-22 15:28:38 -03:00
73d3f51c16 Fix T78136: Image editor - crash to desktop with changing the threshold for extract palette
Also fixed the same error in generate GPencil object from image.

The problem was the Render Result image hasn't  ibuf.
2020-06-22 20:06:43 +02:00
15dda0115c UI: Widget: Replace geometry by fragment shader drawing
This means all the antiailasing is done inside the fragment shader.

We use a Signed Distance Field to draw the 2D rounded boxes. This ensure
the best quality for AA.

This reduce the averge Batch for widget to 16 verts instead of ~600 and
reduce overshading a lot.

Theme Emboss alpha and tria alpha needs to be changed after this refactor.

The shadow drawing is left unchanged and still use geometry.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D7833
2020-06-22 19:57:53 +02:00
3cea42ce29 GPencil: Cleanup comments 2020-06-22 19:27:58 +02:00
9fbbd25e2a Fix T78134: GPencil interpolation crash
Need to verify active frame not NULL.
2020-06-22 19:09:11 +02:00
25d2222c30 Fix T77754: Crash after any alembic import undo in an empty scene
Thanks @mont29 for this patch.

This creates an explicit undo step after the Alembic importer has finished
running. This is necessary when the importer runs as a background job.
2020-06-22 18:10:42 +02:00
fdfe85c616 Fix: Wrong fake user icons in outliner orphan mode
The icons for toggling fake users on orphan datablocks in the outliner
were drawn as the quit and x icons instead of the fake user icon. This
changes to the correct icon, and removes the redundant "F" column.
2020-06-22 09:41:54 -06:00
bfaa41c00d UV Editor: Fix Vertex Overlay color not being color managed
Could be backported to 2.83 LTS
2020-06-22 17:31:51 +02:00
336a8f283f Fix T62917 UV editor: Edge overlay not shown when edge overlay type is Dash
Fix by changing the shader to always compute dash for uv and just change
dash size to something really big for other overlay types.
2020-06-22 17:31:51 +02:00
b175bb2503 Subdiv CCG: Add access to first grid index of a face
Is lazily-initialized array owned by the SubdivCCG. Allows to access
index of a first grid of a given face in the flat array of grids.

Currently unused, but is needed for multires bake.
2020-06-22 17:22:53 +02:00
41158a91f2 Fix (unreported) broken UI of modifiers for liboverrides.
Broken in recent refactor of modifiers UI code...
2020-06-22 16:54:30 +02:00
461ba2c74c Fix random crash in Cycles smoke volume loading
Don't access evaluated mesh data after freeing Blender depsgraph.

Potentially related to T77954.
2020-06-22 16:53:09 +02:00
4a68bf2078 Subdiv: Cleanup, remove unused code 2020-06-22 16:39:04 +02:00
c94a1f5349 Functions: add utilities that allow creating some multi-functions with less typing 2020-06-22 15:50:31 +02:00
6223385043 Functions: Various improvements to the spans and generic data structures
Most of this code is covered by unit tests.
2020-06-22 15:50:31 +02:00
7117ed9691 Fix Preferences not saved when changing translation settings 2020-06-22 15:47:05 +02:00
5726dec0e0 UI: Fix untranslated layout headings 2020-06-22 15:09:54 +02:00
6c76a782e9 UI/BPY: Make layout headings translatable from BPY
This was an oversight when layout headings were added. There's now the regular
translation context option in the Python API.
2020-06-22 15:09:54 +02:00
b0de36a5a3 Fix constraint alignment check on snap axis to plane 2020-06-22 09:53:33 -03:00
508e33842b Tools: rename 'Extrude, Dissolve and Intersect' to 'Extrude Manifold' 2020-06-22 09:20:43 -03:00
e2fc9a88bc Transform: Full snapping support for Vert Slide
Now all options for "snap to" affect the Vert Slide mode.

Reviewed By: campbellbarton

Maniphest Tasks: T66426

Differential Revision: https://developer.blender.org/D3440
2020-06-22 09:08:02 -03:00
85c6f0b472 LibOverride: Add CacheFile properties as overridable. 2020-06-22 14:03:39 +02:00
Damien Picard
961fa2251e External Player: update DJV to version 2 2020-06-22 21:34:56 +10:00
c877c3b8f6 Cleanup: remove workaround for boost 1.46
Part of D8055 by @pioverfour
2020-06-22 21:34:56 +10:00
3d570f7e1f Cleanup: remove blender 2.4 reference in animation playback 2020-06-22 21:34:56 +10:00
99436acde8 Cycles: enable Embree by default for CPU rendering
For GPU debugging purposes, it is still possible to render with the same BVH2
on the CPU using the Debug panel in the render properties.

Note that building Blender without Embree will now lead to significantly reduced
performance in CPU rendering, and a few of the Cycles regression tests will fail
due to small pixel differences.

Ref T73778

Depends on D8014

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8015
2020-06-22 13:28:01 +02:00
2c41c8e94f Cycles: internal refactoring to make thick/ribbon curve separate primitives
Also removing the curve system manager which only stored a few curve intersection
settings. These are all changes towards making shape and subdivision settings
per-object instead of per-scene, but there is more work to do here.

Ref T73778

Depends on D8013

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8014
2020-06-22 13:28:01 +02:00
207338bb58 Cycles: port curve-ray intersection from Embree for use in Cycles GPU
This keeps render results compatible for combined CPU + GPU rendering.
Peformance and quality primitives is quite different than before. There
are now two options:

* Rounded Ribbon: render hair as flat ribbon with (fake) rounded normals, for
  fast rendering. Hair curves are subdivided with a fixed number of user
  specified subdivisions.

  This gives relatively good results, especially when used with the Principled
  Hair BSDF and hair viewed from a typical distance. There are artifacts when
  viewed closed up, though this was also the case with all previous primitives
  (but different ones).

* 3D Curve: render hair as 3D curve, for accurate results when viewing hair
  close up. This automatically subdivides the curve until it is smooth.

  This gives higher quality than any of the previous primitives, but does come
  at a performance cost and is somewhat slower than our previous Thick curves.

The main problem here is performance. For CPU and OpenCL rendering performance
seems usually quite close or better for similar quality results.

However for CUDA and Optix, performance of 3D curve intersection is problematic,
with e.g. 1.45x longer render time in Koro (though there is no equivalent quality
and rounded ribbons seem fine for that scene). Any help or ideas to optimize this
are welcome.

Ref T73778

Depends on D8012

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8013
2020-06-22 13:28:01 +02:00
d1ef5146d7 Cycles: remove SIMD BVH optimizations, to be replaced by Embree
Ref T73778

Depends on D8011

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8012
2020-06-22 13:28:01 +02:00
1de0e13af6 Cycles: remove __UV__ and __INSTANCING__ as kernel options
The kernel did not work correctly when these were disabled anyway. The
optimized BVH traversal for the no instances case was also only used on
the CPU, so no longer makes sense to keep.

Ref T73778

Depends on D8010

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8011
2020-06-22 13:28:01 +02:00
fed101a7be Cycles: always perform backface culling for curve, remove option
The hair BSDFs are already designed to assume this, and disabling backface
culling would break them in some cases.

Ref T73778

Depends on D8009

Maniphest Tasks: T73778

Differential Revision: https://developer.blender.org/D8010
2020-06-22 13:28:01 +02:00
c7d940278b Cycles: remove support for rendering hair as triangle and lines
Triangles were very memory intensive. The only reason they were not removed yet
is that they gave more accurate results, but there will be an accurate 3D curve
primitive added for this.

Line rendering was always poor quality since the ends do not match up. To keep CPU
and GPU compatibility we just remove them entirely. They could be brought back if
an Embree compatible implementation is added, but it's not clear to me that there
is a use case for these that we'd consider important.

Ref T73778

Reviewers: #cycles

Subscribers:
2020-06-22 13:28:01 +02:00
e50f1ddc65 Cycles: use TBB for task pools and task scheduler
No significant performance improvement is expected, but it means we have a
single thread pool throughout Blender. And it should make adding more
parallellization in the future easier.

After previous refactoring commits this is basically a drop-in replacement.
One difference is that the task pool had a mechanism for scheduling tasks to
the front of the queue to minimize memory usage. TBB has a smarter algorithm
to balance depth-first and breadth-first scheduling of tasks and we assume that
removes the need to manually provide hints to the scheduler.

Fixes T77533
2020-06-22 13:27:37 +02:00
54e3487c9e Cleanup: remove task pool stop() and finished() 2020-06-22 13:06:47 +02:00
b10b7cdb43 Cleanup: use lambdas instead of functors for task pools, remove threadid 2020-06-22 13:06:47 +02:00
d8c2092b15 Cycles: make TBB a required library dependency, and use in a few places
Now that the rest of Blender also relies on TBB, no point in maintaining custom
code for paraller_for and thread local storage.
2020-06-22 13:06:47 +02:00
ace3268482 Cleanup: minor refactoring around DeviceTask 2020-06-22 13:06:47 +02:00
b7c34c889b Cleanup: use move semantics for task pool functions 2020-06-22 13:06:47 +02:00
f9d138be51 Cleanup: compiler warning 2020-06-22 13:06:47 +02:00
8ffb006077 Add undo step to Alembic and Collada importers...
Re T77754.
2020-06-22 13:06:16 +02:00
c309177edd Fix initialization of Edge Slide with Single Side
It was not being initialized.
Error introduced in cf42721fe2
2020-06-22 07:54:36 -03:00
ba97da21ac Transform: Simplify and rearrange mirror code
No real functional changes.
2020-06-22 07:54:36 -03:00
d6e07a7cd3 Transform: Do not compute island center when not used
No functional changes from the user's point of view.
2020-06-22 07:54:36 -03:00
5db1ae2605 Cleanup: Remove goto in transform_convert_mesh code 2020-06-22 07:54:36 -03:00
2d866d77ae Cleanup: Rearrange transform_convert_mesh into doxy sections 2020-06-22 07:54:36 -03:00
3752c44b44 GPencil: Remove Fill selection with Tweak tool and fix bug
* Fixed selection of point in multiframe mode. The point was not selected.

* Removed the fill area selection because makes the tool imprecise, and for this tool need to be precise or the selection is impossible. Now only select if it's over the point, not over the filled area.
2020-06-22 10:48:49 +02:00
566b4f126d Fix T78123: Can't remove preset with brackets in the name 2020-06-22 18:30:47 +10:00
26e5718e29 Fix T77942: Add Cube scales immediately upon creation after changing Size attribute on prior Add Cube command
Always use the default size here, since desired bounds have been set
interactively, it does not make sense to use a different size from a
previous command.

Maniphest Tasks: T77942

Differential Revision: https://developer.blender.org/D8056
2020-06-22 09:48:30 +02:00
Harley Acheson
19c7b5f45a Fix error using 'char32_t' as 'wchar_t' on windows
FONT_OT_text_insert failed on Windows.

This change was missing from D6198.
2020-06-22 17:13:36 +10:00
61fa710aa3 Fix T77536: Extrude to cursor keybinding missing
Regression in cec7db2004
2020-06-22 17:03:13 +10:00
f8c8a5c092 Fix T77607: Edit-mode shading regression 2.90
Regression in deaff945d0
2020-06-22 16:44:33 +10:00
9215b5d869 UI: report when reloading unsaved text
Address confusion from T78114.
2020-06-22 16:02:42 +10:00
56d0df51a3 Python: support building again version 3.9 (unreleased)
Resolves T78089, no functional changes.
2020-06-22 14:55:36 +10:00
f2b5f731d5 UI: Only show constaint head/tail property with subtarget 2020-06-21 10:55:16 -04:00
0de14fbe78 UI: Fix view reset when toggling subpanel expansion
The view should only reset for the ctrl-click mode that collapses
all other panels.
2020-06-21 10:47:37 -04:00
3fc5826f7c GPencil: Fix unreported missing material onion filter
This feature was removed by error during the refactor done in draw engine.

Differential Revision: https://developer.blender.org/D8082
2020-06-21 15:51:50 +02:00
91117cad0f GPencil: Change effect tooltips for new Shader operators
Instead to use ShaderFx, use Effect and also fixed some wrong cases using Modifier word.
2020-06-21 10:24:08 +02:00
b4ba27f026 UI: A few small fixes for constraint layouts
- Head / Tail was stuck on two rows. It seems there is an issue with
        headings here, which means the first property has to place its own
        label. (So for example the small button can't be first in the row.)
      - Some misalignment and decorator fixes for aligned toggles
2020-06-20 21:51:32 -04:00
a7f1c68938 Cleanup: Outliner walk select naming
No functional changes. Don't use walk_element now that the walk element
flag is removed.
2020-06-20 16:15:42 -06:00
8ce1a60262 Fix T71812: Outliner walk navigation not activating
Walk navigation used a separate flag to select the element. This is
because activation and mode toggling were connected until rB702e00f91088
cleaned up the selection logic.

Now walk navigation can activate objects and other elements without
changing modes. This also addresses renaming in the outliner which
did renaming from the active element, not the walk element.
2020-06-20 16:15:18 -06:00
2d9ab46e0b Fix T77328: Crash on undo Draw Face Sets stroke with dyntopo active
Draw Face Sets does not work in Dyntopo and the sculpt API should be
responsible for that without needing to add checks all over the code,
but it was doing an undo push of type SCULPT_UNDO_FACE_SETS which is not
supported, causing the crash.

Reviewed By: sergey

Maniphest Tasks: T77328

Differential Revision: https://developer.blender.org/D7924
2020-06-20 21:48:11 +02:00
bb58d3d8e2 GPencil: Fix unreported multiuser datablock for onion message
This is not logic after the refactor.
2020-06-20 19:54:44 +02:00
Philipp Oeser
d994391e0c Fix T77994: VSE crash adding a glow effect strip
Since rB47f98a38d0f8 not all 3 effect inputs were assigned anymore. Their
ImBuf's rect was accessed though in do_glow_effect (even though unused in
the following dedicated functions).

Just pass NULL here instead.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D8064
2020-06-20 06:49:02 +02:00
73ffb3e067 Cleanup: use const args for property name/description access 2020-06-20 13:50:12 +10:00
d7152244f8 Fix T54112: curve.splines.new() ignores Curve.resolution_u/v 2020-06-20 13:17:40 +10:00
92c5b12df6 Fix T75074: Select Hierarchy error, when object is not on view layer 2020-06-20 12:50:24 +10:00
874af5301c Cleanup: Fix build-warning with MSVC
Draco sets CMAKE_CXX_STANDARD to 14, given we
set the c++ standard in the root level CMakeLists.txt
to c++17 this generated build warnings.

Given the rootlevel one is the one we want we can
safely remove this line in dracos cmakelists
2020-06-19 17:28:42 -06:00
466e716495 Bevel: add new 'Absolute' mode for interpreting 'amount' value.
This mode is like Percent, but measures absolute distance along
adjacent edges instead of a percentage.
So, for example, if you use this mode with 2 segments and profile=1,
you will see the length that the bevel moves along unbeveled edges
between beveled ones will match the value specified.
Many users seem to expect this behavior, even though it means the
bevel width is uneven, so this option is for them.
2020-06-19 17:56:01 -04:00
ab72cd2fc1 Cleanup: Spelling 2020-06-19 16:11:15 -04:00
a089286d7b UI: Fix all constraint subpanels empty
Silly typo in earlier fix
2020-06-19 16:07:20 -04:00
bb4cef71ee UI: ShaderFx Drag and Drop, Layout Updates
This patch implements the list panel system D7490 for grease pencil
shader effects. It also moves their drawing to a callback in
ShaderFxTypeInfo in line with the extensible architecture refactoring
goal T75724.

The implementation is basically exactly the same as for the modifier
patch (9b099c8612).

Thanks to Matias Mendiola (@mendio) for helping to develop the layout
changes.

Differential Revision: https://developer.blender.org/D7985
2020-06-19 15:07:13 -04:00
702e00f910 Outliner: Selection cleanup
No functional changes. The outliner selection operators shared many
different functions for selection, activation, mode toggling, and other
actions, but the code paths were not always clear, making any changes
difficult.

This cleans up the code and uses outliner_item_select() as the base
function for selection, activation, mode toggling between the different
selection operators. It also prepares for future features and fixes.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D5817
2020-06-19 12:43:01 -06:00
ec963d9d7d UI: Grease Pencil Modifier Drag and Drop, Layout Changes
This patch implements the list panel system D7490 for grease pencil
modifiers. It also moves their drawing to a callback in
GpencilModifierTypeInfo in line with the extensible architecture
refactoring goal T75724.

This also adds the "set_error" function for grease pencil modifiers,
which hadn't been copied from mesh modifiers yet.

The implementation is basically exactly the same as for the modifier
patch (9b099c8612).

Thanks to Matias Mendiola (mendio) for providing mockups for many
of the layout changes.

Differential Revision: https://developer.blender.org/D7978
2020-06-19 14:42:08 -04:00
fb7d8e2f4b UI: Fix check for constraint panel default expansion 2020-06-19 14:19:41 -04:00
0ded6f5525 Fix: Crash when closing window while Outliner shows screens
Steps to reproduce were:
* From factory settings, change Outliner Display Mode to "Blender File"
* Open "Screens" item, make sure all listed screens are visible
* Open Preference window, close it
* Mouse hover the outliner -> crash

Fix is to force an Outliner tree rebuild when closing screens.
2020-06-19 20:14:04 +02:00
254f164b27 UI: Minor optimization to Outliner lookup for hovered element
The lookup to find the hovered Outliner tree element would possibly check
children that can be skipped with a simple check.

I experimented with various ways to avoid work in this lookup. This one is
simple and reliable, which others wouldn't have been afaics. Plus, there's not
much performance to be gained here anyway.
2020-06-19 20:06:37 +02:00
15083d9e1e UI: Avoid rebuilding Outliner tree when opening/collapsing items
In big files, the Outliner would have a noticeable lag when opening or
collapsing items. That was because the entire tree was rebuilt, which isn't
actually needed in most cases. So we avoid it where possible now.
2020-06-19 20:06:37 +02:00
f4c0ea1d29 UI: Don't rebuild Outliner tree to remove highlight when leaving area
When leaving the Outliner's area, the highlight would be removed and cause a
full rebuild of the tree. This caused a noticable lag in bigger files.
2020-06-19 20:06:37 +02:00
e15f85f23d UI: Avoid rebuilding outliner tree when changing area size
In big files, ie typical production files, resizing the outliner area would be
very slow. The outliner tree would be rebuilt then, which can easily be avoided.
2020-06-19 20:06:37 +02:00
ce7a5a2376 Fix T78042: GPencil: Strokes go missing after Interpolation from another layer
This was due some strokes could be tagged and as the layer was locked, the strokes were not untagged and removed when all tagged strokes are removed.

The tagged strokes are used as temp ghost of the interpolation and removed at the end of the interpolation.
2020-06-19 19:39:30 +02:00
a24cd69d78 Cleanup: Remove unused BKE_constraint functions 2020-06-19 13:21:39 -04:00
eaa44afe70 UI: Drag and Drop Constraints, Layout Updates
This patch implements the list panel system D7490 for constraints.
In this case the panels are still defined in Python.

The layouts are also updated to use subpanels and the a more organized
single column layout. There may be more tweaks necessary for the
layouts.

Reviewed By: Severin, billreynish, Mets

Differential Revision: https://developer.blender.org/D7499
2020-06-19 12:40:48 -04:00
27fb75fec2 Fix T77476: Transform Align mode using View orientation by default 2020-06-19 12:56:53 -03:00
334e5005f4 USD: Upgrade library 20.02 → 20.05
The Blender USD code didn't have to change for this upgrade. Pixar's USD
did include a change that we had in the patch, so that's been removed
from our patch now. Some of the USD code that we patched changed as
well.
2020-06-19 17:37:14 +02:00
71363dd79c Cleanup: Alembic, replace ABC_INLINE with BLI_INLINE
The `ABC_INLINE` macro has been in the Alembic code since it was introduced
to Blender in rB61050f75b13e. It basically does the same a `BLI_INLINE`,
though, so there is no need to keep it around.
2020-06-19 17:08:21 +02:00
f84414d6e1 EEEVEE: Object Motion Blur: Initial Implementation
This adds object motion blur vectors for EEVEE as well as better noise
reduction for it.

For TAA reprojection we just compute the motion vector on the fly based on
camera motion and depth buffer. This makes possible to store another motion
vector only for the blurring which is not useful for TAA history fetching.

Motion Data is saved per object & per geometry if using deformation blur.
We support deformation motion blur by saving previous VBO and modifying the
actual GPUBatch for the geometry to include theses VBOs.

We store Previous and Next frame motion in the same motion vector buffer
(RG for prev and BA for next). This makes non linear motion blur (like
rotating objects) less prone to outward/inward blur.

We also improve the motion blur post process to expand outside the objects
border. We use a tile base approach and the max size of the blur is set via
a new render setting.

We use a background reconstruction method that needs another setting
(Background Separation).

Sampling is done using a fixed 8 dithered samples per direction. The final
render samples will clear the noise like other stochastic effects.

One caveat is that hair particles are not yet supported. Support will
come in another patch.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7297
2020-06-19 17:05:49 +02:00
e18d6f5206 LibOverride: Cleanup: remove unused parameter. 2020-06-19 17:01:20 +02:00
f6b23c63e1 LibOverride: Parallelize diffing of Main database.
This will not give any noticeable improvements in common editing tasks,
since then usually only a very few IDs are changed and checked for
override updates.

However, it makes full override diffing process several times faster
(happens usually when saving a .blend file, but could also help e.g.
when multi-editing several override objects at the same time...).
2020-06-19 17:01:20 +02:00
9905f5725c LibOverride: rempve ID preview from comparison (diffing) process.
Accessing this from RNA may actually create some data, which we do not
want to happen when comparing data. Further more, preview is not data,
but a view of it, so we should be safe ignoring it entirely here.
2020-06-19 17:01:20 +02:00
df25d3c2a3 LibOverride: add some more debug timing prints... 2020-06-19 17:01:20 +02:00
b50d01cbac Cleanup: Alembic, removed some unnecessary extern "C" {} declarations
No functional changes.
2020-06-19 16:43:27 +02:00
3ceb9faf1a Cleanup: IO, made some functions in AbstractHierarchyIterator protected
These functions are not needed in the public interface, only by the
`AbstractHierarchyIterator` class and its subclasses.

No functional changes.
2020-06-19 16:43:27 +02:00
Stefano Bonicatti
59b523c3c9 Fix build with USD, Clang and Linux
The important distinction for the linker flags is not between GCC and Clang,
but between the macOS and Linux.

Differential Revision: https://developer.blender.org/D8023
2020-06-19 15:42:33 +02:00
697b1736ef Cleanup: Alembic, replace #ifndef guards with #pragma once
No functional changes.
2020-06-19 15:30:18 +02:00
1a448c66ed Cleanup: Alembic, move the C++ code to blender::io::alembic namespace
This commit only moves code into the `blender::io::alembic` namespace,
it does not move `static` functions into an anonymous namespace.

No functional changes.
2020-06-19 15:30:18 +02:00
89b7f785e6 Cleanup: Alembic, moved exporter code into separate directory
This moves most of the exporter-related code
from `source/blender/io/alembic/intern`
to   `source/blender/io/alembic/exporter`

This is to prepare the Alembic code for the switchover to using
`blender::io::AbstractHierarchyIterator`. When that happens, a few more
files will be added, and having things in a separate 'exporter'
directory makes things less cluttered.

Note that exporting consists of multiple steps (determine export
hierarchy, create Alembic archive, and then write data into it), which
is why the directory is called "exporter", but many of the files are
called "writer".

No functional changes.
2020-06-19 15:30:18 +02:00
16d09a5864 Fix T67358: Compositor Disabled Node Config -> SegFault
The issue was caused by wrong conversion happening after some of the
proxies are removed. Easiest solution is to first remove proxies and
then add required converter operations.

Thanks Jeroen for the review!
2020-06-19 14:49:36 +02:00
28d77f9354 Performance: Never draw channels region during playback
Channels aren't visually changed by playing back an animation so there
is no need to do this. As rendering channels is using a lot of logic
(filtering animation data, converting fcurves to samples etc) it has an
noticeable overhead.

This change has no functional limitation. Users are still able to do
everything during animation playback. There are other mechanisms in
place that take care of that.

Spring 02_020_A.anim.blend went from 11.8 to 12.0 on a Ryzen 1700. I
didn't test with scenes but it should be more noticeable with more
complex scenes.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D8073
2020-06-19 14:45:55 +02:00
90010c3e04 CMake: Correct warning about which C++ version is required
Was only happening on unsupported compilers.
2020-06-19 14:44:03 +02:00
2193e28dfc USD Test: Don't use designated initializers
This isn't really in C++ standard, some corner cases work in some
compilers (like when all fields are specified), but in general they
do not work.

For some reason MSVC builder started to complain about it now,
weird but better not rely on compiler specifics.
2020-06-19 12:36:37 +02:00
e9a7f4d389 Upgrade C++ standard to C++17
Ref T76783
2020-06-19 12:02:21 +02:00
1f5f3b5588 Cycles: Make compatible with C++17 on 10.9 deployment target
OSLRenderServices contains a member which is 64 bytes aligned and this
is onlys supported by default allocators in SDK 10.14. Since we take
care of allocation ourselves ignoring the diagnostic is an acceptable
way dealign with it.
2020-06-19 12:02:21 +02:00
3f5b295084 Freestyle: Fix compilation error with C++17
AutoPtr class became a sub-class of unique_ptr with some special magic
to mimic behavior of auto_ptr for copy constructor.

The code was already there, but for some reason visual studio did not
set __cplusplus correctly for some reason.

The other change is remove of binary function usage, which is not
needed in the Freestyle code.
2020-06-19 12:02:21 +02:00
7ae9227794 Quadriflow: Fix compilation error with C++17
Unary function has been removed.
Unless I'm missing something subclass is not needed here.
2020-06-19 12:02:21 +02:00
b3b445979e Tests: Use explicit signature constants
Are reported by MSVC 2019 after C++17 switch.

One might suggest lets just silence the warning, I will say why to have
specific signed/unsigned types in API just to then (usafely) ignore the
sign conversion.
2020-06-19 12:02:21 +02:00
8c3dd6d83d Upgrade Google libraries
Upgrades Glog from 0.3.5 to 0.4.0, and Gtest from 0.8.0 to 0.10.0.

Hopefully this will solve compilation error on MSVC with C++17.
2020-06-19 12:02:21 +02:00
0f78a57904 Make BLI_edgehash_test compatible with C++17
random_shuffle was removed (at least the used version).
2020-06-19 12:02:21 +02:00
31ae833811 Ceres: Update to the latest upstream version
Using latest master because of various compilation error fixes.

Brings a lot of recent development. From most interesting parts:

- New threading model.
- Tiny solver.
- Compatibility with C++17.
2020-06-19 12:02:21 +02:00
171c4fb238 Update C++ standard to C++14
This is an intermittent state to get all dependencies to compile.

For example, the latest Ceres is needed to bring C++17 support,
but it has bumped minimal requirement to C++14.
2020-06-19 12:02:21 +02:00
9e70129952 Cloth: allow forces to act parallel to cloth.
Currently all force effectors can only act on cloth when the force is
perpendicular to the surface. This makes sense for wind, but not for
other forces; and the user may want even wind to have some friction.

This changes effector code to output two force vectors - although
you of course can pass the same pointer for both. The force is split
between the two outputs based on a new per-effector setting.

Differential Revision: https://developer.blender.org/D8017
2020-06-19 12:17:02 +03:00
f382109f38 Fix T78024: GPencil - Add missing UV Fill prop to RNA
This was changed in the refactor done in 2.83 and was not included by error.
2020-06-19 10:56:10 +02:00
2dff08c8ce Alembic: always export transforms as inheriting
Blender now always exports transforms as as "inheriting", as Blender has
no concept of parenting without inheriting the transform.

Previously only objects with an actual parent were marked as
"inheriting", and parentless objects as "non-inheriting". However,
certain packages (for example USD's Alembic plugin) are incompatible
with non-inheriting transforms and will completely ignore such
transforms, placing all such objects at the world origin.

When importing non-inheriting transforms from Alembic, Blender will
break the parent-child relation and thus force the child to (correctly)
interpret the transform as world matrix.
2020-06-19 10:24:57 +02:00
f106369ce8 Alembic: prevent spaces in names of exported particle systems
Other types already had spaces, periods, and colons replaced by
underscores. The upcoming Alembic exporter (based on the
`AbstractHierarcyIterator` class) will be more consistent and apply the
same naming rules everywhere. This is in preparation for that change.
The `get_…_name()` functions in `abc_util.{cc,h}` will be removed then.
2020-06-19 10:24:51 +02:00
0d744cf673 Alembic: export object data with object data name
Previously the Alembic exporter exported a mesh object to
`{object.name}/{object.name}Shape`. Now it exports to
`{object.name}/{mesh.name}` instead. The same change also applies to
other object data types.

Note that the code now is a bit hackish, as `m_name` is set even in
cases where it isn't used. This hackishness was already there, though,
but it's now just more visible. This will all be cleaned up when the
Alembic exporter is ported to use the `AbstractHierarchyImporter`
structure of the Universal Scene Description (USD) exporter.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7672
2020-06-19 10:17:41 +02:00
0ae7883d7d IO: ensure export path and export name are always consistent
Before this, there was one code path that set `context.export_path`, and
a different code path for `context.export_name`, allowing the two to
diverge.

Keeping track of the export path of the export parent (which can be, but
is not always, the Blender parent object) also allows a concrete
subclass of `AbstractHierarchyIterator` to find the `AbstractWriter` for
the export parent. In case of exporting to Alembic this is important, as
it's not possible to simply give the Alembic library the full export
path of an object like we do in the Universal Scene Description (USD)
exporter; Alembic needs the C++ object of the parent.
2020-06-19 10:17:41 +02:00
69c3d9804f IO: Allow exporting a subset of the writers
This is in order to prepare for compatibility with the Alembic exporter.
That exporter is capable of writing object transforms and object data at
different (sub)frames.

The rename from `created_writers` to `used_writers` is necessary, as not
all created writers will be actually used in each iteration.

The Universal Scene Description (USD) exporter does not make use of
this.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7670
2020-06-19 10:17:41 +02:00
084c5d6c7e IO: Move Abstract Hierarchy Iterator into io/common
The goal of the `AbstractHierarchyIterator` class (and supporting
classes) was to use it in different exporters. It shouldn't be part of
the USD module + namespace any more, now that it will also be used in
the upcoming Alembic exporter rewrite.

The source files are moved into `io/common`, which is compiled & linked
into a new library `bf_io_common`. The unittests are still inside the
`tests/gtests/usd` directory. They should be moved to a separate test
module too, but that will be delayed until after T73268 has been
resolved.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7669
2020-06-19 10:17:41 +02:00
b1ce4ca40c Fix T77997: GPencil insert keyframe on timeline doen't update viewport
The reason was the datablock is changed but it was not tagged for depsgraph refresh.

In some cases it could be possible to tag several times the same datablock, but as this is not the case all the times and the number of tags is always very small, it doesn't worth a complex code to keep a memory list of the datablocks to tag.
2020-06-19 10:10:11 +02:00
fade37ff07 Writefile: move file flags to BlendFileWriteParams
This removes G_FILE_HISTORY, G_FILE_SAVE_COPY & G_FILE_USERPREFS.

Using file-flags made logic harder to follow since it's not so clear
which flags are expected to be in G.fileflags & which are meant to be
set and passed as arguments, these are shared between read & write
functions too.

Add BlendFileWriteParams so options which don't need to be stored
aren't mixed up with flags that are stored for reuse.
2020-06-19 16:47:12 +10:00
5a77f643f4 Cleanup: SPACE_ACTION does not have a RGB_TYPE_TOOL_HEADER
So no need to check this specific case.
2020-06-19 08:13:06 +02:00
d093f61667 Cleanup: use bool and enums in match_region_with_redraws
Function used int for everything.
2020-06-19 08:11:25 +02:00
642b19c8b8 Fix app-templates not resetting the user interface
Regression in 45b5f4e3df
2020-06-19 14:29:24 +10:00
41f0697501 Outliner: Show pose group icons
Pose groups previously showed a dot icon. Now it draws the correct icon.
2020-06-18 21:53:54 -06:00
1ee32ea228 Cleanup: use doxy sections 2020-06-19 13:17:10 +10:00
0479c28ddd Cleanup commented separator. 2020-06-19 02:04:59 +02:00
f1e5fd030a Cleanup: unsupported ATTR_FALLTHROUGH use, clang-format 2020-06-19 09:44:57 +10:00
b89898cbd3 Cleanup: Move snap callbacks to their respective transform mode
These functions are very specific to the mode.

More modes can support snap, and there is no reason to keep all
callbacks for each mode in the transform_snap.c file.
2020-06-18 16:05:48 -03:00
d56444392f Fix T78004: Instant crash when Shift+D duplicating a Collection Instance.
Dummy mistake in own recent refactor of duplicate code...
2020-06-18 20:34:39 +02:00
3aadf68b88 UI: Weight Modifiers Falloff: Use better step icon 2020-06-18 12:46:00 -04:00
d5954ef11c LibOverride: only tag actually changed orig IDs for automatic override diffing.
This makes any operation (including mere bone selection) several times
faster on some complex production character, since we typically now only
need to diff a single ID, instead of tens of them.
2020-06-18 18:27:49 +02:00
722adcfc48 LibOverride: Improve performances by using better string hashing function.
This is not really huge improvements, but 2% are always good to have.
2020-06-18 18:27:49 +02:00
52b8d668f4 Depsgraph: use blender::Map instead of std::map
We decided to use our own map data structure in general for better
readability and performance.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7987
2020-06-18 18:18:19 +02:00
44f7852660 LibOverride: increase speed of RNA diffing process.
By using own path construction instead of handy printf-like functions,
we get a 10% improvement on overall diffing process!

This remains way to slow on some complex production characters, but
always good to have still.
2020-06-18 18:00:41 +02:00
667ef9917f UI: Place "New Collection" item above list in Move/Link to Collection menu
This way "New Collection" is always assigned the same shortcut (N).
Whereas previously it would be automatically assigned the leftover key
from the list of available collections.

Nice side effect is that since N is next to M in most keyboard layouts,
moving to a new collection is super fast by hitting M then N.

{F8630575, size=full}

Paper-cut pointed out by DerekWatts on [devtalk](https://devtalk.blender.org/t/blender-ui-paper-cuts/2596/4211) (thanks!):
{F8630492, size=full}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D8067
2020-06-18 17:54:49 +02:00
6899cb3c07 Fix for T77095: work around render artifacts with AMD Radeon RX 4xx and 5xx 2020-06-18 14:41:51 +02:00
64bf179a17 Fix T65986: Inaccurate center of mass, calculating mesh center
Use a median center of polygons as an initial value for volume center
calculation since the volume accumulation quickly generates very large
numbers that become inaccurate if the geometry is too far
from it's current center.
2020-06-18 22:37:32 +10:00
55ebf174bc Fluids: fix variable names
This seems to be an error in rBb91b90f0dd3c9bff3b1a6e563c2cce293722ed16.

I found it, because I could not open the file in T77263 anymore.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D8065
2020-06-18 14:27:58 +02:00
e36c05b3d1 Fix T77764: VSE: snap strip to current frame does not move associated
effect strips keyframes along

Maniphest Tasks: T77764

Differential Revision: https://developer.blender.org/D7996
2020-06-18 13:27:50 +02:00
dbf96e6252 Fix T77957: Height change in Camera Properties column when changing lens type
Remove unneeded extra column from perspective type properties.

Maniphest Tasks: T77957

Differential Revision: https://developer.blender.org/D8060
2020-06-18 11:09:53 +02:00
a5e176a8ed Allow interpolation of matrices with negative scale / axis flips
The matrix interpolation function `interp_m3_m3m3()` decomposes the
matrices into rotation and scale matrices, converts the rotation
matrices to quaternions, SLERPs the quaternions, and converts the result
back to a matrix. Since quaternions cannot represent axis flips, this
results in interpolation problems like described in T77154.

Our interpolation function is based on "Matrix Animation and Polar
Decomposition", by Ken Shoemake & Tom Duff. The paper states that it
produces invalid results when there is an axis flip in the rotation
matrix (or negative determinant, or negative scale, those all indicate
the same thing). Their solution is to multiply the rotation matrix with
`-I`, where `I` is the identity matrix. This is the same as element-wise
multiplication with `-1.0f`. My proposed solution is to not only do that
with the rotation matrix `R`, but also with the scale matrix `S`. This
ensures that the decomposition of `A = R * S` remains valid, while also
making it possible to conver the rotation component to a quaternion.

There is still an issue when interpolating between matrices with
different determinant. As the determinant represents the change in
volume when that matrix is applied to an object, interpolating between a
negative and a positive matrix will have to go through a zero
determinant. In this case the volume collapses to zero. I don't see this
as a big issue, though, as without this patch Blender would also produce
invalid results anyway.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D8048
2020-06-18 10:37:52 +02:00
46e4cdf788 Tests: added simple unittests for matrix interpolation
The interpolation of 4x4 and 3x3 matrices will fail when the rotation
component has a singularity, i.e. when there is one axis mirrored. Two
mirrored axes are just a rotation of 180 degrees around the third, and
three mirrored axes are such a rotation + a single axis mirror. To
prepare for a fix, I first wanted to cover the basic functionality with
a few unit tests.

These tests check that `interpolate(A, B, alpha)` always returns `A` for
`alpha=0`, always return `B` for `alpha=1`, and something in between for
`alpha=0.5`.
2020-06-18 10:37:46 +02:00
099d47f8a3 Sequencer: revert selection & keymap changes from D7679
These changes aren't aligned with other timeline selection keymaps
(graph & action for e.g.).

Revert these changes, shortcuts to time-line editors
should take other similar spaces into account.
2020-06-18 16:30:56 +10:00
502e6bd839 Fix doc generation for enum & attr's with multi-line descriptions 2020-06-18 16:26:16 +10:00
3ada1949f8 Python API: path mapping options for library writing function
When "Relative Remap" option was added, the intention was only to remap
paths that were already relative. However it remapped all paths.

This was reported as T62612 and fixed recently,
however some Python script authors depended on the old behavior.

For users, it's reasonable to use the existing operators to make paths
absolute/relative. For scripts however it's useful to be able to write
out individual data-blocks with the ability to make all paths relative.

Now `bpy.data.libraries.write()` takes a path_remap argument which can
be `NONE/RELATIVE/RELATIVE_ALL/ABSOLUTE` allowing the script author to
choose how paths are handled when writing out data-blocks.

Addresses T77768.
2020-06-18 15:49:10 +10:00
aab165b575 Cleanup: remove unnecessary flag clearing
This is not read from blend files.
2020-06-18 14:30:04 +10:00
978e2b6f98 BKE_global: No longer read/write G_FILE_HISTORY
This is a runtime only flag
which doesn't make sense to store in the file.
2020-06-18 14:30:04 +10:00
44f4eaf13b Cleanup: doxy sections for walk/fly operators 2020-06-18 14:30:04 +10:00
3aa1143d57 Cleanup: redundant parenthesis 2020-06-18 14:30:04 +10:00
790d942b69 Cleanup: unused variables 2020-06-18 14:30:04 +10:00
229ed078d1 Fix T75414: Incorrect masking in Color Balance modifier
Color balance factor was infinity. Clamp to +/- `FLT_MAX`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7884
2020-06-18 05:53:25 +02:00
f7f3b2d318 Cleanup: Remove goto statements from strip rendering functions
Remove goto statement from `seq_render_image_strip()` and `seq_render_movie_strip()`.
`seq_render_image_strip_view()` and `seq_render_movie_strip_view()` is used to render individual views in both monoview and multiview branch.

I have included `seq_can_use_proxy()` for convinience

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D7870
2020-06-18 05:53:25 +02:00
67a822e086 Fix T73056: Cache not invalidated in fade operator
This operator is written in python it is inserting keyframes to create fade
effects.

Add Sequence.invalidate() python function to invalidate strip if it is
changed in python.

Perhaps I could implement cache invalidation to actual curve manipulation.
I guess it wouldn't be very hard to do but having means to invalidate form
python is useful as well.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7885
2020-06-18 05:53:25 +02:00
47f98a38d0 VSE: Fix assigning effect strip inputs
Partialy fixes T73828

Currently all 3 effect inputs were assigned even if not all 3 were used.
This causes problems with reassigning effects in python, because 3rd input is
not accessible.

This patch will only assign inputs that are necessary for effect to work
properly.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D6868
2020-06-18 05:53:25 +02:00
8df99b1c0c Cleanup: Remove unused code from seq_proxy_get_fname()
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7868
2020-06-18 05:53:25 +02:00
ac16d56aa8 Fix T66390: Update missing when snaping strips.
Effect strips bound recalculation was mixed with overlap handling, which
caused, that effects wasn't handled.

In some cases there may be problem with order of strips in seqbase. We should
traverse hierarchy instead. This is design issue that applies to all
operators, and should be fixed separately.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7880
2020-06-18 05:53:25 +02:00
d8206602fe Transform: Snap to the intersection between constraint and geometry
This commit changes the behavior of 4 snapping combinations:

**1. While constraining to a plane, snap to an edge element:**
The snap is made at the intersection between the edge direction and the
constraint plane.

**2. While constraining to a plane, snap to a face element:**
The snap is made to the nearest point between the snap point and the
line that intersects the face plane with the constraint plane.

**3. While constraining to an axis, snap to an edge/line element:**
The snap is made to the nearest point on the axis to the edge/line.

**4. While constraining to an axis, snap to a face element:**
The snap is made at the intersection of the axis and the plane defined
by the face.

To avoid unpredictable jumps outside view boundaries, an alignment
check is made for each of these snapping combinations.

Resolve/fix T66422

Differential Revision: https://developer.blender.org/D5608
2020-06-18 00:01:05 -03:00
18ccf328ac Outliner: Fix (unreported) object select in multiple collections
Previous commits to fix parent selection introduced incorrect behavior
when selecting objects linked to multiple collections. The clicked
object would be selected, but also the first listed object in the tree
would be selected.

Instead of always searching for a parent object to select, only search
back when the selected element is not an ID_OB. This prevents multiple
selection of objects linked to multiple collections.
2020-06-17 20:31:55 -06:00
e079bf6996 GPencil: Chnage default Vertex Color mode to Stroke and Fill
The previous value was Stroke only.
2020-06-17 22:49:59 +02:00
ffa23b6c77 GPencil: Fix unreported Vertex Opacity Overlay not working
This values was not working because was removed by error in refactor.

Reviewed By: mendio, fclem

Differential Revision: https://developer.blender.org/D8061
2020-06-17 22:42:49 +02:00
a874cec02b UI: Match some properties set in keymaps with those set for buttons
This allows the operator's shortcut to appear in the context menu.

Except for the shortcut display, there is no functional change from the
user's point of view.

This fix T77839
2020-06-17 16:30:31 -03:00
eacdcb2dd8 Cycles: Add new Sky Texture method including direct sunlight
This commit adds a new model to the Sky Texture node, which is based on a
method by Nishita et al. and works by basically simulating volumetric
scattering in the atmosphere.

By making some approximations (such as only considering single scattering),
we get a fairly simple and fast simulation code that takes into account
Rayleigh and Mie scattering as well as Ozone absorption.

This code is used to precompute a 512x128 texture which is then looked up
during render time, and is fast enough to allow real-time tweaking in the
viewport.

Due to the nature of the simulation, it exposes several parameters that
allow for lots of flexibility in choosing the look and matching real-world
conditions (such as Air/Dust/Ozone density and altitude).

Additionally, the same volumetric approach can be used to compute absorption
of the direct sunlight, so the model also supports adding direct sunlight.
This makes it significantly easier to set up Sun+Sky illumination where
the direction, intensity and color of the sun actually matches the sky.

In order to support properly sampling the direct sun component, the commit
also adds logic for sampling a specific area to the kernel light sampling
code. This is combined with portal and background map sampling using MIS.

This sampling logic works for the common case of having one Sky texture
going into the Background shader, but if a custom input to the Vector
node is used or if there are multiple Sky textures, it falls back to using
only background map sampling (while automatically setting the resolution to
4096x2048 if auto resolution is used).

More infos and preview can be found here:
https://docs.google.com/document/d/1gQta0ygFWXTrl5Pmvl_nZRgUw0mWg0FJeRuNKS36m08/view

Underlying model, implementation and documentation by Marco (@nacioss).
Improvements, cleanup and sun sampling by @lukasstockner.

Differential Revision: https://developer.blender.org/D7896
2020-06-17 21:06:41 +02:00
d6ef9c157a UI: Solve crash with move to index in modifier menu 2020-06-17 14:43:48 -04:00
bcb2b8ab57 UI: Improve Modifier Panel Header Menu
This makes a few changes to the modifier panel header:
  1. Adds "move to top" and "move to bottom" buttons.
  2. Adds a checkmark icon for "apply"
  3. Makes it narrower, the text is closer to the dropdown icon.
     (Requires the change in ui_block_func_POPUP)

Differential Revision: https://developer.blender.org/D8040
2020-06-17 14:09:17 -04:00
4cfdd10c2b UI: Modifier Panel Header Improvements
This includes a few improvments:
  1. Always expose delete. This is the button everyone wants the most,
     it makes a lot of sense to expose this.
  2. Improve "name hiding capability." Basically always align the mode
     buttons to the right, and count their number to see if the name fits.
  3. Aligns more items, to look better, save space, and make the whole
     header seem more grouped.
  4. In my tests the "switch contexts" button never coincides with the
     delete button, so they share the same space.

Differential Revision: https://developer.blender.org/D8037
2020-06-17 13:51:33 -04:00
c1c02f45f7 UI: Ctrl-click on panel header expands & collapses subpanels
If the panel is already open and you ctrl click on its header, its
sub-panels are now expanded / collapsed instead of toggling the
expansion for all other panels. If you're toggling a panel's expansion
it's already in view anyway, so there is no need to collapse the
other panels.

Differential Revision: https://developer.blender.org/D8042
2020-06-17 13:37:59 -04:00
2e0ac1e0c4 Buildbot: Cleanup, remove unused script and change naming
Follow upstream convention.
2020-06-17 17:39:17 +02:00
e590526af6 Fix T76767: Cycles performance regression with CLI renders
When picking a small tile size when doing a CLI render will
yield many status updates being printed to the console
causing a slowdown in the render process. 2.79 with the
same amount of tiles did not have this slowdown.

The reason for this turned out to be a debugging aid added
in rBd2757d149bf2 which disabled buffering for stdout which
on windows caused every single character being printed to the
console to try to obtain a mutex, and worse the thread being
put to sleep when this mutex was unavailable leading to poor
performance.

This patch changes the behaviour by only disabling the
buffering in debug builds.

CLI render of the default cube with 16x16 tiles at 1080p

2.83 : 37.57s
now  : 17.03s

note: this only affected CLI renders, renders from the UI
do not report this kind of information and had no such
slowdown.
2020-06-17 09:26:49 -06:00
9bfd78ae14 Fix T77914: Blender Crashes if viewport is changed manually while having loop cut selected
The selection engine requires a viewport.
2020-06-17 12:16:32 -03:00
ddf4b909de Cleanup: Rearrange SELECTID_Context members for better alignment 2020-06-17 12:16:32 -03:00
13f591d400 ID Duplicate: Factorize a lot the code.
Now that we have a uniform consistent behavior in all our ID duplicate
funtions, we can easily factorize it greatly. Code gets cleaner,
smaller, and less error-prone.

Note that ultimately, this duplicate/deep copy behavior could be added
as a callback of IDTypeInfo.
We could also rethink the duplicate flags (some data, even some obdata,
like Lattice, are not coverred currently).
And so on. But at least code should now be much more easily maintainable
and extendable.
2020-06-17 17:06:05 +02:00
c84fee1ffe ID Duplicate: uniformize Action duplication.
Previously, object (and sub-data) actions would be controlled by the
user preferences flag, collections actions would never be duplicted, and
scenes actions were always duplicated...

Now they all follow the user preferences settings.
2020-06-17 17:06:05 +02:00
ad6cccf058 Refactor duplicate of data-blocks.
Main change from user side, besides that all pointers should now be
properly remapped to new IDs, is that linked objects are no longer
preserved when doing a full copy of scenes.

Will open a task to check whether we actually still want that behavior
(and re-code it in a more correct way then).

This is the main part of work done here, it aims at uniformizing and
sanitizing that 'deep copy' process for supported IDs (currently scenes,
collections and objects).

Note that there will be more follow up commits after that one, but this
should be the most risky and changing one.
2020-06-17 17:06:05 +02:00
514f80b0c4 Fix (unreported) broken logic in BKE_libblock_relink_to_newid
Existing code would not follow as expected into new sub-IDs if they were
only encoutered once in usages by parent IDs...
2020-06-17 17:06:05 +02:00
26c0ca3aa7 Outliner: Unified delete hierarchy operator
This resolves T73673 by allowing delete hierarchy in all outliner view
modes. It also unifies the collection and object hierarchy delete into a
single operator like in rBae98a033c856. This makes it easier to delete
all selected collection and object hierarchies at once.

This also removes the old object delete hierarchy code in favor of the
batch delete code which has been default for over a year.

Maniphest Tasks: T73673

Differential Revision: https://developer.blender.org/D7675
2020-06-17 09:00:04 -06:00
a2c4e5d222 Cleanup: clang-format 2020-06-17 16:07:26 +02:00
fc7c34e380 Cleanup: fix compiler warnings 2020-06-17 14:36:51 +02:00
25b8dedfb4 Fix T77915: Cycles OSL microfacet closure not working in custom shaders
The code to implement the newer closure in terms of the old one got lost in
the removal of our stdosl.h copy. Now implement it as a builtin closure.
2020-06-17 14:09:28 +02:00
8591ee748f Cleanup: doxy sections for meta-ball operators. 2020-06-17 21:22:08 +10:00
70c061ee0a Fix T63411: Crash adding meta-ball with a small radius
Change how the radius, changing the size of meta plane, sphere & cube.

Previously the size of these primitives would be kept the same,
with only the radius outside the primitive being scaled.

This led to small scale adding a lot of polygons instead
of scaling the primitive down as users would expect.

Also change behavior not to change the resolution when adding
to an existing meta-ball.
2020-06-17 21:13:47 +10:00
7dae6eb5a2 Doc: minor change to curve select more/less
Address T55218
2020-06-17 18:07:53 +10:00
1dfd262f2d Cleanup: name mesh join functions using ED_{type} prefix 2020-06-17 17:07:11 +10:00
4892470a47 Fix T70287: Connect vertex path can create duplicate edges/faces 2020-06-17 16:41:16 +10:00
ba312bc8a7 Cleanup: doxy comments 2020-06-17 14:00:09 +10:00
3ff9769762 Fix T76041: Low contrast dirty vertex colors with loose geometry
Add option to normalize vertex colors.
2020-06-17 13:43:20 +10:00
f9be5374ac Cleanup: warning 2020-06-17 13:43:20 +10:00
c7b03fe9c0 UI: Backspace is one word 2020-06-16 14:15:54 -04:00
efb1bf80df Buildbot: Cleanup, typo in logging 2020-06-16 18:12:15 +02:00
1b2a24aae0 Fix issue with uint in headers in recent own commit.
Would break on some systems/compilers...
2020-06-16 18:03:36 +02:00
16652185ce Fix (unreported) wrong size of UserPreferences' dupflag parameter.
Adding volume obdata option to `eDupli_ID_Flags` enum made it go beyond
the 16 bits of a short... Also, enums should typically be stored in
unsigned integers.
2020-06-16 17:40:30 +02:00
94fba47513 Cleanup: use explicit enum type for duplicate option of BKE_object_duplicate
Using enum type itself in implementations, and uint in headers (as using
enums types in headers is a pain when enum are not defined and used in a
single same header file...).
2020-06-16 17:40:30 +02:00
9e307117f8 Cleanup: remove hierarchy parameter from BKE_collection_duplicate
It makes no sense to deep-copy a collection and not also copy its
children collections... Parameter was not used anymore anyway.

So now this duplicate function will always at least deep-duplicate all
of its children collections, recursively.
2020-06-16 17:40:30 +02:00
2c435cf249 Cleanup: get rid of BKE_collection_copy.
We want to get rid of those for all ID types ultimately, but that one
was only used in one place, being the only one calling
`BKE_collection_duplicate` without hierarchical duplicate and parent
collection pointer, effectively using the full power of the complex deep
duplication code for a mere `BKE_id_copy` call...

This will allow for further cleanup in duplicate code.
2020-06-16 17:40:30 +02:00
2e5ef864ab Refactor: move .blend read/write of mesh deform modifier to MOD_meshdeform.c 2020-06-16 17:17:43 +02:00
25a1ed993a Cleanup: remove unnecessary indirection for .blend read/write of curvemapping 2020-06-16 17:04:03 +02:00
d3de5d7ca5 Refactor: Move curvemapping .blend read/write to blenkernel
This is necessary so that it can be accessed from `blendWrite`
and `blendRead` callbacks from modifiers.
2020-06-16 16:59:52 +02:00
4365de3870 Functions: Multi Function
This adds the `MultiFunction` type and some smallish utility types that it uses.
A `MultiFunction` encapsulates a function that is optimized for throughput by
always processing many elements at once.

This is an important part of the new particle system, because it allows us to
execute user generated node trees for many particles efficiently.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8030
2020-06-16 16:35:57 +02:00
f721308bd0 Fix bitscan_reverse_uint on MSVC compiler
Was a mistake from the very beginning of implementation.
2020-06-16 16:17:47 +02:00
2c2fd9f036 Buildbot: Switch WIndows builds to MSVC 2019 2020-06-16 16:17:47 +02:00
bc7a4b126a GPencil: Convert and Bake mesh animation to grease pencil strokes
This patch adds two options:

- Convert a mesh to grease pencil strokes.
- Bake the mesh animation into grease pencil strokes.

Both are related and must be included in the same patch.

Related to tasks: T77629 and T77630

Notice: The conversion is done for mesh edges and it's not considering any visibility clipping. All edges are exported, no matters if it's visible or not.

Example of Convert a Mesh to Grease Pencil strokes:

{F8606028}

This conversion was inspired by the technique used by @luamono in this tweet: https://twitter.com/luamono/status/1239983662176841730

Example of Bake Animation (the video is a little outdate, but the basic functionality is the same, only small changes in UI):

{F8606032}

Reviewed By: mendio, pepeland

Maniphest Tasks: T77629, T77630

Differential Revision: https://developer.blender.org/D7983
2020-06-16 15:28:46 +02:00
e54058b121 Fix T77803: IK Degrees of freedom drawing glitch
IK degrees of freedom is rendered using wires and a solid sphere. The
solid used the wireframe drawing what resulted into drawing glitches.
This patch adds a new shader to draw the solid shape.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D8044
2020-06-16 14:36:18 +02:00
76d50c51a3 Buildbot: Support multiple workers talking to single codesign server
Is achieved by replacing hard-coded signed/unsigned file names with
"<uuid>" which acts as a "request ID". This way multiple workers can
put their requests into a single directory without collisions. The
code sign server will handle the requests sequentially in an unknown
order.
2020-06-16 14:08:14 +02:00
21d862494b Buildbot: Don't use builder name in the build directory
The directory layout on worker goes as following:

  <Worker>
    <Builder Name>
      blender.git/
      build/
      install/
      lib/

Adding an extra <Builder Name> after build is redundant.

Differential Revision: https://developer.blender.org/D8045
2020-06-16 12:24:01 +02:00
7d7090710c CMake: Fix compilation errors related on missing dna_type_offsets.h
Some of the files were (indirectly) using dna_type_offsets.h without
adding dependency from bf_dna (which is needed to ensure the file is
generated prior to library compilation).
2020-06-16 12:22:06 +02:00
38c9573b23 BLI: fix Map.foreach_item method 2020-06-16 12:16:07 +02:00
87df151902 Merge branch 'asset-uuid' into asset-engine 2020-06-16 11:31:58 +02:00
cfde6ebf45 Merge branch 'master' into asset-uuid 2020-06-16 11:31:33 +02:00
d2587f6f93 Cleanup: unused headers, spelling 2020-06-16 16:59:26 +10:00
Alan Troth
a64b8aca39 Fix T61777: Proportional editing doesn't work with multi edit-mode 2020-06-16 16:45:53 +10:00
f72419b9ae Cleanup: doxy sections for camera, collections, text & seqmodifier 2020-06-16 12:56:45 +10:00
a76542cbbf Cleanup: Use LISTBASE_FOREACH in interface_panel.c 2020-06-15 21:38:16 -04:00
4db63b6486 Fix crash when opening some old/broken .blend files after recent fix.
Now that `BKE_main_collections_parent_relations_rebuild()` is called
from readfile code, we need to make it resilient to potential NULL
master collection pointer in scenes.
2020-06-15 18:49:46 +02:00
6a0ebb8088 Refactor: use new blenloader api for laplacian deform modifier 2020-06-15 18:37:30 +02:00
d97cb98b11 Fix unhandled RECALC options in depsgraph code after recent change.
Spotted by @LazyDodo on IRC, thanks.
2020-06-15 18:25:40 +02:00
bf1e5a2133 Blenloader: call blendRead and blendWrite of modifiers when available
This is part of T76372.
2020-06-15 17:55:06 +02:00
b6981d9e48 Modifiers: New callbacks for reading and writing .blend files
This is part of a greater blenloader decentralization effort (T76372).
For modifiers the goal is that fewer files have to be modified when
a new modifier is added.

This patch just adds the `blendWrite` and `blendRead` callbacks to
`ModifierTypeInfo` but does not change any other code yet. In the next
steps, modifier specific code will be moved from `writefile.c` and
`readfile.c` into their corresponding `MOD_*` files.
2020-06-15 17:43:30 +02:00
eaff606f2d Fix T77460: Easy to create cyclic dependencies in collections and crash Blender.
Cyclic check was not checking for collections instanciated by objects...
2020-06-15 17:25:51 +02:00
89bde99674 Fix (unreported) critical mistake in Collection liblink code in readfile.c.
Prelimenary step to fix T77460.

Not sure how or when that thing was done, but since that call walks
around collections relationships, it's an utterly critical violation of
liblinking principles (code here should never, ever 'get outside' of its
own ID scope).

This was wroking so far only because code called through this function
(`BKE_collection_parent_relations_rebuild`) was only following parents
pointers (in `BKE_collection_find_cycle()`), which would be either valid
or non-existent.

But next commit is going to change that to also check collection's
objects instancing of other collections.
2020-06-15 17:25:51 +02:00
Jeroen Bakker
624994caa2 Fix T77496: Bones Custom Shapes Wires not drawn
Lines loose extraction cannot happen on the fly as the render data isn't
complete. This patch will do the lines loose subbuffer extraction as a
simple task and not on the fly.

This patch introduces 2 sub-types of tasks that are executed single threaded.
`EXTRACT_MESH_EXTRACT` would do the extraction using Mesh/BMesh geometry.
`EXTRACT_LINES_LOOSE` creates the `lines_loose` subbuffer from already cached
`lines` IBO.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7964
2020-06-15 16:47:21 +02:00
Bastien Montagne
df1ff76ee2 Fix T77774: New undo code broken by 'make local' behavior.
This is actually a nice issue due to too much optimization...
* Making an ID local just reuse the linked one whenever possible, instead of
  actually making a copy of it.
* Therefore, the collection containing that ID is seen as unchanged, since
  the pointer itself remained the same.
* But on undo step, there is no way to reuse that local object, which then
  gets deleted, and linked one gets re-created - at a different address.
* Collection, however, since unchanged, is not updated at all and thus keeps
  reference to the to-be-deleted local object, instead of the linked one.
* Issue gets even worse with viewlayers, this leads to the crash.

To address this, this patch adds a 'virtual' update flags that does nothing
in update case, but will ensure that the affected IDs using the one made local
are properly detected as changed across the relevant undo step.

Note that the recalc flags were chosen mostly for a logical reason, and also
because they are already properly dealt with and cleared by undo code,
so this looks like the optimal solution.

Reviewed By: brecht

Maniphest Tasks: T77774

Differential Revision: https://developer.blender.org/D8006
2020-06-15 15:35:49 +02:00
0945a79ed1 Fix crash using shrink-wrap modifier in edit-mode
Regression in deaff945d0.
2020-06-15 23:29:54 +10:00
Jeroen Bakker
ab8a691431 Fix T77342: Fail to draw loose edges
The underlying issue is that the loose edge extraction cannot be
threaded. This patch will extract the loose edges during initialization
of the render mesh data.

When working on this patch the mesh_render_data_update was split into
multiple functions to identify what part was failing. These functions
would also help us with debugging.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7962
2020-06-15 15:26:21 +02:00
Jeroen Bakker
3c717a631b Fix Memory Leak introduced by Draw Manager Threading
The memory leak is noticeable when using custom bone shapes. When using custom
bone shapes objects could be extracted twice. Where the second extraction can
overwrite data created by the first extraction what causes the memory leak.

Options that have been checked:
1. Use two task graphs phases. One for normal extraction (DST.task_graph) and
   the other one will handle extractions that require blocking threads.
2. Keep a list of all objects that needs extraction and only start extraction
   when all objects have been populated.

The second would slow performance as the extraction only happens when all
objects have been populated. In the future we might want to go for the second
option when we have the capability to render multiple viewports with a single
populate. As this design isn't clear this patch will implement the first
option.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7969
2020-06-15 15:22:57 +02:00
ec25084f5a Fix T77541: Unregistering DATA_PT_modifiers doesn't remove modifier panels
This is a pretty quick fix; the solution is just removing all the
instanced panels whena panel is unregistered. This also necessitates
adding the option to call UI_panels_free_instanced with NULL context.

Differential Revision: https://developer.blender.org/D7977
2020-06-15 09:06:54 -04:00
eadbdf170a Fix T77853: Error reloading linked library.
Issue related to how ID refcounting was changed when loading blendfile
data...
2020-06-15 15:03:53 +02:00
cf42721fe2 Cleanup: Rearrange Vert and Edge slide functions
And make `trans_mesh_customdata_correction` a more generic utility.
2020-06-15 09:53:18 -03:00
046afacbc6 Fix T77116: Current frame indicator text color hardcoded
Draw the text with the "header text highlight" theme color, which is
rarely used, making it a good candidate for this special case.

Differential Revision: https://developer.blender.org/D7897
2020-06-15 08:35:52 -04:00
73f8dd0f4c Fix T77596: UI: Correct "offset even" location in solidify modifier
This only applies in the "simple" solidify mode.

Differential Revision: https://developer.blender.org/D7967
2020-06-15 08:23:07 -04:00
2797a63a66 Cleanup: remove unnecessary code
This got committed due to a stupid mistake of mine, it does not belong
there at all.
2020-06-15 12:35:51 +02:00
ee61c1fe22 Cleanup: removed trailing spaces from install_deps.sh
No functional changes.
2020-06-15 11:58:58 +02:00
0d59a643aa x264: update URL and hash in versions.cmake
The old URL did have a Git commit hash in it, but apparently the server
was ignoring it and only used the `master` that was also mentioned in the
URL. As a result, every new download would get the latest version from
the `master` branch, invalidating the SHA256 checksum.

I replaced `master` with the actual commit hash. This should make the
situation stable.

No functional changes.
2020-06-15 11:58:58 +02:00
0102b9d47e Alembic: remove HDF5 support from CMake files
This is a follup to 0c38436227.

No functional changes to Blender, just the build scripts.
2020-06-15 11:58:58 +02:00
76ebc608af Fix T77871: GPencil masked points fails with previous point
If selected a point for masking, the previous point that is part of the same segment was included.

This bug was in Sculpt and Vertex paint modes because the code was very similar.
2020-06-15 11:49:08 +02:00
0c38436227 Alembic: remove support for HDF5 archive format
Alembic is not a single file format, it can be stored in two different
ways: Ogawa and HDF5. Ogawa replaced HDF5 and is smaller and much faster
(4-25x) to read ([source](http://exocortex.com/blog/alembic_is_about_to_get_really_fast)).

As long as Blender has had Alembic support, it has never supported the
HDF5 format in any release. There is a build option `WITH_ALEMBIC_HDF5`
that can be used to enable HDF5 support in your own build. This commit
removes this build option and the code that it manages.

In the years that I have been maintainer of Blender's Alembic code, I
only remember getting a request to support HDF5 once, and that was to
support very old software that has likely since then been updated to
support Ogawa. Ubuntu and Fedora also seem to bundle Blender without
HDF5 support.

This decision was discussed on
[DevTalk](https://devtalk.blender.org/t/alembic-hdf5-support-completely-remove)
where someone also mentioned that there is a tool available that can
convert HDF5 files to the Ogawa format.
2020-06-15 11:12:24 +02:00
ece7ebb3a8 Fix text after '|' being right aligned in the ID selector
Only use this to right align libraries when they are added to the name.

Caused by d62bbf4079.
2020-06-15 19:06:07 +10:00
fbf6eb509a Fix T77869: GPencil material preview not visible before frame 2
The problem was related to the change introduced in commit 11ba9eec70

As now the keyframe is only visible if the keyframe is greater or equal than current scene frame and  the preview file had all keyframes in frame number 2, it was not used in frame 0 or 1.

Now, the keyframes have been moved to frame 0.
2020-06-15 11:01:28 +02:00
b358a92faf Various UI messages fixes... 2020-06-15 10:51:26 +02:00
1d6529873f Fix T77735: Numinput of radial control operator behaved incorrectly
This fixes the behavior of `ctrl+F` and `shift+F` to control the angle
and strength of a brush when the unit scale is not one.

Reviewers: pablodp606

Differential Revision: https://developer.blender.org/D7992
2020-06-15 09:46:27 +02:00
bf8b62e874 Fix curve handle color ID display
Regression in 49f59092e7 caused all handles to display using
the 'aligned' theme color.

Arrange flags to fix this, add assert to avoid this happening again.

Also rename flag so it's use is clearer.
2020-06-15 15:33:42 +10:00
Tobias Heinke
24d77e7db7 API docs: mathutils leaked markup
Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8021
2020-06-14 19:15:05 -04:00
caa1b16acc UI: Do not use term 'Subsurf'
So not to be confused with subsurf scatter

Differential Revision: https://developer.blender.org/D8005
2020-06-14 19:06:58 -04:00
4155f8dc21 deps/windows/embree: Prevent exports leaking out of blender binary
embree marks a few of its functions with a dll_export macro
forcibly exporting these symbols from whatever binary links
them. Given we link embree statically and we do not want these
exports in the blender binary, the macro needs to be a no-op.
2020-06-14 11:09:32 -06:00
9464260ed7 Fix T76563: Transforming an auto-aligned point won't set it aligned
Correct previous commit that was checking values not yet initialized,
causing T77796.
2020-06-15 01:07:59 +10:00
cbd894e5a8 Cleanup: remove unnecessary header
Introduced in D8007
2020-06-15 01:07:50 +10:00
725cc959c7 install_deps: Update python default version to 3.7.7.
Re T77846.
2020-06-14 09:42:20 +02:00
b325ecef9c Deps builder: Python 3.7.7
This updates python to the latest patch level available for 3.7
also updates some of the packages we rely on:

idna 2.9
urllib3 1.25.9
cerifi 2020.4.5.2
requests 2.23.0
numpy 1.17.5
2020-06-13 15:25:19 -06:00
b29b1c4ef2 UI: Use consistent order for particle display icons
The viewport, render display order matches modifiers, physics,
and the outliner.

Differential Revision: https://developer.blender.org/D7998
2020-06-13 16:58:55 -04:00
d73920831d Merge branch 'asset-uuid' into asset-engine 2020-06-13 22:54:26 +02:00
5e50380ddc Merge branch 'master' into asset-uuid 2020-06-13 22:54:07 +02:00
23d0361b30 Sculpt: Fix creation of repeated constraints in the Cloth Brush
Previously, constraints were added multiple times from different
vertices. This adds a GSet to check that the same constraint is not
being added twice when iterating over the neighbors of two different
vertices.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D8007
2020-06-13 19:15:29 +02:00
fe3ca3f6ce Fix T66786: Audio SDL: Video editor Sound muted without muting it
Porting fix for SDL 2 audio formats from audaspace upstream.
2020-06-13 15:19:03 +02:00
2a51feff99 Fix error selecting similar vertex groups after the 32nd
Replace 32bit int with bitmap to allow selecting
any number of vertex groups.
2020-06-13 16:56:23 +10:00
827959ff98 Cleanup: use const arguments to deform functions
This changes curve deform code not to set the objects inverse matrix,
this shouldn't cause problems as it's not used elsewhere afterwards.
2020-06-13 16:20:09 +10:00
dd4071b379 Cleanup: remove redundant casts 2020-06-13 15:56:40 +10:00
c5a0ce1ade Cleanup: naming for lattice deform functions
- BKE_lattice_deform_data_create    was init_latt_deform.
- BKE_lattice_deform_data_destroy   was end_latt_deform.
- BKE_lattice_deform_data_eval_co   was calc_latt_deform.
2020-06-13 15:56:40 +10:00
ca10903299 Cleanup: use 'r_' prefix for return arguments
Also improve alignment.
2020-06-13 15:56:36 +10:00
75aac463e7 Cleanup: comments, use bool return value 2020-06-13 15:16:18 +10:00
1754828e33 Cleanup: rename 'par', in deform code
Naming is from legacy code where the deforming object was the parent.
2020-06-13 15:02:47 +10:00
9f5833798c Modifier: skip edit-mesh conversion for armature, curve & lattice
This is an improvement over 2.7x which converted edit-mesh to mesh
(CDDM) for all 3 modifiers.

Overall this increases performance in edit-mode by around 15-20%.
2020-06-13 13:19:34 +10:00
a35de34eb7 Cleanup: clang-format, unused variable 2020-06-13 12:50:19 +10:00
dea2c3f256 Cleanup: spelling 2020-06-13 12:50:07 +10:00
098008f42d Fix T77295: Snapping in edit mode only works for non-selected polys/verts/edges
Caused by the optimization of `Skip EditMesh to Mesh Conversion`.

Now that EditMesh is used when the Mesh has no modifiers, do not
skip the selected elements.
2020-06-12 22:07:27 -03:00
fd8d245e6a LibOverride: Remove 'auto override' option.
Now all overrides are handled that way. Performances of the process look
decent enough, even with production characters...

If performance issues still arise, we'll investigate other solutions.

This should also make T73154 obsolete now.
2020-06-12 19:01:54 +02:00
b586f801fc Cycles: Improve CUDA and OptiX error reporting in the viewport
This patch makes the infamous "Cancel" error in the viewport a thing of the past. Instead it
now shows a more useful error message and streamlines the error handling process in CUDA.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D8008
2020-06-12 18:24:15 +02:00
Simone Barbieri
5dca72dfc9 Add ability to remove Library data-blocks through RNA API.
Just uses same code as for all the other ID types.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7995
2020-06-12 17:52:14 +02:00
dupoxy
091d801e9f UI: Use consistent order for physics display icons
The viewport, display order matches modifiers and the outliner.

Differential Revision: https://developer.blender.org/D8001
2020-06-12 11:38:22 -04:00
b1f9799508 Cloth: implement support for a hydrostatic pressure gradient.
When a fluid is put under influence of gravity or acceleration, it
forms an internal pressure gradient, which causes observable effects
like buoyancy. Since now cloth has support for simulating pressure
changes caused by fluid compression or expansion, it makes sense to
also support the effects of gravity.

This is intended for better simulation of objects filled or
surrounded by fluids, especially when constrained by collisions
or pinned vertices, and should result in more realistic shapes.

Obviously, this doesn't actually simulate fluid dynamics; instead
it is assumed that the fluid immediately adapts to changes in the
shape or acceleration of the object without friction or turbulence,
and instantly reaches a new static equilibrium.

Differential Revision: https://developer.blender.org/D6442
2020-06-12 18:19:40 +03:00
0981b55182 install_deps: bumped USD library version 19.11 → 20.02 2020-06-12 17:09:53 +02:00
cfff8aa067 USD: Library upgrade 19.11 → 20.02
This upgrade required a few changes:
- Some parts of our patch are no longer necessary, as the USD library
  now includes those changes.
- The rest of the patch needed adjustment as the `pxr/base/lib/*`
  directories in USD's source code have moved to `pxr/base/*`.
- Updated library names on Windows -- thanks @LazyDodo.

Note that this does not enable the USD Python API for inclusion in
Blender. It just aims at being an as-simple-as-possible version upgrade
of the USD library.
2020-06-12 16:56:31 +02:00
dc80fe5a3f USD: Use new material binding API
The material binding API that we used was removed in the Universal Scene
Description library version 20.02. Using this new API, the code is
compatible with both USD 19.11 and 20.02.
2020-06-12 16:37:02 +02:00
7e43bbb790 Fix T77586 EEVEE: UDIM image Texture doesn't Display properly 2020-06-12 16:17:37 +02:00
9f5cc128d9 Buildbot: Switch to devtoolset-9
Famous "should just work", but will never know until actually attempted
 to be used.

Ref T76783.
2020-06-12 16:06:54 +02:00
326db1b7cd GPencil: Make accessible via python to keyframe type
This can be requiered for some add-ons and for some reason this prop was missing in RNA.
2020-06-12 15:44:58 +02:00
9cc0597556 Functions: Wrap into blender namespace
Similar to previous commit, aims to resolve compilation on
devtoolset-6.
2020-06-12 15:39:16 +02:00
f8696742bb Fix/workaround compilation error on devtoolset-6
Smells like GCC bug [1], which is backed up by the fact that locally
GCC-10 and CLang-10 works fine.

Since the change is trivial (and, arguably, correct since there is
no real difference between tests code and actual code) seems fine to
fix.

Fix suggested by Jacques Lucke, thanks!

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
2020-06-12 15:17:17 +02:00
fd14d1cceb DRW: Avoid undefined behavior when running multiple iteration
This was caused by DST.dupli_origin not being reset properly. This had
not effect in master but has effect in EEVEE motion blur branch.
2020-06-12 14:06:53 +02:00
a809631ff2 VR: Fix too dark rendering on SteamVR
Apply the sRGB transform workaround we already apply for Monado (and used
to apply for Windows Mixed Reality).
2020-06-12 13:12:45 +02:00
f12fe3c23e VR: SteamVR is now a supported OpenXR runtime! (Windows only)
Steam just released a SteamVR update with OpenXR Developer Preview
support:
https://steamcommunity.com/games/250820/announcements/detail/2396425843528787270.

Once SteamVR is set up for OpenXR (see link above), it works with
Blender "out of the box", thanks to OpenXR!

We have to apply the sRGB transform workaround for SteamVR though,
otherwise it renders way too dark. Done in the next commit.

Note that AMD users may still only see a pink screen, because the
OpenGL-DirectX compatibility fails. I will check on a fix again.
For SteamVR on Linux we may have to wait for until it supports OpenGL
rendering for OpenXR. Alternatively, we *could* add initial Vulkan
support at Ghost level and use Vulkan<->OpenGL interoperability
extensions, Monado uses these as  well.
2020-06-12 13:12:14 +02:00
16595b9ea1 Cleanup: split object data deform functions into their own files
Move armature/curve functions into their headers,
they were previously in BKE_lattice.h
2020-06-12 16:27:46 +10:00
5549fa5466 Cleanup: use doxy sections for armature.c 2020-06-12 15:06:07 +10:00
f79856f9fb Cleanup: minor changes to deform functions
- Use 'float (*)[3]' to avoid casts.
- Remove unnecessary float[3] copy in gpencil_deform_verts.
- Use MEM_SAFE_FREE
- Use const arguments.
2020-06-12 14:39:49 +10:00
24d39620fb Cleanup: split deform functions that take target object-data
Prefer meaningful function names over redundant NULL arguments.

Also clarify variable names as it wasn't obvious the object-data
is part of the object target.
2020-06-12 13:53:25 +10:00
c02baf8b50 Cleanup: use BKE_ prefix for deform functions 2020-06-12 12:52:24 +10:00
c73ee8d998 Makefile: Add build target for release
Fixes T77353
2020-06-11 17:28:01 -04:00
526e8a3da1 GPencil: Cleanup transform code 2020-06-11 20:35:50 +02:00
a03ebe9431 UI: Adjust names for Find/Replace Set Selection
This is really doing two operation so using the ampersand makes more 
sense.
Also selection sounds better than selected.
This also adjusts the name in the text Edit menu which was an issue 
raised in T68738
2020-06-11 14:05:57 -04:00
a61ba6c73d Fix possibility to add objects in override collections.
Override collections do not support that, add proper checks in BKE code
adding objects to collections.

Also try to find a suitable collection in parents in that case.

Note that this is enforced on 'public' API level, internal code can
still bypass those checks if needed. Exposing this possibility to public
API should not be needed.
2020-06-11 17:33:06 +02:00
3d18bd5c51 BLI: define default hash function for const types 2020-06-11 16:16:44 +02:00
49af2f85c3 BLI: fix forwarding with incorrect type 2020-06-11 16:01:25 +02:00
9dffdfc84b Fixes for changes in master after last merge 2020-06-11 15:50:11 +02:00
26428a3e00 Merge branch 'asset-uuid' into asset-engine 2020-06-11 15:49:47 +02:00
a364032dff Cleanup: fix terminology in comment 2020-06-11 15:39:53 +02:00
e44045745d BLI: don't pass const pointers to placement new operator
This resulted in compile errors.
2020-06-11 15:37:09 +02:00
e22098616c BLI: include <new> header
This header defines default placement versions of operator new.
2020-06-11 15:37:09 +02:00
Jeroen Bakker
ed00b5def6 Fix T77657: NVIDIA Quadro FX4800 crash on startup
Limit support for `GLEW_ARB_base_instance` to OpenGL 4.0 and higher. NVIDIA Quadro FX 4800
(TeraScale) report that they support GLEW_ARB_base_instance, but the driver does not support
`GLEW_ARB_draw_indirect` as it has an OpenGL3 context what also matches the minimum needed
requirements.

We use `GLEW_ARB_draw_indirect` as a target for `glMapBuffer(Range)` what is part of the
OpenGL 4 API. So better disable it when we don't have an OpenGL4 context.

Note: fix should be ported to Blender 2.83 LTS

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7994
2020-06-11 15:34:35 +02:00
9385d887d1 Fix bad poll function for constraints in liboverrides. 2020-06-11 12:01:20 +02:00
15e6f9012c Merge branch 'master' into asset-uuid 2020-06-11 11:55:40 +02:00
0b6def7059 Fixes for changes in master 2020-06-11 11:54:45 +02:00
95aa8ffed5 BLI: fix printing name in print_stats methods of Map, Set and VectorSet 2020-06-11 11:21:51 +02:00
665acd2903 Fix T69497: Color Correction node ignores mask in certain cases
Happens when some of the color correction terms are mathematically
undefined: foe example, when pow() is to be calculated and the X
argument is negative.

There is no ground-truth result in such cases, so ignore such terms
entirely.

This is a generalization of D6696 from Jacques.

Differential Revision: https://developer.blender.org/D7966
2020-06-11 11:02:33 +02:00
f028760b83 BLI: make Map::Item and Map::MutableItem more accessible
This makes it easier to write range-for loops over all items
in the map without using auto.
2020-06-11 10:48:52 +02:00
a8b24ca61b Merge branch 'master' into asset-uuid 2020-06-11 10:13:12 +02:00
3f648f5b42 Fix T77171: File selector doesn't tag preferences to be saved 2020-06-11 17:24:00 +10:00
e43a948a2c Sequencer: view toggle no longer cycles over SEQUENCER_PREVIEW state
- Remove the operator, use a generic operator instead.
- Switch between PREVIEW/SEQUENCER as the mixed state isn't as useful.
- Add menu item  to make the shortcut discoverable.
- Remove unused & broken "View Type" menu.
2020-06-11 16:36:23 +10:00
e916817520 Cleanup: move sequencer view operators into sequencer_view.c 2020-06-11 16:01:47 +10:00
cc064acf0f UI: exclude context menus from menu search
This causes the search result to be less predictable as well as
including menu items multiple times.
2020-06-11 15:39:03 +10:00
a76fc2f7ed WM: utility function to iterate on menu types 2020-06-11 15:35:46 +10:00
2c463a8250 ImBuf: use more accurate DPI/PPM conversion
Use 0.0254 for conversion as 39.3700787 isn't exactly 1/0.0254
and can't be written as a round float/double.
2020-06-11 15:04:11 +10:00
0439094105 Cleanup: make the sculpt convert type follow transform convention 2020-06-10 16:36:16 -03:00
bfa5eceb89 UI: Only set panel data expand flag for active panels
This solves a crash when switching from the modifiers tab to an armature
object and expanding a panel. Thanks to Alexander Gavrilov for mentioning
the problem.
2020-06-10 14:56:52 -04:00
faf5f7b63d Cleanup: fix compiler warning after recent changes
It would be good to use override for all member functions, but doing it for
only somes generates compiler warning.
2020-06-10 20:34:01 +02:00
63930c41bc Fix Cycles viewport missing refresh when changing scene hair settings
This code was not updated for the CoW depsgraph.
2020-06-10 19:48:08 +02:00
0621c13b3e Add proper handling of liboverrides to Scene deep copy.
Followup to rB74ec37b70cbc8dc2, also missed a case in collection
deepcopy then.
2020-06-10 19:45:52 +02:00
14bd92b12f Installdeps: Fix broken commit rBe3396d8bfc94.
Not sure why final version of the change was lost...
2020-06-10 19:45:52 +02:00
91462fbb31 Cleanup: Remove no more used ED_object_single_users.
This utils was only used for scenes' full copy, and was using old
deprecated ways to deal with ID relations and such. Good riddance!
2020-06-10 19:45:52 +02:00
4f314ee5b9 Cleanup: rename BKE_scene_copy to _update.
Matches other similar cases for collection and object, and general
naming rule (copy is for generic ID copying, duplicate is for more
involved and poweful behaviors specific to an ID type).
2020-06-10 19:45:52 +02:00
eee35ebdfb Make BKE_scene_copy fully handle all duplicate modes, deep copy included.
This greatly simplifies and unifies logic.

Also addresses T77255: full scene copy will now use same preferences
parameters as object or collection duplicate to choose which data-blocks
to copy along.
2020-06-10 19:45:52 +02:00
b05fa123d7 Make `BKE_collection_duplicate able to handle master collections.
Those are then assumed already duplicated, and not touched. However, all
of ther objects and sub-collections can still be processed as with any
other regular collection...
2020-06-10 19:45:52 +02:00
474b288933 BLI: add Map.pop_default method
There is a nice use case for this in depsgraph code.

Also I added some previously missing calls to std::move.
2020-06-10 19:02:34 +02:00
20658e6a29 Fix T77047: Dyntopo Sample detail size on hidden mesh causes crash
The `Toolbar` and `Sidebar` hide the corresponding panel
`VIEW3D_PT_sculpt_dyntopo` by polling for context.sculpt_object and
context.tool_settings.sculpt. In the Active Tool in the Properties
Editor this poll does not return False though, thus the
sample_detail_size is possible from there.

Second security check (the operator poll `SCULPT_mode_poll`) checks the
active object -- that is still valid even if hidden, so we are allowed
to execute the operator. However the active object becomes NULL once the
area is switched in `sample_detail()` -- see `CTX_wm_area_set`), leading
to the crash.

Dont think there is a quick and easy way to do this in the poll from the
Properties Editor, so just check for a valid active abject in the
operator and return OPERATOR_CANCELLED if we dont have it.

Maniphest Tasks: T77047

Differential Revision: https://developer.blender.org/D7832
2020-06-10 18:46:41 +02:00
4b39de677d Fix T74101: File Browser in macOS fullscreen crashes or makes windows unusable
When closing the File Browser window after making it fullscreen, Blender would
either crash or all windows would disappear, with no obvious way to bring them
back.

The "fix" is to not allow fullscreen for File Browsers (or any future "dialog"
windows), but only maximizing. From what I can tell that's how secondary
windows are supposed to work on macOS. What we previously did seemed like
something macOS doesn't handle cleanly, and I didn't find a simple way to do so
on our side.
2020-06-10 18:40:05 +02:00
84d4447bc5 BLI: fix type forwarding in Map
Without this change, the code might do an unwanted conversion.
2020-06-10 18:27:18 +02:00
4c172f7ca6 BLI: support constructing StringRef from start and end pointer 2020-06-10 18:27:18 +02:00
2d695367a7 UI: More specific modifier move to index operator description 2020-06-10 11:23:03 -04:00
a9dfad831b Fix T77694: Start panel animation when expansion data changes
During normal drawing there is a rather complicated method to check
whether the panels should be animating. It's not set up to deal with
the panel expansion changing from outside the UI, which is now possible
with the panel expansion connected to the modifier's show_expanded
property.

The solution is to activate panel animation if setting the expansion
property has changed.
2020-06-10 11:16:55 -04:00
b0ac7a89b0 UI: Only set first bit of modifier expansion fag with Python
Only the flag for the top level panels is exposed with RNA, so this adds
a set method to only change that bit.
2020-06-10 11:08:58 -04:00
9b784668ae Cleanup: use proper enum type in parameter of BKE_scene_copy. 2020-06-10 17:01:15 +02:00
74ec37b70c Enable (deep) copy of overrides.
This commit enables basic copy of overrides on generic ID level, as well
as from (deep) copy operators for objects and collections.

So e.g. if your linked overridden caracter is in a collection, you can
now (from the outliner) Duplicate that override collection to get a new
overriding copy of the character.

We still need operators (new or modifying existing ones) to handle that
from 3DView e.g.

Note that deep copy code for objects/collections (and incidently
animdata) had to be modified to avoid duplicating/making local IDs that
remain linked ones being used by overrides ones.
2020-06-10 16:48:49 +02:00
1d0017089c Fix (unreported) disapearance of some overrides after save & reload.
The override operations generated from 'do not follow' RNA pointer
properties (i.e. pointers to other IDs) were not properly clearing their
'no more used' flag, and hence were incorrectly deleted on second save.
2020-06-10 16:48:49 +02:00
3ea04d3e11 Blenloader: Don't just crash when a struct name is not known
Related to T77524.

This brings back the old way of handling corrupted data.
2020-06-10 16:31:41 +02:00
6fe32d7fd6 Fix T77524: Don't try to write storage of node with undefined node
This cannot work, because the storagename is the empty string.
2020-06-10 16:16:03 +02:00
d62bbf4079 UI: Show library names grayed out and right-aligned in menus
Should separate the data-block name better from the library name and improve
readability.
2020-06-10 15:52:10 +02:00
93c8955a72 Mesh Edit: preserve Custom Normal vectors in topology operators.
Custom Loop Normals are normally encoded relative to the default
normals, similar to normal maps, allowing them to naturally follow
mesh deformations. Changes to mesh topology however often result
in nonsensical effects that are not desired.

The Remove Doubles operation especially (now known as Merge By
Distance) is intended as a purely topological operation, and
definitely should not change the vector of the custom normals.

This patch implements that behavior by converting the relative
encoding into an absolute vector layer for the duration of the
operation. It also modifies other Merge types in this way for
consistency, the Rip operator as their inverse counterpart;
and also Delete, Dissolve, Connect Path and Knife operators
as other examples more related to topology than shape.

On the technical side, this ports mesh_normals_loop_custom_set
to BMesh, and then uses a temporary Custom Data layer to store
the normals as vectors for the duration of the above mentioned
operations. When the normals are converted back to custom data,
the caller can choose whether to mark edges as sharp to preserve
distinct normals, or just average them instead. All but Remove
Doubles choose to average for now.

Differential Revision: https://developer.blender.org/D4994
2020-06-10 16:51:22 +03:00
a58dc25b07 Cleanup: improve custom data type names
This is related to T76659.

This just renames data type names to `CD_PROP_STRING`, `CD_PROP_FLOAT`
and `CD_PROP_INT32`. It makes them a bit more specific and removes
unnecessary abbreviations.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7980
2020-06-10 15:47:31 +02:00
cc26041d36 Depsgraph: use blender::Set instead of std::set
We decided that `blender::Set` should be the default choice for a set
data structure in Blender.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7982
2020-06-10 15:42:35 +02:00
a7ea07c677 Depsgraph: use blender::Vector instead of std::vector
We decided that `blender::Vector` should be the default choice for
a vector data structure in Blender.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7981
2020-06-10 15:33:50 +02:00
0852d13bbd Depsgraph: use native Set data structure
Differential Revision: https://developer.blender.org/D7982
2020-06-10 15:24:03 +02:00
044b824c9d Cleanup: remove unused MBALL_NOSEL flag 2020-06-10 23:01:57 +10:00
eda58c47b8 Cleanup: asan warning with bit-shifting flag 2020-06-10 23:01:57 +10:00
4fefe3ac3b BLI: rename tests from "array_ref" to "span"
This was missing in an earlier commit.
2020-06-10 14:50:29 +02:00
a71f073dfb BLI: add Map.pop_try method
I found this pattern in depsgraph code more than once.
2020-06-10 14:47:22 +02:00
75ce20a000 Cleanup: redundant headers 2020-06-10 22:34:11 +10:00
0ca0ad5318 Cleanup: move BKE_mesh_wrapper functions into own header 2020-06-10 22:34:11 +10:00
84a0a6d16c BLI: update behavior of Map.lookup_or_add
Previously, this function would expect a callback function as parameter.
This behavior is now in Map.lookup_or_add_cb. The new version just
takes the key and value directly.
2020-06-10 14:15:04 +02:00
f367f1e5a5 Cycles: Improve OptiX viewport denoising performance with CUDA rendering
With this patch Cycles recognizing when a logical OptiX and CUDA device represent the same
physical GPU and attempts to eliminate unnecessary tile copies for viewport rendering if that
is the case for all active devices. In addition, denoising is now no longer performed on the first
available OptiX device only, but instead it will try to match CUDA and OptiX
rendering/denoising devices exactly to maximize utilization.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7975
2020-06-10 14:12:13 +02:00
d12f6a90b1 Fix T77599 Image UV editor use linear interpolation 2020-06-10 13:37:04 +02:00
d4315040ad Cycles: Fix CUDA compilation after cone sampling fix 2020-06-10 13:02:43 +02:00
146473f083 GPencil: Include new Bevel parameters when convert stroke to Curve
These new parameters allow to define bevel depth and resolution.

Related to T77631
2020-06-10 11:42:35 +02:00
82f51fe913 Fix T77356: Texture Preview not taking alpha into account
Since rB329b4c3363e4 a texture preview is not rendered through the
preview.blend and a renderengine anymore [unlike materials etc.]

Alpha wasnt handled in that commit, take that into account now.

sidenote: not sure if we should be looking into drawing alpha with a
checkerboard in the background for texture previews (see texture
previews elsewhere)?

sidenote 2: might also be good to document where the "calculate" and
"invert" alpha options are still used? [looks a bit inconsistent:
compositor uses it, Image Editor as well as Render Engines dont?]

Maniphest Tasks: T77356

Differential Revision: https://developer.blender.org/D7929
2020-06-10 11:07:20 +02:00
df50104e1c Fix T77068: UV Proportional Edit "Connected Only" option affects UV
clipping (even if the proportional edit itself is disabled)

Checking T_PROP_EDIT_ALL returns true for _any_ of the options, so just
check for T_PROP_EDIT.

Note: this might expand to other similar checks (e.g. header text)

Maniphest Tasks: T77068

Differential Revision: https://developer.blender.org/D7927
2020-06-10 11:02:09 +02:00
fc8a7a44b2 Fix T77560: Bone selection crashes
The was caused by 8b347fc2cd as the old BONESEL_NOSEL flag
handled the -1 case (used for none).

Instead of checking for -1, remove these elements from the array
as selection code makes decisions based on the number of hits detected.
2020-06-10 18:04:01 +10:00
edb4e553f5 LibOverride: Fix issues related to ID name differences.
Local datablocks (including overrides) need to have a unique name, which
can then differ from the reference linked one (especially when there are
several local overrides of a same linked data).

Issue is, ID name is a 'rna name property', and as such used as
reference when dealing with override of collections of IDs, so we cannot
have a changing name.

The solution implemented here should work and is simple, but it may have
some issues in corner cases (time will say), it is not really robust.

Alternative solution would be to store ID pointers as reference in
override operations, instead of there name. But that would potentially
add quiet a lot of overhead to foreach looping in `lib_query.c`.
2020-06-10 09:38:34 +02:00
2d1b560a4e Fix T77632: Deform modifier auto-binding not working
Regression in deaff945d0
2020-06-10 15:54:05 +10:00
a4bb4b6e65 Mesh: utility functions to access wrapped mesh coordinates 2020-06-10 15:54:00 +10:00
48ca66cfe7 Fix T77195: Crash with edit-mesh viewport measurements enabled
Simplify looping over faces & tessellation data.

Regression in 6526c3ced8, the index accessed wasn't valid.
2020-06-10 13:46:10 +10:00
46e0ec05ef Cleanup: Move each special_aftertrans_update to their respective TransData file 2020-06-09 20:27:51 -03:00
63a40ed422 Cycles: Fix uniform cone sampling
This code is currently only used for the Glossy Toon BSDF, but it's a generic
building block that might be used for other things in the future.

To see why the current code does not give a uniform distribution, consider that
it chooses both angles uniformly, but the smaller the angle from the center of
the cone is, the smaller the differential solid angle is (similar to how
sampling disks by choosing radius and phi uniformly does not work).

Differential Revision: https://developer.blender.org/D7948
2020-06-09 22:19:15 +02:00
d3f83d9f95 UI: Remove extra separator in some cases 2020-06-09 15:11:14 -04:00
d1932a8ed6 Fix missing animation decorators for pointer buttons
Also, remove manually placed decorator for vertex groups in modifiers. This was
only needed because of this bug, and the layout was slightly misaligned.
2020-06-09 20:42:22 +02:00
819ebc9901 UI: Set modifier panel expansion on every redraw
This will fix situations where the modifier epansion was set elsewhere
besides the UI, like from the python console, solving the drawing part
of T77502.

Also adds  update tags to the show_expanded property, which means
the properties window redraws when the property changes.
2020-06-09 13:41:50 -04:00
cb9de95d61 Sculpt: Face Set Edit Operator
This operator performs an edit operation in the active face set defined
by the cursor position and updates the visibility. For now, it has a
Grow and Shrink operations, similar to Select More/Less in edit mode or
to the mask filter Grow/Shrink modes. More operations can be added in
the future.

In multires, this updates the visibility of an entire face from the base
mesh at once, which makes it very convenient to edit the visible area
without manipulating the face set directly.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7367
2020-06-09 19:09:50 +02:00
77789a1904 Sculpt: Pose Squash and Stretch deform mode
This implements squash and stretch as a deform mode for the Pose Brush.
It is similar to scale, but it applies different scale values in different
axis. To achieve this, the pivot local space of the transform needs to
be aligned to the segment when using this deform mode to apply the scale
in the correct direction.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7934
2020-06-09 18:49:10 +02:00
075156de9f Voxel Size Edit: Fix text not readable when zooming in the viewport
Previously the scale of the text was using object space, so when working
with scaled objects or small meshes the size of the text was wrong. Now
it calculates a scale in screen space, so the text size should be much
more predictable

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D7941
2020-06-09 18:28:41 +02:00
69b67d4f07 Fix Edit Voxel Size label in preview
The format string was wrong so it was rendering an extra % character

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7942
2020-06-09 18:27:18 +02:00
53d1a729cc UI: Avoid rebuilding Outliner tree on simple button interactions
E.g. simply on button hover changes, the tree would be needlessly rebuilt.

I wouldn't be surprised if this causes side-effects, for some state changes we
may still have to do a full rebuild.
2020-06-09 18:12:56 +02:00
ee64b595da Fix T77504: Operator search gives wrong results
Regression in e8ab0137f8
2020-06-10 01:18:17 +10:00
e1cc9aa7f2 Nodes: efficient node tree queries and inlining
This adds two data structures that wrap a node tree. However, they work
on different abstraction levels.

`NodeTreeRef` is an immutable structure that makes working with a node
tree in C++ much more efficient and convenient. It supports various
queries efficiently, that are not easily possible using just `bNodeTree`.

`DerivedNodeTree` builds on top of `NodeTreeRef`. It contains a flattened
view on the node tree, i.e. with node groups being inlined. Every inlined
node still knows its "call stack". It supports pretty much the same queries
as `NodeTreeRef`.

Both data structures come with a dot graph exporter for debugging purposes.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7628
2020-06-09 17:08:41 +02:00
b37fca650e Cleanup: Move pointcache dna to separate file
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7965
2020-06-09 17:01:54 +02:00
0cb59866af Cleanup: extract function for common function call sequence 2020-06-09 16:43:34 +02:00
4622434c34 Fix T76894: Disable clipping region selection in material/rendered mode
In this case the draw engine isn't responsible for the selection, but
the editor is.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7955
2020-06-09 16:31:40 +02:00
Evan Wilson
84a5bd9135 Fix T76984: Normal node not drawing properly in compositor
Differential Revision: https://developer.blender.org/D7827
2020-06-09 16:29:31 +02:00
4e9efa80ca Cleanup: correct enum names in comments 2020-06-09 16:23:27 +02:00
9d75f23566 BLI: remove incorrect const 2020-06-09 16:23:27 +02:00
37d68871b7 GPencil: Keep original stroke when reproject
When reproject a stroke sometimes is good to keep the copy of the original stroke to create volume effects

Related to T77639

{F8603513}

Reviewed By: mendio, pepeland

Maniphest Tasks: T77639

Differential Revision: https://developer.blender.org/D7963
50258
2020-06-09 15:46:55 +02:00
c23b1de2cf Fix T72936: Incorrect gizmo orientation with inherit rotation disabled 2020-06-09 22:35:11 +10:00
3ffb52d114 Fix T77448: Camera Solver constraint can't be converted to f-curve
A regression caused by c57f65c088 as a fix of another issue.

Added an exception for camera solver as that is always pointing
to camera object.

Since this is a regression which happened in 2.83.0 this change is
a candidate to be ported to the 2.83.1.
2020-06-09 14:06:35 +02:00
b7150183e7 Cleanup: Silence some overflow warnings in transform code 2020-06-09 08:51:51 -03:00
8522b429b5 Transform: Fixes after recent refactor
Pointed by strict compiler warnings, but some of the reports were
actually a real bugs:

- Access uninitialized memory of td_mirror_iter.

  Assuming that iterator is to point to the first element of the
  data array.

- Lattice's recalc data was never called.

There is also a fix for redundant declaration of recalcData() and
missing declaration of recalcData_lattice().
2020-06-09 12:19:44 +02:00
5620a09e0d Cleanup: move hashing of OperationIDKey to member function 2020-06-09 12:08:32 +02:00
f7c0f1b8b8 BLI: rename ArrayRef to Span
This also renames `MutableArrayRef` to `MutableSpan`.
The name "Span" works better, because `std::span` will provide
similar functionality in C++20. Furthermore, a shorter, more
concise name for a common data structure is nice.
2020-06-09 11:58:47 +02:00
7d2b4ae9c6 Fix menu operator/search clipping the last character
Noted in T77504
2020-06-09 19:25:59 +10:00
128296129a GPencil: Cleanup doxygen comments 2020-06-09 11:17:21 +02:00
74b0713d8a Fix warning-as-error about int to uint conversion in new BLI CPP code.
Was breaking build for me here...
2020-06-09 11:16:32 +02:00
874a078d86 GPencil: Improve viewlayer masking check
Check if the mask layer is used in a layer that is going to be used in the current viewlayer.

Related to T77667
2020-06-09 11:13:23 +02:00
d68e29b62c Workbench: Fix missing NULL pointer check 2020-06-09 10:59:31 +02:00
9bb7d6ed68 BLI: put C++ data structures in "blender" namespace instead of "BLI"
We plan to use the "blender" namespace in other modules as well.
2020-06-09 10:27:24 +02:00
d8678e02ec BLI: generally improve C++ data structures
The main focus here was to improve the docs significantly. Furthermore,
I reimplemented `Set`, `Map` and `VectorSet`. They are now (usually)
faster, simpler and more customizable. I also rewrote `Stack` to make
it more efficient by avoiding unnecessary copies.

Thanks to everyone who helped with constructive feedback.

Approved by brecht and sybren.

Differential Revision: https://developer.blender.org/D7931
2020-06-09 10:15:43 +02:00
50258d55e7 Cleanup: remove debug prints in py.ops.nla.bake() 2020-06-09 17:57:50 +10:00
7a0ad20e5f Fix mistake in recent fix for text editor overflow 2020-06-09 17:39:43 +10:00
1355d9cc8c Sequencer: restore behavior removed from recent refactor 2020-06-09 16:49:33 +10:00
f88d59ecf8 Fix T77148: Crash changing multiple values for sequencer strips
This was caused by assuming all strips were the same type.
2020-06-09 16:24:50 +10:00
0c4bc09092 Docs: comment text scale behavior
Avoid misunderstanding that caused T77609.
2020-06-09 15:19:31 +10:00
70a27d0a63 Fix T77609: Scale to Fit Text Box fails when text is too narrow
Caused by error in fix for T75965 (83d9ba341e).
2020-06-09 15:07:59 +10:00
f326b6a18e Cleanup: avoid addition with large strings in Python
This is known to be inefficient, use a second write call instead.
2020-06-09 13:40:51 +10:00
9f7d84b656 Cycles: Add support for P2P memory distribution (e.g. via NVLink)
This change modifies the multi-device implementation to support memory distribution
across devices, to reduce the overall memory footprint of large scenes and allow scenes to
fit entirely into combined GPU memory that previously had to fall back to host memory.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7426
2020-06-08 17:55:49 +02:00
0a907657d4 Functions: Run-time type system and index mask
This adds a new `CPPType` that encapsulates information about how to handle
instances of a specific data type. This is necessary for the function evaluation
system, which will be used to evaluate most of the particle node trees.

Furthermore, this adds an `IndexMask` class which offers a surprisingly useful
abstraction over an array containing unsigned integers. It makes two assumptions
about the underlying integer array:
* The integers are in ascending order.
* There are no duplicates.

`IndexMask` will be used to "select" certain particles that will be
processed in a data-oriented way. Sometimes, operations don't have to
be applied to all particles, but only some, those that are in the indexed by
the `IndexMask`. The two limitations imposed by an `IndexMask` allow for
better performance.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7957
2020-06-08 17:37:43 +02:00
b5846ebce7 Fix T77603: OSL parser fails when script ends with comment without newline
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7958
2020-06-08 17:01:47 +02:00
6f96dfabe5 Simulations: initial simulation state and cache
The current particle state is stored in a `CustomData` instance and
the cache is stored in `PointCache`.

The current state exists on the copy-on-write copies of the simulation,
while the cache only exists in the original data block.

This patch implements a temporary trivial particle simulation that does not
use the node system yet. It is used for testing and will be replaced soon.

`PointCache` still has some limitations that need to be overcome using
separate refactorings. For example, we need to be able to store the number
of particles in the point cache. Also we need to change which attributes
are stored for a particle system more dynamically than is currently possible afaik.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7836
2020-06-08 15:49:17 +02:00
bf4198cdaf Fix crash running "Edit Voxel Size" operator outside of a main 3D View region
Accessed `RegionView3D` data from context, which of course would only be set if
actually executed from a main 3D View region.
2020-06-08 15:45:00 +02:00
e3396d8bfc Installdeps: better handling of python versions.
now that we stick to some outdated py version, some distro (like current
debian testing) will feature several python3 dev package, but other
dependant libs like numpy are only built against current default version
of python (3.8 now in deb testing)...

In order to be able to use distro packages we need to allow using higher
versions of python, and set relevant CMake option accordingly.
2020-06-08 15:38:11 +02:00
1c189aa70a Fix T70873: Pivot Center doesn't compute mirror elements 2020-06-08 08:23:37 -03:00
335c1e48ee Cleanup: Create a header for TransData declarations 2020-06-08 08:23:37 -03:00
4f4141c8f4 Cleanup: Move TransDataSeq declaration to its TransData file 2020-06-08 08:23:37 -03:00
6e53b28898 Cleanup: Move TransDataNla declaration to its TransData file 2020-06-08 08:23:37 -03:00
e54fb1b819 Cleanup: Move each recalcData to their respective TransData file 2020-06-08 08:23:37 -03:00
826769d1c7 Cleanup: Split transform conversion of edge and uv to their own files 2020-06-08 08:23:37 -03:00
34b4dca9f1 Cleanup: Move TransSeq declaration to tansform_convert 2020-06-08 08:23:37 -03:00
0e040ef3fb Cleanup: Rename function
I forgot to remove the "_access" suffix in a previous rename.
2020-06-08 12:44:33 +02:00
f71a2fc6c3 Fix T76273 Glitches caused by glCopyImageSubData on windows + intel gpu
We limit this fix to Windows Intel GPU whose driver reports at most GL 4.4
support. This limits the fix to the range of reported GPU.
2020-06-08 12:09:51 +02:00
460c1d8e20 Revert "UI: Bevel: Show Offset type before offset amount"
This reverts commit f50222ba2e.
2020-06-08 05:40:19 -04:00
4d168e0b8c Modifiers: fix copy paste mistake in recent refactor 2020-06-08 11:01:32 +02:00
1f6d1213d2 Workbench: Use eGPUSamplerState to change texture sampling behavior
This removes some fragment shader hacks and improve the support of
different repeat & filtering modes.

This fix T77453 Image texture not repeating in viewport
2020-06-08 10:58:45 +02:00
11ba9eec70 GPencil: Show only first frame if current frame is equals or greater than current frame
Previously, the first frame was displayed from frame 0, but now, the first frame is only displayed when the current frame is equal or greater than the keyframe number.

The previous system was logical when the grease pencil was not an object, but now it seems more logical to display the keyframe if the current frame is equal to or greater than the keyframe number.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D7851
2020-06-08 09:04:25 +02:00
917ab4fbf9 UI: use term 'Merge Distance' instead of 'Merge Limit' 2020-06-07 23:40:14 -04:00
c175ff19d8 UI: Fix Wrong UI Label after recent modifier changes 2020-06-07 23:37:17 -04:00
f50222ba2e UI: Bevel: Show Offset type before offset amount
Because this controls how the amount is used in should be set first and 
is more important therefor place it at the top.

This is also consistent with other areas in Blender
2020-06-07 21:03:26 -04:00
b4ef87afb6 UI: Modifiers: Use Falloff subpanel for Weight Proximity
This makes the UI consitent with the weight edit modifier
2020-06-07 20:17:19 -04:00
24904301e5 Fix: Wrong UI Label for mesh cache play mode 2020-06-07 19:09:35 -04:00
112c86fd5d UI: Use Proper Title Case 2020-06-07 19:00:47 -04:00
281319653e UI: Do Use term 'Subsurf' 2020-06-07 18:16:56 -04:00
ccbf858bb8 Fix T77487: Only disable Multires Buttons in Edit Mode
Previously the operator buttons were disabled in every mode but
edit mode and sculpt mode.
2020-06-07 11:49:38 -04:00
00961d062a GPencil: Fix unreported Shift+F OPacity key not working
This wa snot working since the new scale thickness was included.
2020-06-07 16:18:02 +02:00
dc6cee4724 Fix T77520: GPencil viewlayer filter produce crash with masking layers
If a layer is used for masking, it cannot be filtered by viewlayer because the masked layer needs to have the mask layers in the draw pipeline.

This check is only done in final render.
2020-06-07 13:06:39 +02:00
8f25cfdbfd Refactor: use new api for some remaining functions in writefile 2020-06-07 12:22:19 +02:00
3e07d958f1 Cleanup: remove unused functions 2020-06-07 12:14:17 +02:00
561a81eb24 Refactor: use new api in remaining direct linking code 2020-06-07 12:12:48 +02:00
f6524032ca Refactor: use new api for direct linking pointcache and particle system 2020-06-07 12:05:30 +02:00
a7de01aaa9 Refactor: use new api for direct linking customdata 2020-06-07 11:58:58 +02:00
5f7007a962 Refactor: use new api for direct linking packedfile and dverts 2020-06-07 11:55:27 +02:00
1626c526f8 Refactor: use new api to check if endian switch is required 2020-06-07 11:51:07 +02:00
ab2b9821fc Cleanup: remove unused test_pointer_array function 2020-06-07 11:48:18 +02:00
eb31037503 Refactor: use new api for direct linking movie clip data 2020-06-07 11:47:37 +02:00
01132d4a83 Refactor: use new api for direct linking id properties 2020-06-07 11:42:58 +02:00
5ff8a2ca0e Refactor: use new api to simplify IDP_DirectLinkGroup_OrFree 2020-06-07 11:34:23 +02:00
b8afd4e8bb Refactor: use new api for direct linking bones, view layer and userdef 2020-06-07 11:30:32 +02:00
f0f666541e Refactor: use new api for direct_link_id_common 2020-06-07 11:16:14 +02:00
959267ffcc Refactor: use new api for direct linking preview image 2020-06-07 11:08:38 +02:00
766b3037eb Refactor: use new api for direct linking curvemapping and its callers 2020-06-07 11:07:08 +02:00
ee4732ca22 Refactor: use new api for direct linking gpencil modifiers and shaderfxs 2020-06-07 11:00:48 +02:00
ce9a64c454 Refactor: use new api for direct linking modifiers 2020-06-07 10:56:06 +02:00
a99a8061ae Refactor: use new api for direct linking keying sets, node sockets and pose 2020-06-07 10:35:34 +02:00
6c6658ccc0 Refactor: use new api for direct linking animdata 2020-06-07 10:27:42 +02:00
aed11c673e Fix T77456: Broken vertex paint undo on high-poly objects.
This is a critical fix that should also be backported to 2.83.1

Fairly stupid bug in fact, code detecting changes across undo steps was
assuming that each BHEAD (a block of data in blendfiles) would not be larger
than one memory chunk... Which is the case in alsmost every situation,
besides some super-heavy geometries, and other similar things (images
would also be affected e.g.).
2020-06-06 16:18:39 +02:00
03a693922d Cleanup: Fix typo and other issues in some comment. 2020-06-06 16:18:39 +02:00
5198cb1813 Fix typo in recent bone selection refactor
Thanks to @jbakker for pointing this out.
2020-06-06 23:32:46 +10:00
6c114a139b Refactor: use new api for direct linking paint curve, cachefile and workspace 2020-06-06 14:46:27 +02:00
033b6a7fb4 Refactor: use new api for direct linking particlesettings, movieclip, mask, linestyle and palette 2020-06-06 14:43:06 +02:00
9b3fda0357 Refactor: use new api for direct linking armature, action, nodetree and brush 2020-06-06 14:34:57 +02:00
a5e56efc98 Refactor: use new api for direct linking lattice, world, camera, speaker, sound, lightprobe and collection 2020-06-06 14:25:34 +02:00
18b57d3e2c Refactor: use new api for direct linking light, vfong, text, ipo and key 2020-06-06 14:17:27 +02:00
9a3d54943a Refactor: use new api for direct linking mball, material, texture and image 2020-06-06 14:10:43 +02:00
1800127355 Refactor: use new api for direct linking mesh and curve 2020-06-06 14:02:03 +02:00
cf3e617913 Refactor: use new api for direct linking scene and object 2020-06-06 13:55:59 +02:00
125acdf933 Refactor: use new api for direct linking hair, pointcloud, volume and simulation 2020-06-06 13:28:00 +02:00
0eb969dd99 Refactor: use new api for direct linking screen and gpencil 2020-06-06 13:20:20 +02:00
1d066050b6 Refactor: use new api in direct_link_windowmanager 2020-06-06 12:53:59 +02:00
5146034aa9 Blenloader: simplify list reading api 2020-06-06 12:53:36 +02:00
Marcelo Demian Gómez
7bd73f562a Fix T77473: Removing GPencil vertex group mix data
When removing a vertex group from a Grease Pencil object, if the vertex group is not the last one that was added, the information for the remaining groups weights gets mixed up.

Minor edit of the patch for clang format.

Differential Revision: https://developer.blender.org/D7943
2020-06-06 10:19:26 +02:00
f5781384ae GPencil: Fix unreported fill helper lines not displayed
When use the helper lines (red lines) with fill tool, the lines were not displayed in some situations.
2020-06-06 10:04:56 +02:00
a39cc5ae4d Fix for T77478: Quiet Conversion Error/Warning
Quiet warning/error about int and float multiplication.

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

Reviewed by Ray Molenkamp
2020-06-05 17:05:06 -07:00
b74cc23dc4 UI: Ability to Print Bold and Italics
Adds the ability to print text in bold or italics style, synthesized from a single base UI font.

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

Reviewed by Brecht Van Lommel
2020-06-05 15:39:17 -07:00
fc672ce8e2 Refactor: use new api for remaining direct data writing 2020-06-05 21:55:45 +02:00
60b8db587f Blenloader: new write_struct_at_address api functions 2020-06-05 21:55:45 +02:00
f0047e6754 Refactor: use new api for write_movieclip and write_keyingsets 2020-06-05 21:55:45 +02:00
0f1361bbc3 UI: Apply Latest Changes to Multires Modifier
These changes didn't make it through the transition to the new UI layout.
- Add "has_displacement" check
- Add "sculpt_levels" property
- Give subdivide operators the operator name so they work
2020-06-05 15:31:04 -04:00
5340556710 Refactor: remove temporary IDP_WriteProperty_new_api 2020-06-05 21:22:43 +02:00
7949953b1e Refactor: use new api in write_userdef 2020-06-05 21:19:03 +02:00
a77350cce2 Cleanup: remove unused functions 2020-06-05 20:56:36 +02:00
69c9204026 Refactor: use new api for write_curvemapping and its users 2020-06-05 20:55:42 +02:00
26fb0d4258 Refactor: use new api to finish write_object 2020-06-05 20:46:27 +02:00
c3e88fdd03 Refactor: use new api for write_pointcaches 2020-06-05 20:40:38 +02:00
a943b65f1b Refactor: use new api in write_area_map 2020-06-05 20:34:59 +02:00
4df20c058d Refactor: use new api in write_bone 2020-06-05 20:34:59 +02:00
2ee95e91f7 Remove context check from constraint and shaderfx edit poll
This mirrors 1f78e86070 from 2018 for mesh modifiers.

Differential Revision: https://developer.blender.org/D7940
2020-06-05 14:30:15 -04:00
70ad18b94d Fix T77335: Circle Select tool selects faces perpendicular to the view
Internally the face dots are being drawn when the Edges option of the
overlay (not the selection mode) is disabled.
2020-06-05 14:49:57 -03:00
b91b90f0dd Fluid: Cleanup internal Python object names
Manta Python objects should not carry the global ID in their names.
2020-06-05 18:52:33 +02:00
b16a85fe0b Cleanup: use 'r_' prefix for return arguments in math_color 2020-06-06 00:46:25 +10:00
9b099c8612 UI: Drag and Drop Modifiers, Layout Updates
This patch implements the list panel system D7490 for modifiers.
It also moves modifier drawing to a callback in ModifierTypeInfo
in line with the extensible architecture refactoring goal T75724.

This adds a PanelRegister callback and utilities for registering
panels and subpanels. It also adds the callbacks for expansion saving
and drag and drop reordering described in D7490.

These utilities, callbacks, and other common UI elements shared
between modifiers live in MOD_ui_common.c.

Because modifier buttons are now in panels, we can make use of
subpanels for organization. The UI layouts also use the single
column layout style consistently used elsewhere in Blender.
Additionally, the mode-setting buttons are aligned and ordered
consistently with the outliner.

However, the large number of UI changes in this patch may mean
that additional polishing is required in master.

Thanks to William Reynish (@billreynish) who did a fair amount of the
layout work and to Julian Eisel (@Severin) for consistent help.

Differential Revision: https://developer.blender.org/D7498
2020-06-05 10:41:03 -04:00
4e70e0e384 LibOverride: RNA: Cleanup no more needed property-specific override flags. 2020-06-05 16:37:40 +02:00
846dde590f Cleanup: use doxy sections for sequencer edit, select 2020-06-06 00:12:31 +10:00
0f64de6b9b Cleanup: compiler warning 2020-06-06 00:12:28 +10:00
e9659d0e6e Fix failing assert when dragging panel close to region edge
Forgot to include this change from Julian Eisel @Severin in the
previous commit.
2020-06-05 10:05:47 -04:00
859505a3da UI: Pan 2D Region When Dragging to Boundary
This adds a modal operator called Edge Pan, which is meant to run invisibly
while something inside a region is being dragged. This patch applies this
to dragging panels, but it can be used elsewhere too.

The speed (which is defined relative to how far the mouse is beyond the
boundary) and delay are easily adjustible. and the speed also increases
smoothly from a start value to a max to make it feel more interactive
and less robotic.

Differential Revision: https://developer.blender.org/D7465
2020-06-05 10:01:20 -04:00
1270984e13 Refactor: use new api in write_customdata 2020-06-05 15:54:19 +02:00
b77834ceb1 Refactor: use new api for writing modifiers 2020-06-05 15:38:36 +02:00
a8afe509da Refactor: use new api in write_nodetree_nolib 2020-06-05 15:22:43 +02:00
0ee98c654e Refactor: use new api in write_animdata 2020-06-05 15:15:28 +02:00
abeda01ac6 GPencil: Improve Vertex Paint in filled areas
When use the Tint tool, it was very difficult to tint the filled areas if the strokes had very few points or the area was big.

Differential Revision: https://developer.blender.org/D7936
2020-06-05 15:11:08 +02:00
67b17684e6 Fix T77396: crash in memfile undo code after recent optimizations.
Optimizations in rBcda15408582e8de5b405 do not guarantee anymore that
consecutive memchunks in two consecutive undo steps are actually about
the same data (and hence can share the same buffer when unchanged).

This buffer sharing can now happen without any particular order, so we
need to change the process when 'merging' two undo memfiles together.

Note that existing code was not logically correct either, even with
previous undo storage code, since it would blindly transfer ownership of
the buffer to the second memchunk, without checking whether the first
one was actually the owner of it or not (a same buffer can be shared by
matching memchunks in many consecutive memfiles/undo steps).
2020-06-05 14:54:54 +02:00
ff5d24f8be Refactor: use new api in write_iddata 2020-06-05 14:45:32 +02:00
f797a5406d Refactor: use new api for writing object, mesh and particlesettings 2020-06-05 14:41:42 +02:00
a6cd77bad1 Refactor: use new api for writing camera, lattice, vfont and key 2020-06-05 14:32:26 +02:00
0a41a85bf3 Refactor: use new api for writing curve, mball, image, light, world, material and texture 2020-06-05 14:25:07 +02:00
b78fb8b987 Cleanup: remove unused sequencer marker code from 2.4x 2020-06-05 22:18:58 +10:00
74fa600ede Sequencer: split select side of frame out of the select operator
The select operator was getting overloaded with functionality
unrelated to selecting the strip at the mouse position.

- Don't save settings, allowing the keymap only to include
  non-default options.

- Fix selecting strips overlapping the current frame
  overwrite all flags.
2020-06-05 22:14:02 +10:00
d850daf416 Refactor: use new api for writing collection, action and gpencil 2020-06-05 14:09:35 +02:00
43294e5f49 Refactor: use new api in write_scene 2020-06-05 13:55:45 +02:00
60a786e711 Refactor: use compile time dna struct ids in blenloader api 2020-06-05 13:55:45 +02:00
5ed2ed28ab CodeCleanup: Supressed warning 2020-06-05 13:40:22 +02:00
dc69747f72 Refactor: use new api for writing linestyle, cachefile, hair, pointcloud, volume and simulation 2020-06-05 13:29:46 +02:00
e4e8259d39 Refactor: use new api for writing movieclip, mask, probe, nodetree, brush, palette and paintcurve 2020-06-05 13:14:39 +02:00
2396daf921 Refactor: use new api for writing screen, armature, text and speaker 2020-06-05 12:53:39 +02:00
a1d55bdd53 Refactor: use new api in write_workspace 2020-06-05 12:35:20 +02:00
473aaa389c Cycles: Enable OptiX on all Maxwell+ GPUs 2020-06-05 12:33:00 +02:00
56da8dae67 Refactor: use new api in write_windowmanager 2020-06-05 12:29:40 +02:00
0e6c648f3f Refactor: Move IDProperty writing to new API 2020-06-05 12:21:19 +02:00
7d32a259bf Installdeps: make embree use TBB.
Following changes done to makedeps in rBc7329da14b22.
2020-06-05 12:01:18 +02:00
1c5479167f Cleanup: Strict compiler warning 2020-06-05 11:59:45 +02:00
48075b2c05 Blenloader: New API that will be used for blenloader decentralization
Design Task: T76372

This part of a larger refactoring towards a more extensible architecture
in Blender: T75724

The API is defined in `BLO_read_write.h`. It adds the small data structures
`BlendWriter`, `BlendDataReader`, `BlendLibReader` and `BlendExpander`.
Those contain context about the current read/write operation. Furthermore,
it adds many functions with the prefixes `BLO_write_*`, `BLO_read_*` and
`BLO_expand_*`.

Lib linking and expanding will probably be handled by the more generic libquery
system eventually. The corresponding parts of the API can be removed then.
2020-06-05 11:44:36 +02:00
ce7409fd13 Cleanup: use ED_object_ prefix for constraint functions
- ED_object_constraint_list_from_constraint was get_constraint_lb
- ED_object_constraint_list_from_context    was get_active_constraints
- ED_object_constraint_active_get   was get_active_constraint
- ED_object_constraint_active_set   was ED_object_constraint_set_active
2020-06-05 18:59:47 +10:00
5e55153c89 LibOverride: Cleanup: remove useless per-property override flag.
now that we have more 'global' ways to control that, we can save us
quiet a fwe calls....
2020-06-05 10:57:21 +02:00
191edd224a Cleanup: rename suffix 'conv' to 'convert' 2020-06-05 18:27:38 +10:00
f2d5c53966 Fix accessing online manual for PropertyGroups
Alternate fix for the issue raised in D7837
2020-06-05 18:09:00 +10:00
e8b8e16b24 Code Cleanup: fcurve function naming 2020-06-05 09:30:15 +02:00
fe6be70875 CleanUp: Introduce BKE_fcurve_create 2020-06-05 08:41:35 +02:00
e3a32a22bf GPencil: Channel Lock tooltip
After talking with UI team, we decided to change the tooltip.
2020-06-05 08:27:52 +02:00
0aa2c10ad1 Cleanup: remove braces from previous commit (no functional changes) 2020-06-05 16:12:22 +10:00
8b347fc2cd Armature: increase maximum delectable bones from 4096 to 8192
Remove BONESEL_NOSEL which isn't needed.

Addresses issue raised in T77378.
2020-06-05 16:04:35 +10:00
fd63220a35 Cleanup: maybe uninitialized variable warning 2020-06-05 14:55:15 +10:00
9e96c6d054 Cleanup: spelling 2020-06-05 14:34:00 +10:00
b2d1c4873f Cleanup: remove unnecessary inline header
Caused by lsp/clang applying *fixes* automatically, tsk.
2020-06-05 14:33:59 +10:00
c7329da14b Build: use TBB as Embree tasking system
This avoids launching additional threads and solves some console warnings on
Linux + AMD Ryzen CPU.
2020-06-05 00:58:31 +02:00
0b28f0410c Fix make deps build errors with conflicting Boost system packages 2020-06-05 00:58:31 +02:00
b168c255aa GPUTexture: Make GPU_texture_unbind_all faster on newer opengl version 2020-06-04 21:28:19 +02:00
ba5b303c88 DRW: Fix T77370: Redundant anti aliasing/blur effect 2020-06-04 21:28:19 +02:00
1d72fc5a1a LibOverride: Add Pointer properties to 'overridable by default'.
There is in fact no reason not to do so, RNA pointers are either to
other IDs (which is properly handled by default diffing code), or to
sub-structures that should almost always  be diffed as well.

Exceptions (like backward ID pointers or strictly runtime caches and
data) are to be handled with proper 'no comparison' flag in any case.
2020-06-04 18:06:47 +02:00
d71f9b9886 LibOverride: cleanup Collection case.
This should not give any real difference, those were already
overridable.
2020-06-04 18:06:47 +02:00
f2a0532111 Disable gravity in Draw Face Sets brush
Applying gravity to this brush does not make much sense and undo/redo
won't work correctly as it uses a different undo type.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7925
2020-06-04 18:05:46 +02:00
15ed2f841c Fix Sharpen mesh filter in Multires
Instead of accumulating displacement for each vertex into the neighbors, accumulate the opposite displacement from each neighbor into the vertex. I think this is the same and it does not produce artifacts in Multires.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D7508
2020-06-04 18:04:07 +02:00
caca3d9c97 installdeps: fix bad FFMPEG official version number.
re T77035.
2020-06-04 17:35:33 +02:00
c7a2ed69be GPencil: Fix Lock Frame Dopesheet tooltip
The old tooltip was not clear enough
2020-06-04 16:55:19 +02:00
c604d2762f Fix T77358: Gpencil can't select geometry within transparent layers
This was an old check of opacity for editable layers, but with new system it's not needed because you can use the edit lines.
2020-06-04 16:41:46 +02:00
733a3e3a70 Fix T77164: scaling/rotation fails for 3 selected NURB points 2020-06-05 00:40:14 +10:00
3da4724f72 Fix T77367: Blender's snap package ignores command line options 2020-06-05 00:39:45 +10:00
fd061f61c7 GPUShaderInterface: Reduce creation time on some drivers.
Querying GL_UNIFORM_BLOCK_INDEX seems to be a problem on apple drivers.
2020-06-04 15:28:45 +02:00
3b4ef08d68 Fix Grease Pencil panel showing as first panel in render properties
Move it lower next to the Freestyle panel.
2020-06-04 14:44:00 +02:00
41866070d3 Cleanup: remove unused flag 2020-06-04 14:37:20 +02:00
953c232db3 Fix T77276: Generating Python API docs raises many warnings 2020-06-04 22:31:54 +10:00
10b34ad697 GPUShaderInterface: Change builtin array to array of location/bind
This reduce the base size of the shaderinterface from 400 to 136 bytes.
Improves memory usage and cache coherency when querying a lot of uniforms
at once.
2020-06-04 14:17:06 +02:00
5837de6879 Cleanup: DRW: Add comment and remove bitfields. 2020-06-04 14:17:06 +02:00
7534bbfa34 GPUShaderInterface: Add Builtin Uniform blocks query
This makes the query of theses mandatory uniforms faster.
2020-06-04 14:17:06 +02:00
1438c1cfd5 Merge branch 'blender-v2.83-release' 2020-06-04 13:49:50 +02:00
30395a491f Fix T77073: Objects cannot be activated after collection exclude
When excluding a collection containing the active object in either
texture paint or particle edit mode, the object could not be reactivated
when the collection was re-enabled. This is because the object's mode
was left in TEXTURE_PAINT or PARTICLE_EDIT, and the activation code did
not have cases to handle these modes.

This moves the code that is run when toggling out of texture paint or
particle edit modes to functions so activation can properly toggle off
the respective interaction mode.
2020-06-04 21:48:04 +10:00
c7c3908b8e Cleanup: split particle & texture paint mode switching into utility functions 2020-06-04 21:36:33 +10:00
0f32029522 Fix T77315 Overlay: Selection Highlighting not working with complex scene
Was caused by a UBO bind to the wrong slot.
2020-06-04 12:57:26 +02:00
78017916f7 Fix error removing the image paint cursor
Mix up with imapaint.paintcursor & imapaint.paint.paint_cursor
Remove imapaint.paintcursor since it wasn't used.

Also rename paint_cursor_start_explicit() to paint_cursor_start(),
removing the existing paint_cursor_start() since it took the paint
struct from the context, a value that's known by all callers.
2020-06-04 20:24:57 +10:00
465a9f65de Cleanup: remove window manager argument for paint cursor API
This caused an additional argument when exiting object modes
and many other low level functions which don't need to access context.

This simplifies fixing T77073.
2020-06-04 18:41:16 +10:00
1a23b0be97 LibOverride: Make all modifiers properties overridable.
This is second and last part of T77083.
2020-06-04 10:26:05 +02:00
f9892bd6cf Fix T77264: Mantaflow: Liquid checkbox doesn't turn on while switching
between fluid types

When switching to gas, the fluids were not actually destroyed, leading to
the situation that they were then destroyed when actually switching to
liquid.

Maniphest Tasks: T77264

Differential Revision: https://developer.blender.org/D7907
2020-06-04 09:49:05 +02:00
244ed645e0 GPencil: Improve selection in Fill areas
Now when use selection if the selection area is inside a filled area, the stroke is selected. Before it was necessary to select the border of the stroke.
2020-06-04 09:37:12 +02:00
fe13f3db81 UV: use selection for 'Seams from Islands'
Use bmesh connectivity data to simplify logic.
2020-06-04 17:10:45 +10:00
67a617e196 Cleanup: move auto-execute operators into userpref_ops.c 2020-06-04 16:23:07 +10:00
7aa47083d0 Cleanup: update sections for wm_files.c 2020-06-04 16:10:01 +10:00
Johan Walles
e723ec04fb UI: more informative light energy description based on light type 2020-06-04 13:23:47 +10:00
67b10fcc22 Fix error in recent fix for T77290 2020-06-04 12:40:17 +10:00
b94ab93dfb Eyedropper: Support get samples from other windows
This fix T77226

Differential Revision: https://developer.blender.org/D7910
2020-06-03 15:45:57 -03:00
a4e0bccb87 Cleanup: Use ELEM Macro 2020-06-03 13:34:24 -04:00
0849af4591 Linux: update appdata for 2.83 release 2020-06-03 19:10:51 +02:00
86385d7ebd Fix build error for Cycles standalone
This does not affect the Blender release.

Ref D7915
2020-06-03 19:10:51 +02:00
bd68312cb6 LibOverride: Make camera data-block properties overrideable.
Note that you still have to make overrides of obdata IDs by hand (and
deal with remapping of pointers yourself) for now.
2020-06-03 18:57:49 +02:00
2cdfc1b4af LibOverride: Make constraints fully overrideable.
All settings of constraints should be overrideable now.
Modifiers will follow tomorrow.

Part of T77083.
2020-06-03 18:46:36 +02:00
fc1bb36668 LibOverride: fix debug timing code. 2020-06-03 18:46:18 +02:00
26aa64b688 Fix broken split layout in encoding options
The "Max B-frames" options were misplaced. Uses the usual layout of a checkbox
together with the number button now.
Reported by Peter Fog (@tintwotin), thanks!
2020-06-03 18:12:29 +02:00
ef0ff4aaf2 GPencil: Fix unreported error in Dots Strokes material initialization
The materials was not initializated in the right mode.
2020-06-03 18:01:34 +02:00
dbb1f56e55 Fix T77290: Crash displaying vertex colors in edit mode
Regression from deaff945d0, follow logic from d98ae27f02.
2020-06-04 01:52:33 +10:00
de9c04c287 Cleanup: clang format, warning 2020-06-04 01:18:39 +10:00
51cd6d22c5 Cleanup: GPUMaterilal: Texture Node: Remove unused functions 2020-06-03 16:43:31 +02:00
15a24f3d7f GPUMaterial: Fix shader compilation when using UDIM textures 2020-06-03 16:42:54 +02:00
Nathan Letwory
211b6c29f7 Remove trailing space 2020-06-03 17:38:22 +03:00
96eab08755 DRW: Always unbind texture after drawing
This fix issues with the image editor
2020-06-03 16:24:04 +02:00
b2dcff4c21 GPUMaterial: Rework/simplify image texture filtering
This use the latest GPUTexture change to use the sampler state to avoid
the pole issues instead of using GLSL hacks.

This should fix T73942: Eevee mipmaps not respecting border mode.

Note that this also fix some discrepencies between cycles and eevee (like
boxmapping + clip).
2020-06-03 16:18:50 +02:00
054923c860 GPUMaterial: Rework/simplify environment texture filtering
This use the latest GPUTexture change to use the sampler state to avoid
the pole issues instead of using GLSL hacks.
2020-06-03 16:18:50 +02:00
47bdb28841 GPUTexture: Fix samplers configuration typo 2020-06-03 16:18:50 +02:00
91cc1f38ae GPUMaterial: Add support for different sampler state per image sampler
This bridge between the new sampler state support from GPUTexture and
draw material handling.

The Sampler State is just the one from the texture for now. No change in
logic.
2020-06-03 16:18:50 +02:00
866e067d65 GPUTexture: Add support for binding textures with custom sampler states 2020-06-03 16:18:50 +02:00
4184371fb0 Fix T77156: GPencil view layer filter by layer not working
This was removed by error during the refactor done in 2.83.

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

Reviewers: @fclem
2020-06-03 15:57:09 +02:00
df17ee202b Fix T77203: Mantaflow Bake All cannot be resumed
The manual is also more explicit about this now (rBM6725).
2020-06-03 14:54:40 +02:00
Nathan Letwory
82e3bd4bbb Ensure submodules are at correct commits for 2.83 2020-06-03 15:23:39 +03:00
Nathan Letwory
3c9f80c898 Move 2.83 from beta to release 2020-06-03 15:21:51 +03:00
Nathan Letwory
dc8475ec6a Splash: new image for 2.83 by Ian Hubert 2020-06-03 15:19:34 +03:00
cda1540858 Undo: Detect/find proper memchunk for a given ID during undo step writing.
Most of the time current (based on order) system works fine, but when you add
or rename (i.e. re-sort) some ID, every data/memchunk afterwards would be out
of sync and hence re-stored in memory (and reported as changed).

Now we are storing the ID's session_uuid in the memchunks, which allows to
actually always find the first memchunk for an already existing ID stored in
previous undo steps, and compare the right memory.

Note that current, based-on-order system is still used almost all of the time,
search in the new ghash is only performed for a few data-blocks (when needed at all).

Reviewed By: brecht

Maniphest Tasks: T60695

Differential Revision: https://developer.blender.org/D7877
2020-06-03 12:07:45 +02:00
Bastien Montagne
3384bb2c66 RNA: add option to enable by default lib overridale flag of defined properties.
Similar to the one allowing to deactivate DNA check, etc.

Will helps reduce verbosity when making many new properties overridable.

Note that pointer properties always remain non-overridable by default,
since basically only ID pointers should be.

Reviewed By: brecht

Maniphest Tasks: T77083

Differential Revision: https://developer.blender.org/D7906
2020-06-03 11:18:11 +02:00
0e14eb7b31 Cleanup: DRW: Remove support for ModelViewProjectionMatrix
This has been replace by manual model+viewproj transform inside the shader.
2020-06-03 11:02:56 +02:00
75015f27ba Cleanup: DRW: Remove support for builtin matrices 2020-06-03 11:02:56 +02:00
d4f1efad00 DRW: Remove use of builtin matrices and replace by common_view_lib 2020-06-03 11:02:56 +02:00
3e4c8d48aa Cleanup: DRW: Remove builtin 3D only shader usage 2020-06-03 11:02:56 +02:00
55f8758b87 GPUImmediate: Fix array uniform not working 2020-06-03 11:02:56 +02:00
59bfcd8c5d Cleanup: DRW: Remove persistent uniform functions 2020-06-03 11:02:56 +02:00
9b0543389b Fix domain voxel size indicator drawing
Use already calculated cell_size directly.

Part of T77030.
2020-06-03 10:58:42 +02:00
6f21137722 Object: refactor mode switching
Functionality here has become confusing over time,
this removes duplicate, similar functions, preferring to set the mode
instead of toggle, enter, exit.

Mode switching utility function behaved differently regarding undo,
'ED_object_mode_toggle' for example didn't skip the undo push
where 'ED_object_mode_set' did.
Some callers chose these functions based on the intended undo behavior,
even when toggling didn't make sense.

There was also ED_object_mode_generic_enter which was similar to
ED_object_mode_set, instead of the reverse of ED_object_mode_generic_exit.

Simplify object mode switching internals:

- Replace ED_object_mode_generic_enter with ED_object_mode_set.
- Remove ED_object_mode_toggle as nearly all callers needed to check
  the current mode so toggling would set the mode argument correctly.
- Use ED_object_mode_set for the object mode switching operator
  to simplify logic.
- Add ED_object_mode_set_ex which has an argument to disable undo,
  needed when loading undo data needs to set the mode.
- Remove unused ED_object_mode_exit.
2020-06-03 18:29:06 +10:00
53cb1a32db Cleanup: remove ED_gpencil_setup_modes from object mode set
Grease pencil mode switching functions already call this.
2020-06-03 18:26:02 +10:00
3b6e223a03 Fix app-template warning disabling a template without a Python module 2020-06-03 14:46:52 +10:00
f0df4d6c35 Fix T67577: Add-on unregister can't access preferences on factory reset 2020-06-03 14:46:52 +10:00
2749e6a639 Cleanup: remove redundant call to addon_utils.reset_all()
This is already called by wm_homefile_read
2020-06-03 14:46:52 +10:00
2004f9a342 Cleanup: move shared functionality to wm_file_read_pre
This matches wm_file_read_post.
2020-06-03 14:46:52 +10:00
45b5f4e3df Cleanup: minor changes to wm_homefile_read
Move app_template assignment to the top of the function,
this simplifies further changes.
2020-06-03 14:46:52 +10:00
a5e9f024f2 Fix T77289: Crash when typing negative numbers
This was caused by an oversight in rB45dbc38a8b15. When the next operation
character is found the offset is shifted in the original string. The remaining
length has to be recalculated with that offset before shifting the remaining
characters to make room for the ")".
2020-06-03 00:37:26 -04:00
2e52b3206c PyDoc: Fix warnings from out of bounds include statement 2020-06-02 18:21:42 -04:00
650dedfd10 Cleanup: GPUTexture: Remove uneeded bind 2020-06-02 23:44:22 +02:00
a1f9eebc0b DRW: Remove automatic bind locations and use hardcoded locations for textures
This cleanup use the recent changes in shader interface to allow querying
the binding location a texture should use.

This should aleviate all issue we have with texture state change recompiling
the shaders at drawtime.

All binds are now treated like persistent binds and will stick until a new
shading group bind a different shader. The only difference is that you can
still change it with a new subgroup or same shader shgroup.

Since unbinding can be heavy we only do it when using `--debug-gpu`.
2020-06-02 23:44:22 +02:00
47eccac21c GPUShaderInterface: Fix out of bound reads 2020-06-02 23:44:22 +02:00
ee4bafc63a GPU: Texture: Remove multibind tracking
This is more of a limitation than it is a solution.
2020-06-02 23:44:22 +02:00
beef67d1df GPUShader: Bind shader for interface creation
This will fix the bindpoints not being set at interface creation
2020-06-02 23:44:22 +02:00
ea92f8207a Revert "UI: Fix T77173: Report Background Colors for 2.83 Release"
This reverts commit 7fc0053c27.
2020-06-02 15:59:37 -04:00
e391b3e0fb Merge branch 'blender-v2.83-release' 2020-06-02 15:58:38 -04:00
a87eee65fc Fix T76196: Curve Display hides wires as soon as any part has faces [due
to filling/extrude/etc]

Caused by rB6da097136cf4.

The file in the report has some parts of the curve object generate faces
[due to success in filling] and some others dont [where filling isnt
possible].

rB6da097136cf4 disabled the wires/curves drawing whenever any faces
would be generated (but the only way to see all wires was to set the
Fill Mode to None then).

So now only skip the wires/curves drawing if we are _not_ in wireframe
viewport shading and the object's viewport display options is above
'WIRE'.

This is an alternative fix to D7594 (and I think the better alternative,
thx @stevewarner suggesting this).

Maniphest Tasks: T76196

Differential Revision: https://developer.blender.org/D7874
2020-06-02 21:42:34 +02:00
7fc0053c27 UI: Fix T77173: Report Background Colors for 2.83 Release
This is a temporary solution for T77173 for the 2.83 release. D7203
provides a more long term solution for future releases.

This adds theme colors for the three report backgrounds, setting them
to the color used in 2.82. A separate commit in the addons repository
will follow for changes to the bundled themes.

Differential Revision: https://developer.blender.org/D7908
2020-06-02 15:04:46 -04:00
85098bdb89 Fix T76776: Implement vertex_visibility_get for PBVH_GRIDS
This was missing from when Face Sets were enabled in Multires, so it was
always considering that all vertices in the grids are visible. This
should also fix other unreported bugs.

Reviewed By: sergey

Maniphest Tasks: T76776

Differential Revision: https://developer.blender.org/D7809
2020-06-02 20:52:46 +02:00
071cc71fb0 Cleanup: Use const context for some UI templates
- uiTemplateID: Straightforward, just const for the template
    and the functions it calls
  - uiTemplateCacheFile: Create a function in rna_ui.c because
    the generated RNA callback doesn't have const context.

Differential Revision: https://developer.blender.org/D7895
2020-06-02 14:09:01 -04:00
dcdbcf1ec1 Fix: Crash Edit Mode Selection RCS 2020-06-02 19:57:02 +02:00
Tautvydas Andrikys
ffb3365fb2 Fix T63588: Cycles unnecessarily updates background importance sampling map
With modifications by Brecht to solve T77273, crash enabling portal lights.
2020-06-02 19:48:51 +02:00
0465086223 Merge branch 'blender-v2.83-release' 2020-06-02 19:48:45 +02:00
52cc412e0f Revert "Fix T63588: Cycles unnecessarily updates background importance sampling map"
This reverts commit 33ce0cb5a1.

Fix T77273: crash enabling portal lights. The optimization for background
updates can be added back later for 2.90 and 2.83.1.
2020-06-02 19:44:12 +02:00
572c472754 Cleanup: Always use pbvh in PBVH BKE files
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7889
2020-06-02 19:40:08 +02:00
4153606edd Fix: Crash When Selecting In Edit Mode
TaskGraph wasn't initialized in `DRW_draw_select_id`
2020-06-02 19:09:38 +02:00
b08caeb92b Sculpt: Improve twist axis in Pose FK mode
Previously, the twist rotation was aligned using the stroke location.
This was causing unexpected results when rotating some Face Sets rigs.
Now the intersection with the first Face Set in the flood fill is used,
which produces much better results.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7900
2020-06-02 18:39:41 +02:00
ca09625dcc Cleanup: Remove unused grab delta in Pose Brush
The grab delta is not used in do_pose_brush_task_cb_ex, so there is no
reason to add it to SculptThreadedTaskData

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7901
2020-06-02 18:38:20 +02:00
417ebc3845 UI: Expand linked/overriden collections by default in the Outliner
When linking or overriding an instanced collection, the new collection item in
the Outliner is now un-collapsed by default.
Linking and overriding is typically used in production scenes, where
collections tend to contain many items (children, grand-children, etc.). If all
collections in that hierarchy are expanded by default, the Outliner gets
flooded with items. So users ended up manually collapsing the collections.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
bd3ab27410 Library Overrides: Don't move collections to Scene Collection when overriding
When using the "Make Library Override" operator on instance collections, keep
the overriden collection in the parent collection of the instance empty.
Previoulsy the collection would be added to the scene collection, which was
confusing and not what users expected. It was placed there for a reason after
all.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
1743326889 Library Overrides: Unlink instance empty after "Make Library Override"
Unlink (delete if single-user) collection instance empty once an override is
added to the collection through the "Make Library Override" operator. It isn't
used as a collection instance anymore then so the emtpy is an annoying left
over that has no purpose.

Part of T76555.

Reviewed by: Andy Goralczyk, Bastien Montange.

Differential Revision: https://developer.blender.org/D7626
2020-06-02 17:59:08 +02:00
cdf0d95a50 Fix T77126: Documented frame_change_pre and frame_change_post handlers
The documentation for the `frame_change_pre` and `frame_change_post`
handlers was really sparse, and suggested that `frame_change_pre` is
called before the frame changes. This is not the case; it's called after
the frame has changed, but before the dependency graph has been updated
for it.

No functional changes, just updated documentation.

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

Reviewed by: sergey
2020-06-02 17:31:45 +02:00
6a70d7e09f Fix utterly broken versionning code for weight modifier.
Own fault in some recent patch rewiew/commit...
2020-06-02 17:30:02 +02:00
9d9f35d946 Cleanup: factorize duplicated code in WVG modifiers' RNA. 2020-06-02 17:30:02 +02:00
5ef44dd83f Cleanup: unused argument 2020-06-03 01:05:25 +10:00
9713df4e92 Merge branch 'blender-v2.83-release' 2020-06-03 00:59:56 +10:00
2c204432df Merge branch 'blender-v2.83-release' 2020-06-03 00:59:52 +10:00
e69f70e11f Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.

Better leave the fix for 2.9 series.
2020-06-03 00:59:45 +10:00
50994eace6 Fix T66967: skin modifier crash scaling skin radius to zero 2020-06-03 00:59:44 +10:00
b18c2a3c41 EEVEE: Refactor of eevee_material.c
These are the modifications:

-With DRW modification we reduce the number of passes we need to populate.
-Rename passes for consistent naming.
-Reduce complexity in code compilation
-Cleanup how renderpass accumulation passes are setup, using pass instances.
-Make sculpt mode compatible with shadows
-Make hair passes compatible with SSS
-Error shader and lookdev materials now use standalone materials.
-Support default shader (world and material) using a default nodetree internally.
-Change BLEND_CLIP to be emulated by gpu nodetree. Making less shader variations.
-Use BLI_memblock for cache memory allocation.
-Renderpasses are handled by switching a UBO ref bind.

One major hack in this patch is the use of modified pointer as ghash keys.
This rely on the assumption that the keys will never overlap because the
number of options per key will never be bigger than the pointed struct.

The use of one single nodetree to support default material is also a bit hacky
since it won't support concurent usage of this nodetree.
(see EEVEE_shader_default_surface_nodetree)

Another change is that objects with shader errors now appear solid magenta instead
of shaded magenta. This is only because of code reuse purpose but could be changed
if really needed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7642
2020-06-02 16:58:07 +02:00
eba3aa1837 Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.

Better leave the fix for 2.9 series.
2020-06-03 00:54:29 +10:00
b82cb0ad32 Cleanup: GPU: Remove GPU_shaderinterface_uniform_ensure 2020-06-02 16:46:38 +02:00
38cfcdd51b DRW: Remove defered uniform creation 2020-06-02 16:46:38 +02:00
cb59ef1032 OCIO: GLSL: Avoid undefined behavior
Set ubo binding after shaderinterface creation as GPU_shaderinterface_create
will call glUniformBlockBinding.
2020-06-02 16:46:38 +02:00
Jeroen Bakker
0749cff957 Depsgraph: Remove unneeded RNA_path_resolve
Found during research of {T77124}. In `build_driver_data` an identical
 RNA_path is resolved twice. In stead of resolving it twice this patch
will construct the `property_exit_key` based on the resolution of
`property_entry_key`.

This change isn't noticeable for users. Just a cleanup as it isn't
needed to do the same logic twice.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D7872
2020-06-02 16:02:59 +02:00
Jeroen Bakker
752139556f BVHCache: Performance
This patch changes the BVHCache implementation. It will use
a primitive array in stead of the ListBase. The locking is also
changed from a global lock to a per cache instance lock.

The performance of `gabby.blend` available on the cloud increased from 9.7
fps to 10.5 fps.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7817
2020-06-02 16:01:14 +02:00
Jeroen Bakker
bf34b0c8f4 DrawManager: Graph Task Scheduling
This patch uses a graph flow scheduler for creating all mesh batches.
On a Ryzen 1700 the framerate of Spring/020_02A.anim.blend went from 10 fps to 11.5 fps.

For each mesh where batches needs to be updated a sub-graph will be added to the task_graph.
This sub-graph starts with an extract_render_data_node. This fills/converts the required data
from Mesh.

Small extractions and extractions that can't be multi-threaded are grouped in a single
`extract_single_threaded_task_node`.

Other extractions will create a node for each loop exceeding 4096 items. these nodes are
linked to the `user_data_init_task_node`. the `user_data_init_task_node` prepares the userdata
needed for the extraction based on the data extracted from the mesh.

Note: If the `lines` and `lines_loose` are requested, the `lines_loose` sub-buffer is created
as part of the lines extraction. When the lines_loose is only requested the sub-buffer is
created from the existing `lines` buffer. It is assumed that the lines buffer is always
requested before or together with the lines_loose what is always the case (see
`DRW_batch_requested(cache->batch.loose_edges, GPU_PRIM_LINES)` in `draw_cache_impl_mesh.c`).

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7618
2020-06-02 15:54:45 +02:00
0a00fbd265 Fix T66967: skin modifier crash scaling skin radius to zero 2020-06-02 23:45:51 +10:00
21443056b7 Turn most flags in BlenderDefRNA into proper bool. 2020-06-02 15:18:14 +02:00
43ec8c287f Cleanup: RNA: use BlenderDefRNAtruct named members initialization. 2020-06-02 15:14:10 +02:00
cecda64e2e GPU: ShaderInterface: Refactor to setup all uniform at creation time
This remove the complexity of queriying the locations at runtime and
allows for more performance and upfront binding specifications.

The benefit of doing everything at creation time is that we can assign binding
points in a predictable order which is going to be somewhat the same for
every similar shader.

This also rewrite GPU_vertformat_from_shader to not use shaderface.

This is to keep the shaderface simple. If it becomes necessary to not query
the shader after creation (i.e: vulkan?) we could just create the vert
format in advance at compilation for PyGPU shaders.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7879
2020-06-02 12:11:39 +02:00
bdda53fdb2 GPU: Texture: Replace internal sampler state by explicit state object
This makes it easier to track as well as allowing us to sample the same
texture with different sampling parameters (which should fix the related
T73942 in the long run).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7831
2020-06-02 10:47:56 +02:00
074d469165 Merge branch 'blender-v2.83-release' 2020-06-02 18:39:28 +10:00
ae2f21f378 Fix T76533: Gizmo uses active face center in edge selection mode
Only use the active face when it's selected.
2020-06-02 18:38:58 +10:00
ea516bed72 Merge branch 'blender-v2.83-release' 2020-06-02 10:33:26 +02:00
6aef27602a Cleanup: use C++'s nullptr instead of our own C NULL define, in C++ code. 2020-06-02 10:32:21 +02:00
b724922f1a Merge branch 'blender-v2.83-release' 2020-06-02 10:26:14 +02:00
428c0f9ad5 Fix T77192: Crash when opening bunny.blend file.
New depsgraph code handling drivers was not checking for possible NULL
rna_path, as done everywhere else in code...
2020-06-02 10:21:19 +02:00
c6957e50e8 Merge branch 'blender-v2.83-release' 2020-06-02 18:06:31 +10:00
81f817e7b4 Fix T72088: Missing header redraw when transform changes snap 2020-06-02 18:05:00 +10:00
17d8e7f833 Merge branch 'blender-v2.83-release' 2020-06-02 16:24:30 +10:00
de6c935261 Cleanup: code comments for mode switching
Comment on mode switching cases that are supported,
including the issue from recent regression T77217
which is easy to miss since it's not used in the default key-map.
2020-06-02 16:12:36 +10:00
Johan Walles
9c410c77eb UI: rename Cycles point light Size to Radius, for consistency and clarity
Differential Revision: https://developer.blender.org/D7888
2020-06-02 08:08:59 +02:00
59e793d3bd Cycles: add missing light angle for distant lights in XML reading
Contributed by howetuft.

Differential Revision: https://developer.blender.org/D7891
2020-06-02 08:08:52 +02:00
a8907e409a Merge branch 'blender-v2.83-release' 2020-06-02 08:08:43 +02:00
Stefan Werner
c7280ce65b Cycles: Added shadow terminator offset parameter.
A new user parameter can be used to shift the shadow terminator
towards the light source. With it, one can hide some of the
artifacts that appear on coarse meshes with smooth shading.

Note that this technique is not engery conserving.

This is based on the work by the Appleseed renderer team.

Differential Revision: https://developer.blender.org/D7634
2020-06-02 07:27:14 +02:00
7881c251f3 Fix build error in Cycles standalone without guarded allocator
Solution suggested by howetuft.

Differential Revision: https://developer.blender.org/D7892
2020-06-02 06:27:39 +02:00
Garry R. Osgood
389d550412 Fix T77106: Cycles crash baking with AO shader node
Differential Revision: https://developer.blender.org/D7890
2020-06-02 06:25:08 +02:00
18cda8be87 Cycles: change perspective depth pass to be more standard
Now it matches Eevee, OpenGL and other renderers. Panoramic camera depth passes
are unchanged, and are still distance from the camera center.
2020-06-02 04:54:44 +02:00
98c301d25e Fix NaN in Cycles environment texture importance sampling in some scenes
Cause identified by Ray Molenkamp.
2020-06-02 04:54:39 +02:00
f58e76119a Fix T77239: snap 3D cursor in edit-mode 2020-06-02 12:19:35 +10:00
4f3e686cad Cleanup: Remove Obsolete Current Frame Indicator Drawing Code
This code was made obsolete by the changes to the animation editor
scrubbing areas in D4654.

Differential Revision: https://developer.blender.org/D7898
2020-06-01 22:12:09 -04:00
8b63c6241d Fix snap3d crash (missing NULL check) 2020-06-02 10:50:53 +10:00
1d4bae8566 Sculpt: Cloth Filter
This tool is similar to the cloth brush, but it applies the cloth
simulation deformation to the whole mesh in an uniform way. The
simulation can be controlled using the mask to pin vertices and the face
sets to define force action areas.

It uses the same solver as the cloth brush which now no longer depends
on StrokeCache.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7857
2020-06-01 22:37:06 +02:00
3778f168f6 Sculpt: Pose Brush Face Sets FK mode
This Pose Brush origin mode simulates an FK deformation in the entire
model when clicking on the face sets, as they were controls of a fully
rigged character. Combined with the previous Face Sets modes that allow
creating IK chains, the pose brush should now be able to simulate most
of the common rigs deformations.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7839
2020-06-01 22:30:01 +02:00
5c54a609a9 Cleanup: Remove unused flag 2020-06-01 17:20:28 -03:00
91fb07f361 Fix mesh filter using the wrong face set as active
This was returning the wrong face set in cases where the active vertex
has more than one available face set.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7858
2020-06-01 22:18:59 +02:00
3cce8afe2c UI: Rename "View Camera Center" Op to "Frame Camera Bounds"
The current name isn't very specific about what the operator does.
The operation is more about lining up the edges with the viewport
edges than centering the view.

Differential Revision: https://developer.blender.org/D7866
2020-06-01 11:35:16 -04:00
b0038b8d73 Fix T77139: UI: Add "View Camera Center" to View Menu
The "View Camera Center" operator was not accessible by the new menu search.

Differential Revision: https://developer.blender.org/D7865
2020-06-01 11:34:07 -04:00
45dbc38a8b Fix T74552: Distribute negatives in number input
This applies a relatively simple solution for fixing some unintuitive
cases in unit handling.

Currently entering -1m50cm evaluates to -0.5m, and similarly 1'6"
evaulates to just half a foot. So effectively there's an implied + just
between the numbers, which is quite confusing.

This works by adding parentheses so the negative distributes to the
block of values before the next operator.

For example:
|         Before         |           After            |
| `-1m50cm + 1m -2m50cm` | `-(1m50cm) + 1m -(2m50cm)` |
|   `-4m + 0.5 / -1.1`   |   `-(4m) + 0.5 / -(1.1)`   |
|         `-1'6"`        |         `-(1'6")`          |
|        `-1e-2cm`       |        `-(1e-2cm) `        |

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7813
2020-06-01 08:22:27 -04:00
8d670546f9 Merge branch 'blender-v2.83-release' 2020-06-01 12:12:57 +02:00
31cf87a29e Fix py api doc gen script after recent versionning changes. 2020-06-01 12:10:56 +02:00
19f3f6cd85 Merge branch 'blender-v2.83-release' 2020-06-01 19:00:23 +10:00
c204e3348c Fix T77217: Object mode toggle doesn't work
Toggling object mode to the previous wasn't working, also resolves a
case when toggling modes would cause an extra, unnecessary mode switch.
Own regression in 5159b8e1ea.
2020-06-01 18:56:43 +10:00
9936e23b85 Merge branch 'blender-v2.83-release' 2020-06-01 16:27:23 +10:00
10966926ce Merge branch 'blender-v2.83-release' 2020-06-01 16:27:18 +10:00
520f08aa56 Fix T77241: NDOF navigation doesn't work with the knife tool
Also allow NDOF with loop-cut.
2020-06-01 16:21:30 +10:00
49bd44f5c8 Cleanup: unused variable warning
Also remove unnecessary function return value.
2020-06-01 15:04:47 +10:00
81c33f0ba7 Cleanup: clang-format 2020-06-01 15:04:30 +10:00
c71be9a552 UI: rename "Select Playhead" to "Select -> Side of Current Frame"
Make this consistent with meshes select side of active,
also rename "Under" to "Overlap" as this is confusing since
strips can be considered above/under each other
relative to their channels.
2020-06-01 15:00:25 +10:00
946ae26349 UI: use term current frame instead of playhead
Avoid mixing different terminologies up,
current frame is used in a majority of Blender.
2020-06-01 15:00:25 +10:00
c315e56434 Cleanup: warning 2020-06-01 15:00:25 +10:00
89cd9f110b Fix T77043: Incorrect cache invalidation when changing resolution.
Invalidate cache of scene, not scene strips using said scene.
2020-06-01 06:25:36 +02:00
d4483b6d15 Cleanup: error building on Linux 2020-06-01 14:14:21 +10:00
f18ed7ad89 Fix T67577: Add-on unregister can't access preferences on factory reset 2020-06-01 14:06:55 +10:00
Peter Fog
b5cfb23fa7 VSE UI: Text panel adjustments
This patch adjusts a number of text panel elements:

- The text entry widget has become larger in order to distinguish it from the strip name.
- Wrap has been moved up under the text, since this doesn't relate to bounding box.
- Alignment X/Y has been renamed to Anchor X/Y, since this is the achor point of the text point, and not the Alignment of the text.
- Offset and Crop was completely missing from the Text strip panel, these has been added.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D7869
2020-06-01 05:41:09 +02:00
Peter Fog
adf9ff6359 VSE UI: Add a proxy menu to Preview/View menu
Add Proxy Setup, Build and View to a menu in the Preview View menu.

Reviewed By: ISS, billreynish, pablovazquez

Differential Revision: https://developer.blender.org/D7734
2020-06-01 05:32:36 +02:00
Peter Fog
42dcb1090b VSE: Use color picker for color strip.
Reviewed By: billreynish, ISS

Differential Revision: https://developer.blender.org/D6114
2020-06-01 05:17:20 +02:00
Peter Fog
102a7ae2d9 VSE: Add warnings for failed proxy encoding
Add more descriptive warnings if building proxy fails.
Prevent progressbar from showing if no valid strip is selected.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7689
2020-06-01 05:12:06 +02:00
Peter Fog
95e3356a27 VSE: Add select under playhead, and shortcuts for left, right, under.
Add `UNDER` option for `left_right` property of `sequencer.select` operator.
Add Equal as shortcut for select under playhead, and move Insert Gaps to backspace + ctrl.
Add extend shortcut for left, right under options.
The function is added to Select > Playhead menu.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7679
2020-06-01 04:39:40 +02:00
d0e028a78e Merge branch 'blender-v2.83-release' 2020-06-01 12:12:06 +10:00
d5a92b188b Cleanup: warnings 2020-06-01 12:06:34 +10:00
fcccee0c33 Cleanup: Remove unnecessary step in calling snap callback 2020-05-31 18:28:52 -03:00
14af27e63d Fix T77194: Force global orientation on select constraint (Shift MMB) not working
This feature was a hack to prevent mmb select to print the orientation from menu in pre 2.80 versions.
Removing this feature as it is no longer an issue.
2020-05-31 18:28:52 -03:00
4cb883b6b2 Deps: Update OIIO + ImageLibs + OSL + Helpers
This is the cluster of OIIO and friends , since they are all kinda tangled best to deal with this as a single unit

OIIO 2.1.15.0
png 1.6.37
jpeg 2.0.4
opencolorio 1.1.1
tiff 4.1.0
OSL 1.10.10
pugixml 1.10
openjpeg 2.3.1

Differential Revision: https://developer.blender.org/D7727
Reviewed by: brecht
2020-05-31 13:15:40 -06:00
6f1056ae63 Deps: iconv 1.16 2020-05-31 10:33:11 -06:00
ba711824b3 Fix T77206: G + MMB Doesn't work in Graph Editor if the transform orientation is set to 'Local'
Scene orientation is used only for 3DView.
2020-05-30 18:11:50 -03:00
347c191292 Remove leftover debugging code 2020-05-30 18:11:50 -03:00
9d725fc0cf Merge branch 'blender-v2.83-release' 2020-05-30 17:33:34 +02:00
ec26260132 GPencil: Fix unreported wrong Sculpt brushes initialization in Templates
The Sculpt brushes were not properly initialized when use 2D template or other templates.

Also, using the default template (not factory settings) could be situations where the brushes were not updated.

This problem was introduced when some versioning code was removed in order to avoid duplicated brush creation.
2020-05-30 17:33:09 +02:00
515e8e4f7c Fix T77166: Transforming bone with constraint does not follow mouse position
Bug introduced in rBc75a665c442e
2020-05-30 12:12:36 -03:00
55598269d2 Cleanup: Deduplicate code 2020-05-30 11:28:53 -03:00
a574478d90 Fix T77183: Axis moves with object when constraint movement and using local transform 2020-05-30 11:10:07 -03:00
3d014fa815 Cleanup: Initialize gizmo snap keymap before using 2020-05-30 10:59:27 -03:00
63bcee81f6 GHOST/wayland: use 'is_dialog' flag to prevent drawing into same window 2020-05-30 12:23:39 +01:00
2ee94c954d Fix LayerTypeInfo for CD_PROP_COL
This was introduced in rBd7282537f016 and had the wrong struct name
specified, leading to errors in writing/saving.

Stumbled over this when testing a color layer for pointclouds.

Differential Revision: https://developer.blender.org/D7882
2020-05-29 20:08:38 +02:00
a9689737b3 Cleanup: Use Consistent Capitalization of "Anti-Aliasing" 2020-05-29 13:57:40 -04:00
664c608fb7 Merge branch 'blender-v2.83-release' 2020-05-29 19:43:32 +02:00
691a1e3357 EEVEE: Fix memory leak when using SSS render pass.
Differential Revision: https://developer.blender.org/D7876
2020-05-29 19:42:53 +02:00
D. O
907cab45ff Modifiers: add invert vgroup weights options to operands of Mix modifier.
Please note that vertices which are in a vgroup are not affected by this
option (which means that affected vertices from 'selection' modes remain
the same). Only the weights of selected vertices get inverted.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7811
2020-05-29 18:55:28 +02:00
c93a88413d Merge branch 'blender-v2.83-release' 2020-05-29 18:05:04 +02:00
Cody Winchester
43853d0528 Fix: Array modifier start cap not updating with object changes
When setting the start cap of the array modifier it does not update when
updating the start cap objects geometry.

This patch switches the property update to rna_Modifier_dependency_update,
the same as the end cap which works properly.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D7584
2020-05-29 17:56:42 +02:00
Brecht Van Lommel
a86b5df005 Blender: change bugfix release versioning from a/b/c to .1/.2/.3
The file subversion is no longer used in the Python API or user interface,
and is now internal to Blender.

User interface, Python API and file I/O metadata now use more consistent
formatting for version numbers. Official releases use "2.83.0", "2.83.1",
and releases under development use "2.90.0 Alpha", "2.90.0 Beta".

Some Python add-ons may need to lower the Blender version in bl_info to
(2, 83, 0) or (2, 90, 0) if they used a subversion number higher than 0.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.83/Python_API#Compatibility

This change is in preparation of LTS releases, and also brings us more
in line with semantic versioning.

Fixes T76058.

Differential Revision: https://developer.blender.org/D7748
2020-05-29 17:48:26 +02:00
Peter Fog
67795c90fc VSE: Remove delete confirmation pop-up
It is not needed with the current undo system.

Differential Revision: https://developer.blender.org/D7807
2020-05-29 09:53:52 -04:00
d1bc233ffe Undo: Writefile: fix 'id changed' detected when resorting IDs.
The ListBase next/prev pointers will change everytime you add or rename
an ID, also for 'neighbors' data-blocks in the list, causing unnecessary
'changed' detection.

This info is not needed in blendfile anyway, so just NULLify it.
2020-05-29 14:30:02 +02:00
1d2b89304a Fix T77130: Visually broken/stepped wireframe in object mode (regression)
Create a new shader for the selection fix.

Differential Revision: https://developer.blender.org/D7873
2020-05-29 11:59:40 +02:00
Manuel Castilla
582d3153a1 Fix T73972: Collection in outliner grayed out when all collection children are disabled
There is no reason to have the children enable/disable state to
influence the parent collection. Specially considering that the parent
collection itself can have objects that would be visible.

Reviewed by: dfelinto, brecht

Differential Revision: http://developer.blender.org/D7864
2020-05-29 11:31:49 +02:00
7022c73249 Keymap: remove explicit 3D cursor entry for add tool
Passing through events to place the cursor, as other tools do.
2020-05-29 18:13:44 +10:00
8ec59757d1 Gizmo: fix crash in recent snap gizmo addition 2020-05-29 16:12:44 +10:00
654fde2dd2 PyAPI: use bpy_rna_types_capi.c to set type methods
Remove use of '_bpy' as an intermediate module to store functions
which were then assigned in bpy_types.py.
2020-05-29 15:55:25 +10:00
e115b7b06d PyAPI: support static & class methods for C RNA API methods
Previously the static/class flag was ignored,
always using class methods.
2020-05-29 15:55:20 +10:00
5510d5825b Keymap: swap shift and alt for interactive add tool
Match original proposal.
2020-05-29 13:18:50 +10:00
d1f4adab24 Cleanup: spelling, correct reference to 'Mesh.mcol' 2020-05-29 12:58:29 +10:00
dbdb8a3355 Cleanup: line length, single quote enums, invalid URL 2020-05-29 12:45:46 +10:00
5ec18ae4ab Docs: replace warnings with note for complexity information
Reserve warnings for situations such as corrupt data which can
cause crashes.
2020-05-29 12:42:09 +10:00
2deb6c5177 Fix for T77111: Joins Areas Without Creating Invalid Edges
Properly align every involved edge when performing 'tolerant' area joins.

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

Reviewed by Brecht Van Lommel
2020-05-28 11:34:31 -07:00
Peter Fog
1be79dc2a0 VSE UI: Add buttons for swap Effect strip inputs
The feature where the active strip determines what strip will be the
first input in effect strips can be quite a puzzle for users.
The operator to swap the inputs is hidden in the Strip menu.

This adds the swapping to the Effect sidebar panel.

Differential Revision: https://developer.blender.org/D7849
2020-05-28 14:17:22 -04:00
Peter Fog
155cd03599 VSE UI: Move Scene strip and Mask strip above Adjustment in Sidebar
This is consistent with the other strip specific properties.

Differential Revision: https://developer.blender.org/D7677
2020-05-28 12:53:06 -04:00
Peter Fog
b8bcbaaf0e VSE UI: Rename Scene Strip Panel and Move View Panel Up
- Rename "Scene Preview/Render" to "Scene Strip Display",
   since this relates to Scene Strips.
 - Move the "Scene Strip Display" down, so the view settings are on top.

Differential Revision: https://developer.blender.org/D7676
2020-05-28 12:42:44 -04:00
Peter Fog
82cbf93f20 VSE UI: Group Show Elements in View Menu, Use Consistent Naming
Use the "Show..." syntax for Show elements in View menu.

Differential Revision: https://developer.blender.org/D7344
2020-05-28 12:23:11 -04:00
Peter Fog
6cbb56418f VSE UI: rename Trim Offset to Slip Offset
The operator was at some point renamed from Trim to Slip,
but not yet in the header text.

Differential Revision: https://developer.blender.org/D7712
2020-05-28 12:15:41 -04:00
Peter Fog
a099478cad UI: Use Heading to Remove Text strip Shadow Subpanel
The new "heading=" option allows for a more simple way to expose the
Text strip Shadow operator.

Differential Revision: https://developer.blender.org/D7535
2020-05-28 12:11:53 -04:00
3923062d13 Cleanup: GPU: Fix warning 2020-05-28 14:04:52 +02:00
a9073ccb68 Merge branch 'blender-v2.83-release' 2020-05-28 13:43:57 +02:00
ff1040c6fe GPencil: Reduce aliasing for subpixel lines 2020-05-28 13:42:39 +02:00
59b730b643 GPU: Fix compilation warning about uninitialized values 2020-05-28 13:42:11 +02:00
c7a7dc743d Cleanup: DRW: Remove array suffix from uniform name 2020-05-28 13:42:11 +02:00
bf690ecd39 DRW: Add DRW_shgroup_uniform_vec4_array_copy 2020-05-28 13:42:11 +02:00
68d6b73fde Readfile: move all calls to 'id_us_ensure_real' to direct_link functions.
That kind of 'own' ID management has really nothing to do in lib_link
code.
2020-05-28 12:13:16 +02:00
1335f2d272 Fix T65889: Hair Particles not updating when using image sequence 2020-05-28 10:47:01 +02:00
806db47fd8 Depsgraoh: Fix missing texture node allocation
It was causing wrong binding for image animation: since there was no
ID node for texture at the moment of build_animdata original texture
ID was passed to the callback. This is not what is supposed to happen.

This is part of fix for T65889.
2020-05-28 10:47:01 +02:00
3d2f143000 Cleanup: remove unused struct members from RenderStats 2020-05-28 16:57:19 +10:00
4ddb7a33a4 Cleanup: spelling 2020-05-28 16:42:31 +10:00
5c8ccad652 Fix cone primitive creating duplicate vertices
Using remove double wasn't reliable as the matrix argument
could cause vertices to be further apart than the threshold allowed for.

This happened when adding cones using the new add tool.
2020-05-28 16:17:00 +10:00
122cb1aea8 Object: new add object tool, currently for primitive types
- Interactively adding primitives with two clicks.
- Scene orientation used for new objects.
- Depth [view-plane, axis-plane, surface]
- Origin [base, center]
- Primitive types [cube, cylinder, cone, uv-sphere, ico-sphere ]
- Settings for object types in the top-bar.

Shortcuts:

- Snapping (Ctrl).
- Constrain 1:1 aspect (Shift).
- Toggle center (Alt).

Part of T57210 design task.
2020-05-28 15:08:58 +10:00
16943c0146 Object: add scale argument to creation operators
Needed for to create objects of a specific size.
2020-05-28 14:34:00 +10:00
d35a33ef72 Gizmo: add flag for gizmos to ignore keymap events
Needed for the snap gizmo not to steal mouse events from the tool.
2020-05-28 14:34:00 +10:00
cdcbcca25e Cleanup: missing braces warning 2020-05-28 14:34:00 +10:00
d7282537f0 CD_PROP_COL datalayer
This implements a generic color datalayer and its functions. Based on
D5975.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7838
2020-05-27 20:04:46 +02:00
80d6421f28 Ruler: Remove highlight hack 2020-05-27 14:27:37 -03:00
0b793514fa Cleanup: Use bitmaps insteand of bool and char arrays
This was propsed in D7059, so I applied it to the rest of the code

Reviewed By: campbellbarton, sergey

Differential Revision: https://developer.blender.org/D7480
2020-05-27 18:36:05 +02:00
79e529c5ec Fix T77109: Cycles viewport render crash after object add and undo 2020-05-27 18:03:17 +02:00
7e80aa7ca6 Update the default Face Set when creating Face Sets from visible
If all vertices in the sculpt are visible create the new face set and
update the default face set. This is the same as disabling the overlay,
so it will not have the extra performance cost of rendering a colored
face set twice that gives no information.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7530
2020-05-27 17:35:54 +02:00
735119dd0f Fix T75096: Crash when using liquid simulation as dynamic paint brush
Reviewers: sergey

Differential Revision: https://developer.blender.org/D7853
2020-05-27 16:15:06 +02:00
49c295813b Merge branch 'blender-v2.83-release' 2020-05-27 15:31:03 +02:00
28d9368538 Fix T76947: Optix realtime denoiser progressively reduces brightness of very bright objects
The input data to the OptiX denoiser was clamped to 0..10000 as required, but it could easily
exceed that range with a high number of samples (since the data contains the overall sum). To
fix that, divide by the number of samples first and multiply it back in after the denoiser ran.
2020-05-27 15:17:47 +02:00
efa4ae17f0 OpenSubdiv: Only store edges topology for non-smooth edges
This change makes it so vertices of edge are only stored when edge
has non-zero crease. This allows to lower memory footprint of 1.5M
faces from 78 MiB to 54 MiB in the case all creases are zero.

Meshes with crease are more hard to predict due to array-based
storage, so it all depends on index of edge with crease. Worst case
(all edges are creased) still stays at 78 MiB.
2020-05-27 12:07:16 +02:00
8cd17a9529 OpenSubdiv: Allow any order of edge topology/sharpness assignment
Makes it possible to set adjacent vertices after edge sharpness.

Initially it seemed like useful sanity check, but with time it
became rather a burden.
2020-05-27 12:07:16 +02:00
42cb1e3a2c OpenSubdiv: Optimize faces storage in mesh topology
Avoid per-face pointer and allocation: store everything as continuous
arrays.

Memory footprint for 1.5M faces:

- Theoretical worst case (all vertices and edges have crease) memory
  goes down from 114 MiB to 96 MiB (15% improvement).

  This case is not currently achievable since Blender does not expose
  vertex crease yet.

- Current real life worst case (all edges have crease) memory goes
  down from 108 MiB to 90 MiB (17% improvement).

- Best case (no creases at all) memory goes down from 96 MiB to 78 MiB
  (19% improvement).
2020-05-27 12:07:16 +02:00
c971731b8f OpenSubdiv: Add regression tests for mesh topology
While this looks trivial it already allowed to catch issues in one
of previous attempt to optimize memory usage. It will totally be
useful for an upcoming refactor of face topology storage.
2020-05-27 12:07:16 +02:00
38b50fe393 OpenSubdiv: Hide individual topology elements
Move all API to happen via MeshTopology.

This is a preparation for an upcoming memory optimization.
2020-05-27 12:07:16 +02:00
15bcfc5b19 OpenSubdiv: Cleanup, remove unused code
There is no need in edge map anymore.
2020-05-27 12:07:16 +02:00
12c42738f3 OpenSubdiv: Add TODO avoid checking face-varying topology for equality 2020-05-27 12:07:16 +02:00
8e9fdd2f31 OpenSubdiv: Move preliminary geometry counters check to mesh topology 2020-05-27 12:07:16 +02:00
a444400900 OpenSubdiv: Keep explicit storage of base mesh faces
Allows to perform comparison by doing linear comparison of indices.

Before cyclic match was used to deal with possibly changed winding from
OpenSubdiv side.

Speeds up comparison (and hence improves FPS), makes code more reliable
nut uses more memory.
2020-05-27 12:07:16 +02:00
1e0de7c2ea OpenSubdiv: Compare edge topology
This change makes it so topology refiner comparison will check vertices
of all existing/provided edges.

The initial claim that due to manifold nature of mesh there is no need
in "deep" edges check was wrong: some areas might only provide edges
with non-zero creases. So if crease of one edge goes changes from 1.0
to 0.0 and crease of other edge goes from 0.0 to 1.0 the old comparison
code would not have caught it.
2020-05-27 12:07:16 +02:00
6a8193e505 OpenSubdiv: Refactor, move mesh topology comparison to own file
Makes it easier to follow and extend.
2020-05-27 12:07:16 +02:00
ece54172d0 OpenSubdiv: Use explicit storage for edge sharpness
Similar to previous change in vertex sharpness, explicitly store value
provided by the converter.

Allows to avoid rather fragile check for boundary edges.

Also allows to avoid need in constructing edge map. This lowers memory
footprint of the comparison process and avoids memory allocations
during the comparison (which is an extra benefit from the performance
point of view).
2020-05-27 12:07:16 +02:00
16aef5dc4a OpenSubdiv: Allow use of regular ordered map 2020-05-27 12:07:16 +02:00
ad4cef38e3 OpenSubdiv: Refactor, move comparison to own file 2020-05-27 12:07:16 +02:00
614d70a87d OpenSubdiv: Compare sharpness based on converter
This change starts the transition of topology refiner comparison
to compare actual values given by the converter, which will not be
affected by the refinement or face winding synchronization steps.

Currently is only implemented for vertex sharpness, but will be
extended further as followup development.

Fixes T71908: Subdiv: Incorrect topology comparison, leading to poor performance
2020-05-27 12:07:16 +02:00
717d968fb9 OpenSubdiv: Add explicit storage for mesh topology
The idea is to use this explicit storage for topology comparison rather
than using base level. While this will have memory overhead it allows
to simplify comparison of such things as:

- Vertex sharpness (where base level from topology refiner will have it
  refined, meaning it will be different from what application requested
  for non-manifold and corner vertices).

- It will allow to simplify face-vertices comparison, where currently
  O(N^2) algorithm is used due to possible difference in face winding.

- It will also allow to avoid comparison-time allocation of edge map.

Currently no functional changes, just preparing for development which
will happen next.
2020-05-27 12:07:16 +02:00
5d8515ed86 OpenSubdiv: Add move semantic to the namespace 2020-05-27 12:07:16 +02:00
b5ef644ef6 OpenSubdiv: Refactor, pass higher level object through comparison 2020-05-27 12:07:16 +02:00
444ca1a117 OpenSubdiv: Refactor, move utils to base
Also split them across utilities and types.
2020-05-27 12:07:16 +02:00
39cf673132 OpenSubdiv: Refactor, move base C-API file to base folder 2020-05-27 12:07:16 +02:00
98197343e8 OpenSubdiv: Cleanup, use C++ range based loop
Avoid indirection via define.
2020-05-27 12:07:16 +02:00
be03a756e5 OpenSubdiv: Cleanup, move utility function to base type conversion 2020-05-27 12:07:16 +02:00
0ff665e4ce OpenSubdiv: Refactor, move type conversion to base fodler 2020-05-27 12:07:16 +02:00
4886a704b3 OpenSubdiv: Refactor, move evaluator to own folder 2020-05-27 12:07:16 +02:00
6fc9d106ad OpenSubdiv: Completely disable topology verification
Previously it was enabled for debug builds, now it is to be enabled
explicitly.

The reason for this is to reduce overhead when debugging other areas
which might involve subdivision surface. When conversion is to be
debugged set this manually in the code.
2020-05-27 12:07:16 +02:00
0d089ce881 OpenSubdiv: Refactor, move edge map to base folder 2020-05-27 12:07:16 +02:00
4ab36c4393 OpenSubdiv: Refactor creation of topology refiner
Consolidate it inside of the topology refiner implementation class,
which would allow to store extra data acquired during construction
of the OpenSubdiv's object.
2020-05-27 12:07:15 +02:00
57aae2a355 OpenSubdiv: Refactor, use C++ allocation for internal classes
Only use OBJECT_GUARDED_{NEW. DELETE} for structures which are part of
public C-API (and hence can not have new/delete operators overloaded).

Could try being brave and override new/delete from under C++ ifdef.
2020-05-27 12:07:15 +02:00
c81a5f58f8 OpenSubdiv: Refactor, move topology refiner factory to topology folder 2020-05-27 12:07:15 +02:00
67fe31d751 OpenSubdiv: Refactor, move topology refiner to own folder
In the future factory will also be moved there.
2020-05-27 12:07:15 +02:00
7c0bea0d65 OpenSubdiv: Refactor, move device specific code to own files
Also, move all device files to own folder.

Makes it so checks for device availability are done in a localized
place.
2020-05-27 12:07:15 +02:00
Konrad Puklicki
e490dc4346 UI: Skip unnecessary cursor setting
Currently, in sculpting, weight paint and vertex paint modes every cursor
movement triggers redraw of a brush. During that redraw, native cursor is set.
Under the hood, setting the cursor causes freeing of previous cursor and
allocating a new one. In most cases, in previously mentioned modes, recreating
cursor is unnecessary since cursor stays the same.

This patch adds a check which skips cursor change if requested cursor is
already set. The check could be added in pain_cursor.c, but I felt adding it
inside WM_cursor_set function would hopefully skip more unnecessary cursor
reallocations.

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

Reviewed by: Julian Eisel
2020-05-27 12:06:35 +02:00
bab5fbb66c Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-27 12:01:04 +02:00
1c3b2b5dd8 Fix T77105: Crashes when clicking "new scene" button
This was introduced on ecc395e473.

Effectively this is reverting that commit for cases when
scene->toolsettings->sculpt is NULL. But since the facesets are only
working for sculpting this should be fine.
2020-05-27 12:00:00 +02:00
Stefan Werner
ecc15c55d4 Cycles: Upgraded Embree to version 3.10.0
Enabled round linear hair in Embree.

Differential Revision: https://developer.blender.org/D7623
2020-05-27 10:10:18 +02:00
7836242065 Cleanup: remove unused Main struct from snap context 2020-05-27 16:54:34 +10:00
355d129965 Gizmo: lazy initialize snap context
ED_gizmotypes_snap_3d_context_get could have returned NULL,
rename _get(..) to _ensure(..) and initialize the snap context
in this function.
2020-05-27 16:47:30 +10:00
1f7a791a53 Ruler: Implement Snap Gizmo
The snap point can now be viewed when activating the tool.
2020-05-27 00:16:32 -03:00
2e73e1390e Gizmo Library: New Snap Gizmo
Generic snap gizmo to be used for different tools.

The Gizmo can be configured initially by the following properties:
- `"snap_elements_force"`, `"prev_point"`

The following properties can be read as return:
- `"location"`, `"normal"`, `"snap_elem_index"`

This property can be linked to another (tool_setting.snap_elements):
- `"snap_elements"`

And this 3 extra utilities have been added:
- `ED_gizmotypes_snap_3d_draw_util`,
- `ED_gizmotypes_snap_3d_context_get`,
- `ED_gizmotypes_snap_3d_update`.

Differential Revision: https://developer.blender.org/D7071
2020-05-27 00:14:11 -03:00
7ed7901c00 Gizmo: add flag to disable tooltip
For some gizmos that follow the mouse cursor, this gets in the way.
2020-05-27 12:24:29 +10:00
43af0f4d16 Cleanup: pass const wm for WM_keymap_active 2020-05-27 12:09:52 +10:00
6c1cf395f2 Cleanup: remove unnecessary copy constructor
Caused deprecated-copy warnings as it wasn't used.
2020-05-27 11:50:54 +10:00
a739dc67ef Cleanup: sort file, structs 2020-05-27 10:52:07 +10:00
e5458fa4e5 Cleanup: warning 2020-05-27 10:52:00 +10:00
a8551f93e6 Merge branch 'blender-v2.83-release' 2020-05-26 16:52:15 -06:00
f772a4b8fa Fix: A few missing outliner selection sync tags
Add selection syncing for object add named (e.g. drag and drop from
outliner to 3D view), outliner right click (a sync when the context menu
is cancelled), and for object selection from Python.
2020-05-26 16:42:21 -06:00
eb5422828a Cleanup: Quiet unused variable warning in non-debug builds 2020-05-26 16:02:08 -04:00
5171d86806 UI: List Panel System
This implements a general system to implement drag and drop, subpanels,
and UI animation for the stack UIs in Blender. There are NO functional
changes in this patch, but it makes it relatively trivial to implement
these features for stacks.

The biggest complication to using panels to implement the UI for lists
is that there can be multiple modifiers of the same type. Currently there
is an assumed 1 to 1 relationship between every panel and its type, but
there can be multiple list items of the same type, so we have to break
this relationship. The mapping between panels and their data is stored
with an index in the panel's runtime struct.

To make use the system for a list like modifiers, four components
must be added:
1. A panel type defined and registered for each list data type, with a
    known mapping between list data types and panel idnames.
1. A function called by interface code to build the add the panel
    layouts with the provided helper functions.
    - UI_panel_list_matches_data will check if the panel list needs to
      be rebuilt.
    - UI_panels_free_instanced will remove the existing list panels
    - UI_panel_add_instanced adds a list panel of a given type.
3. An expand flag for the list data and implementations of
    get_list_data_expand_flag and set_list_data_expand_flag.
4. For reordering, the panel type's reorder callback. This is called
   when the instanced panels are drag-dropped. This requires
   implementing a "move to index" operator for the list data.

Reviewed By: Severin, brecht

Differential Revision: https://developer.blender.org/D7490
2020-05-26 15:39:49 -04:00
Cody Winchester
de257b6366 Modifiers: Add normalize weights option to vertex weight modifiers
Original patch by Cody Winchester (@CodyWinch), several fixes and
cleanup by Bastien Montagne (@mont29).

Differential revision: https://developer.blender.org/D7656
2020-05-26 20:56:27 +02:00
00674c12cc Merge branch 'blender-v2.83-release' 2020-05-26 20:49:53 +02:00
18f33f293b Fix Cloth Brush grab deformation mode
The grab mode was not correctly implemented, so the way it was working
was confusing for users.
- Grab delta was calculated in increments from the last stroke position, so it did not match the behavior of a grab brush. I refactored the grab delta calculation to make this change more explicit.
- Grab displacement was not calculated from the original coordinates
- Grab was using an incorrect strength

Grab is now setting the position of the affected vertices directly and
the constraints solve the rest of the cloth. I also tried to implement
an alternative version based on applying forces to move the vertices to
the grab position, but I think this is more controllable and the grab
falloff can be adjusted by tweaking the simulation falloff.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7756
2020-05-26 20:48:46 +02:00
9aea7dc7c6 Fix Pose Brush origin position with large brush size
When the brush size is bigger than the entire mesh, fdata.tot_co can be
0, so the pose origin will default to (0,0,0), which does not make much
sense. After this patch, the pose origin will be set to the farthest
vertex from the pose origin, which at least should be in the surface of
the mesh and in most cases in the direction the pose brush was already
detecting the origin.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7773
2020-05-26 20:45:20 +02:00
9b0f65c4a6 Fix naming in the PBVH neighbor iterator macro
The only possible name for the iterator was ni, this should fix that.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7774
2020-05-26 20:43:14 +02:00
5f63344e84 Fix PBVH API returning wrong normal when using shape keys and modifiers
The implementation of this function should match the one in
SCULPT_vertex_co_get. This does not solve the issue when sculpting with
modifiers active but I think this code is wrong

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D7805
2020-05-26 20:40:27 +02:00
a2baf50242 Cleanup/refactor: Workspace API, boilerplate code, early exit
* Simplify workspace API a bit
* Comment on behavior of workspace-layout relations where exposed in API
* Remove annoying getters/setters
* Avoid lookups if we can early exit
* A NULL check is removed in `direct_link_workspace()` that I don't see
  a need for. Am not 100% sure though, fingers crossed.

In general these changes should improve readability and make things
easier to reason about.
2020-05-26 20:32:21 +02:00
1f223b9a1f UI: Windows Shell Links & Improved Mac Aliases
Adds support for Windows Shell Links (shortcuts) to the File Browser. Extended Mac Alias usage. Better visualization of linked items.

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

Reviewed by Campbell Barton
2020-05-26 08:15:50 -07:00
78eae89c39 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-26 16:44:35 +02:00
a1c9d42584 Fix T77021: Alembic export of animated mesh with multiple UV maps fails
This was caused by a side-effect of our exporting code's memory
management (Alembic considers data "written" and "final" when its C++
objects go out of scope) in combination with my change in
rB65574463fa2d. I removed an "only export UVs on the first frame" clause
because it was unclear why this restriction was there. As it turns out,
it breaks the export of the 2nd and subsequent UV maps on an animated
mesh. Effectively, on every frame the Alembic library thought we want to
create a new UV map, instead of continuing to write a new frame of data
to the existing one.

This is resolved by keeping a reference to the C++ objects for the UV
maps in memory while the exporter is running.
2020-05-26 16:42:01 +02:00
4102e7ed81 Fix T77032: Crash when creating GPUOffscreen without GPUContext in Python 2020-05-26 11:38:19 -03:00
d8733539b7 Merge branch 'blender-v2.83-release' 2020-05-26 16:26:16 +02:00
f3cf29ac96 Fix T77074: Collections: Exclude From ViewLayer toggle crashes
Consider this a bandaid fix (similar to rBe2724abc22d5).

Real issue seems to be that object is still in OB_MODE_PARTICLE_EDIT
whereas it should be in OB_MODE_OBJECT after toggling 'Exclude From
ViewLayer'. So while this patch prevents the crash, it leaves the object
in a weird state (it cannot be selected for example), needs further
investigation.

Maniphest Tasks: T77074

Differential Revision: https://developer.blender.org/D7843
2020-05-26 16:22:41 +02:00
4114e89020 Fix overlapping tabs placement when used in right Top-bar split
Didn't respect alignment rules for split layouts.

Reported in T77075.
2020-05-26 15:42:50 +02:00
14b1c55e11 Cleanup: Remove uneeded NULL checks on ed_screen_context
view_layer should never be NULL.
2020-05-26 15:08:45 +02:00
299682bde7 Merge branch 'blender-v2.83-release' 2020-05-26 15:04:17 +02:00
d3275178fe Fix T77082: Greasepencil error accessing material dropdown on an object without materials
Differential Revision: https://developer.blender.org/D7841
2020-05-26 14:55:37 +02:00
35bd596876 Merge branch 'blender-v2.83-release' 2020-05-26 14:53:19 +02:00
2299f6b5a7 Fix T77049: VSE Image cache is not refreshed when strip are muted/
unmuted in metastrip

Maniphest Tasks: T77049

Differential Revision: https://developer.blender.org/D7834
2020-05-26 14:49:19 +02:00
e790f1a8dc Merge branch 'blender-v2.83-release' 2020-05-26 14:24:50 +02:00
23520cbd13 Cleanup: Avoid mixing unlink-operator and menu name for ID-templates
The context menu name for `UILayout.template_ID_tabs()` would be passed
through multiple functions as `unlinkop`.
2020-05-26 13:28:21 +02:00
2a692e05c8 Fix T77075: Crash omitting optional UILayout.template_ID_tabs parameter 2020-05-26 12:56:53 +02:00
13e17cbd47 Cleanup: remove unused includes from lib_query.c 2020-05-26 12:33:28 +02:00
b44c3ac1e9 Fix/Cleanup: Move some animdata versioning code out of liblinking process.
This was propably added way before we had the after-lib-link versionning
code, but now doing that sort of fixes at liblink time is bad.
2020-05-26 12:33:28 +02:00
4835a09bb1 Cleanup: Create afterliblink doversion for 2.90... and move relevant code there.
Seriously... Please comply with design and do not add 2.9x versionning
code to 2.8x versioning functions!
2020-05-26 12:33:28 +02:00
13b10ab852 Fix/refactor foreach_id handling of animdata.
Now callbacks for animdata, nla strip and fcurve are in their own proper
BKE files (mimicking `foreach_id` callback of `IDTypeInfo`).

This commit also fixes some missing handling of ID pointers (text ID and
IDProperties of script fcurve modifier...).
2020-05-26 12:33:28 +02:00
fc2bb44e94 Fix T68209: Crash opening pre 2.8 file with maximized area
Versioning for workspaces didn't update the map used to determine which
layout is active for a workspace in a specific window. Library code now
called the function to make a workspace active (even if it already was
active), which would also use this map to determine the active layout --
the wrong one.

Error in initial workspace integration, but only uncovered recently.
Likely through 0d8a8ce03b.
2020-05-26 12:19:27 +02:00
5a1ab3e9ae Fix T77067: GPencil Object without materials cannot use Vertex Color mode 2020-05-26 12:13:25 +02:00
825d5c9992 Fix T76522: Grease Pencil transform fill and Adjust Last Operation panel issue
The exec method was totally wrong and also the UI panel was not logic. 

Also changes to make the transformation smoother and the code more simple.

Reviewed By: lichtwerk, mendio

Maniphest Tasks: T76522

Differential Revision: https://developer.blender.org/D7741
2020-05-26 11:22:32 +02:00
2dd6d0ce4b Fix T76926: Crash with Full Screen file browser window preference
Alternative fix for T75292 & T73579 (see b75ce05c3b), that does not
cause this crash.

The crash happened because cancelling the file browser removes its
screen (as in bScreen). Before rBb75ce05c3b0f, the file browser event
wouldn't be handled any further then. After it, it would still be passed
to other areas, while the screen pointer was dangling.
Now the event is only skipped for UI handlers.

Reviewed by: Julian Eisel
2020-05-26 10:38:46 +02:00
49f59092e7 Curves: Implement Handles for selected points only
When editing a complex curve is very annoying to have all handles at a time. Also, this is a requirement for the current GSoC Edit Grease Pencil using curves.
I have seen that this improvement can be used in any other area of blender, so I have decided to publish the option in the overlay panel..

Reviewed By: fclem, #user_interface, billreynish, Severin

Differential Revision: https://developer.blender.org/D7754
2020-05-26 10:37:47 +02:00
ecc395e473 Fix T76902: face sets checkbox broken
Due to recent changes the face sets checkbox broke. The cause is that
{7d38f5036794} changed the responsibility of drawing and updating sculpt GPU
buffers to fix render glitches.

This patch moves the checkboxes evaluation to the overlay engine.
2020-05-26 08:48:57 +02:00
77fdd189e4 Fix T76970: Unneccessary update calls viewport
Due to recent changes clicks in the node editor would trigger a
depsgraph update resulting in too many redraws. This patch limits
the updates to when workbench shown in texture mode in any visible
screen.

There are still cases where too many updates are created. For example when
there are a Cycles render viewport and a Workbench texture viewport on the
same screen.

This fix is meant as a workaround. The actual fix should add a mechanism
to the depsgraph and the viewports should check if they need to be redrawn.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7830
2020-05-26 08:29:24 +02:00
495a98d623 BLI_assert: prevent abort from suppressing return-type warning
Recent commit deaff945d0 broke release builds but not debug builds,
with this change the warning happens in both cases.
2020-05-26 13:40:21 +10:00
4e8693ffcd Improved Area Border Selection and Dragging
Allow use of the full width of visible borders when dragging to resize areas.

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

Reviewed by Brecht Van Lommel
2020-05-25 16:29:21 -07:00
5254ffa17b Fix T77051: IC keymap hotkey conflict in mode switching with GP object 2020-05-25 21:50:07 +02:00
39aa122a0e DRW: Selection: Extend small object selection workaround to all overlays
Fix T77015 box select doesnt select cameras when zoomed out, lasso and circle select do work.
2020-05-25 19:35:07 +02:00
4a9a8611f2 Fix T72121: Measurements are being drawn incorrectly if one end is off screen
The solution is to distribute the drawing for part to be done in 3d
(dashed lines, arc) and another part in 2d (text and caps).

Ref T72121

Reviewed By: fclem

Maniphest Tasks: T72121

Differential Revision: https://developer.blender.org/D6361
2020-05-25 19:17:59 +02:00
4464a9425b Calculate epsilon values for interp_weights_poly to improve accuracy
interp_weights_poly_v2 would have too large epsilon values for small
polygons. To solve this we now calculate the appropriate epsilon value
so it can gracefully handle big and small values.

To make sure there was no regression, these changes were tested with the
files in T36105, T31581. Also with a surface deform modifier test file
attached in the differential below.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D7772
2020-05-25 18:59:14 +02:00
c19cc7ef81 GPUTexture: Make GPU_texture_clear workaround fast.
This way we have a convenient way to clear individual textures.
2020-05-25 18:37:44 +02:00
6fbeded285 Fix T76926: Crash with Full Screen file browser window preference
Alternative fix for T75292 & T73579 (see b75ce05c3b), that does not
cause this crash.

The crash happened because cancelling the file browser removes its
screen (as in bScreen). Before rBb75ce05c3b0f, the file browser event
wouldn't be handled any further then. After it, it would still be passed
to other areas, while the screen pointer was dangling.
Now the event is only skipped for UI handlers.

Reviewed by: Julian Eisel
2020-05-25 18:33:12 +02:00
31cb4133b9 Fix T77009: texture baking crash on Windows
Only happens in master, but DynamicArray implementation is wrong also in 2.83.
Thanks to Jesse Y and Ray Molenkamp for investigating.
2020-05-25 18:17:30 +02:00
52c356c199 Cleanup wrong format specifier in a debug printf. 2020-05-25 17:49:58 +02:00
396bf6ca78 Fix T73164: Undo does not always properly clear no-more-used library data.
Solution is actually very simple, and even makes existing code simpler:
just write all lib IDs when storing and undo step. That way we do not
have to guess which indirectly used library should be kept or not after
an undo step reading.
2020-05-25 17:44:27 +02:00
6d4dc22e17 Sculpt: Pose Brush Scale/Transform deform mode
This is an alternative deformation brush for the Pose Brush intended
quickly change the proportions of the mesh. The regular mode scales
using the segment's origin as a pivot. The inverted mode drags the
entire segment using the grab delta.

The only difference with the regular pose brush is that it is not
compatible with IK, so the option is disabled and set to 1 segment. The
rest of the options should work as expected.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7374
2020-05-25 17:35:39 +02:00
28d81f7b24 Fix T76957: Rigid body "Animated" text cutoff
Removes the flow layout from the panel. No reason to use that here,
surrounding code doesn't either. Probably an unintentional left-over.
2020-05-25 17:26:22 +02:00
9f1f7ba2bb Fix T76925: more Cycles OpenCL compile errors with some drivers on Linux 2020-05-25 17:06:10 +02:00
f53ae843b3 Fix T76267: Stencil texture with negative scale dissapears after
clicking Image Aspect

Calculate with positive areas here and ensure stencil_dimension stays
positive.

Maniphest Tasks: T76267

Differential Revision: https://developer.blender.org/D7821
2020-05-25 16:57:36 +02:00
ce0db0d329 UI: Fix T76918: 3D Mouse Inconsistent / Inaccessible UI
This consolidates the UI code for NDOF input settings, making all
settings accessible from the preferences. This works around an issue
where the Space Navigator's "Menu" button doesn't trigger the settings
menu in Blender.

I also took the opportunity to redo the UI layout.

Note: Separate commit for 2.83 because UI layouts features
have diverged.

Differential Revision: https://developer.blender.org/D7806
2020-05-25 10:53:17 -04:00
2ba3214a21 UI/Physics: Show error enabling Rigid Body if compiled without Bullet
Would just silently fail, which is confusing.
Should only impact custom builds.
2020-05-25 16:49:18 +02:00
7a51eb5340 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-25 16:37:43 +02:00
219ce574b5 Revert "UI: View3D Cursor Changes"
This change is yet to be followed by a more comprehensive design
proposal including:

* How to differentiate the modes apart.
* More clear definition of tools and the rules for their components (gizmo, cursor).
* Selection as a non-tool vs drag option.

This can be revisited for 2.90 with more time. For now the UI team
agrees to revert this.

--
This reverts commit 4aa703aa14.
2020-05-25 16:28:55 +02:00
1b06d5742e Fix building after rBdeaff945d0b9... sic. 2020-05-25 16:07:37 +02:00
ec0ba8e3b5 VR: Fix big performance bottleneck for simple scenes
Blender's main loop puts the main thread to sleep for 5ms if no user input was
received from the OS. We never want that to happen while the VR session is
running, which runs on the main thread too.

For simpler scenes, where the viewport already draws fast, this may have quite
some impact. E.g. in my tests, the classroom scene went from ~55 to quite
stable 90 FPS in solid mode (total render time as measured and averaged by
Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS.
In complex files, there's barely a difference. E.g. less than 1 FPS increase in
a Spring file (both Solid mode and Eevee).
2020-05-25 15:52:24 +02:00
026eba8523 Fix T76941: "Set Inverse" in Child Of constraint broken with armatures
When the Child Of constraint is owned by a bone, before the constraint is
run the matrix is converted from world to pose space. However, setting the
inverse should also take the armature object's transform into account.
2020-05-25 15:46:08 +02:00
8b849f39e8 Merge branch 'blender-v2.83-release'
Conflicts:
	source/blender/blenkernel/intern/lib_id.c
2020-05-25 15:43:54 +02:00
849f5bee19 Cleanup: ID makelocal code: remove useless and confusing debug code.
Thing is, user code should not have the responsibility to check that
libquery is valid. Such checks are only source of confusion and errors
as nobody will think about finding and updating them in some obscure
specific area of the code...
2020-05-25 15:38:36 +02:00
b01d2ea72a Libquery: Refactor: add bmain to data passed to callback.
No reason to enforce defining own callback user data for something that
controlling has already available...
2020-05-25 15:28:15 +02:00
e0ff032711 Fix T76997: bad handling of embedded IDs in partial append.
Code dealing with embedded data was pre-existing proper generic
handling of those by `BKE_library_foreach_ID_link()` - and was never
updated for scene's master collection it would seem...

Note that such fix/refactor is a bit risky at this point in the release
cycle, but on the other end previous situation was really broken. So
finger crossed. :|
2020-05-25 15:28:15 +02:00
7a37db6125 Fix T76997: bad handling of embedded IDs in partial append.
Code dealing with embedded data was pre-existing proper generic
handling of those by `BKE_library_foreach_ID_link()` - and was never
updated for scene's master collection it would seem...

Note that such fix/refactor is a bit risky at this point in the release
cycle, but on the other end previous situation was really broken. So
finger crossed. :|
2020-05-25 15:11:36 +02:00
deaff945d0 Mesh: skip conversion from edit-mesh to mesh in edit-mode
This resolves a performance regression in 2.8x where every edit-mode
update performed an edit-mesh to mesh conversion.

Now the conversion will be lazily initialized if/when it's required.

New BKE_mesh_wrapper_* functions abstract over mesh data access.
Currently only edit-mesh and regular meshes are supported.
In the future sub-surface meshes may be supported too.
2020-05-25 23:07:30 +10:00
df8cbdc696 Merge branch 'blender-v2.83-release' 2020-05-25 14:10:20 +02:00
a8a6b3627a Fix autokeyframing masks not updating properly
Spotted while looking into T76872

Maniphest Tasks: T76872

Differential Revision: https://developer.blender.org/D7786
2020-05-25 13:56:49 +02:00
0270941b70 Merge branch 'blender-v2.83-release' 2020-05-25 21:43:54 +10:00
7e9480b6cd Tests: correct the blender path for non-portable installations 2020-05-25 21:28:03 +10:00
dc3f404a70 Cleanup: unused variable warnings 2020-05-25 21:03:45 +10:00
3c40d2485f Merge branch 'blender-v2.83-release' 2020-05-25 21:01:38 +10:00
1a60aba46f Merge branch 'blender-v2.83-release' 2020-05-25 21:01:34 +10:00
d65f60764b GTest: BLI_ghash_performance_test was failing
Change the seed from 0 to 1, so BLI_ghash_performance_test doesn't
assert with duplicate keys.
2020-05-25 20:52:10 +10:00
baa1886791 Fix T76990: Crash shortest path select with 'face stepping' when no faces.
Note that this sometimes gives no solution when there is a mix of edges
with and without faces... But at leat this should be safe fix.
2020-05-25 12:44:10 +02:00
9ef272bae3 Task: Graph Flow Task Scheduling
Add TBB::flow graph scheduling to BLI_task.

Using flow graphs, a graph of nodes (tasks) and links can be defined.
Work can flow though the graph. During this process the execution of the nodes will be
scheduled among the available threads.

We are planning to use this to improve the threading in the draw manager.

The implemented API is still limited it only supports sequential flows. Joins and buffers
are not supported. We could eventually support them as part of an CPP API. These features
from uses compile time templates and are hard to make a clean C-API for this.

Reviewed By: Sergey Sharybin, Brecht van Lommel

Differential Revision: https://developer.blender.org/D7578
2020-05-25 12:38:12 +02:00
87e9557cd1 Simulations: pass simulation data block to update function 2020-05-25 12:23:55 +02:00
60bed34f16 install_deps: update libraries versions.
- FFMPEG: 4.3.2
- OpenSubDiv: 3.4.3
- OpenXR SDK: 1.0.8
- Switch form SDL 1.2 to SDL 2.0

Re T77035, T77007, T77010 and T77011
2020-05-25 11:54:30 +02:00
1c467d77de Cleanup: typo 2020-05-25 11:39:52 +02:00
528f0b95c4 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-25 10:45:39 +02:00
41bb0548b0 Fix T76897: Lamp Power Not Updating from Driver
Lamps were not tagged with `ID_RECALC_SHADING` when they were updated
from drivers. As a result, Cycles considered the lamp as unchanged. This
is resolved by having a (seemingly non-functional) callback in a new
`LIGHT_UPDATE` depsgraph node.

This patch unconditionally adds the `LIGHT_UPDATE` node + the relation
from the lamp's PARAMETERS node.

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

Reviewed by: brecht
2020-05-25 10:07:10 +02:00
9b9f84b317 Fix crash when converting BMesh to Mesh with shape keys
The `BM_mesh_bm_to_me()` function copies shape keys from the BMesh to
the Mesh. However, it tries to copy the same number of shape keys as are
defined on the target mesh. Since the target mesh does not necessarily
have the same number of shape keys as the BMesh, this would crash if the
target Mesh has more.

Found while performing some tests for {D7785}.

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

Reviewed by: brecht
2020-05-25 09:43:01 +02:00
5a842b3412 Merge branch 'blender-v2.83-release' 2020-05-25 15:55:54 +10:00
c15bb3b55f Fix T77031: Blender as pymodule crashes when rendering
No longer enforce WITH_HEADLESS when building as a Python module
as it disables GPU access which is needed for rendering.
2020-05-25 15:53:43 +10:00
ffcb87813b Merge branch 'blender-v2.83-release' 2020-05-25 15:01:01 +10:00
dc429d5910 Merge branch 'blender-v2.83-release' 2020-05-25 15:00:58 +10:00
31f3e9082a Cleanup: make format 2020-05-25 14:55:48 +10:00
f274b8c102 CMake: disable WITH_USD with blender_lite configurations 2020-05-25 14:54:41 +10:00
0700521833 Py Docs: Update Sphinx and Theme Dependencies
`sphinx_rtd_theme==0.5.0rc1` probably should not be used for 2.83 but it 
would be nice to test
2020-05-24 19:23:28 -04:00
5db2d9c82b Deps: ffmpeg 4.2.3 + codecs update
This diff updates:
FFmpeg : 4.3.2
libogg : 1.3.4
flac   : 1.3.3
vpx    : 1.8.2
xvid   : 1.3.7
x264   : 33f9e1474613f59392be5ab6a7e7abf60fa63622

x264 seemingly has given up on even providing snapshots
and has been updated to the latest hash available at
this time.

faad has been removed since ffmpeg has not supported
it since 2010.
2020-05-24 15:18:39 -06:00
f13b687551 Merge branch 'blender-v2.83-release' 2020-05-24 21:14:23 +02:00
0d0df683d9 Fix(unreported): Crash on prefetching while transforming strip.
While investigating T76274, I found crash scenario when playhead is near end
frame and moving a strip. It is not as easy to reproduce, about 5% success
rate, and it will be even harder after rB4066c921fbe5. Exact cause wasn't
identified yet.

I wanted to disable prefetching during modal operator execution in VSE, but
currently I don't have any signalling method in place. Checking for G.moving
seems to resolve this problem, but it doesn't adress root cause of bug.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7820
2020-05-24 21:03:31 +02:00
6b8555e01c VR: Fix big performance bottleneck for simple scenes
Blender's main loop puts the main thread to sleep for 5ms if no user input was
received from the OS. We never want that to happen while the VR session is
running, which runs on the main thread too.

For simpler scenes, where the viewport already draws fast, this may have quite
some impact. E.g. in my tests, the classroom scene went from ~55 to quite
stable 90 FPS in solid mode (total render time as measured and averaged by
Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS.
In complex files, there's barely a difference. E.g. less than 1 FPS increase in
a Spring file (both Solid mode and Eevee).
2020-05-24 17:26:31 +02:00
8e4c74292a Fix T77000: Preferences window can not be opened from script operator
The operators to open the Preferences, Driver Editor, or Info Log window did
not work when executed from another operator or the Python console. Should work
for all of these now.

I considered using operator properties instead, so the position could be set by
a script, with some fallback (e.g. current window center). But decided that's
not really worth the boilerplate and decreased code readability. Can still be
done if there's a need for it.
2020-05-24 16:14:11 +02:00
f43bb98646 Merge branch 'blender-v2.83-release' 2020-05-24 10:22:28 +02:00
22462fed00 Fix T77003: GPencil Paint presets not initializated
In som ecases, the Paint was not ready when the brushes and palette were created. Now, first the paint is checked.
2020-05-24 10:22:03 +02:00
525fc36a80 Deps : XR_OpenXR_SDK 1.0.8 2020-05-23 15:58:15 -06:00
2ddd9813ef deps: SDL 2.0.12 2020-05-23 15:41:44 -06:00
157b9e78a4 Deps: OpenSubDiv 3.4.3 2020-05-23 15:21:28 -06:00
93f60a4da5 Deps: Freetype 2.10.2 2020-05-23 14:37:17 -06:00
f5cd06ed45 deps: OpenAL 1.20.1 2020-05-23 14:02:34 -06:00
1f34a34fa5 Merge branch 'blender-v2.83-release' 2020-05-23 10:43:41 -06:00
6f8d99322c Fix T76578: Show bone visibility driver in outliner
Allow setting drivers and keyframes for the bone visibility restriction
icon in the outliner. Before the button was a simple icon button, but it
is now connected to the RNA property to show the driven or keyframed
state.

Also when hiding a bone from the outliner it would be deselected, but
from the properties editor it would remain selected. This moves the
deselection to the RNA update function to ensure the bone is always
deselected.

Differential Revision: https://developer.blender.org/D7825
2020-05-23 10:36:54 -06:00
041e440649 Merge branch 'blender-v2.83-release' 2020-05-23 15:26:24 +02:00
b4613e0bca GPencil: Fix unreported Noise modifier does not work in axis aligned strokes
If the stroke is totally straight, the normal was not calculated properly.
2020-05-23 15:25:54 +02:00
08c1f5bf33 Cycles: Improve sampling of area lights
This patch uses the sampling method described in "A Low Distortion Map Between Triangle and Square" by Eric Heitz.
The benefit is avoiding sqrt in the calculation, which could be cheaper on some architectures, and the result is
more even sampling across the triangle surface.

Based on ideas from
https://pharr.org/matt/blog/2019/02/27/triangle-sampling-1.html
https://pharr.org/matt/blog/2019/03/13/triangle-sampling-1.5.html

Reviewed By: Brecht Van Lommel

Differential Revision: https://developer.blender.org/D6566
2020-05-23 14:21:49 +02:00
86fa8dc7f7 Merge branch 'blender-v2.83-release' 2020-05-22 22:59:02 +02:00
ece8ecb4dd Cleanup: remove unnecessary NULL test 2020-05-22 22:57:58 +02:00
Ankit
e8dd8c2829 Cleanup: silence deprecation warnings of Carbon Finder Favorites items
Differential Revision: https://developer.blender.org/D7655
2020-05-22 21:52:38 +02:00
f27e122d95 Fix T76925: Cycles OpenCL compile error with some drivers on Linux 2020-05-22 21:50:24 +02:00
e8209c36e6 Cleanup: Deduplicate code 2020-05-22 14:58:56 -03:00
45f17e10ec Fix redo with local orientation 2020-05-22 14:43:51 -03:00
a958725f81 Fix unused parameter ftext 2020-05-22 14:43:51 -03:00
3bc15c097c Fix T76940: Empty HUD (Redo Panel)
If the redo panel was made visible with the same size it had before
(e.g. stored in the file), the runtime region coordinates wouldn't get
set and ended up being all 0. E.g. the simplest way to cause this was
having a collapsed HUD, saving the file, re-opening it with the same
effective DPI and doing an operation so the closed HUD would appear
again.

Now the size is always recalculated if the visibility state of the HUD
changes.
2020-05-22 18:40:10 +02:00
43d33b3626 Merge branch 'blender-v2.83-release' 2020-05-22 17:48:10 +02:00
98689f51c0 Fix T74443: No render in VP9 lossless mode
We define Lossless as CRF 0 (which is usually the best quality and is
working fine with other codecs afaict), but since WebM only allows for
CRF values between 2-32 and actually has a dedicated "lossless" mode, I
suggest using that (it produces large files though, so double-checking
would be welcome).

https://trac.ffmpeg.org/wiki/Encode/VP9#LosslessVP9

Maniphest Tasks: T74443

Differential Revision: https://developer.blender.org/D7800
2020-05-22 17:41:27 +02:00
cbd4b8ebb0 Fix T76974: Shear Tool Misses Orientation 2020-05-22 12:39:57 -03:00
c75a665c44 Transform: refactoring - unify constraint and default orientation 2020-05-22 12:39:56 -03:00
06860ba29b Merge branch 'blender-v2.83-release' 2020-05-22 17:21:52 +02:00
a76e804309 Fix T76960: fluid baking operators not working with pinned object
Maniphest Tasks: T76960

Differential Revision: https://developer.blender.org/D7819
2020-05-22 17:16:31 +02:00
1633a65d41 RNA: Make enum properties compatible with raw access.
This will allow to use foreach_get/set on enums of RNA collection items,
which can save a lot of time in some cases (see incoming FBX updates).
2020-05-22 15:41:34 +02:00
Jeroen Bakker
0236863c6d Fix T73115: In Front Drawing Bone Envelope Distance
The in front drawing was not supported for transparent part of the   armature. This patch adds a second transparent pass for drawing in
front.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7763
2020-05-22 15:09:48 +02:00
920b698746 Merge branch 'blender-v2.83-release' 2020-05-22 22:42:16 +10:00
8ddcc7fd51 Merge branch 'blender-v2.83-release' 2020-05-22 22:20:01 +10:00
69e331201e UV: remove "UV Local View" for UV editing
This feature was added when Blender used tex-face (per-face images),
but doesn't make as much sense since this was removed.

Removing this from UV edit-mode as this wasn't working in any
of the 2.8x releases, causing UV's to be visible but unselectable.

Resolves issue raised in T76958.
2020-05-22 22:18:32 +10:00
Jeroen Bakker
59aed2a255 Fix T73726: Workbench Closest Interpolation Artifacts
All textures in workbench are using linear interpolation. The fragment
shader modifies the uv coordinates to sample always in the center of a
texel. In rare conditions the GPU could sample an incorrect value due to
rounding errors making some rendering artifacts.

This patch skips the interpolation in the fragment shader to remove
these render artifacts.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7816
2020-05-22 14:11:36 +02:00
f990b42504 Revert "UI: Remove duplicate Mark/Clear Seam entries from Edge menus"
Seams are widely used outside UV context so it's okay to duplicate entries.
Based on community feedback, thanks!

This reverts commit fc62a3366c.
2020-05-22 13:41:48 +02:00
f5c682045d Merge branch 'blender-v2.83-release' 2020-05-22 13:36:23 +02:00
4066c921fb Fix (unreported): prefetching wastes resources when end frame is reached
This bug is not really visible for user. When end frame is reached by
prefetching thread, it doesn't stop and keeps on getting images from
cache.

Add chech for this situation and simplify logic involved in suspending,
so it's easier to read.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7757
2020-05-22 13:31:49 +02:00
c4edc6f3f7 Fix (unreported): Don't restart prefetching during rendering.
Prefetching is stopped in BKE_sequencer_cache_cleanup, but is restarted quickly.

Prefetching has negative effect on performance while rendering.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7751
2020-05-22 13:05:08 +02:00
a1a333a1e9 Fix T76774: Crash on prefetching sequences from another scene.
When rendering another scene, caching in disabled by setting
local_context.skip_cache = true. Precondition checking for this flag was
missing in BKE_sequencer_cache_get and it wasn't first thing to check in
BKE_sequencer_cache_put.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7750
2020-05-22 12:59:26 +02:00
fbbc0229b8 Cleanup: only use nullptr in USD exporter
This removes all use of `NULL` from the USD Exporter, also when calling
into C code.

No functional changes.
2020-05-22 10:12:13 +02:00
b87d81be96 Wayland: support key repeat 2020-05-22 18:09:17 +10:00
fe739f8c26 GHOST: fix GHOST_System::getMilliSeconds()
This wasn't returning milliseconds, causing problems with key repeat.
2020-05-22 18:08:13 +10:00
ce6fd6b6a2 Fix missing header building with wayland 2020-05-22 16:47:59 +10:00
Jeroen Bakker
42f8d52401 Fix T64277: Inverted Wheelmouse
When using CTRL wheel mouse the items were selected in a different order than when opening the menu and use the wheel mouse.

Reviewed By: Brecht van Lommel

Differential Revision: https://developer.blender.org/D7791
2020-05-22 07:32:44 +02:00
3aacd8a4ab Merge branch 'blender-v2.83-release' 2020-05-22 12:40:02 +10:00
1b994a37f4 Fix Python console cursor height 2020-05-22 12:36:39 +10:00
8f21f867e7 Fix T76949: Crash When Selecting Materials Tab.
Dummy typo in own recent libquery refactor, of course that one missed
change was on a line not covered by our tests or the production file
used for validation...
2020-05-21 23:20:29 +02:00
70c483e7db libquery: Cleanup: finish refactor by removing no more used code. 2020-05-21 19:37:57 +02:00
3cb6efd3ab Libquery refactor: Cleanup (remove no more used macros). 2020-05-21 19:36:05 +02:00
1f6ef73f98 Refactor: Move scene foreach_id to new IDTypeInfo structure. 2020-05-21 19:29:55 +02:00
c732edbaa4 Refactor: Move object foreach_id to new IDTypeInfo structure. 2020-05-21 19:09:48 +02:00
ce74df6248 Refactor: Move NOP idtypes foreach_id to new IDTypeInfo structure. 2020-05-21 18:35:11 +02:00
7e4654e4ce UI: Fix T76918: 3D Mouse Inconsistent / Inaccessible UI
This consolidates the UI code for NDOF input settings, making all
settings accessible from the preferences. This works around an issue
where the Space Navigator's "Menu" button doesn't trigger the settings
menu in Blender.

I also took the opportunity to redo the UI layout.

Differential Revision: https://developer.blender.org/D7806
2020-05-21 11:42:23 -04:00
df14b11526 GPencil: Cleanup macro 2020-05-21 16:25:35 +02:00
a39ca327bc Fix T76935: Current orientation not taken in account when using "Align to transform orientation" 2020-05-21 11:01:06 -03:00
de7d32bb7d Fix T76933: 'Align to Transform Orientation' crashes for Custom orientations 2020-05-21 11:01:06 -03:00
2fe615ab9f Merge branch 'blender-v2.83-release' 2020-05-21 23:07:18 +10:00
8a8c61190b Docs: note that the color-ramp uses image alpha
Avoid misunderstanding from T59110
2020-05-21 23:03:24 +10:00
0c9e73845c BLI: improve Vector test 2020-05-21 14:35:19 +02:00
03d8783db0 Merge branch 'blender-v2.83-release' 2020-05-21 19:34:41 +10:00
376b69cbff Fix T73568: Vertex selection fails in weight-paint mode
Lasso, circle, box select fails in weight paint mode with modifiers.
2020-05-21 19:32:15 +10:00
2efd00d4d2 Merge branch 'blender-v2.83-release' 2020-05-21 18:19:10 +10:00
d15efbdc56 Fix T76922: Meta-balls created twice the specified size 2020-05-21 18:18:00 +10:00
850fbe8547 Merge branch 'blender-v2.83-release' 2020-05-21 16:34:36 +10:00
c13bf40ab1 Merge branch 'blender-v2.83-release' 2020-05-21 16:34:20 +10:00
0ff663b6fc Merge branch 'blender-v2.83-release' 2020-05-21 16:33:28 +10:00
8d648e0972 Cleanup: spelling 2020-05-21 16:22:37 +10:00
fcfb87def9 Cleanup: excess blank lines and parenthesis 2020-05-21 16:17:44 +10:00
f66bfb5a86 Cleanup: quiet uninitialized warning
It's possible for the value to be uninitialized
in the case of loading newer preferences into an older Blender.
2020-05-21 15:57:46 +10:00
bbef6fe336 Merge branch 'blender-v2.83-release' 2020-05-21 12:59:55 +10:00
8ecfa6a828 Merge branch 'blender-v2.83-release' 2020-05-21 12:59:51 +10:00
b4a6418e2b Cleanup: add doxy sections for event queue handling
The main function to handle events didn't have it's own section.
2020-05-21 12:22:32 +10:00
522e6c0c06 Cleanup: add asserts for textview drawing
This would have prevented T74298.
2020-05-21 12:22:32 +10:00
8a0840b0ee Merge branch 'blender-v2.83-release'
# Conflicts:
#	source/blender/draw/engines/eevee/eevee_volumes.c
2020-05-20 22:56:09 +02:00
af3a55bb1b Overlay: Wireframe: Add visualization for Hairs in wireframe mode
This only works for particle systems for now.

Fix T61928 Wireframe mode hair not visible
2020-05-20 22:54:04 +02:00
71fa460145 UI: Remove Panel Grid Snapping While Dragging
The reason to have this isn't quite clear, but it looks like a vestige
of the 2.5 transition. Removing this makes dragging panels feel
much more responsive.

Thanks to Julian Eisel @Severin for the original change.

Differential Revision: https://developer.blender.org/D7803
2020-05-20 16:27:44 -04:00
6d7dc2265f UI: Rephrase Tooltip to Avoid 2nd Person 2020-05-20 15:53:45 -04:00
8bff3ec76b Transform: Don't negate the z axis of the View orientation
This was so because of the rotate transformation mode but it can make
other modes confusing and add unnecessary complexity.
2020-05-20 16:22:28 -03:00
600fd1c6f0 Fix T76919: Wrong orientation when changing translate to rotate
During the refactor of the transform operations, in an attempt to
maintain previous behavior, the default orientation of the translate
and resize operations became `Global` and the rotate operation became
`View`.

Now the default is always `View`, and on redo, the translate and rotate
operations are saved as `Global`.
2020-05-20 16:22:10 -03:00
29afadcb15 GPencil: Create new frame when Erase only if additive drawing is enabled
Differential Revision: https://developer.blender.org/D7804
2020-05-20 20:33:49 +02:00
b9aa2acecd Refactor: Move collection foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:47 +02:00
e2b87aabb6 Cleanup collection handling in lib_query code.
Now we do not need anymore that extra function...
2020-05-20 18:43:47 +02:00
1c79484d53 Libquery: refactor: handle scene's master collection like any othe embedded ID. 2020-05-20 18:43:46 +02:00
3a284a37fd Refactor: Move simulation foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
ee44283393 Refactor: Move pointcloud and volume foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
2059b30ee2 Cleanup: Keep common IDTypeInfo code separated from ID type specific API.
Also remove useless IDTypeInfo callbacks.
2020-05-20 18:43:46 +02:00
4d613018ee Refactor: Move hair foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
e2d961809b Cleanup: Keep common IDTypeInfo code separated from ID type specific API.
Also remove useless IDTypeInfo callbacks.
2020-05-20 18:43:46 +02:00
140935ee7e Refactor: Move grease pencil foreach_id to new IDTypeInfo structure. 2020-05-20 18:43:46 +02:00
e4e31e4f14 Fix T76916: Cycles missing deform motion blur for shape key + subdiv modifier 2020-05-20 18:00:34 +02:00
93b5682444 Fix T76909 GPencil: Layers with mask(s) invisible when using "in front"
The gpSceneDepthTexture is using a dummy 1px texture which was generating
wrong values for uvs when sampling gpMaskTexture.

Use the max size of both since any of the 2 can use dummy texture.
2020-05-20 17:48:24 +02:00
e15ffc0c54 UI: Fix Wideline AA for timeline 2020-05-20 17:48:24 +02:00
796412dca0 UI: Allow registering File Browser as child of other child windows
E.g. when opening the File Browser from the Preferences window, it would
be the child of the main window the Preferences belong to. Now it can be
a child of the Preferences window itself.
The File Browser always stays on top of its parent window. Which avoids
some issues with OS window management, see T76418 and T72693.
Also removes a now unnecessary workaround to move the child window back
to the front after closing the file browser (opening the file browser
would move the main window and the file browser to the front).

Fixes T76418, T72693.
2020-05-20 17:10:25 +02:00
8fe448b44d Fix T75197: Eevee does not render instanced smoke
This check was introduced in rBc8005703f298, but does not
seem necessary anymore.

Reviewers: fclem, sebbas, brecht

Differential Revision: https://developer.blender.org/D7799
2020-05-20 16:55:43 +02:00
ccf43fe605 Cycles: Fix rendering instanced smoke domain.
The problem was that Cycles would store a pointer to an object in
`DEGObjectIterData->templ_dupli_object`. This pointer was then accessed
when the iterator was already freed.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D7797
2020-05-20 16:53:28 +02:00
aa0e98d707 Merge branch 'blender-v2.83-release' 2020-05-20 16:52:03 +02:00
b44101950d Fix T73979: Wrong location of fluid mesh when domain origin is not in center
Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7802
2020-05-20 16:52:03 +02:00
c1545c9a9d Fluid: Fix for non-moving liquid particles
Issue was introduced in 7bb3d9787e with new Mantaflow files from 61280e5af3.
2020-05-20 16:37:29 +02:00
717577d5fc BLI: Fix VectorSet copy constructor
Thanks to Howard for pointing that out.
2020-05-20 15:47:32 +02:00
e1050fb395 Merge branch 'blender-v2.83-release' 2020-05-20 15:31:54 +02:00
9897ef6a20 Fix T70948: Library Override: Parenting library override objects does not save offset from parent.
Parent inverse matrix needs to be overridable as well...
2020-05-20 15:31:02 +02:00
22c30219e7 Merge branch 'blender-v2.83-release' 2020-05-20 15:17:21 +02:00
d33c27d68b Fix T75457: Toggle brushes using same hotkey twice is broken
Caused by rB47da01a4db1d.

Above commit did not change the toolname it was setting when the brush
was actually toggled.

Maniphest Tasks: T75457

Differential Revision: https://developer.blender.org/D7792
2020-05-20 15:05:33 +02:00
3a5a158362 Merge branch 'blender-v2.83-release' 2020-05-20 22:16:42 +10:00
707a4c355f Merge branch 'blender-v2.83-release' 2020-05-20 22:16:34 +10:00
eb57377f12 Fix T76794: Number button cursor overrides eyedropper cursor
Pressing 'E' over a number button to pick a distance was keeping
left-right arrows instead of using the eye-dropper cursor.

Workaround this by clearing the active button before setting the cursor.
2020-05-20 22:07:55 +10:00
7d3bf5166d Fix color picker being used for non-color buttons such as rotation
Issue raised in T76794
2020-05-20 22:04:56 +10:00
578b0c00ca Merge branch 'blender-v2.83-release' 2020-05-20 10:43:02 +02:00
3360db83c4 Fix T76883: Zero users scenes after undo.
Some tags need to be preserved when we reuse existing ID entirely.
AFAICT, currently this is only the EXTRAUSER one.
2020-05-20 10:39:50 +02:00
db6e267bfc Fix T74298: Incorrect cursor position in Python console 2020-05-20 18:16:52 +10:00
ec86db82b0 Merge branch 'blender-v2.83-release' 2020-05-20 15:00:57 +10:00
5fe7605f3d Fix the current pixelsize impacting thumbnails 2020-05-20 14:58:57 +10:00
f69ecce14b Merge branch 'blender-v2.83-release' 2020-05-20 13:53:26 +10:00
a296dff2c8 Correct invalid limits in last commit 2020-05-20 13:48:25 +10:00
31137004ae UI: add text to icon-only menu items when displayed in search
Without this icon-only buttons in popovers don't have any text.
2020-05-20 12:43:02 +10:00
bfdfa35e6e Merge branch 'blender-v2.83-release' 2020-05-20 03:34:31 +02:00
aa02a05bc7 Fix T75977: Lower the merge limit in the bisect/mirror operation in symmetrize
This operation is using the code of the mirror modifier, so no default
is guaranteed to work in all cases. This value matches the defaults of
the mirror modifier.

Reviewed By: jbakker

Maniphest Tasks: T75977

Differential Revision: https://developer.blender.org/D7495
2020-05-20 03:24:51 +02:00
dfe8195dfe Cleanup: compiler warning 2020-05-20 01:15:08 +02:00
8f050b6825 Fix Cycles viewport render fully restarting after undo
With the optimized undo datablock pointers remain the same, so Cycles can now
update just the parts that changed.
2020-05-20 01:11:42 +02:00
499c0229f7 Fix T76858: non-thread safe sculpt memory allocation when using --debug-memory
By default the guarded memory allocator is not thread safe, that needs to be
initialized.
2020-05-20 00:33:49 +02:00
4f622c9a08 Fix Windows build after recent guardedalloc changes 2020-05-20 00:32:17 +02:00
e610964e89 Merge branch 'blender-v2.83-release' 2020-05-20 01:22:54 +02:00
183ba284f2 Cleanup: make guarded memory allocation always thread safe
Previously this would be enabled when threads were used, but threads are now
basically always in use so there is no point. Further, this is only needed for
guarded allocation with --debug-memory which is not performance critical.
2020-05-20 01:03:05 +02:00
120e9924c1 Cleanup: remove legacy mmap memory allocation for 32 bit
This helped to go beyond the 4GB limit, but is no longer relevant for 64 bit.
2020-05-20 00:57:41 +02:00
33fc42bd65 Merge branch 'blender-v2.83-release' 2020-05-20 00:46:15 +02:00
5ca8875f69 Fix T73148: Incorrect Repeat Last for transforms with Individual Origins and Normal orientation
`pvec` was confusing and was adding steps that are apparently unnecessary.
So the code has been redone so as not to use this pvec.
2020-05-19 18:54:57 -03:00
3bced3b306 Fix flag conflict in transform operators
This added some redundant properties
2020-05-19 18:54:57 -03:00
5267ce8e03 Merge branch 'blender-v2.83-release' 2020-05-19 23:42:32 +02:00
59cfb20fa1 Fix PBVH parallel range not initializing user data correctly in some cases
This was already changed for the TBB-based BLI_task_parallel_range in master.
This task local storage should always be initialized from the template, not
copied from another task which may be executing at the time the copy happens.

This may not fix any actual bug, we only use this user data for parallel reduce
and it's not clear that TBB ever calls the copy constructor for that case.

Ref T76858
2020-05-19 23:36:28 +02:00
8d63d7337c Fix unnecessary buffer reallocation in sculpt mode, causing an assert
Probably did not cause an actual, the assert is a performance warning.

Ref T76858
2020-05-19 23:36:12 +02:00
20c30534aa Fix T75383:Bevel weird behaviour when using bevel weights
Don't use the cube corner special case when the offsets are different
for the three edges involved. The generic VMesh for this situation isn't
perfect, but it's much better than a failed cube corner VMesh.

Tests pass.
2020-05-19 16:54:05 -04:00
42d77fbea1 UI: Make timeline vertical bars thickness work on OSX
Make use of Polyline shader.
2020-05-19 22:43:42 +02:00
8e0a57f9bd Merge branch 'blender-v2.83-release' 2020-05-19 16:40:53 -04:00
c554f4e14f Fix T75383:Bevel weird behaviour when using bevel weights
Don't use the cube corner special case when the offsets are different
for the three edges involved. The generic VMesh for this situation isn't
perfect, but it's much better than a failed cube corner VMesh.

Tests pass.
2020-05-19 16:40:40 -04:00
13125e0948 GPU: Attempt to fix Crash on startup with Intel HD Graphics 620/630
This only enables the workarounds that we know have effects on intels.
We could add the other workarounds if needed.

Related task T72098
2020-05-19 22:24:25 +02:00
a5a069c272 Fix T76080 Workbench: Background Glitches caused by Screen Cavity effect 2020-05-19 21:37:43 +02:00
0a19b8a5b4 OpenSubdiv: Remove old GPU code
This code was accidentally reintroduced in e73d7d27dc.
2020-05-19 21:35:47 +02:00
a3bdbb5e5b Merge branch 'blender-v2.83-release' 2020-05-19 16:32:43 -03:00
d6cc16831a Fix T73594: Scale Cage sometimes has incorrect center in edit mode
Differential Revision: https://developer.blender.org/D6803
2020-05-19 16:30:21 -03:00
5201bc9dd4 Fix T66916 UI: Wrong information in Status bar after cancelling a render
Fixed thanks to @manowii
2020-05-19 21:23:56 +02:00
e73d7d27dc Merge branch 'blender-v2.83-release' 2020-05-19 21:23:54 +02:00
7bb3d9787e Fix T76812: [Mantaflow] Inflow particles not continuous
Makes use of the new particle skipping option introduced in f25a882955cb.
2020-05-19 21:12:30 +02:00
61280e5af3 Fluid: Updated Mantaflow source files
Includes changes for particle skipping during advection.
2020-05-19 21:12:30 +02:00
fa270a37e8 Fix T76564 Curve: Missing orco cause mesh to not render 2020-05-19 21:01:21 +02:00
a4cbacacbf Fix T73847 Overlay: Camera orthographic scale moves background image 2020-05-19 21:01:21 +02:00
08b4faef01 Properly fix: T71040 / T58983 Ocean Modifier crashes at high resolutions
For a more detailed description of the issue see the commit
message for rB497cd3d7dd6e497be484eb78a8ddb23f53b20343

This change moves fftw to a shared library and reverts the bandaid
we did for 2.83.
2020-05-19 12:28:19 -06:00
a6c0874355 win/deps: generate sndfiles import library with ms lib tool
Unsure what it is that upsets it so much, but when linking
both sndfile and fftw dynamically, the linker gets confused
and thinks that fftw is importing sf_close from the blender
binary (which makes *NO* sense) leading to a start-up error.

Generating the import library from the .def file using the
ms lib tool creates an import library that works fine.
2020-05-19 12:22:36 -06:00
059f79bdd7 Clarify autokeyframe tootip
This applies to masks as well.

Spotted while looking into T76872.

Differential Revision: https://developer.blender.org/D7788
2020-05-19 18:43:30 +02:00
cfb7664d5b Fix: build error due to missing definitions
Reviewers: sergey, brecht

Differential Revision: https://developer.blender.org/D7787
2020-05-19 17:36:40 +02:00
dd62d95687 Merge branch 'blender-v2.83-release' 2020-05-19 17:10:44 +02:00
7fcf2e7d4a Fix T74577: world_to_camera_view broken for off-axis projection
The issue was that the projection would be inverted.
So if you shifted 0.1 along the y axis, world_to_camera_view would act
as if you had shited it -0.1 along the y axis.
2020-05-19 16:27:09 +02:00
813ff8913b UI: Small Changes to Graph Editor Active Vertex Panel
- X / Y value orders are all consistent, between handles and the keyframe.
  - Values are labeled consistently, with just "Frame" and "Value"
  - The more important type property that can affect the others comes first.
  - The "type" property provides nice visual separation between the
    handle properties.

Reviewed By: sybren, billreynish

Differential Revision: https://developer.blender.org/D7738
2020-05-19 10:27:07 -04:00
338abd6f68 Merge branch 'blender-v2.83-release' 2020-05-19 16:03:24 +02:00
0c20fce2f2 Fix T76697: [Mantaflow] mesh generation does not account for some particles
Adapted mesh generation to account for domains with disabled fractionstoo.
2020-05-19 16:02:38 +02:00
Josh Belanich
03fa66d274 Fix T72889: Cycles camera motion blur not usng more than 2 steps
Differential Revision: https://developer.blender.org/D7782
2020-05-19 15:40:56 +02:00
46c35dc283 Fix UV shadow drawing not respecting 'UV Opacity' setting
reapply changes from 30cbbccc60 / D7764 that were only meant for
master. Sorry for the noise!
2020-05-19 15:35:28 +02:00
a95afed6de Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-19 15:24:45 +02:00
9ccc73ade8 Animation: Make dopesheet filter labels consistent
There are three different label styles for the three Dopesheet filter
labels:

- "Display Hidden", which uses "Display" rather than "Show" as the other
  two options.
- "Show Errors", which does not use the word "only" to indicate it will
  hide all the non-error channels.
- "Only Selected", so no "show" or "display" in the label at all.

This commit changes:
- Always use the word "Show", not "Display".
- Always use the word "Only" when enabling the filter hides everything
  else.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D7742
2020-05-19 15:23:44 +02:00
Jeroen Bakker
9ac4e4a1c7 Fix T76375: UDIM Rectangular Tiled Image EEVEE freezes Blender
When packing the image the height of the tile was checked to the width
of the packing area. This resulted that the tile was ignored.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7784
2020-05-19 15:20:40 +02:00
cc485191e4 Merge branch 'blender-v2.83-release' 2020-05-19 15:18:39 +02:00
a6646fb0d0 Fix T76881: Changing "Use Speed Vectors" deletes all existing cache
Reviewers: sebbas
2020-05-19 15:18:33 +02:00
8c4965f86d Fix build error after 30cbbccc60
That part only applies to master, sorry for the noise
2020-05-19 15:17:11 +02:00
14278cd932 Fix T76694: Fluid cache is deleted when changing Upres Factor
Reviewers: sebbas
2020-05-19 15:13:25 +02:00
eb1cb7cb81 Merge branch 'blender-v2.83-release' 2020-05-19 14:45:07 +02:00
30cbbccc60 Fix (unreported) UV shadow not drawing smooth
When showing UV edges after modifiers [draw_uvs_shadow], these were never
drawn anti-aliased [in contrast to the 'main' UVs].

Also: they did not respect the new 'UV Opacity' setting.

Differential Revision: https://developer.blender.org/D7764
2020-05-19 14:42:19 +02:00
22998abe92 Merge branch 'blender-v2.83-release' 2020-05-19 14:17:40 +02:00
675ba2073d Fix T75694: Compositor Backdrop boundbox missing updates
This adds notifiers for backimage_move & backimage_fit.

Maniphest Tasks: T75694

Differential Revision: https://developer.blender.org/D7778
2020-05-19 14:16:22 +02:00
325307d82b Merge branch 'blender-v2.83-release' 2020-05-19 13:59:39 +02:00
4fa1fc29bd Fluid: Cleanup unused variables 2020-05-19 12:33:17 +02:00
e5c5e25c68 GPencil: Make is_nofill_stroke property editable
This can be used by some add-ons.
2020-05-19 12:24:42 +02:00
82bda82ec4 Fix T76541: OpenGl Depth Picking not selecting frontmost object
The issue was that we used GL_ALWAYS for depth checking here which would
lead to the depth information from objects being messed up.

It would not represent which object was closest to the camera.

Reviewed By: Clément Foucault, Jeroen Bakker, Campbell Barton

Differential Revision: http://developer.blender.org/D7710
2020-05-19 12:22:28 +02:00
25dea3e65e Fix T76717: Set Rotation Mode Incorrectly Recalculates Bone Rotation In Pose Mode
The issue was that we didn't convert the current rotational values.
We simply just switched mode without doing any data conversions.
2020-05-19 12:22:18 +02:00
10528a5cd4 Fix Frame Dropping not dropping the correct amount of frames
Previously the playback mode "Frame Dropping" would not drop the correct
number of frames which would lead to slow playback.

For example, the playback target is 60fps.  However we can only muster
around 32 fps.

The delta frames from the last step is in this case ~1.98 or so.

With the previous code, we would floor this.  That would lead us to step
forward one frame each time, effectively playing back the animation at
half the speed as we will try to render every frame.

To fix this we simply save the remaining fraction from the previous
frame and use it to compute the current frame step.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D7694
2020-05-19 12:22:07 +02:00
24e5c64ea2 Made pose push/relax to breakdown behave smooth on rotations
A follow up to T67212. I missed that the rotation interpolation had its
own code path.

The previous rotation push code was actually wrong (but smooth).

Now all of the actions behave correctly and is smoothly interpolated.
2020-05-19 12:21:53 +02:00
cddfa7a449 Fix T72729: Mask Modifier Loose Edges Not Shown
When using the mask modifier loose edges could be added to the mesh.
These edges weren't marked as loose edges and wasn't picked up by other
areas of blender.

This fix recalculates the loose edges so they have the correct flag
`ME_LOOSE_EDGE`.

Reviewed By: Sybren Stüvel

Differential Revision: https://developer.blender.org/D7766
2020-05-19 10:12:57 +02:00
b96ccb5126 Fix T76865: Vertex paint draws hidden but cannot be painted onto 2020-05-19 18:06:27 +10:00
f89b89fa7f CMake: Enable WITH_USD by default
Having USD disabled by default was an oversight, and could have been
corrected earlier. It's already enabled by default in the
`blender_release.cmake` and `blender_full.cmake`.
2020-05-19 09:39:51 +02:00
291136eece Fix T76689: Armature layers not indicating the existence of bones
From what I can see, there are two issues at play in {T76689} and its merged-in report {T76590}:

- In Blender ≤ 2.79 the bone layer dots were updated in the draw code. This ensured the info was up to date before drawing. This is no longer possible, as the drawing code uses evaluated objects, and those should not be written to. This has been addressed in rB709f126e8143 by calling the update function explicitly in various places in the code. The problem is that this wasn't added to all necessary spots.
- When in edit mode, changes are made to the edit bones but not to the 'actual' bones (this is synced when exiting edit mode). This causes undo to mess up the layer indicators.

I think both issues can be addressed by having the dependency graph update the used layer info as part of the armature evaluation. This will make the undo system work properly, and allows the removal of some `BKE_armature_refresh_layer_used()` from various places.

There is still the issue that there are two functions (`BKE_armature_refresh_layer_used()` and `ED_armature_edit_refresh_layer_used()`) that are both responsible for updating `bArmature::layer_used`. This is a trickier thing to solve, though, as the definition of the `EditBone` struct resides in the armature editor module. This means that blenkernel can't iterate over edit bones, but on the other hand the dependency graph shouldn't call any editor functions either. This is why I left the `ED_armature_edit_refresh_layer_used()` calls untouched.

The downside of recalculating `layer_used` from the dependency graph (at least in the way that I did it now) is that it is called every time a user moves a bone in pose mode. This frequency of updates is not necessary.

Differential Revision: https://developer.blender.org/D7709
2020-05-19 09:39:51 +02:00
888427cabb Fix T76780: Freestyle pass for one scene not accessible in compositor in other scenes
Current implementation would update the nodetree of the freestyle scene not the composite scene.

Reviewed By: Dalai Felinto

Differential Revision: https://developer.blender.org/D7770
2020-05-19 08:24:52 +02:00
fc06c248ed Fix T73169: Side by Side Stereo Rendering Glitches
Side by side and top down views were rendered using an unset matrix.
This fix will reset the matrix just before copying the views to the
screen.

Reviewed By: Clément Foucault, Dalai Felinto

Differential Revision: https://developer.blender.org/D7777
2020-05-19 08:22:05 +02:00
ac8b36535e Cleanup: Creator Args Spelling
Differential Revision: https://developer.blender.org/D7735
2020-05-19 00:54:37 -04:00
5fa58fb8a2 Fix T76821: Generalize Use Flow Tooltip 2020-05-19 00:53:59 -04:00
1151bcd53d Merge branch 'blender-v2.83-release' 2020-05-19 13:31:48 +10:00
f557198540 Merge branch 'blender-v2.83-release' 2020-05-19 13:31:44 +10:00
15bf81268c Fix switching to particle edit-mode from editmode
Similar to T76859
2020-05-19 13:27:08 +10:00
1afa97d547 Fix T76859: Cannot switch from editmode to texturepaint mode
Caused by 5159b8e1ea.
2020-05-19 13:18:10 +10:00
7bd07c9f5a Merge branch 'blender-v2.83-release' 2020-05-19 01:33:08 +02:00
ff7a30d928 Fix sculpt mask interpolation in subdivisions
The interpolation function of the datalayer was misssing so the sculpt
mask data was corrupted every time a subdivision surface modifier was
applied.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D7640
2020-05-19 01:31:55 +02:00
79a48c5676 Merge branch 'blender-v2.83-release' 2020-05-19 01:08:23 +02:00
7c9c8cee7b Fix T76397: Missing value property on Clear Mask pie menu
Without this value defined it was reusing the same 1.0 value after using
fill mask, so it was not working.

Reviewed By: jbakker

Maniphest Tasks: T76397

Differential Revision: https://developer.blender.org/D7699
2020-05-19 01:07:38 +02:00
393050e8e5 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-18 16:37:57 -06:00
497cd3d7dd Fix: T71040 / T58983 Ocean Modifier crashes at high resolutions
This is not as much a fix as a work around, but given the real
involves replacing how we build fftw, it is not eligible for 2.83
which is in BCON3 already.

The root of the issue lies with (how we build) fftw3

The first issue is: fftw does not build with MSVC, there are other
dependencies that are not compatible with MSVC and for those we
build the libraries required with mingw64, same for fftw

The second issue is: for reasons unknown we really really really
liked all deps to link statically so wherever possible we did so.

Now during the building of the fftw it linked a few symbols from
libgcc (which we do not ship) like __chkstk_ms, for which we passed
some flags to stop generating calls to it. Problem solved! There
is no way this could possibly turn around and bite us in the rear.

fast forward to today mystery crashes that look like a race condition.

What is happening is, we tell the linker that each thread will require
a 2-megabyte stack, now if every thread immediately allocated 2 megs,
that be 'rough' on the memory usage. So, what happens is (for all apps
not just blender), 2 megs are reserved but not backed by any real memory
and the first page is allocated for use by the stack, now as the stack
grows, it will eventually grow out of that first page, and end up in
an area that has not been allocated yet, to deal with that the allocated
page is followed by a guard page, someone touches the guard page it's
time to grow the stack!

Meanwhile in FFTW is it's doing substantial allocation using alloca
(up to 64 kb) on the stack, jumping over the guard page, and ending
up in reserved but not yet committed memory, causing an access violation.

Now if you think, that doesn't sound right! something should have
protected us from that! You are correct! That thing was __chkstk_ms
which we disabled.

Given we do not want a dependency on libgcc while building with MSVC
the proper solution is to build fftw as a shared library which will
statically link any bits and pieces it needs, however that change
is a little bit too big to be doing in BCON3.

So as a work around, we change the size the stack grows from 8k to
68k which gives fftw a little bit more wiggle room to keep it out
of trouble most of the time.

Note this only sidesteps the issue, this may come up again if the
conditions are just right, and a proper solution will need to be
implemented for 2.90.
2020-05-18 16:35:53 -06:00
c4ee94328f Fix invalid bit shift when GPU shader attribute is not found 2020-05-18 21:22:02 +02:00
0bdb827bdf Fix NULL pointer access reported by ASAN (harmless in practice but still weak) 2020-05-18 21:20:10 +02:00
e0ae229acb Fix potential crash due to dyntopo GPU buffer invalid memory access
When the number of triangles in a node became zero, the wireframe batch was
not freed along with the triangles batch and could still reference a freed
vertex buffer.

Ref T76858
2020-05-18 21:01:41 +02:00
afbe71342b Fix T76813: Snap to Edge Center returning a different normal from snap to Edge
This difference was intentional, but using the edge direction as normal is more useful.
2020-05-18 15:19:13 -03:00
06c57d3e7a Refactor: Move workspace foreach_id to new IDTypeInfo structure. 2020-05-18 19:01:20 +02:00
8f10f9d5dc Refactor: Move WindowManager and Screen foreach_id to new IDTypeInfo structure.
That one was a bit more complicated, and is still only partial refactor
(ultimately we want to have a foreach_id callback in SpaceType itself I
think...).
2020-05-18 18:51:06 +02:00
ae97a7ac10 Refactor: Move action foreach_id to new IDTypeInfo structure. 2020-05-18 18:43:11 +02:00
38a8d3aff1 Merge branch 'blender-v2.83-release' 2020-05-18 17:56:57 +02:00
46a4a53824 Outliner: Fix (unreported) more data-changing operators missing undo. 2020-05-18 17:56:33 +02:00
35f9c3b9a4 Merge branch 'blender-v2.83-release' 2020-05-18 17:35:30 +02:00
20b94257dc Fix part of T76544: dyntopo sculpt undo stack memory leak 2020-05-18 17:25:09 +02:00
31fc01eecb OIpenSubdiv: Cleanup, move to a better sounding namespace
The code is not only part of C-API, but also implements Blender-specific
glue level implementation.
2020-05-18 17:25:07 +02:00
9bc7ea5496 Fix T76814: [Mantaflow] Surface Tension always works
Initialize the curvature grid and compute the laplacian only if the diffusion flag is set.
2020-05-18 17:19:51 +02:00
fa116a9bbe Fix T76795: Missing node tree update after remove-on-cancel
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7775
2020-05-18 17:08:57 +02:00
2ad5131f77 OpenSubdiv: Cleanyp, remove old GPU code
All parts of drawing (shaders, GL mesh descriptor, material partitioner
and so on) needs to be redone for the draw manager and new OpenSubdiv
library.

Removing untested code which is doomed to be replaced to make localized
refactoring easier.
2020-05-18 17:06:48 +02:00
22f68f85a4 OpenSubdiv: Cleanup, remove unused topology orientation code
The code was trying to make winding consistent and manifold, same as
OpenSubdiv expects it to.

Unfortunately, the code was having some issues in corner cases so the
winding wasn't really correct.
Fortunately, the latter (compared to when this code was originally
written) supports orientation on OpenSubdiv side.

Removing code which is currently unused in Blender and which had
known issues. Is simple enough to bring the code from Git history
if the functionality is needed in the future.
2020-05-18 17:06:48 +02:00
54665233eb OpenSubdiv: Cleanup, Remove from legacy SubsurfCCG code
The CPU side implementation is done on a new dedicate base ground.
The GPU side must be redone anyway.
2020-05-18 17:06:48 +02:00
151fb62190 Merge branch 'blender-v2.83-release' 2020-05-18 17:04:43 +02:00
0d57ab611c Fix T76851: GPencil brush is reset after change mode
This was introduced by commit rBe58525706328

Now, the brush is not changed when change mode.

Thanks @Alaska for helping with this bug.
2020-05-18 17:04:17 +02:00
6eb00fb02e Fix T76730 DRW: Sorting of empty shading groups.
This is to fix an assert in EEVEE caused by a transparent shading group
that is create but not populated by any drawcall.
2020-05-18 16:59:04 +02:00
0bd7e202fb Curves: Disable Curve Normals by default
This patch just disable the curve Normals by default.

Reviewed By: #user_interface, billreynish, Severin

Differential Revision: https://developer.blender.org/D7755
2020-05-18 16:38:53 +02:00
cb8d8335b2 Fix T76828 Grease Pencil: Toggle Caps doesn't work
This was a logic error.
2020-05-18 16:01:07 +02:00
19413c4a82 Cleanup: GPencil: Fix float double promotion 2020-05-18 16:01:07 +02:00
48a5b1664a Merge branch 'blender-v2.83-release' 2020-05-18 15:54:30 +02:00
27cac4a102 Fix T62422: Baking ray distance do not work
The previous naming scheme for the "selected to active" baking options
lead to confusion and they were not describing what they actually did.

To remedy this, I've added a new settings that does what the older setting implied it did.

Reviewed By: Brecht, Dalai, Andy Davies

Differential Revision: http://developer.blender.org/D7733
2020-05-18 15:50:36 +02:00
121b2c0424 Fix T76799: Crash from undoing the copy-pasting of multiple data blocks.
Bug was actually in outliner code, paste operator would not generate any
undo step...

This was not correct ever, but with new undo code this has become a
critical issue, it cannot survive a situation where current main data
has been changed without a proper undo push.

This illustrates again how much of a catastrophic mess the 'tools'
callbacks of the outliner are currently, it has already caused us quiet
some pain in the past, and will keep doing so until this is fully
sanitized am afraid.

Would strongly suggest getting rid of thosw nasty mix of custom
callbacks requiring manual undo pushes, I do not see the added value of
this compared to regular menus calling regular operators. It only adds
confusion and extra code for nothing...
2020-05-18 15:47:03 +02:00
dcf67fdf7f UI: Widget: Make emboss offset dependent of line width 2020-05-18 15:27:30 +02:00
27b23148fa UI: Widgets: Reduce constants count in shader 2020-05-18 15:27:29 +02:00
6ede93bab3 Cleanup: Put GPU_state_init inside gpu_state.c
Also put glDisable(GL_DITHER) in it since we don't even use it (but is
enabled by default).

Also leave GL_MULTISAMPLE on by default since it has no impact on non-MSAA
framebuffers.
2020-05-18 15:27:29 +02:00
18dd289e1a Merge branch 'blender-v2.83-release' 2020-05-18 21:29:26 +10:00
80b340b034 Merge branch 'blender-v2.83-release' 2020-05-18 21:29:23 +10:00
b487ef6116 Fix T76593: Coordinate limit of 10,000 units
This is no longer needed for number button dragging to work properly.
2020-05-18 21:16:00 +10:00
b75ce05c3b Fix T75292: File-select events not handled while modal handler is active
Reviewers: Severin

Differential Revision: https://developer.blender.org/D7720
2020-05-18 11:59:53 +02:00
b1492b76ba Alembic: Fix bad allocation with invalid knots data
It is not impossible that the number of knots is stored wrong in the
file (for example, it will be 1 knot only).

This change fixes bad memory allocation and bad memory access in such
cases. It also fixes strict compiler warning which was mentioning that
the allocation size is wrong),

There isn't really the correct way of dealing with such situation, so
simply fall back to Blender's knots calculation.

Differential Revision: https://developer.blender.org/D7765
2020-05-18 11:50:34 +02:00
9796cb1661 Fix T76721: ASAN crash on animation rendering
Simple solution: remove the code which was causing bad threading
conflicts.

This code was a part of workaround for a specific state of linked
scene. It seems to be not needed anymore, since the pose is ensured
to be up to date by the following call stack:

- Dependency graph update,
- Copy-=on-write operation called on object.
- object_copy_data().
- BKE_pose_rebuild().

The workaround was a no-functional change for the dependency graph
anyway, because it was modifying original objects, not the ones
which are evaluated.
2020-05-18 11:48:24 +02:00
f3edff2d7d AVI: Fix read past array bounds
It is not enough to copy max of destination buffer size bytes, the
source might be smaller than the destination size.
2020-05-18 11:05:45 +02:00
005d04e145 Manta: Cleanup, strict compiler flag
For some reason was only visible with gcc-10 in release builds.

Kind of makes sense since there is no CMake code which removes strict
compiler flag, so deal with strict flags in the code itself.
2020-05-18 11:05:45 +02:00
a432cb2ad9 Merge branch 'blender-v2.83-release' 2020-05-18 18:58:21 +10:00
008e964940 Fix T76852: Breakdowner remembers limits last used 2020-05-18 18:49:40 +10:00
470ed9f074 Merge branch 'blender-v2.83-release' 2020-05-18 10:49:23 +02:00
04d15f1625 Fix T76573: Make links with Multires leading to crash 2020-05-18 10:48:45 +02:00
52d8b3a014 Fix T76849: Duplicate templates show in the New menu 2020-05-18 17:59:52 +10:00
a4b2734fe2 Fix T76801: Renaming bone in pose mode doesn't redraw the viewport names
The RNA name property of pose bones did not have any update logic defined.

Same issue also applied to the channel name in animation editors.

Duplicated the update logic from (edit-)bones now, other pose bone functions do
this too...
2020-05-18 09:51:20 +02:00
68ba154869 Merge branch 'blender-v2.83-release' 2020-05-18 17:14:28 +10:00
fd8d2ceafe Merge branch 'blender-v2.83-release' 2020-05-18 17:14:24 +10:00
815ffaa6c1 Merge branch 'blender-v2.83-release' 2020-05-18 17:14:17 +10:00
98e18c41b6 Cleanup: unused warning in last commit 2020-05-18 17:11:48 +10:00
2a3797b109 Cleanup: remove NULL checks from object mode switching take #2
Re-apply changes from 54ea356240,
with a poll function that uses the same active object as the operator,
matching other mode switching functions.
2020-05-18 17:07:23 +10:00
ff144edd8c Revert "Cleanup: remove redundant active object NULL check & poll"
This reverts commit 54ea356240 it
introduced crashes when trying to go to edit mode when the active
object was hidden.

Fix T76837
2020-05-18 08:32:07 +02:00
218579fa53 Merge branch 'blender-v2.83-release' 2020-05-18 16:30:34 +10:00
cfea716128 Fix error mixing incompatible enums when generating the proxy name 2020-05-18 16:12:17 +10:00
41825c7e0d Merge branch 'blender-v2.83-release' 2020-05-18 14:37:48 +10:00
9af72792a3 Cleanup: quiet enum conversion warning 2020-05-18 14:36:02 +10:00
5c5a638b57 Fix: Build error with MSVC
A parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax.

Removing the cast seems fine for both MSVC and GCC
2020-05-17 12:22:14 -06:00
dde7a762c3 Fluid: Bake cache for more frames by default 2020-05-17 17:09:29 +02:00
fe257cc384 Fix T74060: Smoke flow force field not working with Mantaflow Gas
cb252ca8d316 was also needed to fix the velocity loading from the cache.
2020-05-17 17:09:28 +02:00
a975cb9207 Fluid: Foundation for new OpenVDB file IO
This commit lays the foundation for support for OpenVDB caching with multiple grids per cache file.
2020-05-17 17:09:28 +02:00
0abe5936b7 Fluid: Cleanup namespace std 2020-05-17 17:09:28 +02:00
eaf7d36d66 UI: Graph Editor: Draw Handles Lines With Smoothing
Enabling "Use High Quality Display" in the graph editor enables
AA for the curves, this enables it for bezier handles too.

Differential Revision: https://developer.blender.org/D7740
2020-05-15 15:12:58 -04:00
d9773edaa3 Cycles: code refactor to bake using regular render session and tiles
There should be no user visible change from this, except that tile size
now affects performance. The goal here is to simplify bake denoising in
D3099, letting it reuse more denoising tiles and pass code.

A lot of code is now shared with regular rendering, with the two main
differences being that we read some render result passes from the bake API
when starting to render a tile, and call the bake kernel instead of the
path trace kernel.

With this kind of design where Cycles asks for tiles from the bake API,
it should eventually be easier to reduce memory usage, show tiles as
they are baked, or bake multiple passes at once, though there's still
quite some work needed for that.

Reviewers: #cycles

Subscribers: monio, wmatyjewicz, lukasstockner97, michaelknubben

Differential Revision: https://developer.blender.org/D3108
2020-05-15 20:25:24 +02:00
3ff8ca60e9 Merge branch 'blender-v2.83-release' 2020-05-15 19:38:40 +02:00
e5ace51295 Fix T76734: Changing Envelope FModifier controlpoints missing update
Issue is that update functions defined in
`rna_def_fmodifier_envelope_ctrl` (namely `rna_FModifier_update`) are
actually never called.

This is because UI code for FCurve modifiers often does not use RNA
buttons but uses custom update functions (or non at all). For example,
rB9a88bd55903a did this for the generators, envelope control points did
not have this at all.

This is now changed to use RNA buttons for the envelope control points,
this could done for other non-RNA buttons as well to get rid of
'validate_fmodifier_cb()'.

Maniphest Tasks: T76734

Differential Revision: https://developer.blender.org/D7732
2020-05-15 19:29:33 +02:00
e1c2eba4de Merge branch 'blender-v2.83-release' 2020-05-15 19:26:02 +02:00
abcb23f5a3 Fix T76698: Movie clip stabilize display ignore footage colorspace
settings

Stabilized ImBuf just needs to use the same colorspace and alpha
settings as the original one.

Maniphest Tasks: T76698

Differential Revision: https://developer.blender.org/D7713
2020-05-15 19:08:58 +02:00
a8fc3c88ef Refactor: Move linestyle foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
7ff933089a Refactor: Move mask foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
c44d6fb987 Refactor: Move movieclip foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
0055aa994d Refactor: Move particle foreach_id to new IDTypeInfo structure. 2020-05-15 19:03:53 +02:00
a952f8dab0 Merge branch 'blender-v2.83-release' 2020-05-15 18:40:19 +02:00
001d70eb2b Fix T76277: Remove wrong cast in rna_NodeTree_update
This patch fixes T76277 by removing the incorrect cast from
`ptr->data` to `bNode`. The address of `ptr->owner_id` and
`ptr->data` both point to the node tree. Passing the node tree
incorrectly as a node into the `ED_node_tag_update_nodetree`
corrupts the data, because it attempts to set flags on the
node.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D7747
2020-05-15 18:29:42 +02:00
ecec6547c7 Merge branch 'blender-v2.83-release' 2020-05-15 18:02:10 +02:00
9632a06201 Fix embedded IDs not being enough/properly initialized.
Among other things, they were missing library pointer, session uuid
initialization, etc.

Fix T74546: Corrupted nodegroups crash blender when copy pasting or
appending them.

Fix (unreported) asserts when undoing some production scenes (from
coffee run e.g.).

Initialy caused by rB0aac74f18f2d.
2020-05-15 17:57:13 +02:00
b14243be77 blenlib: BLI_file_attributes() Correction
Adds an Correction to properly handle possibility of overflow of path name.

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

Reviewed by Brecht Van Lommel
2020-05-15 08:11:57 -07:00
0f2c7f3864 Merge branch 'blender-v2.83-release' 2020-05-15 16:54:33 +02:00
0541906162 Cleanup: rename readfile utils dealing with embedded IDs to proper name. 2020-05-15 16:54:03 +02:00
363f18c8b5 Merge branch 'blender-v2.83-release' 2020-05-15 16:51:36 +02:00
1cad0a627e GPencil: Fix unreported missing Sculpt/Vertex/Weight paint brushes
This error was introduced wit the change in commit https://developer.blender.org/rB6a850f3cc840

As the brushes were not created, all modes except Edit were broken. 

Now, the brushes and palette are not created when load the file in versioning code, but when the mode is enabled.

Also, if the brush already exist, the parameters are not reset as it was done in the versioning code in order to keep user settings.

The same logic is used for the default palette.
2020-05-15 16:50:38 +02:00
d6e0b55b1c Merge branch 'blender-v2.83-release' 2020-05-15 16:32:50 +02:00
a269761ec1 Cleanup: clang format
Sorry for the noise, somehow missed that in rB0a32f6c8686c.
2020-05-15 16:31:18 +02:00
b67f649077 Merge branch 'blender-v2.83-release' 2020-05-15 16:02:12 +02:00
266caa1820 Fix T76755: texture paint on udims crash
Caused by rB5593efec01c2.

Use first texture if we dont have an ImageUser (instead of multiview
one). Same fix as in rB9ace7e243978 / T74925.

Maniphest Tasks: T76755

Differential Revision: https://developer.blender.org/D7743
2020-05-15 15:56:35 +02:00
998e26704b Merge branch 'blender-v2.83-release' 2020-05-15 23:16:39 +10:00
fe0036c586 Fix T76563: Transforming an auto-aligned point won't set it aligned
When local origins are used or a single control point is selected,
change the handle types from auto to aligned.
2020-05-15 23:13:57 +10:00
2b36cf3118 Libmv: Fix crash solving when having negative frames
Don't use linear array with frame as an index since it has the
following disadvantages:

- Requires every application to take care of frame remapping, which
  could be way more annoying than it sounds.

- Inefficient from memory point of view when solving part of a footage
  which is closer to the end of frame range.

Using map technically is slower from performance point of view, but
could not feel any difference as the actual computation is way more
complex than access of camera on individual frames.

Solves crash aspect of T72009
2020-05-15 14:59:25 +02:00
86580c437b Cleanup: int->BVHCacheType enum 2020-05-15 13:55:01 +02:00
03659c2cf9 Merge branch 'blender-v2.83-release' 2020-05-15 13:47:04 +02:00
a5d394fad2 Fix segfault when trying to free uninitialized loop normals
Forgot this corner case when I created the new normal flip code.
2020-05-15 13:39:35 +02:00
0a32f6c868 Fix T76710: objects get lost in linked/overridden collections
Right now:
- drag-drop in the Outliner prevents dropping inside linked collections
- drag-drop in the Outliner allows dropping inside overridden
collections (should not be the case)
- `Object Properties` > `Collections` panel allows to add to overridden
collection (should not be the case)
- `Object Properties` > `Collections` panel filters out non-local
collections (so adding to linked collections is forbidden)
- `bpy collection.objects.link()` allows to add to linked collections
(should not be the case)
- `bpy collection.objects.link()` allows to add to overridden
collections (should not be the case)

While this might be supported in the future for overriden collections,
these cases should not be allowed atm. since objects get lost on file
reload.

Note: for the case of the `Object Properties` > `Collections` panel,
this could be improved further to filter out overridden collections as
well.

Reviewers: mont29, brecht

Subscribers:
2020-05-15 13:32:15 +02:00
3a14c011f9 GPencil: Fix unreported crash using U key in Draw mode
The problem was the preview could be not available when press the key.
2020-05-15 13:05:58 +02:00
04517ee936 Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-15 12:59:24 +02:00
0ae64a9945 Fix T76695: Not exporting normals properly in Alembic format
When auto-smooth enabled, but no custom normals layer present, the Alembic
exporter would incorrectly assume the mesh was shaded smooth. This is now
corrected, and normals are always written when auto-smooth is enabled.
2020-05-15 12:58:48 +02:00
5f95912afc BLI: add missing include for size_t 2020-05-15 12:48:45 +02:00
7049d2dc58 Fix T76778: Dopesheet "Show Errors" affects timeline
Since the timeline is a variation of the dopesheet, it also respects
some of the dopesheet settings.

The "Selected Only" setting is overridden from a scene property (since
rB4904eadc0f38) and the "Display Hidden" dopesheet setting seems to be
ignored.

This commit adds the remaining "Show Errors" setting to the menu,
allowing it to be updated from the timeline.
2020-05-15 11:54:17 +02:00
547f50b5e0 Libmv: Add map utility 2020-05-15 11:20:45 +02:00
6398892121 Libmv: Cleanup, spelling 2020-05-15 11:20:45 +02:00
f1cb11f0fa Merge branch 'blender-v2.83-release' 2020-05-15 10:53:32 +02:00
19d822c677 Fix T76740: Static Override - Library Override Crash
Missing proper tagging of 'backward' pointer from fcurve to its group in
RNA would lead to infinite loop...

Issue was triggered by override, but crash could be generated from other
places as well (like from py console), on any action actually...
2020-05-15 10:46:55 +02:00
e60560bda0 Fix T76738: Duplicate brushes cause assertion on undo
Changes for 2.90 versioning.
2020-05-15 17:53:03 +10:00
559a8886d6 Merge branch 'blender-v2.83-release' 2020-05-15 17:48:31 +10:00
20c25bffda Merge branch 'blender-v2.83-release' 2020-05-15 17:47:58 +10:00
656692913b Merge branch 'blender-v2.83-release' 2020-05-15 17:47:54 +10:00
3c0fd51cf4 Fix T76738: Duplicate brushes cause assertion on undo 2020-05-15 17:45:41 +10:00
6a850f3cc8 Fix duplicate ID's being created when appending/linking
This removes grease pencil brush creation/dat-block delete on load,
since this causes duplicate data-blocks.

Add assert to prevent this happening in the future
since the error is isn't obvious.
2020-05-15 17:42:01 +10:00
c361f911f9 Fix error versioning paint-slots pre-2.80 2020-05-15 16:51:33 +10:00
191c562f98 Merge branch 'blender-v2.83-release' 2020-05-15 12:52:31 +10:00
4ce1829289 Cleanup: don't check flags as booleans
Causes unexpected behavior when adding new flags.
2020-05-15 12:47:47 +10:00
c880e54a95 Cycles: Refactor microfacet BSDFs to remove separate anisotropy code
Since the sampling and evaluation functions handle both cases anyways,
there's not really a point for keeping the distinction in the kernel,
so we might as well cut down the number of CLOSURE_BSDF_MICROFACETs a bit.

Differential Revision: https://developer.blender.org/D7736
2020-05-15 00:52:57 +02:00
8d918fe0f2 Merge branch 'blender-v2.83-release' 2020-05-14 21:50:07 +02:00
f716bb3b71 GPencil: Add licence text at header 2020-05-14 21:49:44 +02:00
516e1b4031 Fix T76025: Flip/recalc steep custom normals produces wrong result
The issue was the custom loop normal data would be mangled when we
reversed the face loops.

The flip face code will now correctly flip the custom face normals so
they are not left in an undefined state.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D7528
2020-05-14 21:17:33 +02:00
2efe77ca51 Fix missing hinting information in default font
Updates the font file to bring back hinting data, which got lost somehow
in dc3f073d1c.

Second and (hopefully) final fix for T75898.
2020-05-14 20:17:26 +02:00
Nikhil Shringarpurey
3ced9c1c72 Fix missing hinting information in monospace font
Updates the monospace font file to bring back hinting data, which got
lost somehow in dc3f073d1c.

Partial fix for T75898.
2020-05-14 20:17:07 +02:00
6716baa1f7 Fix T76476 EEVEE: Invalid Vector to Float conversion for nodegroups
The previous code only handled the RGBA socket case. For vectors, we simply
use the average of the 3 compoments. This is done using a temp Vector Math
node using the dot operation.
2020-05-14 19:57:51 +02:00
4ac748c099 Merge branch 'blender-v2.83-release' 2020-05-14 19:54:15 +02:00
5f31e5031c GPencil: Fix unreported problem filling textured strokes
The internal image used for filling was not correct when the texture was used in stroke and this makes impossible get a right filling.
2020-05-14 19:53:55 +02:00
cc3d3a453e Fix: Broken build with TBB disabled.
Lite builds without TBB and still needs the alternative codepath
2020-05-14 10:39:12 -06:00
Tautvydas Andrikys
33ce0cb5a1 Fix T63588: Cycles unnecessarily updates background importance sampling map 2020-05-14 17:56:50 +02:00
461fee5328 BLI: deduplicate address sanitizer code
Reviewers: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D7731
2020-05-14 17:42:54 +02:00
5940485369 Fix T76168 Workbench: Shadows behind a culled backface are inverted 2020-05-14 17:41:05 +02:00
16d8a683be Fix T73984: unnecessary Cycles viewport updates with object texture coordinates
Remove old code that added extra updates for shaders that have a dependency on
objects. The dependency graph can now tell Cycles when a material is affected by
an object transform.
2020-05-14 17:39:37 +02:00
ea84c12a2b Merge remote-tracking branch 'origin/blender-v2.83-release' 2020-05-14 17:14:12 +02:00
72492eb2a2 Update RNA Manual References after camera fix
There was no link to the base camera* properties (e.g., lens).
2020-05-14 17:13:52 +02:00
dc4983dfdd Merge branch 'blender-v2.83-release' 2020-05-14 16:49:18 +02:00
78e3b7c28d Sculpt: Render Face Sets always as flat shading
This removes the smooth shading rendering from the face set overlay when
smooth shading is enabled.

Reviewed By: jbakker

Maniphest Tasks: T74906, T74622, T75331, T76530

Differential Revision: https://developer.blender.org/D7105
2020-05-14 16:47:50 +02:00
fa23e313f1 Merge branch 'blender-v2.83-release' 2020-05-14 16:32:38 +02:00
e585257063 GPencil: Changes in 2D template
Differential Revision: https://developer.blender.org/D7619
2020-05-14 16:31:51 +02:00
4ae30b9f63 Merge branch 'asset-uuid' into asset-engine 2019-11-26 18:18:12 +01:00
15a97791c8 Remove the Amber asset engine code, this has nothing to do in that patch. 2019-11-26 18:15:21 +01:00
4da29610d6 Fix after recent merge... 2019-11-26 18:13:59 +01:00
9fd98f9570 Merge branch 'asset-uuid' into asset-engine
Conflicts:
	source/blender/makesrna/intern/rna_asset.c
2019-11-26 18:06:12 +01:00
f3ae50c765 Rename some variables in AssetUUID struct. 2019-11-26 17:59:51 +01:00
c263dbe996 Merge branch 'asset-uuid' into asset-engine 2019-11-26 17:46:25 +01:00
cdacfc2f47 Some more minor fixes/cleanups. 2019-11-26 17:45:55 +01:00
ab324e8ea3 Merge branch 'asset-uuid' into asset-engine
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/writefile.c
2019-11-26 17:37:24 +01:00
67ee496c1b Updates from code review.
Mostly various cleanups, and a few important fixes too (some potential
memleaks, missing writing of UUID struct for ID placeholders of linked
data-block in writefile.c).
2019-11-26 17:34:11 +01:00
9945fab5d5 Merge branch 'asset-uuid' into asset-engine 2019-11-26 15:50:17 +01:00
2563953366 Merge branch 'master' into asset-uuid 2019-11-26 15:49:49 +01:00
e7ac5954c9 Merge branch 'asset-uuid' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_asset_engine.h
	source/blender/blenkernel/intern/asset_engine.c
	source/blender/blenloader/BLO_readfile.h
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_space_types.h
	source/blender/makesrna/RNA_access.h
	source/blender/makesrna/intern/rna_ID.c
	source/blender/makesrna/intern/rna_asset.c
2019-11-25 18:11:05 +01:00
a05cc483f1 Merge branch 'master' into asset-engine 2019-11-25 17:55:20 +01:00
bc13ceba27 Merge branch 'master' into asset-uuid 2019-11-25 17:54:58 +01:00
0eda3bae64 Add 'asset uuid' to IDs.
This commit is a subset of the asset-engine branch, only adding the uuid
struct to data-blocks, with a basic minimal RNA/Python API to use it.

it does not contain anything regarding asset engines and asset
management itself.

Besides being a first step towards full integration of asset engine work
into master, it is also the 'minimal requirement' from the studio here
for next Cosmos production pipeline (regarding own in-house management
tools).
2019-11-25 17:42:01 +01:00
eb62837c32 Merge branch 'master' into asset-engine 2019-11-25 16:07:13 +01:00
870bc1aa66 Merge branch 'master' into asset-engine 2019-11-18 12:37:19 +01:00
b14b335a41 Merge branch 'master' into asset-engine 2019-11-07 16:25:24 +01:00
249646f19d AssetUUID: add basic default init value for asset part of it to rna creator.
Reauest from Cosmos pipeline R&D team.
2019-11-06 17:08:17 +01:00
ffb581e7f4 AssetUUID: add basic search for Asset UUIDs in current .blend file.
Needed for Cosmos pipeline R&D.
2019-11-06 16:52:27 +01:00
c258ff967d Initial basic support for assets definition in .blend file itself, and RNA api access.
This still *very* basic, but should be usable as proof of concept for
Cosmos pipeline tests...

Note that the question of where to put all asset metadata remains open,
we could extend AssetUUID struct, and/or add support of IDProps to it,
or just use some special-named IDProp in IDs themselves (like the
_RNA_UI thing for custo; props UI settings...).
2019-11-05 14:37:43 +01:00
836883f1d2 Merge branch 'master' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/editors/space_file/file_ops.c
2019-11-05 14:35:04 +01:00
52151821c0 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/editors/space_file/file_ops.c
2019-10-14 21:14:03 +02:00
bf72a5ba90 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/editors/space_file/filesel.c
2019-10-10 11:02:13 +02:00
cbbe76a564 Merge branch 'master' into asset-engine 2019-09-30 11:34:29 +02:00
54b60eb1b0 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_files_link.c
2019-09-19 20:51:09 +02:00
a644b3aba7 Merge branch 'master' into asset-engine
Note: reworking filebrowser UI is still TODO.

Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/blenloader/intern/versioning_280.c
	source/blender/editors/include/ED_fileselect.h
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_view3d/space_view3d.c
2019-09-12 15:45:01 +02:00
93e1e3e532 Merge branch 'master' into asset-engine 2019-09-05 09:46:32 +02:00
b5e502982a Merge branch 'master' into asset-engine 2019-09-05 09:24:54 +02:00
f7eec7e19f Merge branch 'master' into asset-engine
Partial merge only, UI in filebrowser has been heavily changed and need
more work...

Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/blenloader/intern/versioning_280.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/intern/wm_operator_props.c
2019-09-04 22:57:38 +02:00
6ccb1999fd Merge branch 'master' into asset-engine 2019-09-02 11:25:00 +02:00
25caef24a8 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenloader/intern/versioning_280.c
	source/blender/makesdna/DNA_ID.h
2019-08-30 09:55:59 +02:00
9a6aef2694 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2019-08-23 10:42:24 +02:00
f398eb0668 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2019-08-19 19:14:10 +02:00
95b12e4fb9 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_defaults.c
	source/blender/windowmanager/intern/wm_files.c
2019-08-06 12:42:58 +02:00
ec822defc6 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2019-07-28 14:58:37 +02:00
faf47d75ae Merge branch 'master' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/makesrna/intern/rna_space.c
	source/blender/windowmanager/WM_api.h
2019-07-14 20:58:20 +02:00
38ea78d664 AssetEngines: fix memleaks in append case... 2019-05-23 21:34:43 +02:00
7553424511 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_defaults.c
	source/blender/editors/space_file/space_file.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/intern/wm_init_exit.c
2019-05-23 21:12:09 +02:00
9c43fc8e84 Merge 'master' into 'asset-engine' 2019-04-17 12:30:44 +02:00
42a2d2bdee Merge 'master' into 'asset-engine' 2019-04-17 12:30:44 +02:00
02780596b4 Merge 'master' into 'asset-engine' 2019-04-17 12:30:42 +02:00
b5cb4021fa Merge 'master' into 'asset-engine' 2019-04-17 12:30:40 +02:00
b1a15bc54e Merge 'master' into 'asset-engine' 2019-04-17 12:30:39 +02:00
a4cac7b066 Merge branch 'master' into asset-engine 2019-04-16 14:47:49 +02:00
3ff7a5991a Merge branch 'master' into asset-engine
Conflicts:
    source/blender/windowmanager/intern/wm_operator_props.c
2019-04-16 12:10:48 +02:00
e782910b18 Merge branch 'master' into asset-engine
Kinda painful merge thanks to extensive changes to things like Main
listbases names, linking code, etc.

Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/intern/wm_files_link.c
2019-03-18 20:28:49 +01:00
edce196beb Merge branch 'master' into asset-engine 2019-02-19 10:33:03 +01:00
b0b7c2482f Merge branch 'master' into asset-engine 2019-02-09 20:08:35 +01:00
6b0dd041e1 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_global.h
	source/blender/python/intern/bpy_app.c
2019-02-04 11:30:02 +01:00
43985368a1 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenloader/BLO_readfile.h
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/intern/wm_files_link.c
2019-01-30 23:04:39 +01:00
2ed89aab44 Merge branch 'master' into asset-engine 2019-01-14 14:35:42 +01:00
a57e03a17a Update Amber & generic Asset Engine code for changes in 2.8.
Many noisy changes in past 6 months... ;)
2019-01-09 17:13:36 +01:00
be2da10260 Merge branch 'master' into asset-engine 2019-01-09 17:09:18 +01:00
080deff077 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_space_types.h
2019-01-09 13:46:58 +01:00
93712fed2c Merge branch 'master' into asset-engine
Rather painful, too much cleanup/renamings in between...

Note that this is not currently functionnal, builds but does not show
AEs in filebrowser selector for some reason. No time to track that now.

Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_defaults.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_script/script_edit.c
	source/blender/editors/space_script/script_intern.h
	source/blender/editors/space_script/script_ops.c
	source/blender/makesrna/intern/rna_internal.h
	source/blender/windowmanager/intern/wm_files.c
	source/blender/windowmanager/intern/wm_files_link.c
2019-01-06 17:27:42 +01:00
5f61756f46 Merge branch 'blender2.8' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_280.c
	source/blender/blenloader/intern/versioning_defaults.c
	source/blender/editors/include/UI_interface.h
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_dragdrop.c
	source/blender/windowmanager/intern/wm_files_link.c
2018-09-10 19:12:10 +02:00
b838d869c6 Merge branch 'blender2.8' into asset-engine 2018-07-01 16:53:32 +02:00
ce490e9846 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenloader/intern/versioning_280.c
	source/blender/blenloader/intern/versioning_defaults.c
	source/blender/windowmanager/WM_api.h
2018-07-01 16:49:59 +02:00
16b540f39e Fix broken Amber after Group -> Collection change. 2018-06-18 13:03:08 +02:00
e1380ed958 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_intern.h
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/makesrna/intern/rna_ID.c
	source/blender/makesrna/intern/rna_space.c
	source/blender/windowmanager/intern/wm_files.c
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/intern/wm_init_exit.c
2018-06-18 12:59:27 +02:00
8211eaa6dc Merge branch 'blender2.8' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_info.py
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_280.c
	source/blender/makesdna/DNA_ID.h
	source/blender/makesrna/intern/rna_space.c
	source/blender/windowmanager/intern/wm_files_link.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2018-05-29 11:15:02 +02:00
eeec0e3ae6 Merge branch 'blender2.8' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2018-04-13 12:25:55 +02:00
77c164439f Typo 2018-04-13 11:58:31 +02:00
b54f31c84c Merge branch 'blender2.8' into asset-engine 2018-04-11 15:24:18 +02:00
2fa019fa65 Fix again 'auto override' system.
Got lost in big undo refactor.

Note that this is probably (maybe) not how we want to have it in the
end, things like EditMode undo should probably not trigger this check?
2018-04-11 15:16:10 +02:00
4aa300ef91 Merge branch 'blender2.8' into asset-engine 2018-04-11 15:09:02 +02:00
966fef9d34 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/makesrna/intern/rna_ID.c
2018-04-10 18:24:09 +02:00
7824b6e506 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_init_exit.c
2018-04-03 17:53:20 +02:00
fd75f7d3e0 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/makesrna/intern/rna_ID.c
2018-03-29 14:27:03 +02:00
571c1ff720 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/WM_types.h
2018-03-19 16:35:17 +01:00
7bd39f4584 Merge branch 'blender2.8' into asset-engine 2018-02-13 09:50:04 +01:00
0daf29b8ea Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/blender.c
2018-02-12 12:55:06 +01:00
10733b356d Add last missing piece of asset engine API, load_post callback.
This allows asset engine to perform whatever they need on data-blocks
(either linked or appended ones), once they have been added to Blender
data (Main).

This is an optional callback intended for advanced/complex asset
management (and possibly also for generative procesing), basic asset
engines should typically not need it.

Amber uses it just to do some dummy testing prints right now.
2018-02-12 12:42:33 +01:00
6169388d0d Merge branch 'blender2.8' into asset-engine 2018-02-09 17:24:44 +01:00
d771d11bf0 Merge branch 'blender2.8' into asset-engine 2018-02-09 16:26:32 +01:00
d4effd9e7b Merge branch 'blender2.8' into asset-engine 2018-02-09 14:43:01 +01:00
baa5f2fca1 Fixes for last merge. 2018-02-07 22:40:11 +01:00
f9dc415114 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2018-02-07 22:30:05 +01:00
33adb5e41b Merge branch 'blender2.8' into asset-engine 2018-02-07 11:57:12 +01:00
55755fa3f7 Merge branch 'blender2.8' into asset-engine 2018-02-07 10:26:44 +01:00
9c9bc6e131 Cleanup/internal renaming. 2018-02-07 10:26:35 +01:00
6cfd91f59e Cleanup: remove asyncio version of Amber, and Claude, from branch for now.
They make review patch even more confusing, and are useless/broken
currently anyway. Claude will be redone later.
2018-02-07 10:26:21 +01:00
70bcbc5569 Merge branch 'blender2.8' into asset-engine 2018-02-02 10:48:02 +01:00
eb6b5b74a8 Merge branch 'blender2.8' into asset-engine 2018-02-01 16:42:42 +01:00
3176da61cb Merge branch 'blender2.8' into asset-engine 2018-01-29 12:58:16 +01:00
e04d94cdab Merge branch 'blender2.8' into asset-engine 2018-01-29 10:28:01 +01:00
2491a8e416 Merge branch 'blender2.8' into asset-engine 2018-01-28 17:50:38 +01:00
8f8f5a6588 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/makesdna/DNA_ID.h
2018-01-21 17:37:33 +01:00
288e30ead0 Merge branch 'blender2.8' into asset-engine 2018-01-11 13:27:36 +11:00
1ceff9329c Fix generating dummy pixel data
Range was for an unsigned int instead of an int,
caused overflow error
2018-01-11 12:40:52 +11:00
bf1a34d000 Amber: Fix several issues with edit code when there was no repo present yet.
Reported by Campbell on IRC, thanks.
2018-01-09 11:02:12 +01:00
ec1e3ba904 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/makesdna/DNA_ID.h
2018-01-09 10:04:02 +01:00
255764cb8b Merge branch 'blender2.8' into asset-engine 2017-12-14 20:26:55 +01:00
61c33428bd Merge branch 'blender2.8' into asset-engine 2017-12-08 10:37:38 +01:00
25f3fe52cd Correct comments. 2017-12-08 10:36:54 +01:00
90adddceb3 Merge branch 'blender2.8' into asset-engine 2017-12-05 22:39:37 +01:00
4f1926fba8 Assets/lib drag'n'drop: append by default, link when shift is held. 2017-12-05 20:45:18 +01:00
21c9ec813d Make Amber a real add-on.
Well, real add-on... since we want to keep it in main repo for now, it
still needs some hacks to 'behave' like a regular add-on. :/

Anyway, it's now removed from startup files, and will live in modules
until we go to master itself.

Also, make it enabled by default in factory startup.
2017-12-05 15:27:08 +01:00
b58165970d Merge branch 'blender2.8' into asset-engine 2017-12-05 12:00:08 +01:00
c87440c91b Fix linking from temp filebrowser.
We should only set mouse coordinates when we are actually invoked to
link something, not when we are invoked to show filebrowser.

Else (filebrowser invoke case) we have a mouse coordinates sticking
around, which we try to use later in wrong context.

For some reasons, in master that was not an issue, but in 2.8
ED_view3d_give_base_under_cursor() will crash when context is wrong. :/
2017-12-04 15:45:55 +01:00
2188483456 Merge branch 'blender2.8' into asset-engine
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_files_link.c
2017-12-04 14:38:47 +01:00
b870590009 Various cleanup and minor fixes. 2017-12-01 14:20:11 +01:00
8f6c42a79f Merge branch 'blender2.8' into asset-engine 2017-12-01 12:26:18 +01:00
a571bee4af Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
	source/blender/windowmanager/intern/wm_files_link.c
2017-11-29 19:55:47 +01:00
172aa404d8 Merge branch 'blender2.8' into id_override_static 2017-11-29 17:45:14 +01:00
62d5a0353d Merge branch 'blender2.8' into id_override_static 2017-11-29 17:23:12 +01:00
e7a364ba8f ID static override: add basic support for overriding animation.
This is very bold right now - you simply can replace (or add) an action
to an override data-block. Actions themselves are not 'customizable'
through override at all currently (we may at least add
'add/remove/replace fcurves' feature in future), and nothing else in
animdata is overridable currently.
2017-11-29 17:20:00 +01:00
0b963b784a Make basic object & bones transformations overridable.
You can now override loc/rot/scale of objects and posebones.

Also added a basic operator to make an override of active linked object,
but this is very limited/wip/testing feature (you have to manually override
object and its armature, and relink to proper local overrides
yourself...). Final 'make proxy killer' will be much more automated of
course.
2017-11-29 17:14:27 +01:00
8a4155eb34 ID static override: Make most Image properties overridable.
First real 'usable' commit, will be needed by the 'virtual data-block'
asset feature (i.e. to be able to link a mere image file as if it was a
linked datablock, and generate automatically an override of it to make
it editable).
2017-11-29 17:10:24 +01:00
322433f18f ID static override: automatically detect new overrides as part of undo step.
We could do that in several different way, e.g. adding some tag during
DEG evaluation, etc. But this is not a critical process (it's main
purpose is user feedback), so current solution seems to work well enough
- and it's dead simple! ;)
2017-11-29 17:06:28 +01:00
e79d9048f3 ID Static Override: add basic generic UI tools to control override of properties. 2017-11-29 17:03:52 +01:00
fc6a116f83 ID Static Override: add basic UI feedback.
For now, using a new color for overridden properties (similar to
animated/driven status), UI team will need to work on a better solution
maybe...
2017-11-29 15:47:37 +01:00
00a6ce878d ID Static Override, part II: RNA changes.
This is essentially a huge refactor/extension of our existing RNA
compare & copy code, since static override needs more advanced handling here.

Note that not all new features are implemented yet, advanced things like
collections insertion/deletion are still TODO (medium priority).

This completes the ground work for overrides, remaining commits will be
about UI and some basic/testing activation of overrides for a limited
set of data-blocks & properties.

For details see https://developer.blender.org/D2417
2017-11-29 15:31:31 +01:00
adc165e651 Define RNA_STACK_ARRAY (usable everywhere in RNA), and make PYRNA_STACK_ARRAY use it. 2017-11-29 15:16:12 +01:00
0b6ff084a9 Merge branch 'blender2.8' into id_override_static
Conflicts:
	source/blender/blenkernel/intern/library_override.c
2017-11-29 15:09:22 +01:00
850a193f64 Merge ID static override, part I: core changes in DNA, BKE and .blend read/write.
See https://developer.blender.org/D2417 for details.

Note that since static overrides rely heavily on RNA, this commit is
essentially invisible from user PoV, more in next commits.
2017-11-29 15:05:03 +01:00
79324d3ca8 Merge branch 'blender2.8' into id_override_static 2017-11-29 13:19:25 +01:00
65fab5b17f Preparing merge of id_override_static: add BKE_id_swap().
This function swaps the memory content of two data-blocks (of same type
obviously), while preserving most of the ID 'header' itself.

It is intended to be used to quickly and easily replace the data of an
existing ID by another one, presumably a temporary 'working' one,
without having to suffer from things like name changes,
registering/removing from Main database, etc.
2017-11-29 13:14:59 +01:00
7051746a6b Merge branch 'blender2.8' into id_override_static 2017-11-29 12:45:41 +01:00
88ed3e37de Rename 'override' to 'override_static' (and similar).
Initially there was hope at least part of this work could be used for
dynamic overrides as well... but looks like not, so better be specific
and avoid any confusion.

PS: this commit break any file saved with static overrides, should not
be an issue though.
2017-11-29 12:40:18 +01:00
61a7f8b015 Address review points (mainly some missing usages of RNA_STACK_ARRAY). 2017-11-28 17:28:42 +01:00
dd4d5e42b0 Merge branch 'blender2.8' into id_override_static 2017-11-28 16:42:30 +01:00
140f7ac389 Cleanup: remove timer-like check for auto-ID-override generation. 2017-11-24 17:10:30 +01:00
5d0deaeb8b Merge branch 'blender2.8' into id_override_static 2017-11-24 17:07:21 +01:00
4f79d68c03 Remove override update from DEG, simply do it on undo push. 2017-11-24 16:57:58 +01:00
4a71ca6351 Merge branch 'blender2.8' into id_override_static 2017-11-24 11:55:44 +01:00
c9b4094808 Address points from initial review. 2017-11-23 23:33:29 +01:00
4ee4eed9e9 Merge branch 'blender2.8' into id_override_static 2017-11-23 22:18:46 +01:00
62aa672d63 Merge branch 'blender2.8' into id_override_static 2017-11-21 12:04:42 +01:00
b780c86a33 Hide override timing stuff behind some debug define. 2017-11-16 16:08:24 +01:00
f457eeacb1 Merge branch 'id_override_static' into asset-engine 2017-11-16 13:22:28 +01:00
3c905e49fd Merge branch 'blender2.8' into id_override_static 2017-11-16 13:05:42 +01:00
bc5381f154 Some cleanup/renaming, and move 'self remapping' into new id_swap function.
I can't think of any case where we would swap content of two IDs while
wanting to keep old 'self' ID pointers after the swap!
2017-11-16 12:29:25 +01:00
72346e6114 Rename destination and source parameters in override_apply.
local and reference are awfully confusing names here, since destination
is a copy of reference that will become local override once applied, and
source is .blend-file-written version of local override...
2017-11-16 10:24:03 +01:00
61ca31f28b Add custom override_apply func for animdata.
This makes creating animation in overridden ID working, at least in the
most basic case...
2017-11-16 10:10:33 +01:00
abd49fb871 Merge branch 'id_override_static' into asset-engine 2017-11-15 11:04:08 +01:00
4c8bcb3a8d Merge branch 'blender2.8' into id_override_static 2017-11-15 10:51:49 +01:00
058b6ea3e9 Merge branch 'id_override_static' into asset-engine 2017-11-14 22:36:02 +01:00
7e909a564f Heavy refactor of new RNA override/comparison code.
Main reason here is to make comparison/override_diff/override_store/override_apply
customizable per RNA property if needed.

This should allow us especially to get advanced behavior on case-by-case
basis, when dealing with Pointer and Collection properties mostly.

Note that IDProps remain fuzzy area for now, a big part of the code
tries to take them into account, but it's most likely still missing some
bits, and definitively not tested at all yet!
2017-11-14 22:31:55 +01:00
dfb541342b Some cleanup, fix auto-override handling in NULL pointer case.
Also, attempt to enable animation override, not yet working though think
we need some re-design of how override is handled per-property type...
2017-11-13 18:05:48 +01:00
f7a7c8d950 Merge branch 'blender2.8' into id_override_static 2017-11-13 17:44:45 +01:00
14132eded0 Merge branch 'id_override_static' into asset-engine 2017-11-10 17:22:14 +01:00
80904de485 Cleanup while attempting to fix auto-override detection in DEG.
Not sure why that piece of code stopped working, but now this operation
is pretty much never evaluated... Will have to either dig deeper in DEG
or ask Sergey about it, but not a crucial issue for now.
2017-11-10 17:16:29 +01:00
560097b499 Auto-override detection: ignore animated properties.
Animation is by definition another kind of (dynamic) override of properties,
which supersedes static override.

Note that this could be debated in some corner cases ('differential'
animation, like dloc/drot/dscale), but think we can ignore that for now,
and expect user to handle those manually when needed.
2017-11-10 17:16:09 +01:00
8f222a0ba0 Cleanup while attempting to fix auto-override detection in DEG.
Not sure why that piece of code stopped working, but now this operation
is pretty much never evaluated... Will have to either dig deeper in DEG
or ask Sergey about it, but not a crucial issue for now.
2017-11-10 17:12:11 +01:00
a08a2ec54f Auto-override detection: ignore animated properties.
Animation is by definition another kind of (dynamic) override of properties,
which supersedes static override.

Note that this could be debated in some corner cases ('differential'
animation, like dloc/drot/dscale), but think we can ignore that for now,
and expect user to handle those manually when needed.
2017-11-10 17:09:08 +01:00
4d8e034ab8 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_files_link.c
2017-11-10 10:45:20 +01:00
7a609a16eb Merge branch 'blender2.8' into id_override_static
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
2017-11-10 10:40:12 +01:00
f6f7127320 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
2017-11-07 15:47:43 +01:00
0a15b7da92 Merge branch 'blender2.8' into id_override_static 2017-11-07 15:40:48 +01:00
d5e9c1f4ab Merge blender2.8 branch.
This means that from now own, we work based on Blender2.8!

Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_file/filesel.c
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_scene_types.h
	source/blender/makesdna/DNA_text_types.h
	source/blender/windowmanager/intern/wm_event_system.c
	source/blender/windowmanager/intern/wm_files_link.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2017-11-07 15:19:40 +01:00
731e848cff Merge blender2.8 branch.
Means that from now on, we work based on blender2.8, no more master!

Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/editors/interface/interface_ops.c
	source/blender/makesdna/DNA_ID.h
	source/blender/makesrna/intern/rna_ID.c
2017-11-07 15:17:59 +01:00
1e97e0a671 Merge branch 'id_override_static' into id_o2.8
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/editors/interface/interface_ops.c
	source/blender/makesdna/DNA_ID.h
	source/blender/makesrna/intern/rna_ID.c
2017-11-07 10:59:40 +01:00
5a1a6dfd1e Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/node.c
	source/blender/makesdna/DNA_ID.h
2017-11-06 20:26:37 +01:00
d60a1c3095 Merge branch 'master' into id_override_static
Conflicts:
	source/blender/makesrna/intern/rna_access.c
2017-11-06 20:18:58 +01:00
420cc7c2b5 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/editors/interface/interface_regions.c
2017-11-06 17:01:25 +01:00
0dce80ad43 Merge branch 'master' into id_override_static
Conflicts:
	source/blender/editors/interface/interface_handlers.c
2017-11-06 16:08:23 +01:00
116613ac4d Fix type of itemf RNA callback... 2017-10-31 17:33:35 +01:00
3403eea6f4 Merge branch 'id_override_static' into asset-engine 2017-10-31 17:25:46 +01:00
e47a2a8d75 Merge branch 'master' into id_override_static 2017-10-31 17:16:17 +01:00
c01cf979e0 Fix issues from recent UI API changes in master. 2017-10-31 17:07:24 +01:00
0dd184550f Merge branch 'master' into id_override_static 2017-10-31 16:58:56 +01:00
92a06831a8 Add drag'n'drop-linking of material onto object in 3DView.
Probably needs to be reorganized a bit better, but basically working.
2017-10-30 17:35:18 +01:00
15305950a5 Amber: fix some more stupid issues/mistakes. 2017-10-30 16:23:48 +01:00
0e256653b2 Amber: Add icon of data type to 'all data' assets add operator. 2017-10-30 14:28:29 +01:00
b4d8e949d8 Amber: Fix bad tag handling in case of empty set. 2017-10-30 14:23:11 +01:00
b1da5716fd Merge branch 'id_override_static' into asset-engine 2017-10-30 13:47:40 +01:00
dd2b82e90f Merge branch 'master' into id_override_static 2017-10-30 13:41:53 +01:00
b9f4a8d75f Add more 'generic' way to select datablock to add as asset.
Faaarrrrr from UI/UX nice thing, but working  for now...
2017-10-27 14:07:50 +02:00
8256007429 Merge branch 'id_override_static' into asset-engine 2017-10-27 12:21:47 +02:00
6016c7ab58 Merge branch 'master' into id_override_static 2017-10-27 12:10:24 +02:00
0f72a2916c Amber: some more dev (tags UIList ordering, some WIP on adding new assets...) 2017-10-26 15:23:59 +02:00
dce7e076da Amber: add new assets with relative path to repo, fix a bug in asset listing when path was aboslute. 2017-10-26 10:01:31 +02:00
7a68cd0298 Amber: Add initial real asset preview.
Design is a bit weak, ideally we'd rathe use directly .blend files
previews, but we need some RNA API work to handle that...
2017-10-26 09:07:17 +02:00
0f0b544c6e Fix a bug in filedraw, when we have only entries, with no variant etc. below. 2017-10-26 09:06:30 +02:00
e524370158 Add way to remove Amber repo, and initial step fro previews. 2017-10-23 17:54:58 +02:00
ff6e79091d Merge branch 'id_override_static' into asset-engine 2017-10-23 10:34:11 +02:00
59f0ca9adf Merge branch 'master' into id_override_static 2017-10-23 10:26:11 +02:00
2a71f1e29e Factorize repo editing 'write on disk' code, and add relevant update callbacks to repo's RNA properties.
Also made writing repo DB on disk slightly safer (using atomic file
swapping instead of directly writing into real repo DB file).
2017-10-20 16:15:05 +02:00
8b501b2a7d Fix mistakes (wrong copy/paste :/ ) in previous commit. 2017-10-20 15:35:31 +02:00
bac215bc67 Amber assets: add more editing UI. 2017-10-20 15:26:19 +02:00
d1dbe241e1 Merge branch 'id_override_static' into asset-engine 2017-10-19 17:22:27 +02:00
7376ebf678 Merge branch 'master' into id_override_static 2017-10-19 15:02:27 +02:00
1ba198a375 Merge branch 'id_override_static' into asset-engine 2017-10-17 09:50:43 +02:00
f97ba5cd3a Merge branch 'master' into id_override_static 2017-10-17 09:39:51 +02:00
9fb243f96d Add one main 'Edit' toggle to Amber.
That way user shall not be allowed to change anything in Amber
repositories unless they goes into 'editing' Amber mode...
2017-10-15 20:32:54 +02:00
ad5a7dc2bd Merge branch 'id_override_static' into asset-engine 2017-10-14 15:30:33 +02:00
5f2707075f Merge branch 'master' into id_override_static 2017-10-14 15:24:41 +02:00
f7722b1ad3 Cleanup: rename uuid's related operator properties to match names used everywhere else. 2017-10-11 20:37:58 +02:00
b13024327a Fix several issues found while working on drag and drop linking.
Append/link exec code was not handling correctly asset cases in 'single
item' case.

Also, first drag'n'drop code was slitghly too much simple, losing uuid's
on the way, had to make things a bit more convoluted...
2017-10-11 20:28:50 +02:00
c6d11f8c13 Fix crash when opening a .blend file with an opened FileBrowser editor. 2017-10-11 10:08:54 +02:00
0b7dcb3252 Merge branch 'id_override_static' into asset-engine 2017-10-10 21:01:50 +02:00
b884046e2a Merge branch 'master' into id_override_static 2017-10-10 20:21:32 +02:00
504287b987 Add initial, very basic/proof-of-concept drag and drop linking.
Essentially works, will still need (as usual :P) lots of extension and
fixes and enhancements...
2017-10-09 20:12:45 +02:00
e40b8cb231 Merge branch 'id_override_static' into asset-engine 2017-10-08 16:34:10 +02:00
8b1759d11a Merge branch 'master' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
2017-10-08 16:33:44 +02:00
063ddf5958 Merge branch 'master' into id_override_static 2017-10-08 16:16:02 +02:00
9134d2c01f Merge branch 'id_override_static' into asset-engine 2017-10-06 12:03:04 +02:00
05bfb8b905 Merge branch 'master' into id_override_static 2017-10-06 11:49:12 +02:00
f49b7031f0 Merge branch 'id_override_static' into asset-engine 2017-10-04 22:03:28 +02:00
942353d8b0 Add needed option to handle or not override's reference pointer when remapping.
There are cases where we'll want to also override the reference pointer
(when we actually switch that datablock itself), but in some specific
situations, like when creating a new override, we need to keep org
pointer here!
2017-10-04 22:01:30 +02:00
ff6caedb47 Merge branch 'master' into id_override_static 2017-10-04 21:00:44 +02:00
8327eb99e0 Merge branch 'master' into id_override_static 2017-10-04 17:13:48 +02:00
9b0f0f7f1f Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/editors/sculpt_paint/paint_vertex.c
2017-10-03 12:40:34 +02:00
c1191102bc Merge branch 'master' into id_override_static 2017-10-03 12:33:06 +02:00
551ed636a6 Merge branch 'master' into id_override_static 2017-10-03 12:19:04 +02:00
7e38180fbe Add basic override generation for virtually linked assets.
Roughly working, most certainly oceans of worms are squirming
under the surface though...
2017-09-28 19:50:24 +02:00
cd33257798 Revert hack making linked virtual datablock editables.
Essentially, this reverts most ID_IS_LINKED_DATABLOCK() checks to
ID_IS_LINKED() one.

Idea of making virtual linked IDs editable was nice as a temp hack to do
quick experiment, but was never intended as final solution, correct way
to do that is to use static override, will be implemented soon.

Note that virtual library/virtually linked ID concept remains, it's
mandatory to handle mere files as assets (and potentially other, more
advanced cases in the future).
2017-09-28 16:37:49 +02:00
05daa1f1a1 Re-enable Amber asset engine. 2017-09-25 22:01:18 +02:00
17cf9445ca Update Amber to take into account new View level.
Also get rid of hack mixing repo and asset uuid into same UUID, now we
do have a real repo UUID in API.

Everything seems to be be back on par with pre-View changes status.
2017-09-25 21:59:50 +02:00
e29ff1adb5 Fix various mistakes and forgotten bits in previous 'Views' adding commit.
Core API code shall now be mostly functional again.
2017-09-25 21:42:25 +02:00
ef056018c0 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_scene_types.h
2017-09-25 12:59:48 +02:00
4b2d0faedd Merge branch 'master' into id_override_static 2017-09-25 10:02:45 +02:00
114d200df8 Asset API: add Views.
This commit add new 'View' forth layer, below history one (Revision).

It also adds a real UUID for the asset repository (as usual, asset
engines not needing it can just set it to zeros), will make Amber's life
(and all multi-repositories engines) easier.

Also fix one or two issues found on the road.

Code builds and links datablocks from libraries in the 'old way'. Real
test will come when re-enabling Amber and adapting it to new API though.
2017-09-21 18:01:19 +02:00
fb5425abba Disable for now asset engines (in preparation of core code changes). 2017-09-21 18:00:55 +02:00
b13b7f53f4 Merge branch 'id_override_static' into asset-engine 2017-09-21 12:29:21 +02:00
913991262b Merge branch 'master' into asset-engine 2017-09-21 12:29:13 +02:00
dd5d8b050b Merge branch 'master' into id_override_static 2017-09-21 12:11:57 +02:00
637206e5c5 Add basic addition support to create new assets.
Again, very basic and limited, to be fleshed out later.
2017-09-13 10:52:54 +02:00
7454f83cca Working basic repository list.
Also, fixed uuids generation.

And finalized/added to UI operator to add a new, empty Amber repo in
current directory.
2017-09-11 16:20:37 +02:00
a25930449e Merge branch 'id_override_static' into asset-engine 2017-09-11 13:06:08 +02:00
058a0cbc91 Merge branch 'master' into asset-engine 2017-09-11 13:05:57 +02:00
d83bdbac2d Merge branch 'master' into id_override_static 2017-09-11 12:55:05 +02:00
f44ffa5035 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2017-09-08 15:06:36 +02:00
9e394424c1 Merge branch 'master' into id_override_static 2017-09-08 14:19:16 +02:00
61bb923c4f Add basic handling of 'bookmarks' of Amber repositories.
Still some glitches to fix (and missing features), but mostly working on
basic level.
2017-09-05 17:38:08 +02:00
8ab97aa2ff Fix two bugs with Amber engine:
* Reported number of assets was -1 in list_dir callback, incorrect and
would loop endlessly in case of empty repo!

* Conversion from main asset classes to their propertygroup
representations was not clearing extra entries in proplists.
2017-09-05 11:08:16 +02:00
f7544fbff4 Merge branch 'id_override_static' into asset-engine 2017-09-05 10:14:03 +02:00
ca68eeab6c Merge branch 'master' into id_override_static 2017-09-05 10:07:07 +02:00
bc9fe321a1 Moar WIP work towards editing Amber repo.
Adding skeleton for adding Amber repos, adding new assets... Not
finished yet, by far.
2017-08-24 20:55:45 +02:00
a88e406d3f Merge branch 'id_override_static' into asset-engine 2017-08-23 16:51:10 +02:00
c493ab5ed8 Merge branch 'master' into id_override_static 2017-08-23 16:43:47 +02:00
09f6f1ad6c Make Amber engine actually refresh repo listing when one hit refresh button in filebrowser, and do refresh after deleting an asset from repo. 2017-08-21 19:56:07 +02:00
7e905b0cf6 All blendlib (ID types) filters ON by default for operator-less filebrowser. 2017-08-21 19:33:01 +02:00
3d755243a2 Add first edit operation on Amber repository - we can now remove an asset, houra :P
Also fixed more various issues.
2017-08-21 17:37:12 +02:00
26b829c936 First basic (useless) step towards UI for editing Amber repository. 2017-08-21 16:41:38 +02:00
ed7ce9251d Fix tag filtering, move repo reading to AmberDataRepository class, cleanup some uuid utils. 2017-08-21 16:28:23 +02:00
b2ff136f9d Fix various misc points, including Assets reloading, in Amber asset engine. 2017-08-21 15:31:20 +02:00
c2e8855777 Merge branch 'id_override_static' into asset-engine 2017-08-21 14:47:45 +02:00
f6f5474deb Merge branch 'master' into id_override_static 2017-08-21 14:41:22 +02:00
0fa9f796bb Heavily rework Amber's data model.
Since we want to be able to edit repo from within Blender, we'll need
UI-compatible representation of the repo.

Alas, PropertyGroup py instances are regenerated all the time, which
means we cannot store py-only data in those, so we have to go to a
triple representation of repo here (the JSON/dict one, the effective py
classes, and the UI-compatible PropertyGroup-based one).

Note that this is rather heavily WIP commit, it most certainly breaks
several things, but at least the basic repo listing from filebrowser is
working again...
2017-08-19 18:23:46 +02:00
5bfab333fd Add some more protection against invalid data from asset engine. 2017-08-19 18:21:01 +02:00
6b2f125d02 Celanup debug print from previous commit. 2017-08-16 12:11:44 +02:00
b266e14bff Make 'non-operator' filebrowser 'library browsing' one.
Will allow to use it to brwose & edit repositories of asset engines.
2017-08-16 12:09:36 +02:00
d96308252e Merge branch 'id_override_static' into asset-engine 2017-08-16 11:59:19 +02:00
1ec38f8ac9 Merge branch 'master' into id_override_static 2017-08-16 11:51:01 +02:00
e3d1361c75 Merge branch 'id_override_static' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
	source/blender/makesrna/intern/rna_ID.c
2017-08-10 17:08:39 +02:00
3f9bea4f0f Merge branch 'master' into id_override_static 2017-08-10 16:07:23 +02:00
1126b83c9b Merge branch 'id_copy_refactor' into id_override_static 2017-08-10 15:46:40 +02:00
496b510438 Merge branch 'master' into id_copy_refactor
Conflicts:
	source/blender/blenkernel/BKE_sequencer.h
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/sequencer.c
	source/blender/editors/space_sequencer/sequencer_edit.c
2017-08-10 15:43:52 +02:00
c116bb0c7f Merge branch 'master' into id_copy_refactor 2017-08-07 16:06:39 +02:00
881ee4fb26 Merge branch 'master' into id_copy_refactor 2017-08-07 12:52:25 +02:00
4263484bd4 Split Amber into pieces! 2017-07-20 15:47:03 +02:00
fe2d096816 Merge branch 'master' into asset-engine 2017-07-20 12:59:16 +02:00
7db3994c4b Merge branch 'id_copy_refactor' into id_override_static 2017-07-20 12:50:49 +02:00
b54335b273 Merge branch 'master' into id_copy_refactor 2017-07-20 12:31:35 +02:00
a8a3674bad Merge branch 'master' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.h
2017-07-18 16:40:20 +02:00
2579acf652 Move Amber into own folder. 2017-07-18 15:13:40 +02:00
2a1df41ae7 Fix typo within Claude engine.
Not working though, something about handshake failing when trying to
update credentials...
2017-07-18 14:17:55 +02:00
880579b670 Merge branch 'master' into asset-engine 2017-07-18 12:21:55 +02:00
c6bda91482 Add more BKE generic way to create an override, make Image mostly overridable, fix a bug in RNA. 2017-07-18 12:08:09 +02:00
238187e640 Merge branch 'id_copy_refactor' into id_override_static 2017-07-18 11:08:30 +02:00
2f2b3149ee Merge branch 'master' into id_copy_refactor 2017-07-18 11:08:03 +02:00
52c4d51fca Merge branch 'master' into id_override_static 2017-07-18 11:07:50 +02:00
24b1371b36 Merge branch 'id_copy_refactor' into id_override_static
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenloader/intern/writefile.c
2017-07-17 15:21:57 +02:00
a8e4aae091 Extend a bit 'NO_MAIN'/'NO_USER_REFCOUNT'/etc. flags to ID allocation itself.
No real reason we keep this only to copying, creating ID outside of
database is handy as well!

Also, add helpers to add/remove an ID from Main, and to set/clear its
'user refcounting' status. Those will be useful in future complex ID
manipulation cases (like static override...).
2017-07-17 15:16:41 +02:00
a70e941fd0 Some cosmetic renaming. 2017-07-17 14:00:06 +02:00
2a992c2464 Merge branch 'master' into id_copy_refactor 2017-07-17 13:50:53 +02:00
0c30245b01 Merge branch 'master' into id_override_static 2017-07-17 13:24:59 +02:00
a721ee8835 Merge branch 'id_copy_refactor' into id_override_static
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenloader/intern/writefile.c
2017-07-17 12:35:10 +02:00
377ab54dad Merge branch 'master' into id_override_static
Conflicts:
	source/blender/blenkernel/BKE_library.h
2017-07-17 12:17:21 +02:00
f9904b05cc Merge branch 'master' into id_copy_refactor 2017-07-17 11:48:50 +02:00
5019fc1c8d Merge branch 'master' into id_copy_refactor 2017-07-11 15:57:40 +02:00
2f812e1d7b Fix stupid mistake in new LineStyle copying code. 2017-07-11 15:56:43 +02:00
e75db0e61b Fix several crashes and other issues in new ID copying code.
Mostly in core and animdata area. Code should now also be more robust,
and slightly simpler & cleaner.
2017-07-11 14:16:48 +02:00
524e03cae1 Huuuuge refactor of Scene copying, added to generic library ID copying.
Note: there are several known issues with this commit (and most likely
more unknown ones), to be fixed in next ones.
2017-07-11 10:31:04 +02:00
d3abcf3318 Merge branch 'master' into id_copy_refactor 2017-07-10 21:30:31 +02:00
0dc428410a Merge branch 'master' into id_copy_refactor 2017-07-10 15:23:44 +02:00
0698e892c7 Add VFont copying.
Not much happy, have to include BKE_curve in BLI_freetypefont to copy
nurbs... Not sure why fonts are in BLI tbh. We are already replicating
quite a bit of nurbs logic there. :(
2017-07-10 13:57:05 +02:00
a7bf34cc0b Add Sound copying callback. 2017-07-10 12:59:11 +02:00
0b009edbde Move Palette, PaintCurve and CacheFIle to new ID copying system. 2017-07-10 09:56:52 +02:00
8bcf950c28 Move Mask and FreestyleLineStyle to new ID copying code. 2017-07-09 22:44:21 +02:00
6637530b81 Move Text, Brush and GPencil datablocks to new copying code. 2017-07-09 22:14:00 +02:00
dcfbe9a6f0 Move Action to new copying code. 2017-07-09 21:41:24 +02:00
f5f013d231 Merge branch 'master' into id_copy_refactor 2017-07-09 21:21:48 +02:00
caae973b8a Move Group and ParticleSettings to new copying system.
Also fix several mistakes from previous commits.
2017-07-08 17:09:52 +02:00
5a1cae541a Move World and MovieClip to new copying system. 2017-07-08 12:46:33 +02:00
fe46bb8b0e Rename new BKE_<foo>_copy_ex to BKE_<foo>_copy_data.
Those are not actually copying the ID, only its internal subdata (and
other ID-specific handling). Generic processing common to all ID copying
is done by `BKE_id_copy_ex()`!
2017-07-08 12:20:54 +02:00
17ceb807dd Move Material, Texture and Image datablocks to new copying code.
Note that this is also bringing back Image copying code into 'regular'
process, instead of doing its own dirty cooking.
2017-07-08 12:14:31 +02:00
fc6619a9ff Merge branch 'master' into id_copy_refactor 2017-07-07 12:35:35 +02:00
022ad8f769 Change a bit ideas behind new copying code, now ID-specific copying never handles usercount.
Makes things much simpler, and more consistent.

Also fix issue with new copying and bloody nodetrees, using same hack as
in original ntree copying code to detect 'root' ntrees that shall never
be put into bmain :(((((((
2017-07-06 15:46:14 +02:00
8af813fee9 Merge branch 'master' into id_copy_refactor 2017-07-06 12:26:34 +02:00
af46458c62 Merge branch 'master' into id_copy_refactor 2017-06-26 11:01:21 +02:00
b7145a2662 Initial work on new copying for nodetrees.
Note that those are an nightmare to handle correctly, current code is
like a plate of noodle, so... most likeley not fully working, think I'll
have to nuke localize code as well :(
2017-06-26 10:53:51 +02:00
48a85f99eb Add remaining 'new copying' for obdata ID types. 2017-06-22 22:46:52 +02:00
6635284917 Merge branch 'master' into id_copy_refactor 2017-06-22 10:44:33 +02:00
c907b16065 Add mball and lattice new copying, tweak a bit more skey handling. 2017-06-21 11:08:50 +02:00
797a696734 Merge branch 'master' into id_copy_refactor 2017-06-21 10:49:39 +02:00
90a463dcfc Add new Curve copying code. 2017-06-20 21:34:18 +02:00
1f7c6fda5d Fix wrong assert, and issue with Key ID freeing tag after copying from mesh... 2017-06-20 21:20:43 +02:00
39b0c6f060 Add Mesh and Key support to new copying code. 2017-06-20 17:55:38 +02:00
3a86873b68 Make object copying fully compatible/aware of new copy flag system.
(continuation of previous WIP commit, sorry about that one :/ ).

This commits changes quite a few things, distributing new copying flags
into sub-data copying code (mostly concerns ID refcounting or not).

It also removes ID refcounting handling from Modifiers' copy callback
(this was ugly from the start, proved to be problematic in current
master, and generally bad practice). This is now done by calling code.

Also, it brings back ID refcounting handling to main BKE_library's copy
code, which means in generic ID copying lower-level IDType-specific copy
code should not use it at all. Support at lower-level remains needed
though, unfortunately, to cope with partial copying tools etc.
2017-06-20 17:55:38 +02:00
596c20c677 Alembic tests: make failures a bit easier to diagnose. 2017-06-20 17:55:38 +02:00
d0af31b317 Fix T51762: Unit test script_alembic_import is failing.
Implemented workaround for use with the legacy depsgraph.
2017-06-20 17:55:38 +02:00
12a5a628f3 Fixed bl_load_py_modules / script_load_modules unit test
It tried to assert that
addons/io_blend_utils/blender_bam-unpacked.whl/__init__.py was loaded when
the io_blend_utils module was imported. However, this happens only on
demand, and not directly when importing the add-on.
2017-06-20 17:55:38 +02:00
b72ba5c78d Use for/else instead of setting 'ok' variable.
This is more efficient, and this use case is exactly what the else clause
is for.
2017-06-20 17:55:38 +02:00
0687d8bdce Removed trailing spaces 2017-06-20 17:55:38 +02:00
258634b43c Fix (unreported) missing Image usercount increase when copying UVProject modifier. 2017-06-20 17:55:38 +02:00
babc0c9bd7 Fix (unreported) bad copying code of Surface Deform modifier. 2017-06-20 17:55:38 +02:00
749a8daf26 Fix compiler warnings from own recent rB0d5c7e5e36b9. 2017-06-20 17:55:38 +02:00
2d3b6b5ad7 Fix (unreported) bad copying of Ocean modifier.
Was needlessly complicated code, forgot to copy a value (foam_fade), and
was utterly leaking memory!
2017-06-20 17:55:38 +02:00
20e3434c5f Fix (unreported) bad copying code in Mesh Deform modifier. 2017-06-20 17:55:38 +02:00
77046ba9d8 Fix (unreported) Dynamic Paint modifier not increasing ID usercount in copy function.
*Sigh* One more example of why we should keep ID management handling in
as few places as possible! It's impossible to keep more than a few
places in sync regarding which ID pointer is refcounted etc.
2017-06-20 17:55:38 +02:00
147735587c Fix (unreported) memory leak in Fluid modifier copying.
Also generally simplify/sanitize this copy code.
2017-06-20 17:55:38 +02:00
44b1680fbf WIP 2017-06-20 17:55:38 +02:00
46af186d21 Cleanup: doxygen comments
Also remove duplicate & mismatching comments from grease-pencil header.
Keep comments close to implementation to avoid getting out of sync.
2017-06-20 17:55:38 +02:00
e61dbcd284 Fix T51774: Children particles hair interpolation not correct with textures or dp.
Children where always getting at least one segment of fixed length...

Now fully hidden ones (zero length) get no segment at all.

Note that even very short ones keep getting one 'unit' length segment - would
rather avoid changing that at this point, given how complex children
particles 'length' can get with all kind of modifiers... Think we can
live with that for now anyway.
2017-06-20 17:55:38 +02:00
5f6725337a Fix T51840: UI redraw in node editor header missing on pointcache bake
Missing a notifier handler in the node editor
2017-06-20 17:55:38 +02:00
780310578a Fix unreported: Copy-pasting nodes crashes when they have an undefined type 2017-06-20 17:55:38 +02:00
d8de772410 Docs: Fix file:line links in generated API docs 2017-06-20 17:55:38 +02:00
f45300856c Add Cone: tip soft-min should be zero
Default value should be included in range.
2017-06-20 17:55:38 +02:00
6493328e37 Guarded allocator: Fix type in macro definition
The crash did not happen yet because we always had proper vmemh defined in
the parent scope.

Patch by Ivan Ivanov (aka obiwanus), thanks!

Differential Revision: https://developer.blender.org/D2715
2017-06-20 17:55:38 +02:00
2e9580e417 PyAPI: Fix warning about indent 2017-06-20 17:55:38 +02:00
0e78b3b794 Fix T51810: Add minimal example of usage of translation API for non-official addons. 2017-06-20 17:55:38 +02:00
09e5d1bc84 Usual i18n/UI messages fixes.
Please do not add useless tooltips! We have enough messages to translate
already...
2017-06-20 17:55:38 +02:00
23941b425e Add same new ID freeing API as copying one.
Idea is the same, looks like it will be a tad simpler than with copy
though, since we should not need to change each ID type freeing func, as
ID usercount handling is done in main BKE_library code (would like to do
that for copy as well, but it's not that simple).
2017-06-16 10:48:42 +02:00
fa64dfa449 On second thought, avoid adding new stuff to ID.
We can extend ID->tag and store there our few alloc-related tags.
2017-06-16 10:48:42 +02:00
7edeccf81d Fleshing a bit new copy logic (using Object datablock as Guinea pig). 2017-06-16 10:48:42 +02:00
8d22d5a2a9 Layout initial ideas/code structure of new ID copying. 2017-06-16 10:48:42 +02:00
945c062cf7 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
2017-06-14 15:34:08 +02:00
5ecbc7c0f2 Merge branch 'master' into id_override_static 2017-06-14 15:20:15 +02:00
f4455faf4c Cleanup/expose template status in RNA utils API. 2017-06-14 15:19:16 +02:00
0e41f5c158 Rename override operation defines, add some operation flags. 2017-06-13 12:51:03 +02:00
352f9ed27b Some more cleanup, add (limited) copying of static override.
Working towards override template, still some work to do though.
2017-06-13 10:25:59 +02:00
470613cdf2 Cleanup: remove unused testcode. 2017-06-12 15:44:48 +02:00
e57bd4e786 Fix for removed stuff from DEG. 2017-06-12 15:31:30 +02:00
0697398af1 Merge branch 'master' into id_override_static 2017-06-12 15:18:01 +02:00
4ce7ad37fe Merge branch 'master' into id_override_static 2017-06-12 15:07:00 +02:00
9505209b1d Fix various issues in RNA diff handling, and make some more props overridable.
Namely, those allowing to link an object to an armature.

Thing is, we cannnot and absolutely do not want to use same trick as
armature proxies regarding deforming their related geometries.

So instead, we'll automatically make override of objects using
overridden armature as deformer, ultimately. This also allows for
several overrides of a same linked data.

Not sure how much good/bad this is, will have to ask artists once it's
ready for testing (cannot think of any non-ugly way to do that 'magic
trick' tbh).
2017-05-31 17:55:08 +02:00
734a889056 Some cleanup, introduce idea of 'override template'.
Nothing functionnal for now, just made it possible for override to have
NULL reference ID.

Those overrides would be used as templates (created in original file of
the ID, they define some kind of default overriding settings). They
should also allow to forcefully lock some properties (forbid users of
that library ID to override some properties).
2017-05-31 12:55:53 +02:00
4813ed0e4a Merge branch 'master' into asset-engine 2017-05-30 17:22:45 +02:00
3489874770 Merge branch 'master' into id_override_static 2017-05-30 16:20:58 +02:00
8aae0549df Make 'set override type' menu option of buttons functional.
There's still lots of things to fix or tweak, but basics are now
working.
2017-04-05 21:53:41 +02:00
ef6045a473 Add finer controll over 'strict' finding of override property operations. 2017-04-05 18:12:18 +02:00
558119854d Bring closer RNA and BKE ...override_..._find() functions, add RNA ..._get() ones. 2017-04-05 17:45:18 +02:00
15937c1f8e Rename RNA_property_override_..._get() functions to ..._find()
Matches functions defined in BKE_library_override!
2017-04-05 17:15:28 +02:00
8811f4cfa3 Merge branch 'master' into id_override_static 2017-04-05 15:34:26 +02:00
404f9ce6ee Merge branch 'master' into asset-engine 2017-03-28 13:39:17 +02:00
a48f5e991d Merge branch 'master' into id_override_static 2017-03-28 10:49:55 +02:00
8698624d1e Merge branch 'master' into id_override_static 2017-03-24 12:48:33 +01:00
f025c57cb4 Implement 'delete override' from UI menu options. 2017-03-24 12:47:34 +01:00
b03542b61f Add public API to BKE's lib override to delete override properties & operations. 2017-03-24 12:44:53 +01:00
da6a2def64 Fix bug in new copy/applyoverride code of RNA property. 2017-03-24 12:43:39 +01:00
78ccdfa0a0 Fix stupid mistake in new BLI_listbase_bytes_find(). 2017-03-24 12:39:55 +01:00
bf145a1a4c Merge branch 'master' into id_override_static 2017-03-23 17:04:35 +01:00
c54f045daf WIP UI menu entries for Override.
Empty shells for now...
2017-03-23 17:03:44 +01:00
6520e2a455 Merge branch 'master' into id_override_static 2017-03-22 19:45:55 +01:00
41f2393e0e Merge branch 'master' into id_override_static
Conflicts:
	source/blender/blenloader/intern/writefile.c
2017-03-20 12:49:00 +01:00
9ff989e3f1 Fix missing removal of asset UUID from ID made local... 2017-03-20 12:31:51 +01:00
a8698b4ef3 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_files.c
2017-03-20 10:28:05 +01:00
9ee6995a35 Merge branch 'writefile_rework' into id_override_static 2017-03-16 11:11:30 +01:00
d14298403f Merge branch 'master' into writefile_rework 2017-03-16 10:52:40 +01:00
ee04a72196 Merge branch 'master' into asset-engine 2017-03-16 10:31:33 +01:00
9ed186ecdb Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
	source/blender/windowmanager/intern/wm_files.c
2017-03-16 10:15:59 +01:00
836194d4a2 Merge branch 'writefile_rework' into id_override_static 2017-03-02 10:27:36 +01:00
fb02b4d4de Merge branch 'master' into writefile_rework 2017-03-02 10:27:16 +01:00
2fa16018b8 Add some basic UI and RNA feedback for overriden properties.
For now chose some teal blue to mark overridden state of prop in UI,
kind of last nicely different tint available...
2017-03-02 09:53:41 +01:00
1ca3fd0b81 Merge branch 'writefile_rework' into id_override_static 2017-03-01 16:32:06 +01:00
e56e0dd75c Merge branch 'master' into writefile_rework 2017-03-01 16:31:50 +01:00
e15af8a978 Merge branch 'writefile_rework' into id_override_static 2017-02-28 14:16:22 +01:00
7572ba85c6 Merge branch 'master' into writefile_rework 2017-02-28 14:16:05 +01:00
18387ad496 Big refactor of differential override storage.
On second thought, modifying real data-block to store diff in it is...
just bad. Because it affects actual data, because it involves complicated
and heavy processes like remapping, and because it stores useless values
in .blend file (i.e. values that would give garbage results if e.g.
opening .blend file with older version of Blender, etc.).

So instead, decided to save an extra data-block in .blend file each time
we have some differential overrides.

Note that for now, we do full copy of datablock into its extra 'storage'
sibbling for .blend file. This is bad (think about double copy of heavy
mesh...) and will have to be fixed. Whole copy process will need serious
work anyway, for that kind of features we need to be able to copy
without increase usercount of IDs etc.

In fact, here, maybe we even need a smarter version of copy that would
only duplicate sub-data as needed by diff-overriden properties...
2017-02-28 14:06:56 +01:00
b08a5d1e57 Merge branch 'writefile_rework' into id_override_static.
That way we don't have to add the same stupid few lines to *all*
datatypes writers! Obvious gain on efficiency and security from coding PoV.

Conflicts:
	source/blender/blenloader/intern/writefile.c
2017-02-27 14:50:21 +01:00
8c2caee7f4 Merge branch 'master' into writefile_rework 2017-02-27 10:03:49 +01:00
54107e6c40 Merge branch 'master' into id_override_static 2017-02-27 09:58:22 +01:00
441ca0202c Merge branch 'master' into id_override_static 2017-02-23 19:41:36 +01:00
15822d9d32 Refactor writefile handling of data-blocks.
Instead of calling a function looping over whole list of a given ID
type, make whole loop over Main in parent function, and call functions
writing a single datablock at a time.

This design is more in line with all other places in Blender where we
handle whole content of Main (including readfile.c), and much more easy
to extend and add e.g. some generic processing of IDs before/after
writing, etc.

From user point, there should be no change at all, only difference is
that data-block types won't be saved in same order as before (.blend
file specs enforces no order here, so this is not an issue, but it could
bug some third party users using other, simplified .blend file reader
maybe).

Reviewers: sergey

Differential Revision: https://developer.blender.org/D2510
2017-02-13 14:57:14 +01:00
68ea57a09b Fix some crashes when ID would reference itself.
Typical case: bones having constraints targetting other bones from same
armature. ID swap needs remapping here.

Really have to find something better than regular ID copy + swap + relinking
for override operations, this is horribly inneficient, complicated
and... most likely a nest of bugs and worms.

(pretty sure e.g. we still can generate same pointers during writefile
with current code :( ).
2017-02-10 09:23:09 +01:00
cad99ae1a5 Merge branch 'master' into id_override_static 2017-02-09 14:54:33 +01:00
dce4e6139f Use a smaller cross icon for clearing search box contents 2017-02-09 14:51:42 +01:00
42249eb9b3 More tweaks to Normalisation options in Graph Editor
* Added a new dedicated icon for normalize
* Only use an icon for "Auto"
2017-02-09 14:51:42 +01:00
a8edfba122 Graph Editor: Replace Normalise/Auto checkboxes with toggle buttons
These take less space, fit in better with rest of the UI, and make their relationship clearer
2017-02-09 14:51:42 +01:00
c42f64ab50 Fix: GPencil delete operators did not respect color locking 2017-02-09 14:51:42 +01:00
b2a0571a46 Cycles: Fix regression with transparent shadows in volume 2017-02-09 14:51:42 +01:00
4e9e577b88 Cycles: Solve speed regression by casting opaque ray first 2017-02-09 14:51:42 +01:00
1899f6c66d Cycles: Fix compilation error on OpenCL 2017-02-09 14:51:42 +01:00
b745195785 Cycles: Split shadow functions to avoid some duplicated calculations 2017-02-09 14:51:42 +01:00
beb6677119 Cycles: Store shadow intersections in the kernel globals
Seems CUDA failed to de-duplicate the array across multiple inlined
versions of the shadow_blocked(). Helped it a bit with that now.

Gives about 100MB memory improvement on a scenes after previous
commit and brings up memory "regression" to only 100MB comparing to
the master branch now.
2017-02-09 14:51:42 +01:00
7765614eb3 Cycles: Speedup transparent shadows on CUDA
This commit enables record-all behavior of transparent shadows
rays.

Render times difference goes as following:

               GTX 1080 render time
BMW                  -0.5%
Fishy Cat            -0.0%
Pabellon Barcelona   -11.6%
Classroom            +1.2%
Koro                 -58.6%

Kernel will now use some extra VRAM memory to store the intersection
array (200MB on my configuration). This we can optimize out with some
further commits.
2017-02-09 14:51:42 +01:00
1a222aaf9f Cycles: Implement record-all transparent shadow function for GPU
The idea is to record all possible transparent intersections when
shooting transparent ray on GPU (similar to what we were doing  on
CPU already).

This avoids need of doing whole ray-to-scene intersections queries
for each intersection and speeds up a lot cases like transparent
hair in the cost of extra memory.

This commit is a base ground for now and this feature is kept
disabled for until some further tweaks.
2017-02-09 14:51:42 +01:00
92ecd3218a Cycles: Use an utility function to sort intersections array 2017-02-09 14:51:42 +01:00
e4280e0e36 Cycles: Make GPU version of shadow_blocked() closer to CPU
Now we break the traversal cycle and then perform volume attenuation
and check with zero throughput. Not sure it makes any measurable sense
at this moment, but in the future it might help de-duplicating some
extra logic here.
2017-02-09 14:51:42 +01:00
b728e9ffbe Cycles: De-duplicate transparent shadows attenuation
Fair amount of code was duplicated for CPU and GPU, now we are
using inlined function to avoid such duplication.
2017-02-09 14:51:42 +01:00
54cde6d096 Fix T49249: Alembic export with multiple hair systems crash blender
Removed unnecessary call to DM_update_tessface_data(). This call is
already performed by DM_ensure_tessface(dm). The call being performed
twice caused a failing BLI_assert().

Reviewed by: Kévin Dietrich
2017-02-09 14:51:42 +01:00
6b5dde499b Alembic export: avoid infinite loops trying to find parent objects.
Also added some assertions for debugging purposes

Reviewed by: Kévin Dietrich
2017-02-09 14:51:42 +01:00
7fc974f89f Alembic export: only create transform writer if the object should be exported
Reviewed by: Kévin Dietrich
2017-02-09 14:51:42 +01:00
154b045f54 Alembic: #undef'ed the correct macro
TEST_RET is not defined anywhere in Blender's sources, and LAYER_CMP
is no longer used after this function ends.
2017-02-09 14:51:42 +01:00
bc7a33f1fc Alembic: Use getXForm() in check, because it's used in rest of the function too
This makes the code within the function consistent.
2017-02-09 14:51:42 +01:00
d4cc008af9 Alembic: Renamed copy_zup_yup to copy_yup_from_zup (and same for zup_from_yup)
With the new names the arguments (yup, zup) are in the same order as
they appear in the function name. The old names used copy_src_dst(dst,
src), which I found very confusing. Furthermore, now it is clear from
where to where the copy is made.

This makes the function names a little bit longer, though. If that is
a real issue, we can just name them zup_from_yup(zup, yup).

Reviewed by: Kévin Dietrich
2017-02-09 14:51:42 +01:00
fbae5a994c Various minor fixes & tweaks. 2017-02-08 20:26:11 +01:00
e029b754fe Some naive solution to avoid running 'generate auto override' code too often.
Proper solution will come later (probably based on some background job
or so...).
2017-02-08 15:38:25 +01:00
9a94b71c75 Merge branch 'master' into id_override_static 2017-02-08 09:59:31 +01:00
c2cece8b29 Preliminary step to support static override of armatures.
I.e. support override of loc/rot/scale of posechannels.

Also implied to add some minimal support of collections in 'diff
generating' RNA code.

Still much to be done of course.
2017-02-07 20:14:57 +01:00
0cc7ecd1dd Merge branch 'master' into id_override_static 2017-02-07 10:16:19 +01:00
98b868c399 Make write code theorically fully compatible with static override.
Readfile.c already was, since it's more generic code there (ID level).
2017-02-06 21:39:22 +01:00
c4d5ba4c7b Merge branch 'master' into id_override_static
Conflicts:
	source/blender/blenloader/intern/writefile.c
2017-02-06 21:01:28 +01:00
e1fc14c358 Merge branch 'master' into id_override_static 2017-02-06 20:54:08 +01:00
7b61d5f5b0 Minor cleanup (comments mostly). 2017-02-06 12:26:41 +01:00
3bab4e1136 Merge branch 'master' into id_override_static 2017-02-05 15:30:00 +01:00
9faf1d18b8 Merge branch 'master' into asset-engine 2017-02-05 15:24:34 +01:00
2cc420f409 Merge branch 'master' into id_override_static
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2017-01-31 11:46:34 +01:00
bf0dff1fe7 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_query.c
2017-01-31 11:34:02 +01:00
d9d247cf26 Merge branch 'master' into id_override_static 2017-01-23 12:27:36 +01:00
14eb249f25 Merge branch 'master' into asset-engine 2017-01-23 12:13:09 +01:00
aa53d26c0e Merge branch 'master' into id_override_static
Conflicts:
	source/blender/makesrna/RNA_types.h
2017-01-12 12:58:57 +01:00
2130d16076 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
2017-01-12 12:45:20 +01:00
d5a7a15083 Merge branch 'master' into id_override_static 2017-01-09 10:50:20 +01:00
9f80107862 Working proof-of-concept of differential override operations.
So, now 'proportional' RNA properties (here, Object's scale) is stored
as 'multiply' override op.

Once again, this is mostly testing for now, there are a lot of potential
issues and traps in current code that'll need more background work to
address later if we keep working in this direction.

Main remaining TODO to complete the proof of concept now is sketching
out a bit of UI/UX control over override!
2017-01-09 10:27:44 +01:00
ffe3fa601c Merge branch 'master' into id_override_static 2017-01-08 12:09:48 +01:00
575e62f051 More WIP work towards supporting override differentila operations.
Code compiles, is mostly neither tested nor hooked to anything yet.
2017-01-05 20:50:51 +01:00
5e0db31f79 Merge branch 'master' into id_override_static 2017-01-04 17:36:33 +01:00
95fac91fb5 Merge branch 'master' into id_override_static 2017-01-04 10:32:24 +01:00
d5e5ce62af Add basic code to prevent editing non-overridable properties. 2017-01-03 21:01:05 +01:00
8684e1566d More work and refactor in RNA override part mostly.
This commit mainly extend/refactor RNA prop copy and equals functions
into more advanced override utils (since equals is a subset of
aurooverride operations generation, and copy is a subset of override
operations application).

And some other work needed on the road...
2017-01-03 18:45:09 +01:00
2fd55e1443 Add first basic working auto-override.
Still called from pre-depsgraph eval step, does an RNA comparison and
generate overriding rules for changed props...

Note: we most certainly do not want to run this on all depsgraph eval.
Own current idea would be to just tag IDs e.g. in depsgraph callback,
and run actual auto-generation e.g. in a low-priority job, maybe? not
sure... :|

Also, fix stupid mistake in RNA applying of override (used when reading
file to apply static override), and add object's loc/rot/scale as
overridable properties.
2017-01-02 22:08:50 +01:00
a634ee733f ID override static: Various minor fixes and tweaks. 2017-01-02 14:45:36 +01:00
b81333106e Merge branch 'master' into id_override_static 2017-01-02 12:57:28 +01:00
b318a3a811 Add ways to forbid override/auto-override.
Add a 'NOOP' override ruul to prevent any kind of override on a given
RNA path, and an ID flag 'AUTOOVERRIDE' to allow automatic definition of
override rules based on changed data.

Again, just defines, do not do anything yet.
2016-12-30 18:15:49 +01:00
453aef97be Include "static override rules generator" operation into new depsgraph.
Note that this is dummy empty placeholder for now!

Idea here is that depsgraph is best place to generate our override rules
based on data changes. That way all tools in Blender keep working as
usual, on local data, and overrides are generated when needed just
before IDs get actually evaluated.

Depsgraph has key advantage of only running over *changed* data-blocks
already.

Not sure this is actually valid idea, but for tests will do the work.
If we want to keep it, we'll have to find a way to prevent this running
too often though, especially not during most animation-triggered
evaluations.
2016-12-30 16:54:50 +01:00
4c224e861b Merge branch 'master' into override_static
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-12-30 12:27:30 +01:00
b76f2c0b6c Some cleanup and refactoring. 2016-12-14 16:03:51 +01:00
de87411544 Revert initial hack to get a new overridable RNA prop flag.
Now that we have some new free ones...
2016-12-14 16:03:51 +01:00
b827ca78c7 Final bits to get first (very raw, limited and experimental) override working.
Mostly code using override data to selectively update a copy of linked one
with local data.

As said, still totally hackish and experimental, but it works - you can
create overrides of linked Objects, and override their position, yeha! :P
2016-12-14 16:03:51 +01:00
4f67a79eac Moar WIP: add operator to make override of linked object.
Mostly nasty testing code, only overriding location of object for now.
And of course, we are still missing bits in read/write code to actually
do the override.

Also, add some minimal exposure of override in RNA, here again, most to
be done still.
2016-12-14 16:03:51 +01:00
64f78e15af More WIP: add basic new BKE and RNA override API, update DNA structs.
Still much to do to even get a first dead simple working prototype, not
doing anything yet (except compiling and not crashing when ran :P ).
2016-12-14 16:03:51 +01:00
d982122f79 Some initial, WIP DNA/RNA/readwrite code for static ID override.
Quite obviously totally useless (and harmless) currently, compiles but
does nothing.
2016-12-14 16:03:51 +01:00
49ab100383 Some changes to RNA property/struct comparison.
Could very easily get into infinite loop when comparing Pointer
properties... And in any case, comparing ID pointer should be enough, no
need to dive into all ID properties!
2016-12-14 16:03:51 +01:00
f5a9f4a584 Quick and dirty hack to get overridable RNA prop flag.
To be reverted once D2400 is committed.
2016-12-14 16:03:51 +01:00
342cc1212f Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-12-12 16:32:11 +01:00
c6c28eacf6 Some more comments etc. to AssetEngine API. 2016-12-05 14:58:28 +01:00
d33ab08132 Fix bad behavior when switching between asset engines with incompatible paths.
A path valid for a given AE can be invalid with another, we need to
check current path when switching between AEs.

Also do proper check of valid path for Amber engines.
2016-12-05 14:40:24 +01:00
9b98bddc11 Merge branch 'master' into asset-engine 2016-12-05 09:05:17 +01:00
e6fc7ea873 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library_remap.c
2016-11-16 16:48:49 +01:00
b0e7c4ded9 Merge branch 'master' into asset-engine 2016-11-07 15:29:48 +01:00
9eca8837d3 Merge branch 'master' into asset-engine 2016-10-15 10:12:06 +02:00
0b61b53c9c Merge branch 'master' into asset-engine 2016-10-07 12:02:41 +02:00
c8b4ef2a59 Merge branch 'master' into asset-engine 2016-09-30 16:00:02 +02:00
ddb61b1a8a Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-09-20 12:28:46 +02:00
909084bafc Merge branch 'master' into asset-engine 2016-09-17 10:27:02 +02:00
923edbf04f Claude: forgot to 'backport' this to actual git repo... 2016-09-16 16:41:02 +02:00
f9b12c8e07 Claude: Add previews handling.
Using PIL right now to load thumbnails, so won't work with 'stock' blender builds :/
2016-09-16 16:11:08 +02:00
32b7fc1433 Merge branch 'master' into asset-engine 2016-09-16 12:24:25 +02:00
2fd24b9c92 Claude: add basic loading of selected images...
Note that you can link several images in a single run.

Also, images are using current 'link file as datablock' hack, awaiting for propper ID override to get really sane behavior here...
2016-09-15 16:55:49 +02:00
13207e388f Merge branch 'master' into asset-engine 2016-09-15 14:40:38 +02:00
8c732bd0f2 Merge branch 'master' into asset-engine 2016-09-14 17:27:56 +02:00
148b3fc212 Merge branch 'master' into asset-engine 2016-09-14 17:20:41 +02:00
d6f0d1f3f5 Claude: Fix erroneous uuid generation.
This uuid generation is just temp placeholder anyway, we want something based on actual uuid of Cloud items,
but at least let's avoid generating several time the same ID in current listing!
2016-09-13 18:50:03 +02:00
dbeabcd953 Merge branch 'master' into asset-engine 2016-09-13 18:00:40 +02:00
0099b34531 Claude: WIP, listing is kind of working, mush to be fixed still though, and of course no import yet. 2016-09-10 22:42:41 +02:00
e204168710 Merge branch 'master' into asset-engine 2016-09-10 16:14:43 +02:00
a8d05f4cde Claude: More WIP work - repo listing starts to work - partially! :P 2016-09-09 22:27:07 +02:00
f7252eb9ab Merge branch 'master' into asset-engine 2016-09-09 19:28:22 +02:00
037e761f1f Claude: more WIP work towards listing content on Cloud repository. 2016-09-08 15:26:36 +02:00
75d77a3475 Allow asset engines to change current dir also from list_dir function.
Rational is, in case of online repo, it may not be practical to decide
whether a path is valid or not from check_dir() callback, which should return
immediately.

So instead, check_dir() can only check whether path **looks** good, and
delegate actual path validation to list_dir (and maybe other similar functions).

That’s what is being tested with Claude engine at least.
2016-09-08 15:23:33 +02:00
44c099d549 Merge branch 'master' into asset-engine 2016-09-08 12:00:26 +02:00
e3d026416c Merge branch 'master' into asset-engine 2016-09-07 13:59:40 +02:00
e11f7a2bb2 Forgot to 'backport' those fixes in last commit :/ 2016-09-07 11:36:08 +02:00
a53e883678 Merge branch 'master' into asset-engine 2016-09-07 09:25:38 +02:00
0da8bae85a Claude: Fix asyncio handling!
Turns out using worker thread to run asyncio loop is not working with pillar, this code is totally
not blender-independent and hence cannot safely work in another thread.

So instead using same technique as in AmberAIO - 'stepping' of asyncio loop, instead of blindly
run_forever() and hoping loop will stop some day...

Note that we may rather call e.g. loop.run_later(1e-5, loop.stop), to actually give a bit more
time to the loop... Time will say what's best option here.
2016-09-06 14:38:51 +02:00
e48e0c1b9a Claude: Fix pillar api url to new value. 2016-09-06 14:38:28 +02:00
f4f6e6f525 AmberAIO: Fix asyncio loop handling.
Finally found the right way to do this (at least, I think! :P).
2016-09-06 14:12:08 +02:00
3ba2133e52 Merge branch 'master' into asset-engine 2016-09-06 12:27:28 +02:00
aa7b74acf1 Merge branch 'master' into asset-engine 2016-09-05 15:10:03 +02:00
655ccef095 Merge branch 'master' into asset-engine 2016-08-31 20:59:49 +02:00
6018191d79 Claude: add Pillar 'login' to Blender CLoud.
Reusing again mostly code from NlenderCloud add-on, adapted to asset engine system...
2016-08-31 12:51:18 +02:00
f346687ef2 Merge branch 'master' into asset-engine 2016-08-31 10:17:05 +02:00
ae3d5ddc7d First (totally experimental and useless) version of a future 'BlenderCloud' asset engine.
For now it's nothing but an empty shell - but a working proof of concept of how to 'embed'
that ugly asyncio-based stuff into a background working thread for asset engines.

Hopefully more funny stuff to come soon(ish).
2016-08-29 17:10:39 +02:00
9897132731 Merge branch 'master' into asset-enginea, and update for new 'checkdir' behavior/expectations.
Conflicts:
	source/blender/editors/space_file/filelist.c
2016-08-29 17:05:45 +02:00
a2a9f12ef3 Grr, forgot that fix in previous commit... 2016-08-28 16:44:59 +02:00
991194f49d Add experimental 'asyncio-based' version of Amber.
This was done to both test asyncio usage in an 'asset engine' context, and wet my feet with this lib.

All in all, am really not convinced by asyncio in this use-case. async and coroutines are much more
complex to grasp and get working correctly (and efficiently!) than mere threading.
Further more, most python lib callbacks (os.listdir, os.ls_stat, etc.) are not async-ready,
so you have to call them through asyncio's executor (aka threads or processes),
which means using asyncio in this context is only adding overhead.

I think asyncio is only really relevant when you have to handle tens (and much more) concurrent I/O tasks,
otherwise threading (or multi-processing if compute-intensive) are much, much simpler to get working,
and also probably lighter in terms of overload?

Further more, asyncio paradigm is not so easy to adapt to the 'AssetEngine' paradigm, i.e. a
python interface that gets called to start, query and finalize jobs that are supposed to keep running
in-between (think event loop should run in a background thread actually...).
2016-08-27 14:27:44 +02:00
cb69195967 Merge branch 'master' into asset-engine 2016-08-26 22:03:58 +02:00
e545d5e21d Merge branch 'master' into asset-engine 2016-08-24 18:07:31 +02:00
8dfb5b8305 Merge branch 'master' into asset-engine 2016-08-21 15:31:35 +02:00
c33f98f6ae AssetEngine previews: fix some issues, make Amber generate dummy ones as test/example.
So now, amber generates dummy mosaic-like random previews (with a 100ms delay to mimic
really slow process), everything seems to work just fine. ;)
2016-08-14 13:14:10 +02:00
85739dabef Add initial support for previews to AssetEngine.
Code not really tested (it just builds and does not crash :P ).

Will also have to rethink a bit API and data structs imho... AssetUUID is starting to become a bit annoying.
2016-08-13 18:40:40 +02:00
70b7333142 Merge branch 'master' into asset-engine 2016-08-13 15:18:52 +02:00
c349b2a5bf Merge branch 'master' into asset-engine 2016-08-10 22:06:45 +02:00
7c263af84a Merge branch 'master' into asset-engine 2016-08-10 15:18:17 +02:00
d55b7416f5 Merge branch 'master' into asset-engine 2016-08-07 21:19:29 +02:00
24430e0902 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/WM_api.h
2016-08-07 10:25:09 +02:00
948f20e74a Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2016-08-02 16:48:31 +02:00
b6540eb4a4 Merge branch 'master' into asset-engine 2016-07-26 15:31:31 +02:00
3f36cd3f33 Changed most of ID_IS_LINKED_foo checks as needed.
Basically, due to new 'virtual' libraries & 'path' assets, we consider those 'virtualmy  linked' IDs as:
* Local for editing purpose (i.e. they are editable).
* Linked for datablock management purposes (i.e. they can be made local, etc.).

Note: all this is more like a quick hack to test 'file-based' asset repositories (like cloud)
in comming weeks. I really do not think we should use that in the end, an full-featured
'overriding ID' system (as proposed in replacement of proxies for 2.8) would be much saner imho.
2016-07-25 17:37:34 +02:00
521222b545 Merge branch 'master' into asset-engine 2016-07-25 16:42:35 +02:00
4a298b10ec Merge branch 'master' into asset-engine 2016-07-25 15:07:44 +02:00
784f7f3264 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2016-07-24 18:13:36 +02:00
70e3f86809 Some more small fixes regarding ID/library asset handling. 2016-07-24 15:58:16 +02:00
d8da816a7c Add more macros to differentiate actual linked datablocks from 'virtually' linked ones (assets only).
Not yet used in code.
2016-07-16 15:54:46 +02:00
5e469bbd95 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_init_exit.c
2016-07-16 15:39:50 +02:00
b0760a5c8f Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-07-07 15:15:48 +02:00
581a819432 Merge branch 'master' into asset-engine 2016-07-02 15:30:54 +02:00
6ba8498307 Fix memleak whene deleting IDs with uuid! 2016-06-30 13:02:09 +02:00
b18270f43a Add utility to print UUID (could make it nicer, but for now will do). 2016-06-30 10:44:10 +02:00
3db91def28 Reduce re-allocation while fetching UUIDs per asset engine (asset reload area). 2016-06-30 10:41:03 +02:00
4dd6ffaf37 Split Library/ID asset-related management into own library_asset file.
This is specific enough to deserve its own file imho, and though rather small
currently, it's likely to grow...
2016-06-29 22:38:49 +02:00
4137cc79f2 Cleanup: rename BKE_asset to BKE_asset_engine.
Since this file mostly defines/handles interactions with asset engines...

Asset handling itself is more done in library area (will split it too in next commit).
2016-06-29 22:09:37 +02:00
b25c224d90 Merge branch 'master' into asset-engine 2016-06-29 18:01:35 +02:00
732cd96737 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-06-28 18:21:53 +02:00
71278cc22a Merge branch 'master' into asset-experiments 2016-06-27 17:44:15 +02:00
99869dab7c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/brush.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/space_action/space_action.c
	source/blender/editors/space_clip/space_clip.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_graph/space_graph.c
	source/blender/editors/space_image/space_image.c
	source/blender/editors/space_logic/space_logic.c
	source/blender/editors/space_nla/space_nla.c
	source/blender/editors/space_node/space_node.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_sequencer/space_sequencer.c
	source/blender/editors/space_text/space_text.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/makesrna/intern/rna_ID.c
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/wm_files.h
2016-06-27 17:29:09 +02:00
d012380cae Merge branch 'asset-engine' into asset-experiments 2016-06-16 23:45:02 +02:00
4c086f6b80 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library.c
2016-06-16 23:44:43 +02:00
56677f4f14 Fix remaining cases of datablocks' BKE_foo_free() touching usercount of their IDs.
Note that a few sub-data (like animdata) needs to keep option to unlink their
own ID usages themselves for now, this is not ideal, but need some more time
to mumble on this and find an elegant fix. Nothing blocking here anyway.
2016-06-16 22:06:32 +02:00
bb4c87a130 Merge branch 'master' into asset-engine 2016-06-16 21:17:45 +02:00
4853f75073 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-06-16 21:13:15 +02:00
04ee81a081 Merge branch 'master' into id-remap 2016-06-16 19:24:14 +02:00
42dda95e89 Merge branch 'master' into id-remap 2016-06-16 18:12:53 +02:00
21b5ce57f5 Fix bad handling of RegionView3Ds in View3D ID remap callback. 2016-06-16 18:10:44 +02:00
c24ba18d7a Found more id-remap missing cases in spaces (new(?) ads of anim editors). 2016-06-16 17:16:25 +02:00
1eac4fde27 Fix missing mask ID pointer update in Clip/Image spaces' remap callbacks. 2016-06-16 16:56:20 +02:00
fc10e42de3 Finish TODOs related to buttons space and ID remapping. 2016-06-16 16:47:32 +02:00
0256d5dde9 Fix reload/relocate trying to use invalid lib path. 2016-06-16 16:06:10 +02:00
7cbe356c4f Fix broken compilation after recent refactor. 2016-06-16 15:59:30 +02:00
bde19b57d6 Cleanup from review comments. 2016-06-16 15:54:22 +02:00
dbf7d30744 Merge branch 'master' into id-remap 2016-06-16 15:39:54 +02:00
d430237282 Cleanup: headers 2016-06-16 20:43:34 +10:00
5fd97c6e85 Move remapping functions into BKE_library_remap.h
This is done since remapping is quite an involved process.
2016-06-16 20:28:54 +10:00
1880cb6c75 Merge branch 'master' into id-remap 2016-06-16 20:03:53 +10:00
25e0f5e9f2 Fixes/updates needed to make asset reload work with new virtual lib stuff. 2016-06-14 17:41:29 +02:00
b74ad975fd Merge branch 'id-remap' into asset-experiments 2016-06-14 16:39:53 +02:00
0d8e70600b Merge branch 'asset-engine' into asset-experiments 2016-06-14 16:39:47 +02:00
beaf33dfb2 Merge branch 'master' into id-remap 2016-06-14 16:36:42 +02:00
46cf8ba269 Cleanup. 2016-06-14 16:36:15 +02:00
f7b21186b5 Merge branch 'master' into asset-engine 2016-06-14 16:31:58 +02:00
fe41942a90 Cleanup: move 'virtual lib' linking code into own helper. 2016-06-14 15:56:32 +02:00
c6d3f76e69 Fix save/load issues with new virtual-lib assets. 2016-06-14 15:47:54 +02:00
69ae86193c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-06-14 15:07:18 +02:00
5aaf18c39c WIP experimental support of direct image-as-linkeddata.
Works okish, but break on load (or save) of .blend file currently...
2016-06-13 21:40:48 +02:00
cbf241510d First step towards supporting non-blender-data as assets.
Idea is to avoid the need for asset engines to generate whole .blend files
with relevant datablocks in case they just need/want to provide files (images, videos, sounds...).

This commit introduces the concept of 'virtual' library, which in fact only exists to store
asset repository data. Datablocks from those virtual libs are then fully written in .blend file.

Much to do still, this is only preliminary/experimental work.
2016-06-13 17:39:02 +02:00
088d32d159 Some minor fixes/enhancements.
Asset engines are now only selectable and used in link/append case. Makes no real sense to have
those in other cases (like regular file opening, or even worse when saving a file!).
Also allows to get back asset engine persistance accross filebrowser usage.
2016-06-13 15:06:52 +02:00
d24c85fc12 Merge branch 'asset-engine' into asset-experiments 2016-06-13 12:54:44 +02:00
595159614f Merge branch 'id-remap' into asset-experiments 2016-06-13 12:54:38 +02:00
98654a9c9a Merge branch 'master' into asset-experiments 2016-06-13 12:54:32 +02:00
4286b606b3 Merge branch 'master' into asset-engine 2016-06-13 12:50:06 +02:00
09df8bd2e0 Merge branch 'master' into id-remap 2016-06-13 12:47:09 +02:00
836ecc6142 Merge branch 'asset-engine' into asset-experiments 2016-06-07 10:17:23 +02:00
0f5642b155 Merge branch 'id-remap' into asset-experiments 2016-06-07 10:17:16 +02:00
b1171ea31c Merge branch 'master' into asset-engine 2016-06-07 10:12:59 +02:00
3f4113ce3e Merge branch 'master' into id-remap 2016-06-07 10:10:14 +02:00
aa5f4d98fc Merge branch 'asset-engine' into asset-experiments 2016-06-07 09:44:08 +02:00
6f20d64f3a Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/makesdna/DNA_ID.h
2016-06-07 09:43:56 +02:00
fd12edebf4 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_ID.h
2016-06-07 09:42:52 +02:00
18f87c8dcb Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-06-07 09:27:56 +02:00
434a851703 Merge branch 'asset-engine' into asset-experiments 2016-05-31 09:58:19 +02:00
7282c6592a Merge branch 'id-remap' into asset-experiments 2016-05-31 09:58:08 +02:00
77cdf1fb49 Merge branch 'master' into asset-engine 2016-05-31 09:53:40 +02:00
2c9f6714a7 Fix merge error. 2016-05-31 09:53:16 +02:00
9400ea0647 Merge branch 'master' into id-remap 2016-05-31 09:38:38 +02:00
8346805963 Merge branch 'asset-engine' into asset-experiments 2016-05-24 15:49:11 +02:00
050209d16e Merge branch 'id-remap' into asset-experiments 2016-05-24 15:49:03 +02:00
0929283ddc Merge branch 'master' into asset-experiments 2016-05-24 15:48:55 +02:00
5afc102357 Fix alignement issues in some DNA struct due to ID one now being properly aligned. 2016-05-24 15:48:15 +02:00
6bae015985 Merge branch 'master' into asset-engine 2016-05-24 14:44:13 +02:00
ba1af2e1bf Some cleanup. 2016-05-24 14:43:48 +02:00
adbd9cb1de Better name handling in case we remap an ID adn cannot replace it totally. 2016-05-24 14:10:28 +02:00
16641d4c02 Merge branch 'master' into id-remap 2016-05-24 12:29:07 +02:00
4795d6bdb1 Merge branch 'master' into id-remap 2016-05-23 18:18:36 +02:00
542302e3f6 Revert "Squashed commit of the atomic-operations branch."
This reverts commit ffe7f4175a.
2016-05-09 15:12:16 +02:00
ffe7f4175a Squashed commit of the atomic-operations branch. 2016-05-09 15:11:40 +02:00
cb530ad07e Merge branch 'asset-engine' into asset-experiments 2016-05-06 13:34:15 +02:00
084f5e9a4d Merge branch 'id-remap' into asset-experiments 2016-05-06 13:34:06 +02:00
4c8e2ebde2 Merge branch 'master' into asset-experiments 2016-05-06 13:33:59 +02:00
d27bae4432 Merge branch 'master' into asset-engine 2016-05-06 13:30:37 +02:00
cbe6475383 Merge branch 'master' into id-remap 2016-05-06 13:28:20 +02:00
93c9ff858a First 'working' version of asset reload.
Dead dummy simplistic test runs (nearly) OK here (only have a memleak from versionning code...),
but obviously will need much serious tests to validate everything.

Also, many things in code will need cleanup/refactor. Not to mention UI/UX.

But we do have asset version check & reload on file opening now! :D

Process summary:
I) Open .blend file exactly as in master, load assets just like any other linked data (add placeholders in case not found).
II) Check all asset engines and ask them whether each asset is OK, needs to be updated/reloaded, is missing...
III) User then can decide to actually reload the asset, or not.

Step II) happens in an async job (since engines using remote storage/database could take some time to answer),
step III) is a locking task (just like initial linking). This should allow user to not be blocked at all by that
asset update process.
2016-05-06 13:16:24 +02:00
7cf890e126 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
2016-05-06 13:05:49 +02:00
961ebfa8c4 Set a main's version to current one after do_version is done.
With current master this is not an issue, but with all the reload stuff,
a same main could end up going several time into 'do_version', which is absolutely
not desired (multi-allocations, repeating conversions over some values, etc.).
2016-05-06 13:03:31 +02:00
341237035f Merge branch 'asset-engine' into asset-experiments 2016-05-06 11:09:56 +02:00
82359a7997 Do not update asset repo info inside link code.
Whole 'database' is rebuilt later anyway, and in more complex 'asset reload' cases
(where we may actually be reloading same asset with same uuid from same lib file),
this creates confusion...
2016-05-06 11:07:53 +02:00
4a429f1525 Merge branch 'asset-engine' into asset-experiments 2016-05-05 17:20:10 +02:00
fa21019745 Add global 'asset search by uuid' helper. 2016-05-05 17:19:27 +02:00
f4e4575e3c Merge branch 'asset-engine' into asset-experiments 2016-05-03 17:52:31 +02:00
a6f085f3c9 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2016-05-03 17:52:19 +02:00
39da83e974 Merge branch 'master' into asset-experiments 2016-05-03 17:45:25 +02:00
783d63f6af Merge branch 'master' into asset-engine 2016-05-03 17:45:05 +02:00
a6a8ff103d Lib relocate/reload: serious rework of code.
Idea here is to both factorize it seriously (reload and relocate are very similar, let's
avoid as much as possible twice the same code...), and make new `lib_relocate_do()`
much more flexible - now it should be able to reload individual IDs as well
(plan is to use it to reload assets in relelvant branch too).
2016-05-03 17:42:23 +02:00
a97da9842c Merge branch 'master' into id-remap 2016-05-03 16:58:34 +02:00
861318bbb9 Merge branch 'master' into asset-engine 2016-05-03 15:32:30 +02:00
41c5ec21b3 Merge branch 'master' into id-remap 2016-05-03 15:32:05 +02:00
b7525de284 Merge branch 'asset-engine' into asset-experiments 2016-05-03 09:57:24 +02:00
071a27f918 Amber: Fix load_pre not using correct repo! 2016-05-03 09:56:44 +02:00
90af45d5b5 Merge branch 'asset-engine' into asset-experiments 2016-05-02 20:51:58 +02:00
56ea898ade Merge branch 'id-remap' into asset-experiments 2016-05-02 20:51:51 +02:00
d95671442d Merge branch 'master' into asset-experiments 2016-05-02 20:51:44 +02:00
26658afad1 Amber: fix missing '..' parent dir entry when inside a repo. 2016-05-02 20:50:57 +02:00
70eb04328c Change how Amber (and all other engines) are expected to work.
So far, we were accepting the idea of several repositories per asset engine (e.g. different
directories in case of Amber). However, if this works OK during listing/initial linking,
it makes things way more complicated later in asset management, since asset uuid is no more
enough to unically indentify an asset!

Now an asset UUID is assumed to be really unique inside an asset engine.

For Amber, we 'salt' assets' uuids with new repo uuids (both being only 2 ints long now),
and keep a config 'cache' of mapping repo uuid -> path to repo.
2016-05-02 20:35:08 +02:00
a47653e5d4 Merge branch 'master' into asset-engine 2016-05-02 14:31:25 +02:00
dd63b849f8 Merge branch 'master' into id-remap 2016-05-02 14:28:49 +02:00
266d99ee42 More WIP code for actual assets reload.
Nothing working yet, need to solve some issue with rootpath actually...
2016-04-28 23:15:46 +02:00
5ad251770b Merge branch 'asset-engine' into asset-experiments 2016-04-28 22:40:03 +02:00
6c478490ea Refactor load_pre helper to work from both DirEntries and uuids... 2016-04-28 22:39:12 +02:00
e451d9b56a WIP (mostly empty for now) code to actually reload assets reported as needing it by update_check. 2016-04-28 21:44:59 +02:00
8bf511ef0b Merge branch 'asset-engine' into asset-experiments 2016-04-28 21:34:46 +02:00
ef14700089 Cleanup: get rid of blocking asset update_check code. 2016-04-28 21:32:32 +02:00
20bf7d949f Some refactor in asset update_check code.
Fetching assets' uuids by engines is now in own func (will be used by update op itself too).

Also, each AssetRef has only *one* asset ID, the first one, avoids us a useless loop!

And early out of update_check op in case we have no asset in current Main, no need to start
job in this case.
2016-04-28 21:30:14 +02:00
60cd55692d Merge branch 'asset-engine' into asset-experiments 2016-04-27 13:16:04 +02:00
b3be710e19 Some tweaks to flags & versionning handling for assets update check. 2016-04-27 13:15:39 +02:00
03d23c42a2 Merge branch 'master' into asset-experiments 2016-04-27 11:02:04 +02:00
42ea7490e5 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
	source/blender/windowmanager/wm_files.h
2016-04-27 11:01:48 +02:00
d4a9111f08 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-27 10:58:41 +02:00
e812fb4825 Add some header info about asset errors or reload needs.
Again, rather rough UI but enough to be useful for now.
2016-04-26 16:42:00 +02:00
cf08eec187 Add simple dummy code in outliner to show assets and their status.
This is purely WIP helper stuff, final UI will need real work - but that's for later.
2016-04-26 16:02:51 +02:00
32c83ba950 Merge branch 'master' into asset-engine 2016-04-26 14:42:05 +02:00
c2a5f95122 Merge branch 'master' into id-remap 2016-04-26 14:33:54 +02:00
b1c715a5fa Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/blender.c
	source/blender/windowmanager/intern/wm_files.c
	source/blender/windowmanager/intern/wm_init_exit.c
2016-04-25 16:55:41 +02:00
60474d11c7 Merge branch 'master' into id-remap 2016-04-25 16:41:26 +02:00
6e1fdd6f2d Actually hook async job of asset updating! 2016-04-20 17:11:14 +02:00
6cdc7c9587 Add 'ensure_uuids' callback to API, fix some flags in RNA code. 2016-04-20 17:08:42 +02:00
8154ee7bb2 Make opening .blend file use new async 'check asset updates' operator.
Nothing much exciting really, just not blocking anymore.
2016-04-20 16:44:07 +02:00
68eaa00290 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-19 23:21:05 +02:00
8055eae905 Merge branch 'master' into id-remap
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-04-19 23:03:53 +02:00
7cb1438035 Asset update: WIP proof-of-concept async (job-based) update code.
Builds, but not tested nor hoocked to anything yet!
2016-04-19 13:07:33 +02:00
e1c0b2ff25 Merge branch 'master' into asset-engine 2016-04-16 15:02:16 +02:00
54307d778d Merge branch 'master' into id-remap 2016-04-16 14:59:16 +02:00
1d40cfafea Move core of update check to BKE's asset area, add an operator for that too. 2016-04-15 10:38:49 +02:00
f36307db4b Merge branch 'master' into asset-engine 2016-04-12 12:30:40 +02:00
9437647f5d Merge branch 'master' into id-remap 2016-04-12 12:21:00 +02:00
9804f9181f Make 'check update' async, and add possibilities for engines to make async callbacks 'immediate'.
So now, jobs callback (async ones) of asset may return a specific job id value in case they actually
complete (or fail) on the first run.

This allows engines that do not need slow async stuff to perform an action to use simpler code
(e.g. imagine an engine able to list its assets from a cached DB, in most cases its list_dir
callback can execute instantaneously (from a user PoV), no need for a listing job then).
2016-04-11 17:35:31 +02:00
09f134aa6c Make asset engine's load_pre callback mandatory now.
Reason is, even if paths returned by `list_dir` are OK, we will also use `load_pre`
during 'reload'/'update' scenarii, where we only have uuids, to retrieve final
.blend datablock paths.
2016-04-11 16:14:05 +02:00
cb926ab6c9 Merge branch 'master' into asset-engine 2016-04-09 15:44:26 +02:00
28382bad00 Merge branch 'master' into id-remap 2016-04-09 15:41:46 +02:00
5b67ec9c9f Always reset to default asset engine (i.e. regular filebrowser code) when opening a new browser.
Else we'd have the last used engine even when saving a .blend or picture, ugly!
2016-04-07 16:35:34 +02:00
7dea5c2462 Finish implementing 'reports' in asset engine (not used yet). 2016-04-07 16:18:42 +02:00
f53c4dd29e Some minor fixes/updates of AE API comments. 2016-04-07 15:50:53 +02:00
1e3d75604d Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/blender.c
2016-04-07 15:26:32 +02:00
897249b254 Merge branch 'id-remap' into asset-experiments 2016-04-07 15:25:42 +02:00
718f8fe55f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_library_query.h
	source/blender/blenkernel/intern/blender.c
	source/blender/blenkernel/intern/library_query.c
2016-04-07 15:25:23 +02:00
698b15538b Fix issue with uuid generation in Amber. 2016-04-06 18:05:02 +02:00
aec80da8f8 More or less finished shell of 'update' code.
Code only reports which datablocks/assets shall be reloaded etc. so far, actual
reloading needs id-remap code (and hence will be implemented in asset-experiment
branch later).
2016-04-06 17:38:12 +02:00
9a31359e07 Merge branch 'master' into asset-engine 2016-04-06 15:23:45 +02:00
b111e0f645 Merge branch 'master' into id-remap 2016-04-06 15:16:39 +02:00
8b81b71cf2 Merge branch 'master' into asset-engine 2016-04-04 14:45:52 +02:00
46206fd9a5 Merge branch 'master' into id-remap 2016-04-04 14:39:59 +02:00
96aa445527 Add a 'check_dir' callback to asset engines, allowing them to control current 'root dir'.
Note that this is hacked around bpyrna incapacity to handle strings as return values of functions callbacks...
2016-03-31 20:50:29 +02:00
d63895ee30 Merge branch 'master' into asset-engine 2016-03-30 21:39:09 +02:00
f820643e9f Merge branch 'master' into id-remap 2016-03-30 21:37:49 +02:00
e9d7c741ca Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-03-30 21:31:21 +02:00
826ba124b6 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-03-30 21:10:10 +02:00
0ab784332a Merge branch 'libquery-recursive' into asset-engine 2016-03-23 17:16:52 +01:00
cab4bd90c1 Merge branch 'master' into asset-engine 2016-03-23 17:16:45 +01:00
c1452617fb Merge branch 'libquery-recursive' into id-remap 2016-03-23 17:08:32 +01:00
50d2c7f8f4 Merge branch 'master' into id-remap 2016-03-23 17:08:26 +01:00
f0f46e9ef6 Rework library_query foreach looper - add optional recursivity.
This commit:
* Fixes bad handling of 'stop iteration' (by adding a status flag, so that we can actually
  stop in helper functions too, and jumping to a finalize label instead of raw return, to
  allow propper clean up).
* Adds optional recursion into 'ID tree' - callback can also decide to exclude current id_pp
  from recursion. Note that this implies 'readonly', modifying IDs while recursing is not
  something we want to support!
* Changes callback signature/expected behavior: return behavior is now handled through flags,
  and 'parent' ID of id_pp is also passed (since it may not always be root id anymore).

Used this new recursive behavior in ID preview generation as an example, would obviously be committed separately.

Reviewers: sergey, campbellbarton

Differential Revision: https://developer.blender.org/D1869
2016-03-23 13:15:41 +01:00
be5c2a5266 Finish RNA flags for asset UUIDs! 2016-03-17 14:54:29 +01:00
484f1bc226 Merge branch 'libquery-recursive' into asset-engine 2016-03-17 12:52:10 +01:00
97cb96720c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/blender.c
2016-03-17 12:51:53 +01:00
37c4db1125 Merge branch 'libquery-recursive' into id-remap 2016-03-17 12:26:34 +01:00
cb770e58ad Merge branch 'master' into id-remap 2016-03-17 12:26:25 +01:00
09444bca5f Merge branch 'master' into libquery-recursive 2016-03-17 12:23:42 +01:00
a639446614 More WIP work towards designing Updated feature for assets/engines. 2016-03-09 20:33:38 +01:00
22f5772b44 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/creator/creator.c
2016-03-07 16:42:19 +01:00
8403577397 Merge branch 'id-remap' into asset-experiments 2016-03-07 15:37:43 +01:00
ebe52b71a5 Merge branch 'libquery-recursive' into asset-experiments 2016-03-07 15:37:35 +01:00
59aeb07895 Merge branch 'master' into asset-experiments
Conflicts:
	source/creator/creator.c
2016-03-07 15:37:22 +01:00
b0a541a76c Slightly modified way to check for assets on loadfile.
Since we now build a list of assets and their dependencies in Library datablocks, use it!
2016-03-07 15:03:28 +01:00
c93a86909c Merge branch 'libquery-recursive' into asset-engine 2016-03-06 14:57:20 +01:00
204ec489b8 Merge branch 'master' into asset-engine 2016-03-06 14:57:10 +01:00
873e90be65 Merge branch 'libquery-recursive' into id-remap 2016-03-06 14:54:06 +01:00
30b90cbb01 Merge branch 'master' into id-remap 2016-03-06 14:53:57 +01:00
f500019eac Merge branch 'master' into libquery-recursive 2016-03-06 14:51:03 +01:00
3cfea6eadc Merge branch 'libquery-recursive' into asset-engine 2016-03-04 14:35:18 +01:00
304cdfa476 Merge branch 'master' into asset-engine 2016-03-04 14:35:05 +01:00
cea847738a Merge branch 'libquery-recursive' into id-remap 2016-03-04 14:25:27 +01:00
bb3d3cc9cf Merge branch 'master' into id-remap 2016-03-04 14:25:20 +01:00
3d4ac80157 Merge branch 'master' into libquery-recursive 2016-03-04 14:24:59 +01:00
8b4997c6c7 WIP dummy code to update assets on file (re)load.
Actual code will be implemented in asset-experiment (we need id-remap code for this),
but will first try to define dummy API in this branch.
2016-03-01 16:58:31 +01:00
beff4ca725 Merge branch 'libquery-recursive' into asset-engine 2016-02-29 15:33:21 +01:00
982dd93357 Merge branch 'master' into asset-engine 2016-02-29 15:33:07 +01:00
2fa8db4ec6 Merge branch 'libquery-recursive' into id-remap 2016-02-29 15:21:54 +01:00
fa4d7deac0 Merge branch 'master' into id-remap 2016-02-29 15:21:39 +01:00
2a09cb62e2 Merge branch 'master' into libquery-recursive 2016-02-29 15:15:49 +01:00
0588ca9c08 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_operators.c
2016-02-25 15:07:27 +01:00
bb75900289 Merge branch 'id-remap' into asset-experiments 2016-02-25 14:55:56 +01:00
49e2a441cb Merge branch 'libquery-recursive' into asset-engine 2016-02-25 14:45:49 +01:00
ae9ae24c95 Merge branch 'libquery-recursive' into id-remap 2016-02-25 14:43:04 +01:00
d1dd9b6261 Merge branch 'master' into id-remap 2016-02-25 14:42:55 +01:00
5b5f55067b Merge branch 'master' into libquery-recursive 2016-02-25 14:21:30 +01:00
37f58ffec9 Forgot to include AnimationData into new recursive libquery foreach... 2016-02-25 14:20:58 +01:00
59a1340714 Add asset dependencies (re)build.
Is rebuilt when we link a new asset, or when we (re)load a .blend file.
Runtime data only, not saved in .blend file.
2016-02-24 20:42:58 +01:00
adfd89d9bd Merge branch 'libquery-recursive' into asset-engine 2016-02-24 10:35:00 +01:00
85959e8b4a Merge branch 'master' into asset-engine 2016-02-24 10:34:50 +01:00
c448d4422e Merge branch 'libquery-recursive' into id-remap 2016-02-24 10:34:14 +01:00
3dfd063697 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-02-24 10:26:50 +01:00
e714e1c5ef Merge branch 'master' into libquery-recursive 2016-02-24 10:18:38 +01:00
3054a8a91b Merge branch 'master' into libquery-recursive 2016-02-20 18:06:13 +01:00
dc34313dc9 Merge branch 'libquery-recursive' into asset-engine 2016-02-19 10:53:52 +01:00
afdf2a3fb2 Merge branch 'master' into asset-engine 2016-02-19 10:53:38 +01:00
aabe83d4c0 Merge branch 'libquery-recursive' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-02-19 10:50:26 +01:00
9bb32dd445 Merge branch 'master' into id-remap 2016-02-19 10:48:24 +01:00
87a385b838 Cleanup (remove some useless diff compared to master). 2016-02-19 10:47:32 +01:00
3652a0e7da Merge branch 'master' into libquery-recursive 2016-02-19 10:29:18 +01:00
b6022f1488 Fix for new libquery callback API. 2016-02-18 23:11:03 +01:00
6a951054d0 Merge branch 'libquery-recursive' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-02-18 18:10:57 +01:00
6ec0026f8d Merge branch 'libquery-recursive' into asset-engine 2016-02-18 17:56:58 +01:00
827b1457ca Rework library_query foreach looper - add optional recursivity.
This commit:
* Fixes bad handling of 'stop iteration' (by adding a status flag, so that we can actually
  stop in helper functions too, and jumping to a finalize label instead of raw return, to
  allow propper clean up).
* Adds optional recursion into 'ID tree' - callback can also decide to exclude current id_pp
  from recursion. Note that this implies 'readonly', modifying IDs while recursing is not
  something we want to support!
* Changes callback signature/expected behavior: return behavior is now handled through flags,
  and 'parent' ID of id_pp is also passed (since it may not always be root id anymore).

Used this new recursive behavior in ID preview generation as an example, still needs more testing!
2016-02-18 17:53:42 +01:00
40562d0e11 Merge branch 'master' into asset-engine 2016-02-18 17:35:12 +01:00
cd43bd241f Merge branch 'master' into asset-engine 2016-02-16 14:35:54 +01:00
a9054360c6 Merge branch 'master' into id-remap 2016-02-15 19:46:24 +01:00
66375326b4 Merge branch 'master' into asset-engine 2016-02-15 19:39:57 +01:00
3eefdc0ed7 WIP Add asset sub-data dependency info.
We need that info (knowing which non-asset IDs are used by which asset-IDs),
otherwise managing reloading, updates etc. of assets would be impossible
(or rather, would leave a mess of unused IDs behind them).
Only partially done, non-functional yet.

This commit also adds asset repository references in libraries.
2016-02-15 16:52:12 +01:00
14d11c1609 Merge branch 'asset-engine' into asset-experiments 2016-02-14 20:31:37 +01:00
6b61c25815 Merge branch 'id-remap' into asset-experiments 2016-02-14 20:31:31 +01:00
576eca8ab3 Merge branch 'master' into asset-engine 2016-02-14 20:27:48 +01:00
ad72025611 Merge branch 'master' into id-remap 2016-02-14 20:24:53 +01:00
65e357fe56 Merge branch 'asset-engine' into asset-experiments 2016-02-12 10:06:03 +01:00
46903fbccf Merge branch 'id-remap' into asset-experiments 2016-02-12 10:05:56 +01:00
ac2e25986c Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-02-12 10:05:28 +01:00
71b65b417c Merge branch 'master' into id-remap 2016-02-12 09:55:22 +01:00
30db6e0cb7 Merge branch 'master' into asset-engine 2016-02-03 10:06:45 +01:00
2ca8421987 Assets: add uuid to linked data, write and read it from file.
Note that this is only very first steps, I think we'll need to 'propagate'
uuid to all data used/linked by asset itself, otherwise most things won't get
updated/reloaded. Still have to think about this.
2016-02-02 14:14:15 +01:00
11c6fed3ee Merge branch 'master' into asset-engine 2016-02-02 14:10:27 +01:00
f3de9752fd Merge branch 'id-remap' into asset-experiments 2016-02-01 14:05:11 +01:00
1b34246af2 Merge branch 'master' into id-remap 2016-02-01 14:04:48 +01:00
dded3bb21f Merge branch 'asset-engine' into asset-experiments 2016-01-31 15:09:24 +01:00
3f63cb8843 Merge branch 'id-remap' into asset-experiments 2016-01-31 15:09:17 +01:00
d1b4471012 Merge branch 'master' into asset-engine 2016-01-31 15:05:09 +01:00
5b16d59ffc Merge branch 'master' into id-remap 2016-01-31 14:59:57 +01:00
f1fc8959db Assets: add uuid to linked data, write and read it from file.
Note that this is only very first steps, I think we'll need to 'propagate'
uuid to all data used/linked by asset itself, otherwise most things won't get
updated/reloaded. Still have to think about this.
2016-01-21 16:12:08 +01:00
955cb4a8db Merge branch 'asset-engine' into asset-experiments 2016-01-21 09:46:46 +01:00
351f74dee9 Merge branch 'id-remap' into asset-experiments 2016-01-21 09:46:39 +01:00
da81c78fc7 Merge branch 'master' into asset-engine 2016-01-21 09:45:52 +01:00
911095d372 Merge branch 'master' into id-remap
Conflicts:
	source/blender/editors/space_outliner/outliner_tools.c
2016-01-21 09:45:18 +01:00
d9a93eb3bd Merge branch 'asset-engine' into asset-experiments 2016-01-20 15:31:01 +01:00
27470754b6 Merge branch 'id-remap' into asset-experiments 2016-01-20 15:30:53 +01:00
6b1065b11c Merge branch 'master' into asset-engine 2016-01-20 15:02:49 +01:00
1705fd66d8 Merge branch 'master' into id-remap 2016-01-20 15:02:29 +01:00
28adc7d248 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2016-01-20 14:27:45 +01:00
f4214d1d1c Merge branch 'asset-engine' into asset-experiments 2016-01-15 16:31:13 +01:00
48f9931257 Merge branch 'id-remap' into asset-experiments 2016-01-15 16:31:06 +01:00
a0803fabfe Merge branch 'master' into asset-engine 2016-01-15 16:24:55 +01:00
6eec8eaa57 Merge branch 'master' into id-remap 2016-01-15 15:26:34 +01:00
498b712a37 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-01-14 20:32:03 +01:00
0fa187e4b5 Fix handling of asset uuid in WMLinkAppendDataItem helper struct.
We need a pointer here (reduces mem footprint, and allows to say 'we have no uuid' with a NULL value!).
2016-01-14 20:29:40 +01:00
a9284fd093 Merge branch 'asset-engine' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:23:06 +01:00
8af7d783c7 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:21:34 +01:00
a7cfb5fc22 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-12 16:08:05 +01:00
a414edc0af Merge branch 'master' into id-remap 2016-01-12 16:01:17 +01:00
4c535c07c6 Fix & cleanup in outliner area.
Now all new entries in items' menus should behave correctly!
2016-01-07 21:47:47 +01:00
22f5a17b9c Fix some bad id->flag/tag mismatch from not-so-recent merge with master... 2016-01-07 16:14:16 +01:00
07b8b90f39 Fix assert when deleting obdata.
Issue here is again with NEVER_NULL usages: obdata (& co) would be dereferenced twice.

I'm not totally happy with this solution, ideally remap should never leave Main
in invalid state, but for now it will do...
2016-01-07 16:11:14 +01:00
5a65830830 Fix a crash when deleting a lib featuring some proxyob source... 2016-01-07 14:51:37 +01:00
f2db96fbaf Merge branch 'master' into id-remap 2016-01-07 10:28:55 +01:00
2e8297108d Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library_query.h
	source/blender/blenkernel/intern/library_query.c
	source/blender/makesrna/intern/rna_ID.c
2016-01-06 21:40:12 +01:00
eaa892c14f Merge branch 'asset-engine' into asset-experiments 2016-01-04 20:41:15 +01:00
f3077f411d Merge branch 'id-remap' into asset-experiments 2016-01-04 20:41:08 +01:00
46e6f3b420 Merge branch 'master' into asset-engine 2016-01-04 20:35:05 +01:00
fc7f086f4b Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2016-01-04 20:34:31 +01:00
74393f8f15 Merge branch 'asset-engine' into asset-experiments 2016-01-04 12:10:26 +01:00
9c3e0b558c Merge branch 'id-remap' into asset-experiments 2016-01-04 12:10:19 +01:00
e49966dd96 Merge branch 'master' into asset-engine 2016-01-04 11:55:56 +01:00
e921ecabaf Merge branch 'master' into id-remap 2016-01-04 10:58:39 +01:00
e58cae1b7a Merge branch 'asset-engine' into asset-experiments 2015-12-31 12:56:53 +01:00
e28986aa8f Merge branch 'id-remap' into asset-experiments 2015-12-31 12:56:45 +01:00
19e6c23b75 Merge branch 'master' into asset-engine 2015-12-31 12:50:34 +01:00
9ae928ff9d Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/BKE_material.h
2015-12-31 12:50:08 +01:00
b40d4ba517 Merge branch 'asset-engine' into asset-experiments 2015-12-27 13:09:54 +01:00
8d3129cba2 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-27 13:09:42 +01:00
009ccfecb6 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-27 13:06:34 +01:00
f4e7fec73c Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/makesdna/DNA_ID.h
2015-12-27 12:54:57 +01:00
a6e9aba17f Merge branch 'master' into id-remap 2015-12-20 15:41:27 +01:00
b9c5da9ba8 Merge branch 'master' into id-remap
Conflicts:
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-18 22:17:25 +01:00
4eaa6c4a7b Merge branch 'master' into id-remap 2015-12-18 21:23:27 +01:00
b46b921738 Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
2015-12-17 19:39:05 +01:00
dab1a1dd5f Merge main remap funcs' bool parameters into a single bitflag.
Too much bools kill bools.
2015-12-17 19:32:33 +01:00
24556b3c3d More cleanup - remove unused stuff, some simplifications. 2015-12-17 14:56:15 +01:00
817fee305f Cleanup: mostly removes useless diff from master. 2015-12-17 13:21:18 +01:00
613bf6755e Merge branch 'id-remap' into asset-experiments
Conflicts:
	source/blender/blenloader/BLO_readfile.h
	source/blender/blenloader/intern/readfile.c
	source/blender/windowmanager/intern/wm_operators.c
2015-12-16 22:28:31 +01:00
f2ce01f844 Merge branch 'asset-engine' into asset-experiments 2015-12-16 21:50:17 +01:00
3de18048b3 Merge branch 'master' into asset-experiments 2015-12-16 21:50:02 +01:00
d02c201814 Merge branch 'master' into asset-engine 2015-12-16 21:39:49 +01:00
c089f28504 Merge branch 'master' into id-remap 2015-12-16 21:34:04 +01:00
cddbeaeec8 Merge branch 'master' into asset-engine 2015-12-14 16:26:49 +01:00
d0b037d0ef Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/text.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-14 16:26:14 +01:00
8bbfd2729a Merge branch 'master' into id-remap 2015-12-07 17:45:41 +01:00
6dffedc75e Fix several issues with logic of core id-remap:
* We need to clear the 'user-one' flags and potential usercount for old_id.
* We need to consider ID usages inside a same lib as **never** being indirect ones.

Also re-enabled proxy checking for now (not sure why I commented it, think testing stuff or so...).
2015-12-07 17:33:35 +01:00
49b67b58aa Fix id-remap looper not 'freeing' 'use-one' id usercount. 2015-12-07 15:54:03 +01:00
67cc51d32d Merge branch 'master' into id-remap 2015-12-07 11:01:09 +01:00
574d63cf65 Merge branch 'master' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_intern.h
	source/blender/editors/space_file/file_ops.c
2015-12-07 11:00:38 +01:00
05bd9572a6 Some more fixes, and make Outliner's delete available for all IDs, not only libraries! 2015-12-04 17:48:00 +01:00
56679ae31c Merge branch 'master' into id-remap 2015-12-04 17:24:43 +01:00
705a247e2e Better handling of usercount during ID deletion, also add this to ID RNA API.
Seems to work for simple cases, but deletion of complex libs from complex files
(Gooseberry ones) still generates lots of assert failures, and crashes in some cases.
2015-12-03 16:34:11 +01:00
e8b46461e6 Merge branch 'master' into id-remap 2015-12-03 14:25:05 +01:00
9584c88b6b Fix a bunch of more stuff, more correct handling of ID/Lib deletion...
Still have some usercount issues here, though things seems to start working...
2015-12-01 21:37:25 +01:00
84d25cb87a Merge branch 'master' into id-remap.
Also, changing how library delete works (not functional currently).

Conflicts:
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_ops.c
	source/blender/editors/space_outliner/outliner_tools.c
2015-12-01 17:45:22 +01:00
1da2edfb25 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library_query.c
2015-11-30 15:38:42 +01:00
6f90aa2016 Fix issue when reloading a lib with selected object. 2015-11-30 10:48:55 +01:00
81edad9966 Merge branch 'master' into id-remap 2015-11-28 21:45:12 +01:00
3319e460e6 Merge branch 'master' into id-remap 2015-11-28 15:00:57 +01:00
f66e14611d Attempt to fix RNA nightmare with ListBase used as Collection return type for functions.
This is hacky to make work on Linux, and seems to totally break on Windows.

So now, instead, we define a CollectionListBase (exact copy of ListBase), to be used inside RNA...

Seems to work nicely on Linux, lets see what win buildbot says.
2015-11-26 15:26:05 +01:00
7ce594b544 Merge branch 'master' into id-remap 2015-11-26 15:04:45 +01:00
a0df6ce03b Merge branch 'master' into id-remap 2015-11-26 12:42:56 +01:00
df10b4d7a8 Fix mysterious AC IDs refcount issue when reloading some gooseberry files' libs.
Turned out our libquery ID looper was ignoring constraints' 'reference' parameter in callback, grrr...
2015-11-26 12:00:50 +01:00
bfad4bba7a Add helpers to BKE_library_query to find which datablocks are using/referencing a given ID.
Also expose this in RNA. Priceless to debug ID usages...
2015-11-25 20:48:22 +01:00
d35d72893e Merge branch 'master' into id-remap 2015-11-25 16:23:22 +01:00
b47b035f57 Merge branch 'master' into id-remap 2015-11-25 15:16:26 +01:00
0c161e23d9 Merge branch 'master' into id-remap 2015-11-25 12:48:38 +01:00
a6df054b02 Merge branch 'master' into id-remap 2015-11-24 15:52:04 +01:00
7fa92ad950 Merge branch 'master' into id-remap 2015-11-24 09:50:29 +01:00
91be63e127 Merge branch 'master' into id-remap 2015-11-23 14:21:50 +01:00
387b120579 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenloader/intern/readfile.c
2015-11-19 22:39:11 +01:00
f1a7118c04 Add missing AnimData ID to foreach_ID_loop.
Atempt to fix missing action remapping, but no luck so far. :|
2015-11-12 11:50:01 +01:00
c9df632175 Merge branch 'master' into id-remap 2015-11-12 09:54:20 +01:00
11d4cbb04c Merge branch 'master' into id-remap 2015-11-11 20:22:02 +01:00
e74ce5bd86 Merge branch 'master' into id-remap 2015-11-11 19:53:14 +01:00
ab5a591f91 Do not try to reload directly non-linkable datablocks (shapekeys),
those will get reloaded by 'owner' mesh anyway.

Why, why, why are shapekeys datablocks???
2015-11-11 18:12:08 +01:00
483247d756 Fix Text usage by TextEditor (USER_REAL, not USER_ONE). 2015-11-11 17:43:26 +01:00
ded1333f3c Rework a bit IDRemap struct to separate input flags from output status, and fix
issues with unlinking ParticleSettings.

We now have the option to still decrement user count of old_id, even if we could not
replace it with NULL new_id (aka unlinking), needed to keep proper user count when
unlinking and ID from datablocks it uses, to delete it.
2015-11-11 16:52:15 +01:00
4cf00de7d4 Merge branch 'master' into id-remap 2015-11-11 16:15:53 +01:00
61bad3cfe0 Merge branch 'master' into id-remap 2015-11-11 15:06:32 +01:00
75c5f6135c Silence a bit debug prints! 2015-11-11 12:44:47 +01:00
73c8d3abcc Merge branch 'master' into id-remap 2015-11-11 12:43:51 +01:00
12292d441d Merge branch 'master' into id-remap 2015-11-11 11:49:33 +01:00
9e6cdd8e3a Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/intern/library.c

Also clears now useless 'bool is_user_one' flag from editors' ID remap callback.
2015-11-11 10:48:11 +01:00
7a62ac4127 Some minor tweaks. 2015-11-10 20:15:01 +01:00
d2913c1409 Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/object.c
2015-11-10 19:59:44 +01:00
5f0299898d Hopefully fix the 'real user' nightmare.
Idea is to add two new flags, one saying 'we need to ensure a real user exists',
the other 'we had to increment user count to ensure we have a real user'.

This allows us to easily control the extra user in release/delete/remap cases,
and also fixes the infamous 'add new image to texture, open image in ImageEditor,
delete image from texture, have a zero-user red image in Image Editor' issue.

There is still much to be done here, more places where we can use those flags,
also clear them when we force usercount to zero, etc.

All this allows us to fix unsolvable issues (like Group being ensure_user'ed
in loading code, but only if they do have objects in them), and to avoid returning
ugly bool from editors' callbacks (this is still to be cleaned up in the branch too).

Bad news - this means we cannot use short ID->flag anymore (not enough flags), for now
added a new int ID->flag2 (replacing pad int), not sure how to best manage change here,
maybe for 2.8 we can totally wipe ID->flag? But this would totally break forward compat.
2015-11-10 16:56:54 +01:00
9ddc60bc10 Merge branch 'master' into id-remap 2015-11-10 16:21:37 +01:00
959e2e8cfe Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/library.c
2015-11-10 14:51:42 +01:00
965d9649c4 Minor update/cleanup on usercount, from work done in master. 2015-11-10 14:47:38 +01:00
033a89957c Merge branch 'master' into id-remap
Conflicts:
	source/blender/blenkernel/intern/curve.c
	source/blender/blenkernel/intern/linestyle.c
	source/blender/blenkernel/intern/material.c
	source/blender/blenkernel/intern/mball.c
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/scene.c
	source/blender/blenkernel/intern/world.c
2015-11-10 12:45:42 +01:00
e43d70a60f Merge branch 'master' into id-remap 2015-11-08 17:59:08 +01:00
7f53cbb556 Cleanup: get rid of bmain in foreach ID callback.
messing with depsgraph here is not a good idea I think... and makes things simpler!
2015-11-07 11:31:28 +01:00
8b6928b2fb Merge branch 'master' into id-remap 2015-11-07 10:54:48 +01:00
f0c6c85788 Attempt to fix the 'user_one' mess...
Seems to work (though will need much more tests), but makes code more ugly. :|
2015-11-06 18:00:09 +01:00
0c8b1a8c37 Merge branch 'master' into id-remap 2015-11-06 12:35:45 +01:00
77231eeb2f Merge branch 'master' into asset-engine 2015-11-02 19:27:48 +01:00
9521d71735 Merge branch 'master' into id-remap 2015-11-02 19:22:14 +01:00
3ad17b9405 Merge branch 'master' into asset-engine 2015-10-27 15:05:17 +01:00
6bf915e925 Merge branch 'master' into id-remap 2015-10-27 15:04:51 +01:00
c7f48be47c Merge branch 'master' into asset-engine 2015-10-17 11:47:35 +02:00
2d7bc36462 Merge branch 'missing-libs' into id-remap 2015-10-17 11:39:48 +02:00
177295f856 Merge branch 'master' into missing-libs 2015-10-17 11:34:29 +02:00
06b38491f1 Merge branch 'master' into asset-engine 2015-10-15 17:13:29 +02:00
de71f7ab8a Fix deadlock. Would be really cool if Main spinlock could be re-entrant. :| 2015-10-15 17:03:54 +02:00
6da735e81c Merge branch 'missing-libs' into id-remap 2015-10-15 16:55:43 +02:00
59ff3b5498 Merge branch 'master' into missing-libs 2015-10-15 16:12:57 +02:00
9a9796564a Fix broken ID placeholder code (from recent merges).
Here we need a bit different handling than in missing-lib branch...
2015-10-15 15:33:24 +02:00
a2aafbe656 Merge branch 'master' into asset-engine 2015-10-15 14:29:50 +02:00
d899710952 Merge branch 'missing-libs' into id-remap
Huge load of conflicts, hope it did not break too much things...
Current code build, but crashes easily :|
2015-10-14 21:24:14 +02:00
a6028f8e6b Merge branch 'master' into id-remap 2015-10-14 20:38:27 +02:00
3ffc5c9209 Moar cleanup. 2015-10-14 20:24:05 +02:00
f15741f830 Merge branch 'master' into missing-libs 2015-10-14 17:17:30 +02:00
b89530845a Cleanup. 2015-10-14 16:22:57 +02:00
4dac0afa9c Merge branch 'free-refcount-ids' into missing-libs 2015-10-13 15:48:18 +02:00
168604ecbe Revert to master - those changes are globally valid, but remain incomplete,
and total new code is being done in id-remap anyway, not worth bothering with this for now...
2015-10-13 15:44:58 +02:00
9d5cdf92b2 Merge branch 'master' into free-refcount-ids 2015-10-13 15:41:54 +02:00
67d922f61a Merge branch 'master' into free-refcount-ids 2015-10-13 14:41:33 +02:00
4ed3a36e31 Merge branch 'missing-libs' into id-remap 2015-10-12 21:01:53 +02:00
9442a43853 Merge branch 'free-refcount-ids' into id-remap 2015-10-12 21:00:47 +02:00
13faefaf6a Merge branch 'master' into id-remap 2015-10-12 21:00:02 +02:00
5f2276a553 Merge branch 'free-refcount-ids' into missing-libs 2015-10-12 20:46:28 +02:00
e95ba11ce6 Merge branch 'master' into free-refcount-ids 2015-10-12 20:31:39 +02:00
7d1e429d7c Attempt to fix the NodeTree issue.
So, idea is, since mat/tex/scene/etc. nodetrees are owned by their respective IDs
(those nodetree do not exist in Main, they are systematically freed with their ower IDs, etc.),
we should not treat them as IDs in IDlooper, but rather as mere sub-data, and hence directly
loop over the IDs of those nodetrees.

From quick check it seems to work, but this needs to be confirmed as a valid idea!
2015-10-08 20:35:47 +02:00
cb08f47121 Merge branch 'master' into id-remap 2015-10-08 15:18:08 +02:00
84c6bcac0d Merge branch 'master' into id-remap 2015-10-08 13:15:29 +02:00
74ac2beba2 Again, fix for stupid broken relinking of Objects... 2015-10-08 13:07:06 +02:00
741ceed378 Fix stupid crash... 2015-10-08 12:54:10 +02:00
f0ffe42858 Merge branch 'missing-libs' into id-remap 2015-10-08 12:45:48 +02:00
d8a171f8a7 Merge branch 'lib-link-rework-temp' into id-remap 2015-10-08 12:44:35 +02:00
d4b5b8f1bc Merge branch 'free-refcount-ids' into id-remap 2015-10-08 12:44:28 +02:00
e0c7dcba5b Merge branch 'master' into id-remap 2015-10-08 12:43:41 +02:00
6188d17623 Merge branch 'lib-link-rework-temp' into missing-libs 2015-10-08 12:13:43 +02:00
a219728914 Merge branch 'free-refcount-ids' into missing-libs 2015-10-08 12:13:28 +02:00
92bcc7dd19 Merge branch 'master' into missing-libs 2015-10-08 12:08:29 +02:00
32d9f75660 Merge branch 'master' into lib-link-rework-temp 2015-10-08 12:06:57 +02:00
249aa6c649 Merge branch 'master' into free-refcount-ids 2015-10-08 12:03:03 +02:00
f2293df9a6 Replace 'do_id_user' param of BKE_xxx_free() funcs by generic BKE_libblock_relink().
Heavily simplfies that freeing area, but again a rather risky and likely-to-break change.

At least, NodeTree is known to be a trouble-maker here, due to how it seems to be
'owned' by its mat/tex/sce/etc. Have to dig deeper here, this is still quite unclear
what exactly happens with those, and how to handle them correctly.
2015-10-07 23:15:03 +02:00
1daa502f87 Add BKE_libblock_relink(), which works as _libblock_remap(), but only over one given ID
(instead of whole Main content).

Could replace maybe things like constraint, rigisbody world, etc. '_relink' func,
but for now it's only intended to replace custom 'id releasing' code in _free()
funcs of all IDs!
2015-10-07 21:56:27 +02:00
06c6492d7d Avoid fexplicit conversion to ID * for remap parameters (use void pointers instead).
Also found another missing ID in foreach_id (sound pointer of sequences).
2015-10-07 21:10:50 +02:00
6ed0fcc187 Merge branch 'master' into id-remap 2015-10-07 20:56:54 +02:00
dca705d1c3 Huuuuuuuge commit - replace ugly scene/object/group_unlink by new generic libblock_unlink.
Previous situation was pretty much horrible, a few data types having their own coocking to
unlink, often doing more than only unlinking, often doing the same thing two times or more,
often messing with areas they should not have touched (like editors from withing BKE)...

Now we hope to have something generic, working the same way for all ID types
(we do have to add some specific handling for groups/objects/scene unfortunately,
but this remains reasonable).

Needless to say such a change is calling for troubles - I tried to follow and reproduce
as best as I could previous code, but most likely some areas will become buggy. Do not think
previous code was 100% correct anyway, things like Objects have a really big and complicated
usage of IDs...

Also, foreach_id tool has been enhanced, again for complex types like objects & co, we should
cover much better all possible IDs now (e.g. rigidbody & logic bricks were
totally missing from there).

And there is more to come...
2015-10-07 20:32:59 +02:00
ad8fa268a4 Adding game sensors/controllers/actuators to foreachid libquery.
Those were totally missing, cannot see a good reason for it...
Seems to work OK, but only very quickly tested code.
2015-10-07 10:31:36 +02:00
34c608d010 Make use of new IDWALK_REFCOUNTED flag in our ID remap code.
Think core of the system is getting pretty much OK, now we'll likely have to deal
with tons of specific cases, given how Blender is totally inconsistent when it comes to
handling user counts (e.g. spaceimage...).

Also, still have to make generic ID_unlink and ID_release_datablocks func to replace
redundant code in BKE we have currently.
2015-10-06 14:47:35 +02:00
b8e224507f Merge branch 'missing-libs' into id-remap 2015-10-06 12:25:56 +02:00
f3e2e92f5c Merge branch 'lib-link-rework-temp' into id-remap 2015-10-06 12:25:49 +02:00
64f0cd7b33 Merge branch 'free-refcount-ids' into id-remap 2015-10-06 12:25:38 +02:00
7a7b5bc6d3 Merge branch 'master' into missing-libs 2015-10-06 12:23:50 +02:00
2a3e261554 Merge branch 'master' into lib-link-rework-temp 2015-10-06 12:20:57 +02:00
913938514d Merge branch 'master' into free-refcount-ids 2015-10-06 12:19:29 +02:00
bb6da9cbea ID foreach: add support for modifiers to indicate whether given ID pointer is refcounted or not. 2015-10-05 16:30:33 +02:00
45b83f6fd5 Merge branch 'master' into id-remap 2015-10-05 16:00:33 +02:00
650efcf2d9 Update foreach ID (add a few missing IDs, and add new flag, REFCOUNTED, to indicate when a given ID pointer affects id->us count).
Still missing: at least modifiers (have to change all modifiers callbacks, yuck).
AFAIK constraints never refcount thier IDs so we can keep current code here.
2015-10-05 15:04:39 +02:00
09dcfbbe46 Merge branch 'free-refcount-ids' into id-remap 2015-10-05 13:58:49 +02:00
a33cc08a99 Fix for object freeing. 2015-10-05 13:58:21 +02:00
5327de0f40 Merge branch 'missing-libs' into id-remap 2015-10-05 12:32:19 +02:00
e0adc0b705 Merge branch 'lib-link-rework-temp' into id-remap 2015-10-05 12:32:10 +02:00
0548a1dc6f Merge branch 'free-refcount-ids' into id-remap 2015-10-05 12:32:00 +02:00
3b37921e01 Merge branch 'master' into id-remap 2015-10-05 12:31:52 +02:00
8bb7031dec Minor cleanup. 2015-10-05 12:17:51 +02:00
d7d236ce5c Merge branch 'master' into lib-link-rework-temp 2015-10-05 12:09:19 +02:00
a5d1709771 Merge branch 'master' into missing-libs 2015-10-05 12:05:50 +02:00
794a977bad Merge branch 'master' into free-refcount-ids 2015-10-05 12:05:00 +02:00
44e62635c5 Cleanup , and remove public '_release_datablocks' funcs for now.
On second thaought, will end up doing this differently in id-remap branch,
so for now just make this branch a cleanup, consistency-fixing one.
2015-10-05 10:59:38 +02:00
f00f3496a0 Merge branch 'master' into free-refcount-ids 2015-10-05 09:23:08 +02:00
d5f35c6c4e Merge branch 'free-refcount-ids' into id-remap 2015-10-03 19:22:35 +02:00
e2aab5750b Merge branch 'master' into asset-engine 2015-10-03 19:03:38 +02:00
a4c3d645ed Add note about object release func... 2015-10-01 17:44:02 +02:00
b63872cd5e Free IDs: MovieClip & Mask.
Mask freeing was doing really bad (as in, not consistent with other ID freeing code) things (unlinking, and even not freeing animdata!).
2015-10-01 17:38:04 +02:00
e734bef9d6 Free IDs: Nodes & Groups. 2015-10-01 17:13:16 +02:00
105c6a6c26 Free IDs: Action & Armature. 2015-10-01 16:57:28 +02:00
45f25c6241 Free IDs: Sound & Speaker.
Also cleanup, removed horrible `BKE_sound_delete()`!
2015-10-01 16:47:12 +02:00
1a8727fea0 Free IDs: vfont & text. 2015-10-01 16:34:09 +02:00
ad6495d14b ID free: another round of cleanup & fixes (mostly insconsitancies among IDs code)... 2015-09-30 21:59:24 +02:00
fe3c796c31 Free ID: Brush & World. 2015-09-30 21:34:57 +02:00
099eb3111e ID free: GP & particles... 2015-09-30 21:15:20 +02:00
dd266202b0 ID free: freestylelinestyle & other minor types, some cleanups (mostly use MEM_SAFE_FREE where possible). 2015-09-30 20:52:33 +02:00
1636b12d4d Merge branch 'master' into free-refcount-ids 2015-09-30 20:23:47 +02:00
9e64ad1ad5 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-30 20:23:14 +02:00
6fb87bc545 Merge branch 'master' into missing-libs 2015-09-30 20:23:07 +02:00
919a887399 Merge branch 'master' into lib-link-rework-temp 2015-09-30 20:22:37 +02:00
921a86b51f Free IDs; lattice & camera. 2015-09-27 15:50:28 +02:00
5b02b2429a Free IDs: images & lamps. 2015-09-27 15:28:57 +02:00
2282a80697 ID freeing: materials and textures. 2015-09-27 15:12:27 +02:00
931570b480 ID free: tackle Scene (and Library, but not much to do there). 2015-09-27 14:43:49 +02:00
063aea9124 Merge branch 'asset-experiments' into asset-engine 2015-09-27 11:30:21 +02:00
b5ee93c1a3 Merge branch 'master' into asset-engine 2015-09-27 11:30:08 +02:00
e6fa18cebf Merge branch 'master' into asset-experiments 2015-09-27 11:29:39 +02:00
0b4439994f Merge branch 'missing-libs' into id-remap 2015-09-27 11:28:20 +02:00
f330da10db Merge branch 'lib-link-rework-temp' into id-remap 2015-09-27 11:28:15 +02:00
53c28a790b Merge branch 'master' into id-remap 2015-09-27 11:28:07 +02:00
ff7b6d36e3 Merge branch 'master' into free-refcount-ids 2015-09-27 11:26:46 +02:00
0b8a47d1b0 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-27 11:24:50 +02:00
9960295484 Merge branch 'master' into missing-libs 2015-09-27 11:24:42 +02:00
113979e658 Merge branch 'master' into lib-link-rework-temp 2015-09-27 11:19:31 +02:00
c4a3c9d006 Merge branch 'free-refcount-ids' into id-remap 2015-09-24 20:49:58 +02:00
a7e540d7c8 Clean up BKE_object_free() and add BKE_object_release_datablocks().
Similar changed to those done for mesh/curve/mball.

Also, systematically nullify pointers in `_free()` functions, this does not cost
much and can help troubleshooting later.

And tag `BKE_object_unlink()` as an horrible piece of code...
2015-09-24 20:43:35 +02:00
56dae06c56 Cleanup of free/unlink/release of ID: mesh/curve/mball.
Renamed their `_unlink()` functions to `_release_datablocks()`, since they do not
unlink anything (not in the sense `BKE_object_unklink()` does, at least)!

Also, added a `const bool do_id_user` to their `_free()`, for consistency, now
relevant `_release_datablocks()` func only gets called when this option is set.
2015-09-24 19:53:38 +02:00
2cdd19de0b Merge branch 'missing-libs' into id-remap 2015-09-24 13:19:08 +02:00
96092913fb Merge branch 'lib-link-rework-temp' into id-remap 2015-09-24 13:18:59 +02:00
6e88990a4b Merge branch 'master' into id-remap 2015-09-24 13:18:51 +02:00
19f05f274a Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-24 13:15:24 +02:00
4c486c075e Merge branch 'master' into missing-libs 2015-09-24 13:14:48 +02:00
6b49cc1221 Merge branch 'master' into lib-link-rework-temp 2015-09-24 13:13:02 +02:00
4058333c49 Half-working workaround for image refcount in SpaceImage.
Our ID refcount handling is really flacky in many places, this is going to be a serious
issue for this work I'm afraid... :/
2015-09-24 13:10:20 +02:00
d5c69ffeb9 Fix bad handling of non-linkable IDs on reload.
They would be removed from bmain, but never added again nor freed - in this case
we can simply explicitely reload them in fact, non-linkable is only a user-related status...
2015-09-22 21:26:41 +02:00
8da4413ba3 Merge branch 'missing-libs' into id-remap 2015-09-22 10:03:37 +02:00
fc3822988c Merge branch 'lib-link-rework-temp' into id-remap 2015-09-22 10:03:23 +02:00
2665b3ee83 Merge branch 'master' into id-remap 2015-09-22 10:01:20 +02:00
5186e5a0c9 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-22 10:00:28 +02:00
cf7e75ad53 Merge branch 'master' into missing-libs 2015-09-22 10:00:20 +02:00
1b75f74086 We do not require anymore linking datablocks grouped by types, makes code even simpler. 2015-09-22 09:58:59 +02:00
7a5edf3b45 Merge branch 'master' into lib-link-rework-temp 2015-09-22 09:49:24 +02:00
2c0faad6d5 Minor picky fix... 2015-09-22 09:44:14 +02:00
a508d49e33 Better handling of missing datablocks in reload case.
We need to generate a placeholder for those here... Also, enhances handling
of direct/indirect flags & co.
2015-09-21 21:57:54 +02:00
5bc6608ea5 Merge branch 'missing-libs' into id-remap 2015-09-21 21:37:49 +02:00
06eb69b892 Correct handling of name in placeholder generator (this is a name, not an idname...). 2015-09-21 21:37:05 +02:00
9b9dbb5865 Merge branch 'missing-libs' into id-remap 2015-09-21 21:27:25 +02:00
f0d843cf56 Sort placeholder in its listbase! 2015-09-21 21:25:28 +02:00
47328499cb Merge branch 'missing-libs' into id-remap 2015-09-21 21:09:21 +02:00
62fdf030c6 Change ID placeholder generator to not need an ID as reference (we only need type, name and flag here). 2015-09-21 21:08:25 +02:00
db33f64a89 Fix cases where previously indirect lib becomes direct one after some relocate... 2015-09-21 20:48:31 +02:00
3f9a6f9fea Unlock around core of linking code in reload/relocate context too, for now. 2015-09-21 20:40:46 +02:00
d990888686 Fix for recent merges. 2015-09-21 18:11:26 +02:00
37e21ea855 Merge branch 'missing-libs' into id-remap 2015-09-21 18:04:38 +02:00
1d75fe5b95 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-21 18:04:17 +02:00
5a53d20efc Merge branch 'master' into id-remap 2015-09-21 18:04:08 +02:00
bcf4cc37ff Make placeholder ID creation its own function (we'll need it too in reload context...). 2015-09-21 18:02:56 +02:00
e6a84d5a48 Merge branch 'lib-link-rework-temp' into missing-libs 2015-09-21 17:50:27 +02:00
3391a5ed2f Merge branch 'master' into missing-libs 2015-09-21 17:48:12 +02:00
e91d614e4e Merge branch 'master' into lib-link-rework-temp 2015-09-21 17:46:09 +02:00
ac797f03ef Fix broken multi-lib linking, and remove Main locking around core linking code for now.
We need to append to linklist, or our library indices would be reversed compared to lib list...

As for locking, we need reentrant one here if we want to use it. :(
2015-09-21 17:42:32 +02:00
c18849bb1b Lock bmain around core part of linking code now, this is much safer imho!
This also means we need to ensure no code called from there tries to lock again bmain
(no reentrant spinlock, arg :/).
2015-09-21 16:35:29 +02:00
8cbc05c1cd Add reload lib code, and various fixes (some to be backported to other working branches actually). 2015-09-21 16:15:21 +02:00
99008d4841 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-21 15:11:17 +02:00
d02aa8c4fd Merge branch 'missing-libs' into id-remap 2015-09-21 15:11:10 +02:00
0e62a00bc4 Merge branch 'master' into id-remap 2015-09-21 15:11:00 +02:00
33b7772563 Merge branch 'master' into missing-libs 2015-09-21 15:10:39 +02:00
f7a3ead1c7 Merge branch 'master' into lib-link-rework-temp 2015-09-21 15:10:20 +02:00
c7d931b6d2 Merge branch 'lib-link-rework-temp' into id-remap 2015-09-20 15:46:38 +02:00
2e564ce19c Merge branch 'missing-libs' into id-remap 2015-09-20 15:46:30 +02:00
1d4e36a4c9 Merge branch 'master' into lib-link-rework-temp 2015-09-20 15:41:37 +02:00
bcbbee4f73 Merge branch 'master' into missing-libs 2015-09-20 14:54:33 +02:00
f5b0c53531 Relocate: remove old lib datablocks after relocate, if no ID comes from it anymore. 2015-09-19 20:03:25 +02:00
aaab73d54d Attempt to handle correctly LIB_EXTERN vs. LIB_INDIRECT ID flags.
This is far from simple, and most likely not yet fully working, but we have a base...
2015-09-19 19:56:43 +02:00
38670bc9a9 Some fixes, add basic wrapper code needed for reload feature (not yet implemented). 2015-09-19 18:26:36 +02:00
98efbb312c Merge branch 'lib-link-rework-temp' into id-remap
Also, fix some issues in previous code.
2015-09-18 22:42:05 +02:00
5ac9844083 Some naming cleanup. 2015-09-18 22:27:35 +02:00
856ef065b2 Rework a bit new liblink code, to use our beloved memarena instead of ugly pile of malloc.
Performances are not an issue at all here, but it makes code slightly simpler, avoids
a loop over ghash of libs, avoids some potential mem fragmentation, and will be easier
with lib relocate code too in future...
2015-09-18 22:22:56 +02:00
f011cdcc11 Consider proxy objects as 'linked' ones when it comes to ID remapping.
Reason is, on next fileread, proxy will be assigned with its target's data again...
Note that this may not be true about all its datablocks pointers - but proxy objects
are really brittle in current code anyway, they could use a serious work as well.
2015-09-18 21:31:56 +02:00
32ea612fcc Moar cleanup, some fixes towards sanier handling of remap & indirect data...
Proxy are still not correctly handled here though.
2015-09-18 18:09:13 +02:00
80ddd9afd9 Merge branch 'master' into asset-engine 2015-09-18 16:20:21 +02:00
5d8b0a8bcc Merge branch 'lib-link-rework-temp' into id-remap 2015-09-18 16:12:58 +02:00
33a4a4ed8f Merge branch 'missing-libs' into id-remap 2015-09-18 16:12:40 +02:00
7df45b2a49 Merge branch 'master' into id-remap 2015-09-18 16:12:31 +02:00
1ba2646706 Some cleanup & tweaks. 2015-09-18 16:11:55 +02:00
c7e14ac1f8 Merge branch 'master' into lib-link-rework-temp 2015-09-18 15:47:07 +02:00
87a3de5852 Merge branch 'master' into missing-libs 2015-09-18 15:44:10 +02:00
f9eef9a678 Some cleanup & tweaks. 2015-09-18 15:01:59 +02:00
185c216743 Relocate library: first working code.
Basics seem to be working, proving idea is valid. There is much to do yet though,
handling correctly all possible scenarii (especially those including indirect libs
used by several libraries, or libs used both directly and indirectly, etc.)
is not going to be a piece of cake...
2015-09-18 14:44:08 +02:00
4ee210857a Merge branch 'lib-link-rework-temp' into id-remap 2015-09-17 21:00:55 +02:00
49156ee77b Serious rework (again) of append/link code, to make it more generic.
Making the code in WM area more generic (will be used by relocate libs feature too in future).
And multi-append/link shall no more close & re-open lib files for each and every idcode!

Also, serious cleanup of BLO_append_... API (renamed BLO_link_..., since it links and never appends!),
main real changes there are removing the bContext arg in favor of scene/v3d (a bit more verbose, but does
not requires a valid context anymore to be able to instanciate ob/groups!). And logic behind instanciating
or not has been simplified, previous code was really obscure and sometimes redondant, from quick tests
it still works as expected.

This is temp branch for until 2.76 is over, shall be merged in master asap then.
2015-09-17 20:45:51 +02:00
0df9a4ae3d Merge branch 'master' into id-remap 2015-09-17 19:12:01 +02:00
18cddb58c4 Merge branch 'master' into id-remap 2015-09-17 13:54:36 +02:00
3cce86e4d3 Merge branch 'master' into id-remap 2015-09-16 17:46:32 +02:00
ab9126b7b5 Move most of (currently NoP) relocate code to WM area. 2015-09-16 15:28:19 +02:00
2622e4b208 More work towards relocate operator for libraries (still pretty much empty shell).
Note that this op will have to be moved to WM area in fact, it's way too generic for Outliner only...
and we need to re-use most of append/link operator code!
2015-09-15 22:14:35 +02:00
258725cf49 Merge branch 'master' into id-remap 2015-09-15 14:24:44 +02:00
962751c1a0 Outliner: add a dedicated ID_LI operation handler, and add skeletton for 'relocate' tool... 2015-09-14 22:30:48 +02:00
2f43d7a099 Merge branch 'master' into id-remap 2015-09-14 15:55:15 +02:00
648ce6a080 Some minor fixes and refactor of core id-remap code. Will also allow us to call it when bmain is already locked higher in code. 2015-09-13 15:41:13 +02:00
b428df5408 Merge branch 'missing-libs' into id-remap 2015-09-13 15:19:53 +02:00
6fda73fe0e Merge branch 'master' into missing-libs 2015-09-13 15:19:31 +02:00
68096bb8e8 Merge branch 'missing-libs' into id-remap 2015-09-13 15:19:11 +02:00
8f496e7ebf Add remaining missing id_remap editors' callbacks.
This is far from being done though... :/
2015-09-12 17:15:06 +02:00
8ae125e946 Merge branch 'master' into id-remap 2015-09-12 15:40:35 +02:00
5c029b1628 Add support id-remap for 3Dview bgpic and Image space.
SpaceImage seems to have a weird handling of image ID user count :/
2015-09-11 17:22:40 +02:00
15f08697e7 Rework our 'space id remapping' code by adding a new 'id_remap' callback to SpaceType, and add one for View3D.
Think it's much cleaner this way.

View3D new id_remap only handles camera/ob_center pointers for now, images will need some more work I think...
2015-09-11 16:27:42 +02:00
efb2d755c1 Merge branch 'master' into id-remap 2015-09-11 15:53:37 +02:00
07136e6176 Merge branch 'master' into id-remap 2015-09-10 22:47:25 +02:00
0abb0ee156 Merge branch 'master' into missing-libs 2015-09-10 22:39:39 +02:00
1fd6979bdb Some minor UI updates... 2015-09-10 14:35:49 +02:00
13d9d33158 Merge branch 'asset-experiments' into asset-engine 2015-09-10 14:14:25 +02:00
93fb699e20 Merge branch 'master' into asset-experiments 2015-09-10 14:13:57 +02:00
6d2519250a Add some (mostly commented) debug prints... 2015-09-10 14:13:18 +02:00
06f937c9b1 Fix nasty hidden RNA/bool related bug.
**NEVER** pass a boolean as address (pointer) to a RNA property function - it will read (or write) it as an integer!
2015-09-10 14:08:36 +02:00
8094de89ce Fix filelist_file_create_entry() adding the generated entry twice to the cached list in AE case. 2015-09-10 13:01:37 +02:00
b4861a9ec1 Merge branch 'asset-experiments' into asset-engine 2015-09-09 21:45:37 +02:00
283da2a596 Merge branch 'master' into asset-experiments 2015-09-09 21:38:07 +02:00
2d861d68a7 Merge branch 'asset-experiments' into asset-engine 2015-09-09 17:25:22 +02:00
ec99859c44 Merge branch 'master' into asset-experiments 2015-09-09 17:20:14 +02:00
a77cd3e953 Fix 3DView and others not updating after ID remapping.
Notifiers usage could really use a good cleanup imho...
2015-09-03 17:56:03 +02:00
3f22fbf32b Merge branch 'master' into id-remap 2015-09-03 16:16:50 +02:00
65a108cf35 Merge branch 'master' into missing-libs 2015-09-03 16:16:26 +02:00
62ff31971a Merge branch 'master' into id-remap 2015-08-30 12:06:02 +02:00
75db37e80f Merge branch 'master' into missing-libs 2015-08-30 11:55:38 +02:00
baa1513603 Merge branch 'asset-experiments' into asset-engine 2015-08-30 11:44:35 +02:00
2420f8a32e Merge branch 'master' into asset-experiments 2015-08-30 11:40:49 +02:00
e8af25479d Merge branch 'asset-experiments' into asset-engine 2015-08-30 11:29:03 +02:00
aa4896317d Merge branch 'master' into id-remap 2015-08-23 18:45:13 +02:00
031aab8d0c Some minor tweaks & cleanup. 2015-08-23 16:34:19 +02:00
317474e231 Merge branch 'master' into id-remap 2015-08-23 15:08:17 +02:00
b9110048f9 Merge branch 'master' into id-remap 2015-08-22 15:38:58 +02:00
6711e9d15f Merge branch 'master' into missing-libs 2015-08-22 15:11:32 +02:00
173ffb140a Minor tweak: adjust icon size to thumbnail size.
Avoids too big 'data type' icon in tiny display...
2015-08-19 22:38:27 +02:00
211ef292ba Merge branch 'master' into asset-experiments 2015-08-19 21:54:20 +02:00
f5140d4e82 Merge branch 'asset-experiments' into asset-engine 2015-08-18 14:51:52 +02:00
03829f7c48 Merge branch 'master' into asset-experiments 2015-08-18 14:35:56 +02:00
9fc2d1e35b Merge branch 'master' into asset-experiments 2015-08-18 13:24:09 +02:00
f5f06db832 Merge branch 'master' into asset-experiments 2015-08-18 12:43:35 +02:00
3a21279bc8 Merge branch 'master' into asset-experiments 2015-08-18 12:24:06 +02:00
0baa1469d0 Merge branch 'master' into asset-experiments 2015-08-11 12:01:12 +02:00
dc659c05d4 Merge branch 'master' into asset-experiments 2015-08-10 18:04:13 +02:00
47e73e6b72 Merge branch 'master' into asset-experiments 2015-08-10 17:47:00 +02:00
67282959af Fix bug in preview generator. 2015-08-10 17:21:11 +02:00
979d22b361 Some cleanup re master... 2015-08-10 15:52:18 +02:00
53312d1fac Merge branch 'master' into asset-experiments 2015-08-10 15:44:20 +02:00
a2a3e40cf1 Merge branch 'master' into asset-experiments 2015-08-10 15:10:16 +02:00
2aab8c7a95 Some ultimate cleanups. 2015-08-10 14:36:39 +02:00
14786d653a Merge branch 'master' into asset-experiments 2015-08-10 14:18:23 +02:00
386efee483 Minor tweak - adapt a bit number of preview workers to number of available physical threads! 2015-08-09 18:08:33 +02:00
9ebdab0e17 Merge branch 'master' into asset-experiments 2015-08-09 16:09:23 +02:00
6b34b4f066 Merge branch 'master' into id-remap 2015-08-02 18:02:16 +02:00
d2bdc66143 Merge branch 'master' into missing-libs 2015-08-02 17:50:29 +02:00
231237f1b5 Merge branch 'asset-experiments' into asset-engine 2015-08-02 17:17:57 +02:00
37e679772e Merge branch 'master' into asset-experiments 2015-08-02 17:13:42 +02:00
574a7da03e Fix several issues, add a quick and dirty new action in Outliner to remap IDs.
We have to take care of Object->data aside from main foreach loop, since we can
only replace that pointer if object is **not** in Edit mode!

Also, added a "Remap" action to ID context menu of outliner. This is **very far**
from nice and pretty code/feature, but it allows to quickly test the code.

Only did very quick tests with meshes so far...
2015-07-21 22:42:06 +02:00
1ebdfb4d45 Fix some dummy mistake, add simple RNA callback to 'remap' IDs.
Also, added Object.data to BKE_library_foreach_ID_link(), wonder if there was a good reason
for this to not be here???
2015-07-21 22:42:06 +02:00
df50b8cabf Add main 'ID remap' function.
Theoretical code, compiles, but needs to be tested!
2015-07-21 22:42:06 +02:00
f2d6e85212 ID remapping: first step - modify some editors callback to not only support ID freeing, but also ID remapping.
This seems to be OK, but will obviously need much more testing - and is useless as-is, we need
the big ID remapping code itself still.

Also, Nodetrees' remapping of Scene IDs is still TODO, not sure yet how to do this.
2015-07-21 22:42:06 +02:00
313fabd310 Merge branch 'master' into missing-libs 2015-07-21 08:07:42 +02:00
93563c5522 Merge branch 'asset-experiments' into asset-engine 2015-07-21 08:01:47 +02:00
c1589b71c5 Merge branch 'master' into asset-experiments 2015-07-21 07:55:51 +02:00
aee44d5070 Merge branch 'master' into missing-libs 2015-07-17 21:13:03 +02:00
09787f03b7 Merge branch 'master' into missing-libs 2015-07-16 19:53:31 +02:00
4e2f5a6461 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-16 19:46:35 +02:00
f37adc4312 Merge branch 'master' into asset-experiments 2015-07-16 19:45:22 +02:00
2bfd60e54f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-16 16:53:55 +02:00
610a04ab5d Fix rebase mess :/ 2015-07-15 20:38:51 +02:00
222a199f99 Add outliner's visualization for broken libs, and also tag lib ID itself as missing. 2015-07-15 20:36:22 +02:00
82d166df72 Add remaning 'init' callbacks for needed ID types.
Note all this remains a bit theoretical, some cases (ID types) are a bit delicate to handle here.7
Time and tests will say if it's OK as is.
2015-07-15 20:36:22 +02:00
83dd16a6d6 Add some checks in BKE_xxx_init() that data is really NULLified.
Needed, since trying to (re)init data already set could lead to many issues,
and handling this is not in the scope of this function.

Note that definition of BLI_memcmp_null stuff is rather bad currently, no good idea where to place this. :|
2015-07-15 20:36:22 +02:00
4181f35014 Handling missing libs: changed idea, now adding 'real' empty data.
Just having 'NULL' data as placeholder is not really possible, too much places
to check against that.

WIP commit, still much to be done!

See T43351 for details.

Differential Revision: https://developer.blender.org/D1394
2015-07-15 20:36:22 +02:00
266f0d3e77 Very first step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.

That way, you can work on your file, save it, and find again your missing data once
lib becomes available again.

Plans are also to be able to locate missing libs and reload them at runtime.

To support all that, we must be able to make Blender survive those missing data
(i.e. empty datablocks) all over the place. This commit contains some early work
in that direction, but this will need much much more work!
2015-07-15 20:36:21 +02:00
9a2ae72156 Icons: Add new 'library_data_broken' one. 2015-07-15 20:36:21 +02:00
37a6a92f76 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-07-11 23:00:56 +02:00
5a16f29700 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-07-11 22:51:30 +02:00
80acaa3009 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-07-04 13:16:30 +02:00
05017bc9a3 Merge branch 'master' into asset-experiments 2015-07-04 12:59:37 +02:00
047525019a Expose fewest more generic ID filtering options.
Full precise filtering remains possible in new 'Advanced filter' panel.
2015-07-04 12:56:09 +02:00
6cb2f6e870 UI-fix (bad 'recusion level' value in RNA enum, 1 is only valid in library listing case). 2015-07-04 01:48:43 +02:00
9f176db5ea Merge branch 'master' into asset-experiments 2015-07-04 01:42:37 +02:00
c2049e740e Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/BLI_ghash.h
2015-07-02 21:22:07 +02:00
665ac71aee Add API to IMB_thumb to enable thread safety.
Indeed, though rather unlucky, we may end up handling same source file from
different preview threads, which could lead to conflicts and bugs.

So idea is to add a simple way of locking a given source file path, since
thumb handling of different paths shall never conflict.

Note that this adds some 'generic' stuff to GHash and Threads area, that are to
be committed separately of course.
2015-07-02 13:31:38 +02:00
dd15ef2528 Previews: do not keep preview task and timer running continuously in 'Preview' mode.
The task was not so annoying (workers are just sleeping anyway), but having the timer
always checking for updates was not so nice. This remains quite minor optimization probably...

So now, we do not start anymore preview task when enabling previews. This is deferred
to the moment we really need it (i.e. when we cache block of entries currently visible).
Preview timer is started at the same time.

Further more, when preview task has been inactive for about one second (i.e. all
queued previews have been handled, and no new one have been queued), we free it
(switching to some kind of 'standby' mode).

This also allows to avoid stoping/restarting preview tasks on each redraw when user is scrolling.
2015-07-02 12:01:09 +02:00
effabf0ce7 Remove queing TODO previews when starting preview task, this is already handled
(in a better way) by filelist_file_cache_block().
2015-07-01 17:43:49 +02:00
a1c8d693a8 Fix windows bug with scons builds.
Classical bool vs char value mismatch... Here it was leading to a constant re-filtering
of the list, which invalidates cached previews.

Strange thing is, it would look as if Windows CMake builds are using 'real' bool,
while scons ones are using fake char-based one?
2015-07-01 16:40:07 +02:00
2cac2ec784 Merge branch 'master' into asset-experiments 2015-07-01 16:28:57 +02:00
23c81d8990 Merge branch 'master' into asset-experiments 2015-06-30 19:17:34 +02:00
633e3d2545 Merge branch 'master' into asset-experiments 2015-06-29 14:55:38 +02:00
cd980e85d7 Merge branch 'master' into asset-experiments 2015-06-28 20:22:14 +02:00
857d5f3580 Be much smarter with file size display... 2015-06-28 00:16:14 +02:00
b5a65fd7be Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
2015-06-27 23:42:06 +02:00
9379b7f968 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/editors/space_file/filelist.c
2015-06-27 23:26:32 +02:00
fb43c07681 Merge branch 'master' into asset-experiments 2015-06-27 23:15:58 +02:00
6c8e34e59b Filebrowser internal listing & UUIDs: simpler & safer UUIDs generation.
Instead of computing MD5sum of paths, just use incremental UUIDs!
There meaning and lifetime for internal listing is very limited anyway,
they shall only be unique for a given listing.

Note about using atomic op here: did it because it's nice use case,
not sure it's worth adding atomic stuff to /editors area though?
2015-06-19 14:31:00 +02:00
011061ab5e Remove copying of preview data for objects and groups datablocks.
Those get temporarily duplicated by renderers (Cycles, Freestyle),
not nice to have useless memory usage here.
2015-06-19 13:04:04 +02:00
7b84fa5927 Various minor cleanup & fixes from review. 2015-06-19 13:01:39 +02:00
6f236221c6 Merge branch 'master' into asset-experiments 2015-06-19 12:33:18 +02:00
c3492716ee Merge branch 'master' into asset-experiments 2015-06-19 11:44:23 +02:00
ae569a4e76 Merge branch 'master' into asset-experiments 2015-06-18 11:53:14 +02:00
924ff970cc Merge branch 'asset-experiments' into asset-engine 2015-06-17 14:28:53 +02:00
d6b5f82bae Merge branch 'master' into asset-experiments 2015-06-17 14:28:24 +02:00
1e1cc1409b Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-06-16 18:11:21 +02:00
9a7d5130ec Cleanup: get rid of ugly bool in structs, replaced by bitflags. 2015-06-16 17:32:46 +02:00
649b09debb Make selection & co really working even during listing process.
This commit replaces `filelist_numfiles()` by `filelist_files_ensure()`. The later
also returns number of visible files (i.e. filtered ones), but also ensures filelist
is filetered and sorted.

Otherwise, during listing process, operators could be executed between an update of the listing job,
and the refresh from the file space - i.e. at a time filelist is virtually empty (from filebrowser PoV).

Also, got rid of 'need_refresh', this ended up being unused...
2015-06-16 16:59:29 +02:00
f616871e62 Selection/UUIDs handling enhancements:
* Do not systematically clear selection_state's uuids GHash when updating filelist
  during listing process - uuids used here should remain valid.
  Allows to not lose selections during listing background job!
* Use new BLI_ghash_lookup_p to handle selection state setting, symbolic optimization but...
2015-06-16 16:19:06 +02:00
3d9da00815 Make imbuf_thumb for .blend a bit less stupid & noisy regarding missing previews.
A file which does not have *any* preview is perfectly valid, error is only when there
are some previews, but not the same number as actual datablocks...
2015-06-16 15:45:52 +02:00
bfb6155466 Fix some fileops operators that could try to get out-of-bound indices.
Also, some minor reordering in full-block-recaching, currently could not create
issues but better be safe & logic here.
2015-06-16 15:40:58 +02:00
edb87ecd75 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-06-16 14:24:05 +02:00
bc43854651 Merge branch 'asset-experiments' into asset-engine 2015-06-12 10:43:14 +02:00
5fbd8997c2 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-06-12 10:42:44 +02:00
27ed6ef95c Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-06-11 20:17:30 +02:00
c3866a0fe1 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_ops.c
2015-06-11 20:07:29 +02:00
04f7493588 Fix/adapt new 'keyboard select' code to changes from branch. 2015-06-11 19:58:23 +02:00
a4965036a7 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/space_file.c

NOTE: Tagged some parts in new code to be fixed, rather do that in a separate commit.
      This means this commit is broken and won't compile.
2015-06-11 18:16:43 +02:00
22abc19145 Merge branch 'asset-experiments' into asset-engine 2015-06-11 16:35:53 +02:00
b5635fb70d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/idcode.c
2015-06-11 16:31:30 +02:00
7793df2491 Merge branch 'asset-experiments' into asset-engine 2015-06-03 17:11:27 +02:00
edf50e3a5d Fix error when batch-rendering preview of scene with no world. 2015-06-03 17:07:48 +02:00
7cc52cc8dd Fix bad ID preview clearing in RNA API.
Logic here was piece of crap... sigh.
2015-06-03 16:55:35 +02:00
44adb244bc Merge branch 'master' into asset-experiments 2015-06-03 16:48:17 +02:00
e1a3c1d4e7 Arg, missed those in previous 'review' commit. 2015-06-03 16:29:03 +02:00
aab3ec8624 Merge branch 'asset-experiments' into asset-engine 2015-06-03 15:49:33 +02:00
89db98c0be Address new review points. 2015-06-03 15:47:43 +02:00
221142275c Merge branch 'master' into asset-experiments 2015-06-03 14:15:53 +02:00
c436a00372 Fix broken behavior e.g. for 'save as' operator...
We need to set filename/filepath from sfile->params in case operator does not support multi-files!
2015-06-02 15:34:10 +02:00
f2f4c4c93d WIP more work towards inclusion of asset engine/asset uuids in linking process. 2015-06-02 14:04:06 +02:00
d4e5cad70e Merge branch 'asset-experiments' into asset-engine 2015-06-02 10:20:13 +02:00
0f285b566d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/imbuf/intern/thumbs.c
2015-06-02 10:19:50 +02:00
b57abacd8c Merge branch 'asset-experiments' into asset-engine 2015-05-29 10:56:19 +02:00
7f59c846a7 Add comment about why we need to store fileselection state outside of filelist items now. 2015-05-29 10:38:55 +02:00
21e498acdd Tweaks and fixes in py part (preview handling). 2015-05-29 10:32:31 +02:00
5301ea7b96 Address most points from first reviewing pass.
Nothing new here, just some cleanup and refactor.
2015-05-29 10:12:46 +02:00
2a5d07773e Merge branch 'master' into asset-experiments 2015-05-29 09:30:08 +02:00
ab049a335d More WIP towards integrating AE/assets_uuids in append/link process... 2015-05-28 19:51:25 +02:00
74aeb8ef11 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2015-05-28 14:46:10 +02:00
99a3e09088 Refactor code in multi-append/link operator.
Avoid writing a big chunck of code doing nearly the same thing twice...
2015-05-28 14:42:12 +02:00
b87e275429 WIP more AE/uuid in append/link operator. 2015-05-28 10:37:01 +02:00
a4c5aa208d Merge branch 'asset-experiments' into asset-engine 2015-05-27 15:47:19 +02:00
bae3805edb Merge branch 'master' into asset-experiments 2015-05-27 15:44:38 +02:00
9ab309901d Add asset engine version to uuids list struct. 2015-05-26 21:18:28 +02:00
bd0e78bb23 Add needed asset-related data to Library and ID structs. 2015-05-26 20:47:43 +02:00
f34c098f0c Add 'bl_version' to asset engine type, needed to support asset engine in file read/write! 2015-05-26 17:21:10 +02:00
23beab242a Fix asset engine resetting on every resize!
Only reset AE type to default in `file_init()` if current type is invalid!

Also, better handling of getting default AE type now.
2015-05-26 17:02:45 +02:00
99cf8b2188 Merge branch 'asset-experiments' into asset-engine 2015-05-26 16:32:36 +02:00
180958cb2c Merge branch 'master' into asset-experiments 2015-05-26 15:50:19 +02:00
f6dc0573f8 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/makesrna/intern/rna_space.c
2015-05-25 15:58:24 +02:00
ac516fddb2 Merge branch 'master' into asset-experiments 2015-05-25 15:38:14 +02:00
a5c580c9e4 Some tweaking to UI, try to make filebrowser header a bit more compact... 2015-05-21 15:20:53 +02:00
b5db0c903c Merge branch 'asset-experiments' into asset-engine 2015-05-21 14:37:02 +02:00
59a8cbc49b Merge branch 'master' into asset-experiments 2015-05-21 14:36:41 +02:00
0a52a358fa Better handling of tags in Amber.
Also adds some 'state' flags to AssetEngine, so that custom AE's setting changes
can be notified to filebrowser, as default internal ones are.

For now, we only have 'dirty filtering' and 'dirty sorting'.
2015-05-21 14:15:46 +02:00
223e098ca1 Some minor cleanup in Amber code. 2015-05-20 10:28:46 +02:00
7f7f296475 Merge branch 'asset-experiments' into asset-engine 2015-05-20 09:39:06 +02:00
a9efb6a5ae Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-05-20 09:19:23 +02:00
b5c72b15ed Merge branch 'master' into asset-experiments 2015-05-13 17:14:46 +02:00
85499bb5e8 Fix crash in append/link on windows (sigh). 2015-05-13 17:06:44 +02:00
952ef0fedf Fix newly created dir not going into rename state anymore.
Due to async dir listing...
2015-05-13 14:07:49 +02:00
044398c786 Merge branch 'master' into asset-experiments 2015-05-13 13:58:39 +02:00
b0f1a9e27f Merge branch 'master' into asset-experiments 2015-05-13 12:52:11 +02:00
3bef09f672 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-05-12 19:39:44 +02:00
9706ec852d Restore drag'n'drop from filebrowser.
We need to store non-static data here, so had to tweak drag and drop button code...
2015-05-12 19:21:13 +02:00
ade786b30c Some cleanup and reducing diff from master. 2015-05-12 17:00:12 +02:00
63d52d7bb1 Merge branch 'master' into asset-experiments 2015-05-12 15:33:32 +02:00
113c17ea76 Merge branch 'asset-experiments' into asset-engine 2015-05-11 17:25:43 +02:00
9346891c3c Merge branch 'master' into asset-experiments 2015-05-11 17:24:24 +02:00
acd076a9f3 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_icons.h
	source/blender/blenkernel/intern/icons.c
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/interface/interface_icons.c
	source/blender/makesrna/intern/rna_ID.c
2015-05-11 17:09:53 +02:00
51a3024f33 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-05-11 09:46:17 +02:00
bf583c8c95 Merge branch 'master' into asset-experiments 2015-05-11 09:36:20 +02:00
f2ceb38ce8 Add variable sliding window for cached filebrowser items.
With big screens and tiny drawing, we can show much more than 1k items at once...
Also allows to reduce number of cached items in case we show few things big!
2015-05-10 17:15:59 +02:00
47a7246a5c Merge branch 'master' into asset-experiments 2015-05-10 15:26:26 +02:00
dd2034623c Merge branch 'asset-experiments' into asset-engine 2015-05-09 16:43:22 +02:00
b1ce5e6772 Fix bad behavior in case of 'refresh' while still listing.
Mismatch in 'owner' of job, not giving right one to stoping helper, sigh.

Note that this was also affecting any 'interrupting' task (like changing level of flat listing...).
2015-05-09 16:42:13 +02:00
c77f3b57bc Fix flickering of previews during listing process.
We cannot keep 'stable' list of items during listing process (each time new
entries are added, we have to filter and sort the whole lot again, which
means rebuilding 'draw' data from scratch - previews included).

Just wait until our filelist is complete to generate/use previews.
2015-05-09 16:06:30 +02:00
abed546672 Fix crash due to some missing final jop update in some rare cases. 2015-05-09 16:00:07 +02:00
71a061bc1a Merge branch 'master' into asset-experiments 2015-05-09 14:29:46 +02:00
6cae0ccded Merge branch 'asset-experiments' into asset-engine 2015-05-07 19:31:48 +02:00
4767de15b8 Fix win build... 2015-05-07 19:30:56 +02:00
97798c6125 Merge branch 'master' into asset-experiments 2015-05-07 19:17:45 +02:00
9d9ee6699a Get rid of nice 'static' in array args of functions, MSVC does not like them. :( 2015-05-06 19:59:02 +02:00
b943f6fd28 Merge branch 'master' into asset-experiments 2015-05-06 18:13:20 +02:00
3745062bf9 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-05-05 17:23:32 +02:00
0e5789c43c Some cleanup and addressing TODOs in ID preview generation module. 2015-05-05 17:18:49 +02:00
ef484c7a59 Expose preview/icon render sizes in bpy.app 2015-05-05 17:18:30 +02:00
d0799901f7 Merge branch 'master' into asset-experiments 2015-05-05 14:26:58 +02:00
fc5adb63a0 Merge branch 'master' into asset-experiments 2015-05-04 21:14:47 +02:00
85406569e1 FileBrowser: enhance handling of most compact drawing by also reducing size of static strings like file size. 2015-05-04 17:00:45 +02:00
54e753f85e Fix size of files not showing in default Filebrowser mode. 2015-05-04 16:23:54 +02:00
0bdf85afde FileBrowser: make (fixed) column size user-configurable (re[ab]using new thumbnail size). 2015-05-04 16:15:12 +02:00
1ca9c549f9 Merge branch 'asset-experiments' into asset-engine 2015-05-04 15:55:56 +02:00
056f11ec8d Merge branch 'master' into asset-engine 2015-05-04 15:55:45 +02:00
bc8ad4c739 Cleanup/reduce needless diff with master. 2015-05-04 15:54:48 +02:00
870c2040bc Merge branch 'master' into asset-experiments 2015-05-04 14:59:13 +02:00
2f477065a0 Merge branch 'asset-experiments' into asset-engine 2015-05-02 17:05:17 +02:00
cc02a0a7e5 Merge branch 'master' into asset-experiments 2015-05-02 17:03:45 +02:00
e0c275e239 Merge branch 'master' into asset-engine 2015-05-02 17:03:22 +02:00
92123e578a Fix T44586: Viet language problem for Blender Interface
We were missing many of the complex diacritics combinations in latin extended additional code block...

Alawyas a pleasure to edit this font... :|
2015-05-02 16:49:12 +02:00
56b3d8d273 Fix stupid crash. 2015-05-02 15:25:35 +02:00
40dd7cbe21 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-05-02 15:10:31 +02:00
756bb6b404 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/makesrna/intern/rna_space.c
2015-05-02 15:01:34 +02:00
839cc7b2a1 Merge branch 'asset-experiments' into asset-engine 2015-04-27 18:25:48 +02:00
59d5f5c253 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/object.c
	source/blender/windowmanager/intern/wm_operators.c
2015-04-27 18:21:59 +02:00
c31c62c7ec Merge branch 'asset-experiments' into asset-engine 2015-04-18 12:20:18 +02:00
863f19431d Merge branch 'master' into asset-experiments 2015-04-18 12:05:23 +02:00
45164ac6e3 WIP work to pass asset data to operator.
Asset engine ID, asset/variant/revision uuids, root path...
First goal is link code!
2015-04-16 18:28:59 +02:00
eca9cb2adb Merge branch 'asset-experiments' into asset-engine 2015-04-16 14:55:58 +02:00
31e89b1fcf Merge branch 'master' into asset-experiments 2015-04-16 14:49:04 +02:00
ba20e06227 Merge branch 'asset-experiments' into asset-engine 2015-04-16 10:46:37 +02:00
b3c8192715 Merge branch 'master' into asset-experiments 2015-04-16 10:45:24 +02:00
00e451015b Merge branch 'asset-experiments' into asset-engine 2015-04-15 19:21:11 +02:00
399b2927df Merge branch 'master' into asset-experiments 2015-04-15 19:18:57 +02:00
a9d5eddc52 Rename RNA's 'IDPreview' to 'Preview' - there is no reason to keep that for IDs only,
we likely will want to use it in other cases...
2015-04-15 19:17:34 +02:00
eb9784dea2 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-15 17:48:26 +02:00
b239c249ac FileBrowser: only generate size/date/time strings when needed!
Also, cleanup remaining cruft from modes/owner stuff.
2015-04-15 17:43:05 +02:00
ab9f937bd8 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/makesrna/intern/rna_space.c
2015-04-15 16:45:35 +02:00
8124e69a91 Backport some changes from asset-engine branch:
* uuids as int[4] instead of char[16];
* move use_library_browsing to params instead of spacefile.
2015-04-15 16:40:52 +02:00
5ffbf49439 AssetEngine: Various fixes and new features:
* Let asset engine draw most of header bar itself!
* Pass whole FileSelectParams to AE's sort_filter function.
* Move 'use_library_browsing' to params level (this way AE's sort_filter can be ware of it too).

Amber:
* Now supports real basic sorting/filtering modes
* Also basic support of tags (needs a way to refresh though, currently).
2015-04-15 16:26:33 +02:00
fde14db489 Switch definitively to int32[4] for uuid's, mixing mixing it with char[16] is confusing at least.
This is only on human-level anyway... And endianess should not be an issue
either, hopefully, that way!
2015-04-15 12:50:04 +02:00
c4a1d5143e Merge branch 'asset-experiments' into asset-engine 2015-04-15 12:23:00 +02:00
163ad29b58 Merge branch 'master' into asset-experiments 2015-04-15 12:20:32 +02:00
52db10355b WIP better/fixed support of uuid's in asset engines.
Still not working as expected it seems... Not having a real bytes type in RNA is a real PITA. :/
2015-04-14 22:49:28 +02:00
68bab334e0 More fixes...
Amber engine seems to be running nice again in new system, pfew!
2015-04-14 16:58:38 +02:00
18f18ec8b3 Fix issue in final selection in some cases. 2015-04-14 16:23:26 +02:00
80c0f3da22 Merge branch 'asset-experiments' into asset-engine 2015-04-14 16:10:00 +02:00
63318a2a4c Merge branch 'master' into asset-experiments 2015-04-14 16:07:04 +02:00
476a1b9eff Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-13 22:13:16 +02:00
2842949e13 Add uuids ghash to filelist's cache. 2015-04-13 21:54:37 +02:00
b3ad658b45 Merge branch 'master' into asset-experiments 2015-04-13 21:19:53 +02:00
449e1d8074 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c

... And fixes for code specific to that branch.
2015-04-13 20:22:27 +02:00
11ef8d9797 Small refactor (will allow better factorization with AE listing code). 2015-04-13 17:40:32 +02:00
2feeea8328 Caching of FileDirEntry: simplify things, fix some more mem bugs. 2015-04-13 17:36:11 +02:00
026f967dff Various fixes with asset engine and new code...
Still not working completely, and need small rework in asset-experiments first.
2015-04-13 17:27:06 +02:00
6adc839e40 Fix stupid freeing issues. 2015-04-13 16:20:24 +02:00
e39242c4ce Merge branch 'asset-experiments' into asset-engine 2015-04-13 15:55:30 +02:00
0e3a9530da Merge branch 'master' into asset-experiments 2015-04-13 15:53:37 +02:00
23bba70da5 Merge branch 'asset-experiments' into asset-engine 2015-04-10 23:43:20 +02:00
bf19bf0110 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/imbuf/IMB_thumbs.h
	source/blender/imbuf/intern/thumbs.c
2015-04-10 23:42:43 +02:00
eb8b2413de Merge branch 'master' into asset-experiments 2015-04-10 14:27:18 +02:00
336c7f9ba5 AssetEngine WIP support of new filelisting behavior in filebrowser...
Nearly working, still have some mem issues to fix.
2015-04-09 20:35:36 +02:00
96f060d32d Merge branch 'asset-experiments' into asset-engine 2015-04-09 12:05:47 +02:00
126e1aa60a Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/editors/space_file/filelist.c
2015-04-09 12:05:09 +02:00
bfb977534f Merge branch 'asset-experiments' into asset-engine 2015-04-08 14:38:44 +02:00
57786fda42 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-08 14:38:18 +02:00
9763ba8f72 Merge branch 'asset-experiments' into asset-engine 2015-04-08 14:21:32 +02:00
990598e60c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
	source/blender/imbuf/IMB_thumbs.h
	source/blender/imbuf/intern/thumbs.c
	source/blender/imbuf/intern/thumbs_blend.c
2015-04-08 14:21:00 +02:00
485a9abf29 Merge branch 'asset-experiments' into asset-engine 2015-04-07 15:40:34 +02:00
d9c690b559 Misc cleanup, fix previews memleak. 2015-04-07 15:38:06 +02:00
a2b4d96b65 Merge branch 'asset-experiments' into asset-engine 2015-04-07 15:07:47 +02:00
b3de44cc01 Cleanup: get rid of preview handling in lib listing code. 2015-04-07 15:07:09 +02:00
6e8cc0bc05 Move handling of ID blocks previews in thumbnail handler.
this is mandatory, since we do not keep previews for all listed items anymore
(with 10k datablocks would start to take too much mem). So we now generate (read)
them from thumbnailing threaded task as any other image, has several advantages:
* Quicker initial listing of data from .blend files.
* Since thumbnails are cached on disk, re-generating them is rather quick.
* General consistency!

Note thumbnail generation of datablocks could (should!) be enhanced, right now
it reads all previews for a given datatype in a file each time it has to generate
a single datablock thumbnail, we should generate all of those previews in a single
run. But this means handling cache dirty things (TBH_FAIL, outdating, etc.) on another
level so need some more work.

Also, still some memleaks issues with thumbnails, have to track those dose!
2015-04-07 15:00:40 +02:00
b6ef6da231 Merge branch 'master' into asset-experiments 2015-04-07 09:30:50 +02:00
fc543da843 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-06 20:27:04 +02:00
eaf71f7f17 Some minor tweaks for asset-engine branch... 2015-04-06 20:23:22 +02:00
bdf2e64255 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-06 20:15:29 +02:00
5cee945744 Merge branch 'master' into asset-experiments 2015-04-06 19:51:34 +02:00
c539aaf19d FileBrowser: internal listing: use own, much lighter struct to store whole list.
Since with internal listing we have no choice but to list everything, store
those data in the smallest possible struct - note we do not even store preview
here, these are only handled in full FileDirEntry cache (re-loading them from
cached thumbnails is really quick anyway).

Still not complete, have to re-do ID previews now, among other things...
And some memleaks again with previews, ugh.
2015-04-06 19:51:07 +02:00
979d16e52f BLI filelist: get rid of strings for size/time/mode/etc.
Those were eating quite a bit of bites, not neglectable with thousands of entries...
Also, useless to print those info most of the time, they are not used!

So now, we only store 'raw' stat data, and expose funcs to convert them to readable
strings on demand.
2015-04-05 15:47:59 +02:00
718e84201a Merge branch 'master' into asset-experiments 2015-04-05 11:49:35 +02:00
5e593dd851 Resurrect filelist_selection_get()...
Still not working though.
2015-04-04 15:14:03 +02:00
75ef507e70 Merge branch 'asset-experiments' into asset-engine 2015-04-04 15:07:21 +02:00
51bb1cef39 FileBrowser: add dummy accessor to entries from their uuid.
Needed for assets branch, to be rework seriously later of course.
2015-04-04 15:06:23 +02:00
6704abce7f Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-04 13:19:25 +02:00
868a4288ab FileBrowser: block caching: minor tweak (mostly needed in ae branch actually). 2015-04-04 13:17:43 +02:00
4696bce257 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
2015-04-04 13:15:17 +02:00
bbfe0652eb FileBrowser: rewrite 'entry selection' code.
Since we do not store anymore ell entries, we cannot use them to hold selection status.

So we now use a ghash in FileList struct, with entry UUID's as keys.

Also cleanuped up / refactored selection handling, filelist.c now features a nice intern
api and all other code uses it instead of accessing directly entries' selflag!
2015-04-04 12:43:53 +02:00
c0748c4292 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenlib/intern/storage.c
	source/blender/editors/space_file/filesel.c
2015-04-04 10:50:17 +02:00
e836c116ac Internal FileListing: generate a valid UUID, we'll need this for things like selection state... 2015-04-02 20:12:18 +02:00
f2e55db040 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-04-02 17:34:47 +02:00
e75c5c35cc FileBrowser Preview: enhance handling of previews when modifying cache of entries... 2015-04-02 17:29:31 +02:00
744c029d01 AssetEngine: Add needed API for new 'on demand' entries listing from FileBrowser.
Also use that new API in filebrowser - only partially for now, at least
it does not crash anymore even if 100% empty...
2015-04-02 17:11:33 +02:00
0d4ac96da0 Fixes needed to make it compile again. Remains broken though! 2015-04-02 15:29:21 +02:00
e70139964d Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/makesrna/intern/rna_internal.h

Notes:
* asset-experiments branch still needs some work (e.g. entires selection is to be reworked too),
  but was more than time to do a first merge...
* This is raw merge, code is hence broken and needs more fixes to take into account new changes!
2015-04-02 15:20:52 +02:00
6ec52ce5eb Merge branch 'master' into asset-experiments 2015-04-02 14:53:27 +02:00
d07aeb2fce FileBrowser: cleanup.
Get rid of cache iterator code (not needed, and don't think we'll need it later,
easy to add back if needed). Also comment some debug prints.

New preview (thumbnails) handling seems to be working pretty nice now.
2015-04-02 14:41:19 +02:00
7bfe994093 FileBrowser: Fix stupid cache clear on each redraw while previews where updating.
Missing 'need filter' flag clearing...
2015-04-02 14:06:56 +02:00
d8169c2db7 FileBrowser - fix two crashers.
* Full path is no more static, so we need dynamic tooltips to use it (still an
  issue with drag stuff here :| ).
* Remove timer would attempt to free timer's customdata, which is mere int-in-pointer
  in case of new notifier timer, so we need a special tweak on remove here.
2015-04-02 13:51:13 +02:00
a592525a7e FileBrowser: cleanup (remove) all the thumbnails job stuff, no more needed. 2015-04-02 10:38:19 +02:00
c61d6e36ba FileBrowser: Fix sorting/filtering (we need to clear the cache in those cases!). 2015-04-02 10:27:07 +02:00
49951df23d Merge branch 'master' into asset-experiments 2015-04-02 10:17:11 +02:00
0dc6b92fe6 FileBrowser new preview code: bunch of fixes.
Start to looks good... This commit adds a new timer helper, that only send notifiers
(kind of very restricted subset of wm_job stuff), since using jobs for previews
would be now counter-productive and way too much heavy.

Also fix/enhance how previews are generated (order), etc. etc.

Still WIP though, having some weird crashes and such lurking around.
2015-04-01 22:26:25 +02:00
ce3a8f9f5b Merge branch 'master' into asset-experiments 2015-04-01 15:07:24 +02:00
46d777f017 FileBrowser previews: first fixing round.
Nearly working now (no more freeze or huge mem leak), still need to
find a way to get refresh as long as all previews have not been generated...
2015-03-31 16:44:46 +02:00
fd5e70fc99 Merge branch 'master' into asset-experiments 2015-03-31 15:43:06 +02:00
f970994cd3 Some minor cleanups. 2015-03-31 15:42:51 +02:00
982fdbf506 FileBrowser: Various fixes...
Stupid useless allocations, memleaks, etc.

WIP, thumbnails still not working.
2015-03-31 15:41:04 +02:00
c1617cccd1 Merge branch 'master' into asset-experiments 2015-03-30 22:02:34 +02:00
e7c7b00fe0 WIP FileBrowser thumbnails: get rid of job here, use lighter threaded tasks.
Fully WIP, compiles but not yet working!
2015-03-30 21:35:56 +02:00
8093c5c2a8 Merge branch 'master' into asset-experiments 2015-03-30 14:59:25 +02:00
bf3bba802d Quick attempt to resume thumbnails generation on cache.
Note this is rather stupid anyway, we need to rewrite this from scratch,
using a	 job for that makes no sense now, we should stick to a lighter
threading schema with a queue, or something like that!
2015-03-30 14:54:31 +02:00
2984d39a46 Fix and use block caching from UI draw code.
Seems to work nice now.
2015-03-30 12:24:00 +02:00
11df07e53f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/space_file/filelist.h
2015-03-30 11:56:35 +02:00
ef0367d094 Merge branch 'master' into asset-experiments 2015-03-27 22:23:47 +01:00
188419ac3d WIP cache system for filebrowser entries.
Core part seems to be working, but this is still heavy WIP, much to do
to resume complete features from existing code. Mainly:

* Previews (those should only be ran on cached items now).
* Use block-caching to load in-display entries.
* Rework things like selection (cannot store selected states in entires anymore).

Also, internal listing is stupid currently (since it still stores everything
as FileDirEntry & co), not really crucial currently, but ultimately it'll
use its own, compact struct to keep full listing!

Also did some minor cleanup/renaming.
2015-03-27 22:05:36 +01:00
7a749ebbcf BLI listbase: add an helper to remove a constinuous chunk of the list in a single call. 2015-03-26 17:49:15 +01:00
e7dbb4b217 FileBrowser: First step towards allowing partial "storage" of entries.
That code is currently pretty stupid, but we need to clearly separate
what is handled by filebrowser itself, and what is by listing code
(be it internal one or future asset engines).

Plan/idea is to have a dual cache system (one 'block' of entries - centered
on currently viewed ones -, and one 'random' FIFO for random access to any entry).

This implies filebrowser itself shall now only be aware of the number of (filtered)
entries, and it then requests entries as needed.

Also, made size of columns in filebrowser fixed (ultimately, user configurable),
since it has no more access to the whole list of entries!

Still heavy WIP.
2015-03-26 15:24:03 +01:00
fca4cda7f9 Merge branch 'master' into asset-experiments 2015-03-26 11:04:37 +01:00
26d28b755b Reduce uuids size to 16 (as 'official' ones), more than enough! 2015-03-23 15:55:52 +01:00
9fbec44247 Merge branch 'master' into asset-experiments 2015-03-23 15:25:21 +01:00
a9f02fda07 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/makesdna/DNA_space_types.h
2015-03-21 16:48:34 +01:00
8834875281 Merge branch 'master' into asset-experiments 2015-03-21 16:44:40 +01:00
8bc8015657 WIP Amber: very quick, dirty, primitive and broken first implementation of tags handling.
We cannot do that correctly with current listdir system, have to rework again
in asset-experiments brnach first, so that listing, filtering and sorting is
completely "delocalized" to asset engine (will also try to solve scalability issues).
2015-03-21 16:42:00 +01:00
9553016ec1 WIP 2015-03-19 16:15:42 +01:00
01b6fd1f3e Merge branch 'master' into asset-experiments 2015-03-19 14:01:16 +01:00
3f860e0e73 AssetEngine: add IDProps, and RNA access to actual asset engine from filespace.
Also, some quick dummy test/demo code for that in Amber.
2015-03-17 21:07:57 +01:00
cdfd3c17f5 Merge branch 'asset-experiments' into asset-engine
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-03-17 16:27:39 +01:00
bc40f4852d Fix broken 'sort by type' in filebrowser.
Also, take advantage of blentype stored in entries now,
this greatly simplifies (and make quicker) that sorting
for blendlib items!
2015-03-17 16:02:12 +01:00
99373c918f Add a 'comment' field to listdir revisions.
Also, make clear tags are only informative here.

Reason is, if the project is a success, we have to think big and
imagine asset engines managing catalogs of tens or hundreds of thousands
of entries (web ones e.g.), we cannot hold list of those in filebrowser!
So most of filetring will be 'deffered' to asset-engine.

We'll also probably have to implement a 'chunck listing' behavior
(to only list at most n entries in a row), for same reasons.

This will make things slightly more complicated :|
2015-03-17 15:39:20 +01:00
920bf9f2f3 Merge branch 'master' into asset-experiments 2015-03-17 14:47:54 +01:00
18baac2502 Amber: Some cleanup and atempt to fix repeated entries, not yet working. 2015-03-16 21:23:43 +01:00
9cf2583126 I18n: update for new akward algo names in UI messages... 2015-03-16 20:51:35 +01:00
0661b80aa0 Continue fleshing out Amber.
Start to add real asset engine behavior. Still completely uncomplete and not even half working.
2015-03-16 20:18:42 +01:00
0473ff213e Merge branch 'asset-experiments' into asset-engine 2015-03-16 13:51:42 +01:00
025b502f98 Merge branch 'master' into asset-experiments 2015-03-16 13:48:19 +01:00
f3c6cc9f32 Fix nasty bug preventing any navigation in directories!
Think issue also exists in master code actually, where some op properties
could be left uninitialized in 'params_to_op' helper func... But it does not
backfire like that for sure.
2015-03-15 20:34:42 +01:00
60783fd64e Amber: only list dirs from real filesystem.
Actual data (assets) are to be 'listed' by another way!

Also, fix mem leak.
2015-03-15 17:28:10 +01:00
7059cd538f Merge branch 'asset-experiments' into asset-engine 2015-03-15 15:48:40 +01:00
4621ac3ac1 Merge branch 'master' into asset-experiments 2015-03-15 15:31:10 +01:00
f9adc7fbac Start to make Amber a bit more serious!
Still useless - behaves more or less like a very basic, broken filebrowser.

But basics are here, and listing process seems to be working pretty well.
2015-03-13 22:26:22 +01:00
e615009ae4 Revert "Revert "Merge branch 'asset-engine' into asset-experiments""
This reverts commit f751e34f91.
2015-03-13 15:21:55 +01:00
f751e34f91 Revert "Merge branch 'asset-engine' into asset-experiments"
This reverts commit ccd1479200, reversing
changes made to 8da3bb3885.

Conflicts:
	release/scripts/startup/bl_operators/__init__.py
	release/scripts/startup/bl_operators/amber.py
	source/blender/blenkernel/BKE_asset.h
	source/blender/blenkernel/intern/asset.c
	source/blender/editors/space_file/file_ops.c
	source/blender/makesrna/intern/rna_asset.c
2015-03-13 15:18:24 +01:00
47ce2c5574 Merge branch 'master' into asset-experiments 2015-03-13 14:45:08 +01:00
ec3eec1ac5 Add load_pre callback to RNA, and stupid dummy code in Amber to make quick test of it. 2015-03-12 19:41:12 +01:00
47e3d34d94 RNA listdir: add some more accessors, and ability to remove/clear list of entries (assets). 2015-03-12 15:19:27 +01:00
ab463cb324 Rename 'Flame' to 'Amber'! 2015-03-12 11:07:10 +01:00
ccd1479200 Merge branch 'asset-engine' into asset-experiments 2015-03-12 11:03:40 +01:00
8da3bb3885 Merge branch 'master' into asset-experiments 2015-03-12 11:00:14 +01:00
473e702d5d First step to add 'load_pre' behavior.
This will allow asset engines to:
* Actually ensure requested data is available (downloading it, generating it, etc. as needed).
* Change entries generated for user by actual data paths (allows e.g. to present
  a set of different paths to load as a single 'asset' to user).

As usual, had to change existing filebrowser code... Seems to be working fine
from quick tests (i.e. regular filebrowser not being broken).
2015-03-12 10:59:10 +01:00
da53656be1 Add refcounting and shallow copy to AssetEngine.
Reason is, we want operator to 'inherit' ae instance from spacefile too.
2015-03-10 12:52:25 +01:00
99404d3a70 Fix initialization of AssetEngine type in new filebrowser. 2015-03-10 12:11:07 +01:00
4504d50012 Merge branch 'asset-experiments' into asset-engine 2015-03-09 16:26:04 +01:00
9c6abdff3a Merge branch 'master' into asset-experiments 2015-03-09 15:32:52 +01:00
8f0709f9eb Add more stuff to filelist RNA. 2015-03-05 10:08:33 +01:00
32f4fb952a Cleanup - remove big commented blocks from renderengine initial copy/paste. 2015-03-05 10:08:33 +01:00
5d732ddcae Add some asset engine-aware stuff in filebrowser.
Basically, filelisting code in space_file becomes default, internal 'asset engine',
and user can switch to any other available engine instead.

Note filelisting with asset engines is fully main-thread from C code PoV,
parallelization/asynchronism is responsability of the py code!

Also, added a basic (dummy currently) AssetEngine py implementation.
Not much there, but helps checking things works as expected before
writing whole interface!

All this is very basic early code yet, much much to do before we get anything really usable...
2015-03-05 10:08:33 +01:00
9f61207b23 Minor updates to asset engine API, and add some more basic file listing stuff to RNA. 2015-03-05 10:08:33 +01:00
1dcff09045 Further rework of file listing handling - complete decouple from OS-related direntry.
Remove everything not really related to OS representation of file entries.

FileBrowser will now use a complete decoupled version of file representation,
much easier to keep sane behavior this way, easy integration with RNA, etc.
2015-03-05 10:08:33 +01:00
7142e653b6 Add RNA structs for assets listing (with variants, revisions, etc.). 2015-03-05 10:08:33 +01:00
f6c3f08690 WIP start defining asset engine API. 2015-03-05 10:08:33 +01:00
beee21d045 Void skeleton of asset engine.
Mostly copied from RenderEngines code. Compiles, now we have to flesh this!
2015-03-05 10:08:33 +01:00
c5fde2845e Merge branch 'master' into asset-experiments 2015-03-05 09:48:28 +01:00
f2bff41cd5 Merge branch 'master' into asset-experiments 2015-03-03 17:10:30 +01:00
65b49051fb Add name/description fields to entries themselves too.
This allows us to greatly simplifies sorting (and avoid recomputing UI name each and everytime!).
Also, correctly free entries/variants names/descriptions.
2015-03-01 11:42:28 +01:00
de58d865b6 Spread (future assets) uuid over entries/variants/revisions.
Makes more sense this way, and will probably save memory in the end even.
2015-03-01 11:21:01 +01:00
6771aeeff5 Merge branch 'master' into asset-experiments 2015-03-01 10:54:02 +01:00
02c09be238 Merge branch 'master' into asset-experiments 2015-02-28 15:21:44 +01:00
25e0d0d63d Filelisting: switch from mere arrays to listbases.
Was not sure about that (adds two pointers to entries, variants **and** revisions :/ ),
but with the incremental process of listing we are using now, it makes things sooooo
much easy to handle (and also avoids tons of (deep)copy and mem (re)alloc), that it's
definitively worth it.

And since most (if not all) of 'public' access to filelist is done through filtered ones,
we can easily keep this a mere array of pointers, and hence keep quick index lookup.

Also, quite noticiably simplified the whole listing code (less functions, less levels of subcalls...).

Note: for now we stick to mere alloc, we may benefit from either memarena or mempool,
but those are not threadsafe (which means we could not so easily pass mem from worker
thread to main one), so not quite sure it would be worth it.

Note: thumbnail stuff is to be reworked from scratch too, have the feeling it's not yet
100% thread safe, and using a job here is probably way overkill, since we do not show
any progress in UI.
2015-02-27 19:18:33 +01:00
543984ffff Merge branch 'master' into asset-experiments 2015-02-27 14:23:37 +01:00
a35de360d0 Merge branch 'master' into asset-experiments 2015-02-26 15:38:59 +01:00
ae294763aa Merge branch 'master' into asset-experiments 2015-02-24 20:15:13 +01:00
52d3e71302 Move back path, image etc. to FileDirEntry.
Also, reduce revision's uuid to 64bytes, should be more than enough!

Thing is, we can expect tens (if not hundreds) of thousands of revisions from a
big assets repository with history storage (vcs). So we want that struct
to be as small as possible.

Also, we do not expect to handle several variants/revisions of a same asset within
a same 'context' (there is always only one active variant & rev). So storing
path & co at entry level shall be enough. And helps make code simpler/nicer.
2015-02-24 16:20:19 +01:00
21ae02a327 Get rid of abspath storage, this is storing twice the same data, not nice memory-wise.
We may suffer a little performance loss here, but would not expect it to be really important,
since rebuilding a full abspath is not needed that often.
2015-02-24 14:46:45 +01:00
da7092ff7d Restore size/date sorting.
Also, get rid of modes/owner crap, this is quite advanced UNIX fs info, not much to
do in our filebrowser imho, and takes time, UI space and Mem space!
2015-02-24 14:14:27 +01:00
cf89c7aa28 Merge branch 'master' into asset-experiments 2015-02-24 12:48:23 +01:00
f7f71bb152 Merge branch 'master' into asset-experiments 2015-02-23 16:13:26 +01:00
fb94004e6f Merge branch 'master' into asset-experiments 2015-02-23 15:08:14 +01:00
29d3cbc6f9 Filelisting: First step of sanitanization...
Move typeflag and selflag back to FileDirEntry, and add blentype there too,
this will be needed by asset engines, and avoids rechecking lib ID types over and over!

There's much more to do here though. Also, FileDirEntryRevision is going to be
used quite higly, we want to keep it as light as possible (much lighter than
its current state for sure!). Think we can move back to FileDirEntry paths
(and try to get rid of abspath on the run, too), but also most likely
preview (we won't store a preview for all possible revisions anyway),
owner/permissions, etc.

Rev should probably only have its uuid, and date/time.

Also, simplified filetype generation (from extensions for real files, and BLO helpers
for libdata), now it's nicely encapsulated into each reading callback.
2015-02-23 14:47:34 +01:00
156c5bc41e Merge branch 'master' into asset-experiments 2015-02-23 12:27:29 +01:00
e08fd1ebe5 Merge branch 'master' into asset-experiments 2015-02-22 15:21:38 +01:00
b32de3eaff Merge branch 'master' into asset-experiments 2015-02-19 15:30:51 +01:00
a759d0190b Big refactor of filelisting in filebrowser - decouple os/fs-related direntry from actual blender listing.
Main idea is that direntry had quite a bit of things already absolutely useless
in the mere 'file listing' context (image pointer, void 'data' pointer, etc.).

On the other end, to handle future asset stuff, we need *more* 'meta data' for our 'files'
(tags, variants, revisions...).

Further more, we need all this to be easily usable through RNA, i.e. we need it to
be defined in DNA.

So instead of trying to use direntry in DNA, mixing low-level system stuff like stat
where we do not want to see it, we define our own 'file' representation,
with only what we really need (who cares about chars or block or dev files in filebrowser?
we only need to know whether it's a regular file or a directory, period).

That way, low-level dirlisting remains clean, and we can easily extend our own
data as needed.

Note this new code works, does not crash (so far...) nor memleak, but it
needs quite a bit of work still, we are still storing useless stuff in direntry
(all those strings representing modes, size etc.!), and mem handling
during dir/lib listing is confusing at best (would like to use a memarena
or mempool here, but it's not that easy).
2015-02-18 21:36:48 +01:00
3e6aa7bd08 Merge branch 'master' into asset-experiments 2015-02-18 19:30:06 +01:00
a35ced0b97 Merge branch 'master' into asset-experiments 2015-02-17 15:37:20 +01:00
14ff7cdf76 Merge branch 'master' into asset-experiments 2015-02-16 16:21:28 +01:00
ecb79a5bd5 Preview generation on Windows: attempt to fix mysterious error by using even more ID's names.
Passing around ID's themselves is not safe - they may change their mem addresses.

Yet, I had no issue on linux, but on win build this is still not enough,
have to use a super strange hack (add an 'import sys' line just before where error happens)
to get things running...
2015-02-16 14:54:19 +01:00
d893c9f198 Merge branch 'master' into asset-experiments 2015-02-16 14:01:44 +01:00
07042a8d5d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
2015-02-15 16:54:08 +01:00
d78819caf9 Cleanup of ugly allocation stuff (cast of void pointer, not-so-safe sizeof()'s, etc.). 2015-02-15 15:28:43 +01:00
ec071eb76a Merge branch 'master' into asset-experiments 2015-02-15 15:10:34 +01:00
5e25fdd514 Merge branch 'master' into asset-experiments 2015-02-15 10:39:38 +01:00
fb2c646dee Rework job multi-level listing - factorize even more and avoid recursion.
This is much cleaner than previous code...
2015-02-13 22:28:36 +01:00
3e603b606c Merge branch 'master' into asset-experiments 2015-02-13 19:47:00 +01:00
4c02644a58 Merge branch 'master' into asset-experiments 2015-02-12 19:45:25 +01:00
c6ea9e8f48 Merge branch 'master' into asset-experiments 2015-02-12 19:35:41 +01:00
05390dc4b5 Cleanup. 2015-02-12 18:01:02 +01:00
09a09c1010 Merge branch 'master' into asset-experiments 2015-02-12 17:55:07 +01:00
5144dcaeab Add previews to scenes, and enhance batch preview generation.
Batch preview generation can now also generate 'internal' previews (materials, textures etc.),
as well as scene ones. Also, some basic Cycles handling is there now.
You can now chose which kind of data to generate previews for, and whether the files are
trusted or not (for py autorun and drivers).
And rendering happens in background again, issue was actually a bug in creator.c, fixed in master.
Main TODOs reamining here: OpenGL rendering, and find a way to prevent '.blend1' when
saving over (either as a new option of save op, or simply by removing those files in script?).

Added a batch cleanup of previews too.

Also, added path of files as their tooltip 'image' button in main filebrowser view,
quite useful with the 'recursive' option...
2015-02-12 17:53:00 +01:00
e9484fa25e Merge branch 'master' into asset-experiments 2015-02-11 17:32:41 +01:00
92ef1b997b Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/space_file.c
2015-02-11 11:18:42 +01:00
6f603ea0d2 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_fileselect.h
	source/blender/editors/interface/interface_intern.h
	source/blender/editors/interface/interface_templates.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/fsmenu.c
	source/blender/editors/space_file/space_file.c
	source/blender/makesrna/intern/rna_space.c
2015-02-11 11:14:42 +01:00
67eb234783 Merge branch 'master' into asset-experiments 2015-02-10 12:40:24 +01:00
ec4b79fb60 Merge branch 'master' into asset-experiments 2015-02-09 10:15:02 +01:00
08bccfed6c Merge branch 'master' into asset-experiments 2015-02-09 09:20:39 +01:00
d8567fc45d Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-06 17:31:55 +01:00
51bc0a2b5d Fix crash when appending/linking (double free...). 2015-02-04 20:41:13 +01:00
8374fe855e Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-04 20:14:04 +01:00
399ae5d41a Make 'recursion' work as expected.
Now, recursion  0 = previous behavior,
     recursion  1 = only show content of immediate .blend files, do not recurse in actual dir hierarchy,
     recursion >1 = complete recursion!
2015-02-03 21:47:51 +01:00
ad1399acc4 Flat listing of libs: do not show the 'categories' directories unless we are
inside a single .blend lib in this case, useless and heavily clutters space.
2015-02-03 21:18:07 +01:00
d04a0baae7 Merge branch 'master' into asset-experiments 2015-02-03 20:45:25 +01:00
c0d0b3db66 Merge branch 'master' into asset-experiments 2015-02-02 12:16:00 +01:00
8b19837b83 Cleanup: add 'ED_' prefix to public fsmenu functions... 2015-02-01 21:02:29 +01:00
f6b9cad064 Cleanup: get rid of unused stuff! 2015-02-01 20:49:45 +01:00
9a4eb983be Merge branch 'master' into asset-experiments 2015-02-01 20:35:48 +01:00
93da0a8187 Prepare assets UI: switch filebrowser to tools + tool props areas, instead of channels.
This will allow us to keep op panel independent, and have tabs for future assets tools!

Note 'conversion' from previous file area (channels) is not perfect, you have to hit 'T'
twice currently if you had a filebrowser in your .blend file...
2015-01-30 18:38:02 +01:00
b3cd561032 Merge branch 'master' into asset-experiments 2015-01-30 13:58:45 +01:00
8ebe85f733 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_operators/wm.py
2015-01-29 19:37:50 +01:00
9efd36bac0 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2015-01-27 19:51:35 +01:00
d41e1c00e6 Merge branch 'master' into asset-experiments 2015-01-27 12:02:40 +01:00
1c83d9ddbb Fix filtering in new UIList bookmarks & co. 2015-01-26 21:41:31 +01:00
ce765ad441 Better sorting when we are displaying several levels at once, for 'lib' append/link.
Consider blendfiles and 'categories' inside them as regular dirs, but with this hierachy:
    real dir > blende file lib > category in a blend lib.

This gives a much better sorting (among other things, gives more importance to
blend files!).
2015-01-26 21:30:00 +01:00
b3c0b59825 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/file_ops.c
	source/blender/editors/space_file/filelist.c
2015-01-26 17:38:16 +01:00
6f1e2e562d Merge branch 'master' into asset-experiments 2015-01-26 12:28:00 +01:00
6199ce89a8 Reworked from scratch 'icon over previews' feature.
Previous implementation was horribly complicated in the end... sigh.
2015-01-25 15:30:46 +01:00
bdda315260 Fix crasher (Looks like PointerRNA->type can be NULL...). 2015-01-25 14:59:04 +01:00
50d25aa395 Merge branch 'master' into asset-experiments 2015-01-25 12:43:36 +01:00
b1a885ab16 Merge branch 'master' into asset-experiments 2015-01-20 14:07:41 +01:00
8ff6e455fa Merge branch 'master' into asset-experiments 2015-01-18 18:50:31 +01:00
f1d1073046 Merge branch 'master' into asset-experiments 2015-01-17 20:09:37 +01:00
956d8e0ddd Fix for Windows - 'foobar.blend\' is a valid file path to that OS, sigh...
Also, store temp nullified pathsep in chars now, better.
2015-01-17 20:08:12 +01:00
03b7104b72 Fix stupid UI/py bug after recent refactor. 2015-01-17 00:04:06 +01:00
2d98ce2e72 Merge branch 'master' into asset-experiments 2015-01-17 00:03:33 +01:00
de3fd8a45c Merge branch 'master' into asset-experiments 2015-01-15 16:23:19 +01:00
d7b0bc9522 Merge branch 'master' into asset-experiments 2015-01-13 16:44:36 +01:00
548029c000 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
2015-01-13 16:42:33 +01:00
0715b73e18 Recursive listdir: let user set level of recursion... 2015-01-13 15:41:10 +01:00
912cdb2acb Merge branch 'master' into asset-experiments 2015-01-13 14:57:27 +01:00
5fccc64f6d Merge branch 'master' into asset-experiments 2015-01-13 14:15:01 +01:00
c944362fcd Merge branch 'master' into asset-experiments 2015-01-12 19:58:43 +01:00
27ce761880 Reorganization:
* Make 'clear preview' a C operator;
* Move 'object preview generator' op in wm namespace;
* Add those two to file-> data preview submenu.
2015-01-12 17:45:45 +01:00
517b06c296 Reorganization: move ID filters to DNA_ID.h, and add helpers in bke's idcode.c to convert between idcode and idfilter. 2015-01-12 17:44:44 +01:00
3118756854 Merge branch 'master' into asset-experiments 2015-01-12 15:50:35 +01:00
d35bbc2a15 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/intern/group.c
	source/blender/blenkernel/intern/object.c
2015-01-10 10:18:23 +01:00
2c7ee72167 Add moving around bookmarks (same system as for vgroups etc.). 2015-01-07 21:13:45 +01:00
884603573a Merge branch 'master' into asset-experiments 2015-01-07 14:22:12 +01:00
67231a22a2 Merge branch 'master' into asset-experiments 2015-01-07 12:47:51 +01:00
e53cdbf62f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/include/UI_interface_icons.h
	source/blender/editors/interface/interface_icons.c
	source/blender/windowmanager/intern/wm_files.c
2015-01-07 12:44:45 +01:00
d46c9b876c Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
2015-01-07 12:05:23 +01:00
dbd766f827 Nearly finished 'UIList for bookmarks'.
Got completely rid of C code for those panels.

Added full path in ttips of each 'bookmark' entry, as in current master.
Note this forced me to make tip in uiBut dynamic (like label). Not so sure
about this, but seems to me forcing tooltips to be static is actually quite
bad and limitating? we'll see...

Only remaining TODO (new feature) is reordering of bookmarks, should be easy now.

Also fixed some stupid (again!) mistake with RNA access to paths of bookmark entries.
2015-01-05 21:12:23 +01:00
de229b4085 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/space_file.c
2015-01-05 16:15:37 +01:00
3993965bd7 Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/file_draw.c
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filesel.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/windowmanager/intern/wm_operators.c
2015-01-04 18:43:08 +01:00
97a00b9199 Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/space_filebrowser.py
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/makesrna/intern/rna_space.c
2015-01-03 22:05:01 +01:00
d237ac45fe Get rid of this stupid string len def, RNA knows this better! 2015-01-03 21:34:17 +01:00
0f44f5506f Fix some issues with image previews.
* When overlaying icon, we have to also ensure background pict is always the same size
  (else you get usgly icon size changes). Still not perfect though, suspect some more issues
  in filrdraw code, probably should systematiacally run the 'ensure size' code during thumbnail
  generation?
* Sharing of img ImBuf between thumbnail job and main thread could still happen,
  leading to random crashes.
2015-01-03 18:43:51 +01:00
d730ff663b Fix py script generating obj/group previews after recent merge. 2015-01-03 17:39:23 +01:00
8f4d6f62ea Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenkernel/BKE_camera.h
	source/blender/blenkernel/intern/camera.c
	source/blender/blenlib/BLI_fileops.h
	source/blender/blenlib/intern/storage.c
	source/blender/editors/space_file/filelist.c
	source/blender/makesrna/intern/rna_object_api.c
	tests/gtests/blenlib/BLI_path_util_test.cc
2015-01-03 17:07:16 +01:00
55c792df8e Add 'dup_poin' callback param to new BLI_duplicate_filelist() func, to allow handling direntry's poin if needed. 2015-01-02 17:38:25 +01:00
7b05fd5830 Merge branch 'master' into asset-experiments 2015-01-02 17:24:39 +01:00
67040e08d3 Fix issues when giving a non-existent dir to filebrowser.
Note: unlike in current master, path is checked immediately when setting it
into filelist (simpler now that filelist building itself is threaded).
`filelist_setdir()` modifies in place given path if this one is not valid.
2015-01-01 16:58:30 +01:00
87518faa20 Use new BLI fnmatch helpers to fix wrong update in some cases when editing
string search filter.
2015-01-01 15:30:02 +01:00
e660793896 Add BLI helpers for fnmatch head/tail wildcards handling.
`BLI_fnmatch_strncpy_add_endswildcards()` will copy and add '*' wildcards on both ends of given string, if needed.

`BLI_fnmatch_strcmp_ignore_endswildcards()` is same as strcmp, but ignores any '*' wildcards on both ends of given strings.
2015-01-01 15:23:16 +01:00
224eb0025f Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/interface/interface_icons.c
2015-01-01 15:18:38 +01:00
31043d87cd Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-01-01 11:35:21 +01:00
de0b270014 Merge branch 'master' into asset-experiments 2015-01-01 11:11:10 +01:00
0fa91e1723 SpaceFile: Cleanup: fix stupid indices in filelist_from_main()
Dead code (currently), but still...
2015-01-01 11:10:12 +01:00
aa336809fa Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/editors/space_file/filelist.c
	source/blender/editors/space_file/filelist.h
	source/blender/editors/space_file/space_file.c
2015-01-01 11:08:21 +01:00
425e8119de SpaceFile: Tweak thumbnail to avoid restarting the job needlessly. 2014-12-31 20:45:39 +01:00
4f241d3d36 SpaceFile: Refactor sorting and filtering of filelist.
New code shall be more easy to maintain and extend.
Sorting is now handled quite the same as filtering, and all filtering parameters
are now packed into a sub-struct to help extending it later.

Also done some optimizations in filelist refresh, and sorting/filtering area.
Now we should avoid re-sorting and re-filtering too often, also removed
calls to those in read_xxx funcs.

Note thumbnail job is still started basically on each call to `file_refresh()`,
will be addressed in next commit.
2014-12-31 20:13:21 +01:00
6a7076c9d4 SpaceFile: Filelist: reorder a bit things, also cleanup some unused and pure-private funcs. 2014-12-31 19:25:41 +01:00
ba0294cfe0 Merge branch 'master' into asset-experiments 2014-12-31 12:00:06 +01:00
0350111424 Merge branch 'master' into asset-experiments 2014-12-29 16:50:37 +01:00
8fa24594ce Merge branch 'master' into asset-experiments 2014-12-28 12:52:52 +01:00
1d42f07d58 Change timer of readdir job to 10ms, this gives an 'immediate' listing for most
usual cases, as in current master.
2014-12-28 12:49:24 +01:00
dc0a4fde63 Merge branch 'master' into asset-experiments 2014-12-27 17:26:17 +01:00
00cb0035a7 Fix one more issue - we need a string length callback too, for pure 'virtual' RNA strings... 2014-12-26 21:50:36 +01:00
4e19102964 Fix a mem leak in file listing threaded code, and another bug in fsmenu.c (new named bookmarks). 2014-12-26 19:58:08 +01:00
3c52c4ab0a Merge branch 'master' into asset-experiments
Conflicts:
	release/scripts/startup/bl_ui/__init__.py
	source/blender/editors/interface/interface_utils.c
2014-12-26 18:37:01 +01:00
0357a4928f Fix some 'minor' errors in fsmenuentry RNA name handling.
Still have a nice mem leak somewhere too... :/
2014-12-22 16:01:19 +01:00
4b1f410012 Add buttons to add/remove bookmarks, and to reset recent list. 2014-12-22 15:20:33 +01:00
cfc61a9337 Filebrowser uilist bookmarks: add icons as expected. 2014-12-22 14:47:12 +01:00
acaa5b2748 You can now edit bookmarks (and recent) names... 2014-12-22 14:39:54 +01:00
aa87764d13 WIP UILists for filebrowser: add access to three remaining types.
This also change update of active bookmark indices to happen in file_refresh().

Still not fully working, of course.
2014-12-22 12:25:40 +01:00
1a5caea321 Merge branch 'master' into asset-experiments 2014-12-22 10:26:07 +01:00
242fdf5e60 WIP: merge work on local branch about using UILists for bookmarks, be able to rename them, etc.
Doing it mostly because I need some update work done here so far to get py uilists/bookmarks working.

This exposes/moves part of bookmark code to ED_ area, so that it becomes available from e.g. RNA.
And adds RNA struct and such to represent a bookmark entry.

Also, Bookmark format is ammended to store optional custom names.

All this is still *very* crappy, should probably take some time soon to cleanup the whole branch!

See also T42777.
2014-12-21 16:02:12 +01:00
b734d9bf17 Merge branch 'master' into asset-experiments 2014-12-21 15:20:21 +01:00
4478ddc3d9 Add group preview generation too. 2014-12-20 16:47:41 +01:00
aa24a7d0a5 Merge branch 'master' into asset-experiments 2014-12-20 13:44:41 +01:00
d1743e3783 Fix stupid error (CMake install does not clean removed files it seems :/ ) 2014-12-19 14:54:35 +01:00
1dab208eb8 Various improvements to obj preview generation:
* Do not render cameras, lamps etc. for now.
* Generate bbox in camera local space, gives much better results.
* Add an op to clear previews from files.
2014-12-19 14:29:06 +01:00
db9310ac67 Merge branch 'master' into asset-experiments 2014-12-19 13:59:13 +01:00
d0187bf624 Merge branch 'master' into asset-experiments 2014-12-18 19:38:29 +01:00
baeeacc62d First basic pyscripts to generate previews for objects.
Much to be done still, but with it you can select some blender file,
and generate a basic rendered preview of each object.
2014-12-18 19:36:51 +01:00
88ffc9767c Finalized working new 'fit in camera view' code.
Now for any object, we have an rna func to call with a set of (flatten :/)
coordinates, and we get back location this object should be to 'see'
all given points.

Would need more refinements, but will do for now.
2014-12-18 15:26:34 +01:00
95b103c73b Merge branch 'master' into asset-experiments 2014-12-18 12:37:32 +01:00
a79a8fa111 Full WIP work to get better control regarding 'camera' aspect of objects.
First expose a method in Object RNA to get camera projection matrix (done).

Then, expose a method to get camera position (and scale for ortho) so that
it fits a given set of coordinates (still unfinished).

this among other things implied rewriting `BKE_camera_view_frame_fit_to_scene()`
underlying logic so that it uses `CameraParams` system, instead of `BKE_camera_view_frame()` one.
2014-12-17 21:56:09 +01:00
5cc7df849f Fix stupid merge error. 2014-12-17 10:43:31 +01:00
12e3347a5a Merge branch 'master' into asset-experiments
Conflicts:
	source/blender/blenloader/intern/writefile.c
2014-12-17 10:42:52 +01:00
c440c22d18 RNA access to previews (image and icons).
Note since this gives python possibility to change those previews,
we add flags to PreviewImage to tag as user_defined.

TODO: replace all those shorts-used-as-bools by bitflags!
2014-12-16 18:03:28 +01:00
46d6d74386 Merge branch 'master' into asset-experiments 2014-12-16 16:59:01 +01:00
e1a345b3fe Ensure previews are up to date when saving .blend file.
Previuosly, we would only write existing data - and big previews were
nearly never generated by default.

Now, if saving previews is enabled, `wm_file_write()` will ensure
all 'common' previewable datablocks do have up-to-date previews
(brushes remain TODO here for now, they have both a preview **and**
an icon_imbuf, sigh...).

This implied adding an 'immediate' non-job-background version of
`ED_preview_icon_job()`.

Note this does not include objects/groups/etc. It's not simple to generate
previews for those, will probably go for a user-launched py operator here...

Also, cleanup some debug prints!
2014-12-16 14:41:44 +01:00
3c738b301f Never write preview data when doing memsave (i.e. undo).
Takes useless space, and they even could easily get out of sync.

Also, some minor preparative work to (re)generate previews on file write,
if needed!
2014-12-16 11:50:15 +01:00
b3b362a212 Reshufle a bit icon/preview size defines.
We now have a _RENDER_ variant of those, used when creating the previews,
so that we create 32x32 icons needed for those special screens...
2014-12-16 11:12:14 +01:00
9516d3fafc Some minor refinement regarding overlayed icons.
Note, even when unpremultiplying alpha, we still have 'breadcrumbs' around
icons, not sure why...
2014-12-16 09:56:57 +01:00
ddf519096d Merge branch 'master' into asset-experiments 2014-12-16 09:18:45 +01:00
02290ec582 A bit crappy, but working 'ID icons' over previews. 2014-12-15 19:55:15 +01:00
b36d5570c8 Refactor 'immediate search'
Previous implementation was uglyly relying on button using a specific
icon (VIEWZOOM) to enable this feature. Now we have a dedicated button flag
(UI_BUT_TEXTEDIT_UPDATE) and a dedicated RNA subtype (PROP_SEARCH) for that.

Also, if no icon is specified, it automatically set VIEWZOOM for it,
which saves us explicitely defining it in UI py code!

NOTE: this is to be committed asap in master, but has to wait for
after 2.73, so storing it here for now.
2014-12-15 14:52:10 +01:00
66f3def3b4 Cleanup: use ICON_DEFAULT_HEIGHT everywhere for ICON_SIZE_ICON
If we need bigger icon size for previews (like 32 instead of 16), then
it should be handled everywhere!
2014-12-15 13:02:54 +01:00
05926f7253 Do not set filetype to IMAGEFILE when we get a preview, this is absolutely stupid! 2014-12-15 12:28:17 +01:00
002e71f255 Merge branch 'master' into asset-experiments 2014-12-15 12:02:07 +01:00
f12f6ddd04 Fix stupid buggy behavior when init (root) dir had no trailing slash. 2014-12-15 11:19:43 +01:00
dfe8884e7a Add missing 'ID' icons, and a 'blenlib' filter to filetypes. 2014-12-15 11:03:44 +01:00
4f2e8c0315 Merge branch 'master' into asset-experiments 2014-12-15 09:37:56 +01:00
812f40c493 More borring boiling code for ob/group previews.
Also, try to make brushes also save their previews.

Anyway, something fishy is going on here, in theory we should get
previews for brushes, worlds, lamps... for free, but so far looks like
lib 'peek' code only handles mat/texture previews correctly?
2014-12-13 15:48:18 +01:00
3c634400a0 Add preview pointers to Object and Group, with read/write logic.
Doing nothing useful yet, though!

Note: ultimately we may want to move that preview stuff to ID struct,
so that we get a real basic generic handling of it, but for now
simpler to keep it as is.
2014-12-13 15:14:04 +01:00
8058d7d04f Merge branch 'master' into asset-experiments 2014-12-13 14:25:59 +01:00
35554d43b1 Merge branch 'master' into asset-experiments 2014-12-11 20:10:47 +01:00
8644862fac Add progressbar to dirlist job.
Progressbar value is quite chaotic currently, will check that later.

Also, fixed G.main still being used in job, and factorized once more time code.
2014-12-11 20:07:32 +01:00
5cf39b228d More cleanup, rename and commentting.
Also, definitively removed 'G.main.name protection' from lib reading
code. I do absolutely not see how listing a separate blend file handle
could possibly affect that anyway - and we do not want to access
G from non-main thread I'd bet...
2014-12-11 18:37:58 +01:00
b81d5a194a Atomic Cleanup: get rid of 'old' stuff no more used (mostly non-job read/list funcs)! 2014-12-11 18:16:32 +01:00
d211c58856 Merge branch 'master' into asset-experiments 2014-12-11 17:49:47 +01:00
7cb8a89aa0 Fix that stupid memleak in job-dir-listing code. 2014-12-11 17:46:46 +01:00
cb0272ceab Full rework of job (background) filereading code.
Now it works reasonably OK for filesystem, and also for .blend libs.

Code is even quite simpler than previous one. Now it needs some serious cleanup,
and find where (new) memleak comes from too.
2014-12-11 17:33:16 +01:00
9a7ff0f4fe Merge branch 'master' into asset-experiments 2014-12-11 09:57:06 +01:00
769de4ff1e Merge branch 'master' into asset-experiments 2014-12-10 21:16:42 +01:00
5d3ee3d695 WIP code to make readfilelists jobs.
Only very partially working in this state, still needs some work.
Proof of concept seems rather interesting though.

Also, only pure filesystem stuff is implemented for now.
2014-12-10 21:14:26 +01:00
3ff51cd5df Merge branch 'master' into asset-experiments 2014-12-10 17:05:04 +01:00
e4d9f9b772 Merge branch 'master' into asset-experiments 2014-12-10 15:58:39 +01:00
09b3e44b22 Reduce recursion to one level (.blend libs do not take that into account anyway).
Quicker, and in most cases I think this will be enough for libs and file browsing.

Real asset handling is another question.
2014-12-10 11:51:25 +01:00
c5fccb7caf Merge branch 'master' into asset-experiments 2014-12-10 11:40:01 +01:00
0add26e60b Merge branch 'master' into asset-experiments 2014-12-09 17:46:10 +01:00
c725d868af Filter completely 'dot-files', even when hidden in paths. 2014-12-09 17:44:29 +01:00
8f1df9fbba Fix wrong update when switching 'flat' state, also fix remaining memleak. 2014-12-09 17:23:32 +01:00
f06ed97ce7 Do not show ID-types filtering when we are not browsing libs! 2014-12-09 14:56:30 +01:00
f13f85676d Merge branch 'master' into asset-experiments 2014-12-09 14:15:35 +01:00
21030e3ae6 Merge branch 'master' into asset-experiments 2014-12-09 11:10:35 +01:00
677c716c0f Fix two very stupid bugs! 2014-12-08 19:21:39 +01:00
e28fb66186 More sorting fixes and tweaks (things should work rather OK now). 2014-12-08 18:51:38 +01:00
da7f20e385 Merge branch 'master' into asset-experiments 2014-12-08 17:37:49 +01:00
6b07e8e31d Take IDTypes into account when sorting by types.
Also:
* Changed BLO_library_path_explode, now r_group and r_name must be pointers of char pointer,
  if found they will point to right place in r_dir 'memspace'.
* Select everything in IDTypes filtering by default.
2014-12-08 16:40:43 +01:00
ffb0fc35a9 Get rid of BLO_is_a_library. 2014-12-08 13:59:32 +01:00
4e96fe77b1 Add ID-types filtering. 2014-12-08 12:45:54 +01:00
337d7b2a6a Merge branch 'master' into asset-experiments 2014-12-08 10:56:15 +01:00
f92e64f207 Merge branch 'master' into asset-experiments 2014-12-06 18:12:09 +01:00
5eaa8739c5 Moar fixes (re ;ostly filtering mixed lib/data and regular files). 2014-12-06 18:10:59 +01:00
c689af14d8 Make 'append/link' code handle data from several different sources at once.
Nothing really magic here, just grouping the imports by libfile/grouptype.
We could probably get better code (loop less on given list of 'files' to import)
but not sure it'd be worth it, this is not supposed to be a performance-critical point.
2014-12-06 18:05:54 +01:00
951dbff60e Moar fixes to sorting code and such. 2014-12-06 15:40:00 +01:00
53148b5ebc Some flatmode fixes:
* Delete filelist when changing flat setting (so that we get immediate update when changing that setting).
* Disable flat when going up in tree (we ;ight actually want to do this everytime).
2014-12-06 14:50:03 +01:00
429cc6072f Merge branch 'master' into asset-experiments 2014-12-06 12:57:54 +01:00
b3e2cbac79 Merge branch 'master' into asset-experiments 2014-12-05 16:47:05 +01:00
9939e783a9 Reworked 'flat' mode, added it outside of blendfiles (libraries).
Note this is WIP, it 'breaks' load/append/etc. operators to some points,
and many other 'details' that need to be addressed.
2014-12-05 16:43:57 +01:00
276286aa85 Merge branch 'master' into asset-experiments 2014-12-05 12:45:31 +01:00
5ceec532b7 Merge branch 'master' into asset-experiments 2014-12-04 18:46:11 +01:00
9ea42ae3ba Add basic 'glob' filter by name feature.
Not much to add, we'll likely add more filtering options (tags, categories...) later,
maybe for now we just need an 'exclude' option for name filter...
2014-12-04 18:43:17 +01:00
f8f82821ef Refactor: do not filter each item twice! Mem usage here is not really an issue anyway. 2014-12-04 17:45:55 +01:00
d9b4186e6e Refactor filtering code, should be easier to add new filter options now. 2014-12-04 17:30:51 +01:00
c728f537ae Fix issues when data name have slash inside.
Adding `BLO_library_path_explode` simplies things. We might end getting rid of
`BLO_is_a_library` (or rather, merge back both things) later, though.
2014-12-04 16:51:46 +01:00
1089d97f04 Fix stupid mistake preventing 'traditional' append/link 2014-12-04 15:23:56 +01:00
d00d1d5622 Cleanup: more. 2014-12-04 15:03:33 +01:00
f02bc0cda8 Cleanup, remove tons of debug prints 2014-12-04 14:53:55 +01:00
b65d8de56a Add icons to datatypes (IDs) in browser, when appending/linking.
Not yet previews, but still better than anonymous icon!
2014-12-04 14:48:56 +01:00
158e6fd7f3 Merge branch 'master' into asset-experiments 2014-12-04 11:19:31 +01:00
ff1ff9823d Merge branch 'master' into asset-experiments 2014-12-04 11:11:33 +01:00
ca70271876 Append/link from 'global' level works.
Note I had to implement 'relative' path handling for 'filenames' in
append/link op, we may want to do this a bit differently later?
2014-12-03 18:55:07 +01:00
b29258922f Fix name issue (stupid really), show them better in UI. 2014-12-03 16:39:05 +01:00
99a1f8172b Do not shoz/consider at all inner '..'
Also more debug code that'll need to be cleaned up
2014-12-03 16:07:28 +01:00
74ae847cfa First (awful) tests to get a whole blend file content shown flat
Main goal is to see whether we can use existing filelist to handle that
(by default it is 100% tree-oriented).

Also, getting some strange issues with ID name currently...
2014-12-03 15:29:18 +01:00
2235 changed files with 129466 additions and 94781 deletions

View File

@@ -257,6 +257,10 @@ ForEachMacros:
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter
- SLOT_PROBING_BEGIN
- SET_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
# Use once we bump the minimum version to version 8.
# # Without this string literals that in-line 'STRINGIFY' behave strangely (a bug?).

View File

@@ -278,10 +278,9 @@ option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd
# Alembic support
option(WITH_ALEMBIC "Enable Alembic Support" ON)
option(WITH_ALEMBIC_HDF5 "Enable Legacy Alembic Support (not officially supported)" OFF)
# Universal Scene Description support
option(WITH_USD "Enable Universal Scene Description (USD) Support" OFF)
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
# 3D format support
# Disable opencollada when we don't have precompiled libs
@@ -322,14 +321,6 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
# Freestyle
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# New object types
option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_OBJECT_TYPES)
# New simulation data block
option(WITH_NEW_SIMULATION_TYPE "Enable simulation data block (use for development only, don't save in files)" OFF)
mark_as_advanced(WITH_NEW_SIMULATION_TYPE)
# Misc
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
@@ -371,7 +362,7 @@ option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" OFF)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
@@ -628,12 +619,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
endif()
# may as well build python module without a UI
if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
endif()
if(NOT WITH_PYTHON)
set(WITH_CYCLES OFF)
set(WITH_DRACO OFF)
@@ -661,6 +646,7 @@ if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
set(WITH_BOOST OFF)
endif()
set_and_warn_dependency(WITH_TBB WITH_CYCLES OFF)
set_and_warn_dependency(WITH_TBB WITH_USD OFF)
set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE OFF)
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
@@ -1252,7 +1238,7 @@ endif()
if(WITH_LIBMV)
# We always have C++11 which includes unordered_map.
set(CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
set(CERES_DEFINES "-DCERES_STD_UNORDERED_MAP;-DCERES_USE_CXX_THREADS")
endif()
#-----------------------------------------------------------------------------
@@ -1568,20 +1554,15 @@ if(WITH_PYTHON)
endif()
if(MSVC)
# MSVC needs to be tested first, since clang on windows will
# match the compiler test below but clang-cl does not accept -std=c++11
# since it is on by default and cannot be turned off.
#
# Nothing special is needed, C++11 features are available by default.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
endif()
# Visual Studio has all standards it supports available by default

View File

@@ -32,6 +32,7 @@ Convenience Targets
* debug: Build a debug binary.
* full: Enable all supported dependencies & options.
* lite: Disable non essential features for a smaller binary and faster build.
* release Complete build with all options enabled including CUDA and Optix, matching the releases on blender.org
* headless: Build without an interface (renderfarm or server automation).
* cycles: Build Cycles standalone only, without Blender.
* bpy: Build as a python module which can be loaded from python directly.
@@ -141,6 +142,10 @@ Information
endef
# HELP_TEXT (end)
# This makefile is not meant for Windows
ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make")
endif
# System Vars
OS:=$(shell uname -s)
@@ -207,6 +212,10 @@ ifneq "$(findstring lite, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_lite
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_lite.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring release, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_release
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_release.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring cycles, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_cycles
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/cycles_standalone.cmake" $(CMAKE_CONFIG_ARGS)
@@ -317,6 +326,7 @@ all: .FORCE
debug: all
full: all
lite: all
release: all
cycles: all
headless: all
bpy: all

View File

@@ -48,11 +48,7 @@ include(cmake/options.cmake)
include(cmake/versions.cmake)
if(ENABLE_MINGW64)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
include(cmake/setup_mingw64.cmake)
else()
include(cmake/setup_mingw32.cmake)
endif()
include(cmake/setup_mingw64.cmake)
else()
set(mingw_LIBDIR ${LIBDIR})
endif()
@@ -97,17 +93,18 @@ if(UNIX)
else()
include(cmake/pugixml.cmake)
endif()
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/xr_openxr.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
endif()
if(WITH_WEBP)
include(cmake/webp.cmake)
endif()
if(WIN32)
# HMD branch deps
include(cmake/hidapi.cmake)
# OCIO deps
include(cmake/tinyxml.cmake)
include(cmake/yamlcpp.cmake)
@@ -130,7 +127,6 @@ if(NOT WIN32 OR ENABLE_MINGW64)
include(cmake/vpx.cmake)
include(cmake/x264.cmake)
include(cmake/xvidcore.cmake)
include(cmake/faad.cmake)
include(cmake/ffmpeg.cmake)
include(cmake/fftw.cmake)
include(cmake/sndfile.cmake)

View File

@@ -16,16 +16,6 @@
#
# ***** END GPL LICENSE BLOCK *****
if(ALEMBIC_HDF5)
set(ALEMBIC_HDF5_HL)
# in debug mode we do not build HDF5_hdf5_hl_LIBRARY which makes cmake really
# unhappy, stub it with the debug mode lib. it's not linking it in at this
# point in time anyhow
if(BUILD_MODE STREQUAL Debug)
set(ALEMBIC_HDF5_HL -DHDF5_hdf5_hl_LIBRARY=${LIBDIR}/hdf5/lib/libhdf5_hl_D.${LIBEXT})
endif()
endif()
set(ALEMBIC_EXTRA_ARGS
-DBUILDSTATIC=ON
-DLINKSTATIC=ON
@@ -38,6 +28,7 @@ set(ALEMBIC_EXTRA_ARGS
-DBoost_DEBUG=ON
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DILMBASE_ROOT=${LIBDIR}/openexr
-DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/openexr/include/OpenEXR
-DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
@@ -52,7 +43,6 @@ set(ALEMBIC_EXTRA_ARGS
-DUSE_PRMAN=0
-DUSE_HDF5=Off
-DUSE_STATIC_HDF5=Off
-DHDF5_ROOT=${LIBDIR}/hdf5
-DUSE_TESTS=Off
-DALEMBIC_NO_OPENGL=1
-DUSE_BINARIES=ON
@@ -61,7 +51,6 @@ set(ALEMBIC_EXTRA_ARGS
-DGLUT_INCLUDE_DIR=""
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${ALEMBIC_HDF5_HL}
)
ExternalProject_Add(external_alembic

View File

@@ -26,10 +26,20 @@ set(EMBREE_EXTRA_ARGS
-DEMBREE_RAY_MASK=ON
-DEMBREE_FILTER_FUNCTION=ON
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_TASKING_SYSTEM=INTERNAL
-DEMBREE_MAX_ISA=AVX2
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
)
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_TBB_LIBRARY_NAME=tbb_static
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_static
)
endif()
if(WIN32)
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
else()
@@ -41,9 +51,16 @@ ExternalProject_Add(external_embree
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${EMBREE_HASH}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
add_dependencies(
external_embree
external_tbb
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -1,40 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(FAAD_EXTRA_ARGS)
if(WIN32)
set(FAAD_EXTRA_CONFIGURE "utils\\win32\\ac2ver.exe" "faad2" "configure.ac" > libfaad\\win32_ver.h)
else()
set(FAAD_EXTRA_CONFIGURE echo .)
endif()
ExternalProject_Add(external_faad
URL ${FAAD_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${FAAD_HASH}
PREFIX ${BUILD_DIR}/faad
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && ${FAAD_EXTRA_CONFIGURE} && ${CONFIGURE_COMMAND} --disable-shared --enable-static --prefix=${LIBDIR}/faad
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && make install
INSTALL_DIR ${LIBDIR}/faad
)
if(MSVC)
set_target_properties(external_faad PROPERTIES FOLDER Mingw)
endif()

View File

@@ -127,7 +127,6 @@ endif()
add_dependencies(
external_ffmpeg
external_zlib
external_faad
external_openjpeg
external_xvidcore
external_x264

View File

@@ -19,8 +19,12 @@
set(FFTW_EXTRA_ARGS)
if(WIN32)
set(FFTW3_ENV set CFLAGS=-fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-lto &&)
set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3 < ${PATCH_DIR}/fftw3.diff)
set(FFTW_EXTRA_ARGS --disable-static --enable-shared)
set(FFTW_INSTALL install-strip)
else()
set(FFTW_EXTRA_ARGS --enable-static)
set(FFTW_INSTALL install)
endif()
ExternalProject_Add(external_fftw3
@@ -28,10 +32,10 @@ ExternalProject_Add(external_fftw3
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${FFTW_HASH}
PREFIX ${BUILD_DIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${FFTW3_ENV} cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && ${CONFIGURE_COMMAND} --enable-static --prefix=${mingw_LIBDIR}/fftw3
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && ${CONFIGURE_COMMAND} ${FFTW_EXTRA_ARGS} --prefix=${mingw_LIBDIR}/fftw3
PATCH_COMMAND ${FFTW3_PATCH_COMMAND}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make install
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make ${FFTW_INSTALL}
INSTALL_DIR ${LIBDIR}/fftw3
)
@@ -39,7 +43,8 @@ if(MSVC)
set_target_properties(external_fftw3 PROPERTIES FOLDER Mingw)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_fftw3 after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.a ${HARVEST_TARGET}/fftw3/lib/libfftw.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.dll.a ${HARVEST_TARGET}/fftw3/lib/libfftw.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/bin/libfftw3-3.dll ${HARVEST_TARGET}/fftw3/lib/libfftw3-3.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/include/fftw3.h ${HARVEST_TARGET}/fftw3/include/fftw3.h
DEPENDEES install
)

View File

@@ -31,10 +31,6 @@ if(BUILD_MODE STREQUAL Release)
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# OpenImageIO
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
@@ -44,30 +40,13 @@ if(BUILD_MODE STREQUAL Release)
# glew-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
# sndfile
${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/lib/libsndfile.dll.a ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h &&
# tiff
${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ &&
# hidapi
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/
DEPENDS
)
endif()
if(BUILD_MODE STREQUAL Debug)
add_custom_target(Harvest_Debug_Results
# OpenImageIO
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib &&
# hdf5
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5/lib ${HARVEST_TARGET}/hdf5/lib &&
DEPENDS Package_Python
)
endif()
else(WIN32)
function(harvest from to)

View File

@@ -0,0 +1,63 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
if(WIN32)
set(ISPC_EXTRA_ARGS_WIN
-DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe
-DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe
-DM4_EXECUTABLE=${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe
)
endif()
set(ISPC_EXTRA_ARGS
-DARM_ENABLED=Off
-DISPC_NO_DUMPS=On
-DISPC_INCLUDE_EXAMPLES=Off
-DISPC_INCLUDE_TESTS=Off
-DLLVM_ROOT=${LIBDIR}/llvm/lib/cmake/llvm
-DLLVM_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_EXECUTABLE=${LIBDIR}/clang/bin/clang
-DISPC_INCLUDE_TESTS=Off
-DCLANG_LIBRARY_DIR=${LIBDIR}/clang/lib
-DCLANG_INCLUDE_DIRS=${LIBDIR}/clang/include
${ISPC_EXTRA_ARGS_WIN}
)
ExternalProject_Add(external_ispc
URL ${ISPC_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${ISPC_HASH}
PREFIX ${BUILD_DIR}/ispc
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/ispc/src/external_ispc < ${PATCH_DIR}/ispc.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ispc -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ISPC_EXTRA_ARGS} ${BUILD_DIR}/ispc/src/external_ispc
INSTALL_DIR ${LIBDIR}/ispc
)
add_dependencies(
external_ispc
ll
external_clang
)
if(WIN32)
add_dependencies(
external_ispc
external_flexbison
)
endif()

View File

@@ -42,20 +42,17 @@ if(WIN32)
set(JPEG_LIBRARY jpeg-staticd${LIBEXT})
endif()
else(WIN32)
# autoconf for unix
if(APPLE)
set(JPEG_EXTRA_ARGS --host x86_64-apple-darwin --with-jpeg8)
else()
set(JPEG_EXTRA_ARGS --with-jpeg8)
endif()
# cmake for unix
set(JPEG_EXTRA_ARGS
-DWITH_JPEG8=ON
-DENABLE_STATIC=ON
-DENABLE_SHARED=OFF
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpg/lib)
ExternalProject_Add(external_jpeg
URL ${JPEG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${JPEG_HASH}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && autoreconf -fiv && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/jpg NASM=yasm ${JPEG_EXTRA_ARGS}
BUILD_IN_SOURCE 1
BUILD_COMMAND ${CONFIGURE_ENV} && make install
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg

View File

@@ -52,7 +52,6 @@ if(BUILD_MODE STREQUAL Release)
PREFIX ${BUILD_DIR}/openal
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openal
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff
)
if(WIN32)

View File

@@ -18,26 +18,41 @@
set(OIDN_EXTRA_ARGS
-DWITH_EXAMPLE=OFF
-DWITH_TEST=OFF
-DOIDN_APPS=OFF
-DTBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
-DOIDN_STATIC_LIB=ON
-DOIDN_STATIC_RUNTIME=OFF
-DISPC_EXECUTABLE=${LIBDIR}/ispc/bin/ispc
)
if(WIN32)
set(OIDN_EXTRA_ARGS
${OIDN_EXTRA_ARGS}
-DTBB_DEBUG_LIBRARY=${LIBDIR}/tbb/lib/tbb.lib
-DTBB_DEBUG_LIBRARY_MALLOC=${LIBDIR}/tbb/lib/tbbmalloc.lib
)
else()
set(OIDN_EXTRA_ARGS
${OIDN_EXTRA_ARGS}
-Dtbb_LIBRARY_RELEASE=${LIBDIR}/tbb/lib/tbb_static.a
-Dtbbmalloc_LIBRARY_RELEASE=${LIBDIR}/tbb/lib/tbbmalloc_static.a
)
endif()
ExternalProject_Add(external_openimagedenoise
URL ${OIDN_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/openimagedenoise.diff
INSTALL_DIR ${LIBDIR}/openimagedenoise
)
add_dependencies(
external_openimagedenoise
external_tbb
external_ispc
)
if(WIN32)
@@ -46,7 +61,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openimagedenoise/include ${HARVEST_TARGET}/openimagedenoise/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/openimagedenoise.lib ${HARVEST_TARGET}/openimagedenoise/lib/openimagedenoise.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/common.lib ${HARVEST_TARGET}/openimagedenoise/lib/common.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/mkldnn.lib ${HARVEST_TARGET}/openimagedenoise/lib/mkldnn.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/dnnl.lib ${HARVEST_TARGET}/openimagedenoise/lib/dnnl.lib
DEPENDEES install
)
endif()
@@ -54,7 +69,7 @@ if(WIN32)
ExternalProject_Add_Step(external_openimagedenoise after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/openimagedenoise.lib ${HARVEST_TARGET}/openimagedenoise/lib/openimagedenoise_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/common.lib ${HARVEST_TARGET}/openimagedenoise/lib/common_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/mkldnn.lib ${HARVEST_TARGET}/openimagedenoise/lib/mkldnn_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimagedenoise/lib/dnnl.lib ${HARVEST_TARGET}/openimagedenoise/lib/dnnl_d.lib
DEPENDEES install
)
endif()

View File

@@ -32,7 +32,7 @@ endif()
if(WIN32)
set(PNG_LIBNAME libpng16_static${LIBEXT})
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2 -DOPJ_STATIC=1)
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
set(OPENJPEG_POSTFIX _msvc)
else()
set(PNG_LIBNAME libpng${LIBEXT})
@@ -49,23 +49,17 @@ endif()
if(MSVC)
set(OPENJPEG_FLAGS
-DOPENJPEG_HOME=${LIBDIR}/openjpeg_msvc
-DOPENJPEG_INCLUDE_DIR=${LIBDIR}/openjpeg_msvc/include/openjpeg-${OPENJPEG_SHORT_VERSION}
-DOPENJPEG_LIBRARY=${LIBDIR}/openjpeg_msvc/lib/openjp2${LIBEXT}
-DOPENJPEG_LIBRARY_DEBUG=${LIBDIR}/openjpeg_msvc/lib/openjp2${LIBEXT}
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg_msvc
)
else()
set(OPENJPEG_FLAGS
-DOPENJPEG_INCLUDE_DIR=${LIBDIR}/openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION}
-DOPENJPEG_LIBRARY=${LIBDIR}/openjpeg/lib/${OPENJPEG_LIBRARY}
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg
)
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILDSTATIC=ON
-DBUILD_SHARED_LIBS=OFF
${OPENIMAGEIO_LINKSTATIC}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/openexr/
-DOPENEXR_ILMIMF_LIBRARIES=${LIBDIR}/openexr/lib/IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
@@ -73,7 +67,16 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-OIIO_BUILD_CPP11=ON
-DUSE_LIBSQUISH=OFF
-DUSE_QT5=OFF
-DUSE_NUKE=OFF
-DUSE_OPENVDB=OFF
-DUSE_BZIP2=OFF
-DUSE_FREETYPE=OFF
-DUSE_DCMTK=OFF
-DUSE_LIBHEIF=OFF
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_FIELD3D=OFF
@@ -81,15 +84,12 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_PYTHON=OFF
-DUSE_GIF=OFF
-DUSE_OPENCV=OFF
-DUSE_OPENSSL=OFF
-DUSE_OPENJPEG=ON
-DUSE_FFMPEG=OFF
-DUSE_PTEX=OFF
-DUSE_FREETYPE=OFF
-DUSE_LIBRAW=OFF
-DUSE_PYTHON=OFF
-DUSE_PYTHON3=OFF
-DUSE_OCIO=OFF
-DUSE_OPENCOLORIO=OFF
-DUSE_WEBP=${WITH_WEBP}
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
-DOIIO_BUILD_TESTS=OFF
@@ -103,17 +103,13 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DJPEG_LIBRARY=${LIBDIR}/jpg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpg/include
${OPENJPEG_FLAGS}
-DOCIO_PATH=${LIBDIR}/opencolorio/
-DOpenEXR_USE_STATIC_LIBS=On
-DOPENEXR_HOME=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_PATH=${LIBDIR}/openexr/
-DILMBASE_PACKAGE_PREFIX=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DSTOP_ON_WARNING=OFF
${WEBP_FLAGS}
@@ -125,27 +121,38 @@ ExternalProject_Add(external_openimageio
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENIMAGEIO_HASH}
PREFIX ${BUILD_DIR}/openimageio
PATCH_COMMAND
${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/src/include < ${PATCH_DIR}/openimageio_gdi.diff &&
${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio_static_libs.diff
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimageio
)
add_dependencies(
external_openimageio
external_png external_zlib
external_png
external_zlib
external_openexr
external_jpeg
external_boost
external_tiff
external_opencolorio
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
)
if(NOT WIN32)
add_dependencies(
external_openimageio
external_opencolorio_extra
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -67,7 +67,7 @@ endif()
ExternalProject_Add(external_opensubdiv
URL ${OPENSUBDIV_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENSUBDIV_Hash}
URL_HASH MD5=${OPENSUBDIV_HASH}
PREFIX ${BUILD_DIR}/opensubdiv
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opensubdiv -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${OPENSUBDIV_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/opensubdiv

View File

@@ -27,6 +27,7 @@ set(OPENVDB_EXTRA_ARGS
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/

View File

@@ -17,7 +17,7 @@
# ***** END GPL LICENSE BLOCK *****
if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/lapack/fftw3 by installing mingw64" ON)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
@@ -45,11 +45,7 @@ message("PATCH_DIR = ${PATCH_DIR}")
message("BUILD_DIR = ${BUILD_DIR}")
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/patch.exe)
else()
set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/patch.exe)
endif()
set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/patch.exe)
set(LIBEXT ".lib")
set(LIBPREFIX "")
@@ -82,17 +78,10 @@ if(WIN32)
set(PLATFORM_CXX_FLAGS)
set(PLATFORM_CMAKE_FLAGS)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(MINGW_PATH ${DOWNLOAD_DIR}/mingw/mingw64)
set(MINGW_SHELL ming64sh.cmd)
set(PERL_SHELL ${DOWNLOAD_DIR}/perl/portableshell.bat)
set(MINGW_HOST x86_64-w64-mingw32)
else()
set(MINGW_PATH ${DOWNLOAD_DIR}/mingw/mingw32)
set(MINGW_SHELL ming32sh.cmd)
set(PERL_SHELL ${DOWNLOAD_DIR}/perl32/portableshell.bat)
set(MINGW_HOST i686-w64-mingw32)
endif()
set(MINGW_PATH ${DOWNLOAD_DIR}/mingw/mingw64)
set(MINGW_SHELL ming64sh.cmd)
set(PERL_SHELL ${DOWNLOAD_DIR}/perl/portableshell.bat)
set(MINGW_HOST x86_64-w64-mingw32)
set(CONFIGURE_ENV
cd ${MINGW_PATH} &&

View File

@@ -44,6 +44,7 @@ set(OSL_EXTRA_ARGS
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DLLVM_DIRECTORY=${LIBDIR}/llvm
-DLLVM_INCLUDES=${LIBDIR}/llvm/include
-DLLVM_LIB_DIR=${LIBDIR}/llvm/lib
@@ -74,6 +75,7 @@ set(OSL_EXTRA_ARGS
-DUSE_LLVM_BITCODE=OFF
-DUSE_PARTIO=OFF
-DUSE_QT=OFF
-DINSTALL_DOCS=OFF
${OSL_SIMD_FLAGS}
-DPARTIO_LIBRARIES=
)

View File

@@ -25,7 +25,7 @@ set(PNG_EXTRA_ARGS
ExternalProject_Add(external_png
URL ${PNG_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${PNG_HASH}
URL_HASH SHA256=${PNG_HASH}
PREFIX ${BUILD_DIR}/png
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/png ${DEFAULT_CMAKE_FLAGS} ${PNG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/png

View File

@@ -1,227 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
####################################################################################################################
# Mingw32 Builds
####################################################################################################################
# This installs mingw32+msys to compile ffmpeg/iconv/libsndfile/lapack/fftw3
####################################################################################################################
message("LIBDIR = ${LIBDIR}")
macro(cmake_to_msys_path MsysPath ResultingPath)
string(REPLACE ":" "" TmpPath "${MsysPath}")
string(SUBSTRING ${TmpPath} 0 1 Drive)
string(SUBSTRING ${TmpPath} 1 255 PathPart)
string(TOLOWER ${Drive} LowerDrive)
string(CONCAT ${ResultingPath} "/" ${LowerDrive} ${PathPart})
endmacro()
cmake_to_msys_path(${LIBDIR} mingw_LIBDIR)
message("mingw_LIBDIR = ${mingw_LIBDIR}")
message("Checking for mingw32")
# download mingw32
if(NOT EXISTS "${DOWNLOAD_DIR}/i686-4.9.4-release-win32-sjlj-rt_v5-rev0.7z")
message("Downloading mingw32")
file(DOWNLOAD "https://astuteinternet.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.4/threads-win32/sjlj/i686-4.9.4-release-win32-sjlj-rt_v5-rev0.7z" "${DOWNLOAD_DIR}/i686-4.9.4-release-win32-sjlj-rt_v5-rev0.7z")
endif()
# make mingw root directory
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw")
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/mingw
WORKING_DIRECTORY ${DOWNLOAD_DIR}
)
endif()
# extract mingw32
if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/ming32sh.cmd") AND (EXISTS "${DOWNLOAD_DIR}/i686-4.9.4-release-win32-sjlj-rt_v5-rev0.7z"))
message("Extracting mingw32")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/i686-4.9.4-release-win32-sjlj-rt_v5-rev0.7z
WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw
)
endif()
message("Checking for pkg-config")
if(NOT EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip")
message("Downloading pkg-config")
file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip" "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip")
endif()
# extract pkgconfig
if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/pkg-config.exe") AND (EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip"))
message("Extracting pkg-config")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip"
WORKING_DIRECTORY ${DOWNLOAD_DIR}/
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1/bin/pkg-config.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/pkg-config.exe"
)
endif()
message("Checking for nasm")
if(NOT EXISTS "${DOWNLOAD_DIR}/nasm-2.13.02-win32.zip")
message("Downloading nasm")
file(DOWNLOAD "http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/win32/nasm-2.13.02-win32.zip" "${DOWNLOAD_DIR}/nasm-2.13.02-win32.zip")
endif()
# extract nasm
if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/nasm.exe") AND (EXISTS "${DOWNLOAD_DIR}/nasm-2.13.02-win32.zip"))
message("Extracting nasm")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/nasm-2.13.02-win32.zip"
WORKING_DIRECTORY ${DOWNLOAD_DIR}/
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/nasm-2.13.02/nasm.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/nasm.exe"
)
endif()
SET(NASM_PATH ${DOWNLOAD_DIR}/mingw/mingw32/bin/nasm.exe)
message("Checking for mingwGet")
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip")
message("Downloading mingw-get")
file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip" "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip")
endif()
# extract mingw_get
if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get.exe") AND (EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip"))
message("Extracting mingw-get")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip"
WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw32/
)
endif()
if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get.exe") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/make.exe"))
message("Installing MSYS")
execute_process(
COMMAND ${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get install msys msys-patch
WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw32/bin/
)
endif()
if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get.exe") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/mktemp.exe"))
message("Installing mktemp")
execute_process(
COMMAND ${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get install msys msys-mktemp
WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw32/bin/
)
endif()
message("Checking for CoreUtils")
# download old core_utils for pr.exe (ffmpeg needs it to build)
if(NOT EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2")
message("Downloading CoreUtils 5.97")
file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/MSYS/Base/msys-core/_obsolete/coreutils-5.97-MSYS-1.0.11-2/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2" "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2")
endif()
if((EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/pr.exe"))
message("Installing pr from CoreUtils 5.97")
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/tmp_coreutils
WORKING_DIRECTORY ${DOWNLOAD_DIR}
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy ${DOWNLOAD_DIR}/tmp_coreutils/coreutils-5.97/bin/pr.exe "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/pr.exe"
WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/
)
endif()
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/ming32sh.cmd")
message("Installing ming32sh.cmd")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/ming32sh.cmd ${DOWNLOAD_DIR}/mingw/mingw32/ming32sh.cmd
)
endif()
message("Checking for perl")
# download perl for libvpx
if(NOT EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip")
message("Downloading perl")
file(DOWNLOAD "http://strawberryperl.com/download/5.22.1.3/strawberry-perl-5.22.1.3-32bit-portable.zip" "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip")
endif()
# make perl root directory
if(NOT EXISTS "${DOWNLOAD_DIR}/perl32")
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/perl32
WORKING_DIRECTORY ${DOWNLOAD_DIR}
)
endif()
# extract perl
if((NOT EXISTS "${DOWNLOAD_DIR}/perl32/portable.perl") AND (EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip"))
message("Extracting perl")
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip
WORKING_DIRECTORY ${DOWNLOAD_DIR}/perl32
)
endif()
# get yasm for vpx
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/yasm.exe")
message("Downloading yasm")
file(DOWNLOAD "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win32.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/yasm.exe")
endif()
message("checking i686-w64-mingw32-strings")
# copy strings.exe to i686-w64-mingw32-strings for x264
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strings.exe")
message("fixing i686-w64-mingw32-strings.exe")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/strings.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strings.exe"
)
endif()
message("checking i686-w64-mingw32-ar.exe")
# copy ar.exe to i686-w64-mingw32-ar.exe for x264
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ar.exe")
message("fixing i686-w64-mingw32-ar.exe")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ar.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ar.exe"
)
endif()
message("checking i686-w64-mingw32-strip.exe")
# copy strip.exe to i686-w64-mingw32-strip.exe for x264
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strip.exe")
message("fixing i686-w64-mingw32-strip.exe")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/strip.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strip.exe"
)
endif()
message("checking i686-w64-mingw32-ranlib.exe")
# copy ranlib.exe to i686-w64-mingw32-ranlib.exe for x264
if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe")
message("fixing i686-w64-mingw32-ranlib.exe")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
)
endif()

View File

@@ -19,7 +19,7 @@
####################################################################################################################
# Mingw64 Builds
####################################################################################################################
# This installs mingw64+msys to compile ffmpeg/iconv/libsndfile/lapack/fftw3
# This installs mingw64+msys to compile ffmpeg/iconv/libsndfile/fftw3
####################################################################################################################
message("LIBDIR = ${LIBDIR}")
@@ -128,6 +128,14 @@ if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get.exe") AND (NOT EXISTS "$
)
endif()
if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get.exe") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe"))
message("Installing m4")
execute_process(
COMMAND ${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get install msys msys-m4
WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw64/bin/
)
endif()
message("Checking for CoreUtils")
# download old core_utils for pr.exe (ffmpeg needs it to build)
if(NOT EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2")

View File

@@ -60,3 +60,14 @@ if(UNIX)
external_flac
)
endif()
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_sndfile after_install
COMMAND lib /def:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.def /machine:x64 /out:${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/sndfile/src/external_sndfile/src/libsndfile-1.lib ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h
DEPENDEES install
)
endif()

View File

@@ -1,4 +1,4 @@
%targets = (
my %targets = (
"blender-linux-x86" => {
inherit_from => [ "linux-x86" ],

View File

@@ -50,6 +50,13 @@ ExternalProject_Add(external_tbb
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_tbb after_install
# findtbb.cmake in some deps *NEEDS* to find tbb_debug.lib even if they are not going to use it
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.dll
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib

View File

@@ -22,9 +22,14 @@ set(USD_EXTRA_ARGS
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# USD wants the tbb debug lib set even when you are doing a release build
# Otherwise it will error out during the cmake configure phase.
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
@@ -76,14 +81,14 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/libusd_m.lib ${HARVEST_TARGET}/usd/lib/libusd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_m.lib ${HARVEST_TARGET}/usd/lib/libusd_m.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/libusd_m_d.lib ${HARVEST_TARGET}/usd/lib/libusd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_m_d.lib ${HARVEST_TARGET}/usd/lib/libusd_m_d.lib
DEPENDEES install
)
endif()

View File

@@ -20,17 +20,17 @@ set(ZLIB_VERSION 1.2.11)
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_HASH 1c9f62f0778697a09d36121ead88e08e)
set(OPENAL_VERSION 1.18.2)
set(OPENAL_VERSION 1.20.1)
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
set(OPENAL_HASH d4eeb0889812e2fdeaa1843523d76190)
set(OPENAL_HASH 556695068ce8375b89986083d810fd35)
set(PNG_VERSION 1.6.35)
set(PNG_VERSION 1.6.37)
set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.xz)
set(PNG_HASH 678b7e696a62a193ed3503b04bf449d6)
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
set(JPEG_VERSION 1.5.3)
set(JPEG_VERSION 2.0.4)
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
set(JPEG_HASH 5b7549d440b86c98a517355c102d155e)
set(JPEG_HASH 44c43e4a9fb352f47090804529317c88)
set(BOOST_VERSION 1.70.0)
set(BOOST_VERSION_NODOTS 1_70_0)
@@ -66,9 +66,9 @@ else()
set(OPENEXR_VERSION_POSTFIX)
endif()
set(FREETYPE_VERSION 2.10.1)
set(FREETYPE_VERSION 2.10.2)
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_HASH c50a3c9e5e62bdc938a6e1598a782947)
set(FREETYPE_HASH b1cb620e4c875cd4d1bfa04945400945)
set(GLEW_VERSION 1.13.0)
set(GLEW_URI http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz)
@@ -78,10 +78,6 @@ set(FREEGLUT_VERSION 3.0.0)
set(FREEGLUT_URI http://pilotfiber.dl.sourceforge.net/project/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)
set(HDF5_VERSION 1.8.17)
set(HDF5_URI https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-${HDF5_VERSION}/src/hdf5-${HDF5_VERSION}.tar.gz)
set(HDF5_HASH 7d572f8f3b798a628b8245af0391a0ca)
set(ALEMBIC_VERSION 1.7.12)
set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz)
set(ALEMBIC_MD5 e2b3777f23c5c09481a008cc6f0f8a40)
@@ -101,21 +97,21 @@ set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f)
set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip)
set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a)
set(OPENSUBDIV_VERSION v3_4_0_RC2)
set(OPENSUBDIV_Hash f6a10ba9efaa82fde86fe65aad346319)
set(OPENSUBDIV_VERSION v3_4_3)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 7bbfa275d021fb829e521df749160edb)
set(SDL_VERSION 2.0.8)
set(SDL_VERSION 2.0.12)
set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_HASH 3800d705cef742c6a634f202c37f263f)
set(SDL_HASH 783b6f2df8ff02b19bb5ce492b99c8ff)
set(OPENCOLLADA_VERSION v1.6.68)
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLORIO_VERSION 1.1.0)
set(OPENCOLORIO_URI https://github.com/imageworks/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 802d8f5b1d1fe316ec5f76511aa611b8)
set(OPENCOLORIO_VERSION 1.1.1)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 23d8b9ac81599305539a5a8674b94a3d)
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz)
@@ -127,23 +123,23 @@ set(CLANG_HASH 13468e4a44940efef1b75e8641752f90)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENIMAGEIO_VERSION 1.8.13)
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f5526c3c9878029ee900d84856683f93)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(TIFF_VERSION 4.0.9)
set(TIFF_VERSION 4.1.0)
set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_HASH 54bad211279cc93eb4fca31ba9bfdc79)
set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(OSL_VERSION 1.10.9)
set(OSL_VERSION 1.10.10)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH a94f1e8506f7e8f5e993653de5c5fa00)
set(OSL_HASH 00dec08a93c8084e53848b9ad047889f)
set(PYTHON_VERSION 3.7.4)
set(PYTHON_VERSION 3.7.7)
set(PYTHON_SHORT_VERSION 3.7)
set(PYTHON_SHORT_VERSION_NO_DOTS 37)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH d33e4aae66097051c2eca45ee3604803)
set(PYTHON_HASH 172c650156f7bea68ce31b2fd01fa766)
set(TBB_VERSION 2019_U9)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
@@ -153,24 +149,24 @@ set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
set(IDNA_VERSION 2.8)
set(IDNA_VERSION 2.9)
set(CHARDET_VERSION 3.0.4)
set(URLLIB3_VERSION 1.25.3)
set(CERTIFI_VERSION 2019.6.16)
set(REQUESTS_VERSION 2.22.0)
set(URLLIB3_VERSION 1.25.9)
set(CERTIFI_VERSION 2020.4.5.2)
set(REQUESTS_VERSION 2.23.0)
set(NUMPY_VERSION v1.17.0)
set(NUMPY_VERSION 1.17.5)
set(NUMPY_SHORT_VERSION 1.17)
set(NUMPY_URI https://files.pythonhosted.org/packages/da/32/1b8f2bb5fb50e4db68543eb85ce37b9fa6660cd05b58bddfafafa7ed62da/numpy-1.17.0.zip)
set(NUMPY_HASH aed49b31bcb44ec73b8155be78566135)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH 763a5646fa6eef7a22f4895bca0524f2)
set(LAME_VERSION 3.100)
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
set(OGG_VERSION 1.3.3)
set(OGG_VERSION 1.3.4)
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
set(OGG_HASH c2e8a485110b97550f453226ec644ebac6cb29d1caef2902c007edab4308d985)
set(OGG_HASH fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e)
set(VORBIS_VERSION 1.3.6)
set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz)
@@ -180,51 +176,41 @@ set(THEORA_VERSION 1.1.1)
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
set(THEORA_HASH b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc)
set(FLAC_VERSION 1.3.2)
set(FLAC_VERSION 1.3.3)
set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz)
set(FLAC_HASH 91cfc3ed61dc40f47f050a109b08610667d73477af6ef36dcad31c31a4a8d53f)
set(FLAC_HASH 213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748)
set(VPX_VERSION 1.7.0)
set(VPX_VERSION 1.8.2)
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_HASH 1fec931eb5c94279ad219a5b6e0202358e94a93a90cfb1603578c326abfc1238)
set(VPX_HASH 8735d9fcd1a781ae6917f28f239a8aa358ce4864ba113ea18af4bb2dc8b474ac)
set(OPUS_VERSION 1.3.1)
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
set(OPUS_HASH 65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d)
set(X264_URI http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20180811-2245-stable.tar.bz2)
set(X264_HASH ae8a868a0e236a348b35d79f3ee80294b169d1195408b689f9851383661ed7aa)
set(X264_URI https://code.videolan.org/videolan/x264/-/archive/33f9e1474613f59392be5ab6a7e7abf60fa63622/x264-33f9e1474613f59392be5ab6a7e7abf60fa63622.tar.gz)
set(X264_HASH 5456450ee1ae02cd2328be3157367a232a0ab73315e8c8f80dab80469524f525)
set(XVIDCORE_VERSION 1.3.5)
set(XVIDCORE_URI http://downloads.xvid.org/downloads/xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(XVIDCORE_HASH 165ba6a2a447a8375f7b06db5a3c91810181f2898166e7c8137401d7fc894cf0)
set(XVIDCORE_VERSION 1.3.7)
set(XVIDCORE_URI https://downloads.xvid.com/downloads/xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(XVIDCORE_HASH abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce2d)
# This has to be in sync with the version in blenders /extern folder.
set(OPENJPEG_VERSION 2.3.0)
set(OPENJPEG_VERSION 2.3.1)
set(OPENJPEG_SHORT_VERSION 2.3)
# Use slightly newer commit after release which includes a cmake fix
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/66297f07a43.zip)
set(OPENJPEG_HASH 8242b18d908c7c42174e4231a741cfa7ce7c26b6ed5c9644feb9df7b3054310b)
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6a9)
set(FAAD_VERSION 2-2.8.8)
set(FAAD_URI http://downloads.sourceforge.net/faac/faad${FAAD_VERSION}.tar.gz)
set(FAAD_HASH 28f6116efdbe9378269f8a6221767d1f)
set(FFMPEG_VERSION 4.0.2)
set(FFMPEG_VERSION 4.2.3)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 5576e8a22f80b6a336db39808f427cfb)
set(FFMPEG_HASH 695fad11f3baf27784e24cb0e977b65a)
set(FFTW_VERSION 3.3.8)
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
set(FFTW_HASH 8aac833c943d8e90d51b697b27d4384d)
set(ICONV_VERSION 1.15)
set(ICONV_VERSION 1.16)
set(ICONV_URI http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz)
set(ICONV_HASH ace8b5f2db42f7b3b3057585e80d9808)
set(LAPACK_VERSION 3.6.0)
set(LAPACK_URI http://www.netlib.org/lapack/lapack-${LAPACK_VERSION}.tgz)
set(LAPACK_HASH f2f6c67134e851fe189bb3ca1fbb5101)
set(ICONV_HASH 7d2a800b952942bb2880efb00cfd524c)
set(SNDFILE_VERSION 1.0.28)
set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_VERSION}.tar.gz)
@@ -246,13 +232,13 @@ set(SPNAV_VERSION 0.2.3)
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
set(SPNAV_HASH 44d840540d53326d4a119c0f1aa7bf0a)
set(JEMALLOC_VERSION 5.0.1)
set(JEMALLOC_VERSION 5.2.1)
set(JEMALLOC_URI https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2)
set(JEMALLOC_HASH 507f7b6b882d868730d644510491d18f)
set(JEMALLOC_HASH 3d41fbf006e6ebffd489bdb304d009ae)
set(XML2_VERSION 2.9.4)
set(XML2_VERSION 2.9.10)
set(XML2_URI http://xmlsoft.org/sources/libxml2-${XML2_VERSION}.tar.gz)
set(XML2_HASH ae249165c173b1ff386ee8ad676815f5)
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
set(TINYXML_VERSION 2_6_2)
set(TINYXML_VERSION_DOTS 2.6.2)
@@ -267,9 +253,9 @@ set(LCMS_VERSION 2.9)
set(LCMS_URI https://nchc.dl.sourceforge.net/project/lcms/lcms/${LCMS_VERSION}/lcms2-${LCMS_VERSION}.tar.gz)
set(LCMS_HASH 8de1b7724f578d2995c8fdfa35c3ad0e)
set(PUGIXML_VERSION 1.9)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v1.9.tar.gz)
set(PUGIXML_HASH 9346ca1dce2c48f1748c12fdac41a714)
set(PUGIXML_VERSION 1.10)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison//win_flex_bison-2.5.5.zip)
@@ -279,37 +265,37 @@ set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
# sources from Debian packaging.
set(BZIP2_VERSION 1.0.6)
set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERSION}.orig.tar.bz2)
set(BZIP2_HASH d70a9ccd8bdf47e302d96c69fecd54925f45d9c7b966bb4ef5f56b770960afa7)
set(BZIP2_VERSION 1.0.8)
set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERSION}.orig.tar.gz)
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
set(FFI_VERSION 3.2.1)
set(FFI_VERSION 3.3)
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
set(FFI_HASH d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37)
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
set(LZMA_VERSION 5.2.4)
set(LZMA_VERSION 5.2.5)
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
set(LZMA_HASH 3313fd2a95f43d88e44264e6b015e7d03053e681860b0d5d3f9baca79c57b7bf)
set(LZMA_HASH 5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df)
set(SSL_VERSION 1.1.0i)
set(SSL_VERSION 1.1.1g)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH ebbfc844a8c8cc0ea5dc10b86c9ce97f401837f3fa08c17b2cdadc118253cf99)
set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46)
set(SQLITE_VERSION 3.24.0)
set(SQLITE_VERSION 3.31.1)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(EMBREE_VERSION 3.8.0)
set(EMBREE_VERSION 3.10.0)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
set(EMBREE_HASH 4bbe29e7eaa46417efc75fc5f1e8eb87)
set(USD_VERSION 19.11)
set(USD_VERSION 20.05)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH 79ff176167b3fe85f4953abd6cc5e0cc)
set(USD_HASH 6d679e739e7f65725d9c029e37dda9fc)
set(OIDN_VERSION 1.0.0)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.zip)
set(OIDN_HASH 19fe67b0164e8f020ac8a4f520defe60)
set(OIDN_VERSION 1.2.1)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH cbebc1a25eb6de62af3a59e943063608)
set(LIBGLU_VERSION 9.0.1)
set(LIBGLU_URI ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${LIBGLU_VERSION}.tar.xz)
@@ -319,6 +305,9 @@ set(MESA_VERSION 18.3.1)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)
set(XR_OPENXR_SDK_VERSION 1.0.6)
set(XR_OPENXR_SDK_VERSION 1.0.8)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 21daea7c3bfec365298d779a0e19caa1)
set(XR_OPENXR_SDK_HASH c6de63d2e0f9029aa58dfa97cad8ce07)
set(ISPC_VERSION v1.13.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 4bf5e8d0020c4b9980faa702c1a6f25f)

View File

@@ -18,9 +18,6 @@
if(WIN32)
set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST})
set(X264_PATCH_CMD ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/x264/src/external_x264 < ${PATCH_DIR}/x264.diff)
else()
set(X264_PATCH_CMD echo .)
endif()
@@ -29,7 +26,6 @@ ExternalProject_Add(external_x264
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH SHA256=${X264_HASH}
PREFIX ${BUILD_DIR}/x264
PATCH_COMMAND ${X264_PATCH_CMD}
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
--enable-static
--enable-pic

View File

@@ -376,8 +376,9 @@ USE_CXX11=true
CLANG_FORMAT_VERSION_MIN="6.0"
PYTHON_VERSION="3.7.4"
PYTHON_VERSION="3.7.7"
PYTHON_VERSION_MIN="3.7"
PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_MIN
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false
@@ -436,7 +437,7 @@ OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.4.0_RC2"
OSD_VERSION="3.4.3"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
@@ -458,7 +459,7 @@ ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
USD_VERSION="19.11"
USD_VERSION="20.05"
USD_FORCE_BUILD=false
USD_FORCE_REBUILD=false
USD_SKIP=false
@@ -468,7 +469,7 @@ OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
EMBREE_VERSION="3.8.0"
EMBREE_VERSION="3.10.0"
EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false
@@ -478,14 +479,14 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false
OIDN_SKIP=false
FFMPEG_VERSION="4.0.2"
FFMPEG_VERSION="4.2.3"
FFMPEG_VERSION_MIN="2.8.4"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.6"
XR_OPENXR_VERSION="1.0.8"
XR_OPENXR_FORCE_BUILD=false
XR_OPENXR_FORCE_REBUILD=false
XR_OPENXR_SKIP=false
@@ -1029,7 +1030,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl1.2, libglew, [libglewmx].\""
* libsdl2, libglew, [libglewmx].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1535,11 +1536,13 @@ _update_deps_tbb() {
OSD_FORCE_REBUILD=true
OPENVDB_FORCE_REBUILD=true
USD_FORCE_REBUILD=true
EMBREE_FORCE_REBUILD=true
OIDN_FORCE_REBUILD=true
if [ "$_is_building" = true ]; then
OSD_FORCE_BUILD=true
OPENVDB_FORCE_BUILD=true
USD_FORCE_BUILD=true
EMBREE_FORCE_BUILD=true
OIDN_FORCE_BUILD=true
fi
}
@@ -1571,7 +1574,7 @@ compile_TBB() {
if [ ! -d $_inst ]; then
INFO "Building TBB-$TBB_VERSION$TBB_VERSION_UPDATE"
_is_building=true
# Rebuild dependencies as well!
_update_deps_tbb
@@ -1688,7 +1691,7 @@ compile_OCIO() {
if [ ! -d $_inst ]; then
INFO "Building OpenColorIO-$OCIO_VERSION"
_is_building=true
# Rebuild dependencies as well!
_update_deps_ocio
@@ -2985,7 +2988,7 @@ compile_Embree() {
fi
# To be changed each time we make edits that would modify the compiled results!
embree_magic=9
embree_magic=10
_init_embree
# Clean install if needed!
@@ -3039,9 +3042,13 @@ compile_Embree() {
cmake_d="$cmake_d -D EMBREE_RAY_MASK=ON"
cmake_d="$cmake_d -D EMBREE_FILTER_FUNCTION=ON"
cmake_d="$cmake_d -D EMBREE_BACKFACE_CULLING=OFF"
cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=INTERNAL"
cmake_d="$cmake_d -D EMBREE_MAX_ISA=AVX2"
cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=TBB"
if [ -d $INST/tbb ]; then
make_d="$make_d EMBREE_TBB_ROOT=$INST/tbb"
fi
cmake $cmake_d ../
make -j$THREADS && make install
@@ -3517,7 +3524,7 @@ install_DEB() {
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
# libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true
@@ -3668,9 +3675,11 @@ install_DEB() {
INFO "Forced Python/NumPy building, as requested..."
_do_compile_python=true
else
check_package_DEB python$PYTHON_VERSION_MIN-dev
check_package_version_ge_DEB python3-dev $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB python$PYTHON_VERSION_MIN-dev
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
install_packages_DEB python3-dev
clean_Python
PRINT ""
if [ "$NUMPY_SKIP" = true ]; then
@@ -3883,7 +3892,6 @@ install_DEB() {
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
# No package currently, only HDF5!
compile_ALEMBIC
fi
@@ -4163,7 +4171,7 @@ install_RPM() {
THEORA_DEV="libtheora-devel"
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
@@ -4290,8 +4298,10 @@ install_RPM() {
INFO "Forced Python/NumPy building, as requested..."
_do_compile_python=true
else
check_package_version_match_RPM python3-devel $PYTHON_VERSION_MIN
check_package_version_ge_RPM python3-devel $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_RPM python3-devel` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
install_packages_RPM python3-devel
clean_Python
PRINT ""
@@ -4724,7 +4734,7 @@ install_ARCH() {
_packages="$BASE_DEVEL git cmake \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl fftw \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc"
OPENJPEG_USE=true
@@ -4815,6 +4825,8 @@ install_ARCH() {
else
check_package_version_ge_ARCH python $PYTHON_VERSION_MIN
if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_ARCH python` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
install_packages_ARCH python
clean_Python
PRINT ""
@@ -5405,11 +5417,11 @@ print_info() {
PRINT " $_1"
_buildargs="$_buildargs $_1"
_1="-D PYTHON_VERSION=$PYTHON_VERSION_MIN"
_1="-D PYTHON_VERSION=$PYTHON_VERSION_INSTALLED"
PRINT " $_1"
_buildargs="$_buildargs $_1"
if [ -d "$INST/python-$PYTHON_VERSION_MIN" ]; then
_1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_MIN"
if [ -d "$INST/python-$PYTHON_VERSION_INSTALLED" ]; then
_1="-D PYTHON_ROOT_DIR=$INST/python-$PYTHON_VERSION_INSTALLED"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi

View File

@@ -1,20 +0,0 @@
cmake_minimum_required(VERSION 2.8)
project(hidapi)
set(SRC_FILES
windows/hid.c
)
set(HEADER_FILES
hidapi/hidapi.h
)
include_directories(hidapi)
add_definitions(-DHID_API_STATIC)
add_library(hidapi STATIC ${SRC_FILES} ${HEADER_FILES})
install(TARGETS hidapi DESTINATION lib)
INSTALL(FILES hidapi/hidapi.h
DESTINATION "include"
)

View File

@@ -0,0 +1,14 @@
diff -Naur orig/common/sys/platform.h external_embree/common/sys/platform.h
--- orig/common/sys/platform.h 2020-05-13 23:08:53 -0600
+++ external_embree/common/sys/platform.h 2020-06-13 17:40:26 -0600
@@ -84,8 +84,8 @@
////////////////////////////////////////////////////////////////////////////////
#ifdef __WIN32__
-#define dll_export __declspec(dllexport)
-#define dll_import __declspec(dllimport)
+#define dll_export
+#define dll_import
#else
#define dll_export __attribute__ ((visibility ("default")))
#define dll_import

View File

@@ -1,15 +0,0 @@
--- hidapi/hidapi.h 2011-10-25 20:58:16 -0600
+++ hidapi/hidapi.h 2016-11-01 12:05:58 -0600
@@ -30,7 +30,11 @@
#include <wchar.h>
#ifdef _WIN32
- #define HID_API_EXPORT __declspec(dllexport)
+ #ifdef HID_API_STATIC
+ #define HID_API_EXPORT
+ #else
+ #define HID_API_EXPORT __declspec(dllexport)
+ #endif
#define HID_API_CALL
#else
#define HID_API_EXPORT /**< API export macro */

View File

@@ -0,0 +1,36 @@
diff -Naur external_ispc/CMakeLists.txt external_ispc_fixed/CMakeLists.txt
--- external_ispc/CMakeLists.txt 2020-04-23 17:29:06 -0600
+++ external_ispc_fixed/CMakeLists.txt 2020-05-05 09:01:09 -0600
@@ -389,7 +389,7 @@
# Link against Clang libraries
foreach(clangLib ${CLANG_LIBRARY_LIST})
- find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS})
+ find_library(${clangLib}Path NAMES ${clangLib} HINTS ${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIR})
list(APPEND CLANG_LIBRARY_FULL_PATH_LIST ${${clangLib}Path})
endforeach()
target_link_libraries(${PROJECT_NAME} ${CLANG_LIBRARY_FULL_PATH_LIST})
diff -Naur orig/CMakeLists.txt external_ispc/CMakeLists.txt
--- orig/CMakeLists.txt 2020-05-05 09:19:11 -0600
+++ external_ispc/CMakeLists.txt 2020-05-05 09:26:44 -0600
@@ -333,7 +333,7 @@
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
- ${LLVM_INCLUDE_DIRS}
+ ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
# Compile options
diff -Naur orig/cmake/GenerateBuiltins.cmake.txt external_ispc/cmake/GenerateBuiltins.cmake.txt
+++ orig/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
+++ external_ispc/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
@@ -97,6 +97,8 @@
if ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "x86")
set(target_arch "i386")
+ # Blender: disable 32bit due to build issues on Linux and being unnecessary.
+ set(SKIP ON)
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
set(target_arch "x86_64")
elseif ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "arm")

View File

@@ -1,13 +0,0 @@
diff -Naur external_openal_original/CMakeLists.txt external_openal/CMakeLists.txt
--- external_openal_original/CMakeLists.txt 2016-01-24 20:12:39 -0700
+++ external_openal/CMakeLists.txt 2018-06-02 12:16:52 -0600
@@ -885,7 +885,8 @@
OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
IF(HAVE_WINDOWS_H)
# Check MMSystem backend
- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
+ set(CMAKE_REQUIRED_FLAGS "-D_WIN32_WINNT=0x0502")
+ CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
IF(HAVE_MMSYSTEM_H)
CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
IF(HAVE_LIBWINMM)

View File

@@ -1,120 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70ec895..e616b63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,7 +178,9 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION "0")
## Open Image Denoise examples
## ----------------------------------------------------------------------------
-add_subdirectory(examples)
+if(WITH_EXAMPLE)
+ add_subdirectory(examples)
+endif()
## ----------------------------------------------------------------------------
## Open Image Denoise install and packaging
Submodule mkl-dnn contains modified content
diff --git a/mkl-dnn/cmake/TBB.cmake b/mkl-dnn/cmake/TBB.cmake
index 0711e699..c14210b6 100644
--- a/mkl-dnn/cmake/TBB.cmake
+++ b/mkl-dnn/cmake/TBB.cmake
@@ -138,13 +138,13 @@ else()
set(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
if(APPLE)
find_path(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${TBB_ROOT}/include NO_DEFAULT_PATH)
- find_library(TBB_LIBRARY tbb PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
- find_library(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ find_library(TBB_LIBRARY tbb_static PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ find_library(TBB_LIBRARY_MALLOC tbbmalloc_static PATHS ${TBB_ROOT}/lib NO_DEFAULT_PATH)
else()
find_path(TBB_INCLUDE_DIR tbb/task_scheduler_init.h PATHS ${TBB_ROOT}/include NO_DEFAULT_PATH)
set(TBB_HINTS HINTS ${TBB_ROOT}/lib/intel64/gcc4.4 ${TBB_ROOT}/lib ${TBB_ROOT}/lib64 PATHS /usr/libx86_64-linux-gnu/)
- find_library(TBB_LIBRARY tbb ${TBB_HINTS})
- find_library(TBB_LIBRARY_MALLOC tbbmalloc ${TBB_HINTS})
+ find_library(TBB_LIBRARY tbb_static ${TBB_HINTS})
+ find_library(TBB_LIBRARY_MALLOC tbbmalloc_static ${TBB_HINTS})
endif()
endif()
diff '--ignore-matching-lines=:' -ur '--exclude=*.svn*' -u -r
--- a/cmake/install.cmake 2019-08-12 18:02:20.794402575 +0200
+++ b/cmake/install.cmake 2019-08-12 18:06:07.470045703 +0200
@@ -18,6 +18,13 @@
## Install library
## ----------------------------------------------------------------------------
+if(UNIX)
+install(FILES
+ ${CMAKE_BINARY_DIR}/libOpenImageDenoise.a
+ ${CMAKE_BINARY_DIR}/libmkldnn.a
+ ${CMAKE_BINARY_DIR}/libcommon.a
+ DESTINATION ${CMAKE_INSTALL_LIBDIR})
+else()
install(TARGETS ${PROJECT_NAME}
EXPORT
${PROJECT_NAME}_Export
@@ -38,6 +45,7 @@
DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
)
endif()
+endif()
## ----------------------------------------------------------------------------
## Install headers
@@ -78,6 +86,7 @@
## Install CMake configuration files
## ----------------------------------------------------------------------------
+if(NOT UNIX)
install(EXPORT ${PROJECT_NAME}_Export
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
#NAMESPACE ${PROJECT_NAME}::
@@ -92,3 +101,4 @@
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel
)
+endif()
diff '--ignore-matching-lines=:' -ur '--exclude=*.svn*' -u -r
--- a/CMakeLists.txt 2019-08-12 14:22:00.974078598 +0200
+++ b/CMakeLists.txt 2019-08-12 18:05:05.949057375 +0200
@@ -14,7 +14,11 @@
## limitations under the License. ##
## ======================================================================== ##
-cmake_minimum_required(VERSION 3.1)
+if(UNIX)
+ cmake_minimum_required(VERSION 3.1)
+else()
+ cmake_minimum_required(VERSION 3.13)
+endif()
set(OIDN_VERSION_MAJOR 1)
set(OIDN_VERSION_MINOR 0)
@@ -32,13 +36,8 @@
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
# Build as shared or static library
-if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
- option(OIDN_STATIC_LIB "Build Open Image Denoise as a static library.")
- mark_as_advanced(CLEAR OIDN_STATIC_LIB)
-else()
- set(OIDN_STATIC_LIB OFF CACHE BOOL "Build Open Image Denoise as a static library." FORCE)
- mark_as_advanced(OIDN_STATIC_LIB)
-endif()
+option(OIDN_STATIC_LIB "Build Open Image Denoise as a static library.")
+mark_as_advanced(CLEAR OIDN_STATIC_LIB)
if(OIDN_STATIC_LIB)
set(OIDN_LIB_TYPE STATIC)
else()
diff -Naur orig/core/api.cpp external_openimagedenoise/core/api.cpp
--- orig/core/api.cpp 2019-07-19 08:37:04 -0600
+++ external_openimagedenoise/core/api.cpp 2020-01-21 15:10:56 -0700
@@ -15,7 +15,7 @@
// ======================================================================== //
#ifdef _WIN32
-# define OIDN_API extern "C" __declspec(dllexport)
+# define OIDN_API extern "C"
#else
# define OIDN_API extern "C" __attribute__ ((visibility ("default")))
#endif

View File

@@ -0,0 +1,36 @@
diff -Naur orig/CMakeLists.txt external_openimageio/CMakeLists.txt
--- orig/CMakeLists.txt 2020-05-10 21:43:52 -0600
+++ external_openimageio/CMakeLists.txt 2020-05-13 17:03:35 -0600
@@ -170,7 +170,7 @@
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
- add_subdirectory (src/testtex)
+ #add_subdirectory (src/testtex)
add_subdirectory (src/iv)
endif ()
diff -Naur orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler.cmake
--- orig/src/cmake/compiler.cmake 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/cmake/compiler.cmake 2020-05-13 17:02:54 -0600
@@ -172,6 +172,7 @@
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)
+ add_definitions (-DOPJ_STATIC)
endif (MSVC)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"
diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/include/OpenImageIO/platform.h
--- orig/src/include/OpenImageIO/platform.h 2020-05-10 21:43:52 -0600
+++ external_openimageio/src/include/OpenImageIO/platform.h 2020-05-13 17:04:36 -0600
@@ -41,6 +41,9 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
+# ifndef NOGDI
+# define NOGDI
+# endif
# include <windows.h>
#endif

View File

@@ -1,26 +0,0 @@
Index: OpenImageIO/osdep.h
===================================================================
--- OpenImageIO/osdep.h (revision 61595)
+++ OpenImageIO/osdep.h (working copy)
@@ -34,6 +34,7 @@
# define WIN32_LEAN_AND_MEAN
# define VC_EXTRALEAN
# define NOMINMAX
+# define NOGDI
# include <windows.h>
#endif
Index: OpenImageIO/platform.h
===================================================================
--- OpenImageIO/platform.h (revision 61595)
+++ OpenImageIO/platform.h (working copy)
@@ -77,6 +77,9 @@
# ifndef NOMINMAX
# define NOMINMAX
# endif
+# ifndef NOGDI
+# define NOGDI
+# endif
# include <windows.h>
#endif

View File

@@ -1,22 +0,0 @@
diff -Naur external_openimageio.orig/src/cmake/compiler.cmake external_openimageio/src/cmake/compiler.cmake
--- external_openimageio.orig/src/cmake/compiler.cmake 2018-07-31 23:45:19 -0600
+++ external_openimageio/src/cmake/compiler.cmake 2018-08-16 12:50:12 -0600
@@ -152,6 +152,7 @@
add_definitions (-D_CRT_NONSTDC_NO_WARNINGS)
add_definitions (-D_SCL_SECURE_NO_WARNINGS)
add_definitions (-DJAS_WIN_MSVC_BUILD)
+ add_definitions (-DOPJ_STATIC)
endif (MSVC)
# Use ccache if found
--- external_openimageio.orig/CMakeLists.txt 2018-07-31 23:45:19 -0600
+++ external_openimageio/CMakeLists.txt 2018-08-17 15:22:56 -0600
@@ -169,7 +169,7 @@
add_subdirectory (src/iinfo)
add_subdirectory (src/maketx)
add_subdirectory (src/oiiotool)
- add_subdirectory (src/testtex)
+# add_subdirectory (src/testtex)
add_subdirectory (src/iv)
endif ()

View File

@@ -48,3 +48,22 @@ diff -Naur OpenShadingLanguage-Release-1.9.9/src/liboslexec/llvm_util.cpp extern
size_t
LLVM_Util::total_jit_memory_held ()
diff -Naur OpenShadingLanguage-Release-1.9.9/CMakeLists.txt external_osl/CMakeLists.txt
--- orig/CMakeLists.txt 2020-01-27 16:22:31 -0700
+++ external_osl/CMakeLists.txt 2020-05-13 18:04:52 -0600
@@ -102,10 +102,11 @@
set (OPTIX_EXTRA_LIBS CACHE STRING "Extra lib targets needed for OptiX")
set (CUDA_TARGET_ARCH "sm_35" CACHE STRING "CUDA GPU architecture (e.g. sm_35)")
-# set (USE_OIIO_STATIC ON CACHE BOOL "If OIIO is built static")
-# if (USE_OIIO_STATIC)
-# add_definitions ("-DOIIO_STATIC_BUILD=1")
-# endif ()
+set (USE_OIIO_STATIC ON CACHE BOOL "If OIIO is built static")
+if (USE_OIIO_STATIC)
+ add_definitions ("-DOIIO_STATIC_BUILD=1")
+ add_definitions ("-DOIIO_STATIC_DEFINE=1")
+endif ()
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM)

View File

@@ -1,14 +1,3 @@
diff -x .git -ur usd.orig/cmake/defaults/Options.cmake external_usd/cmake/defaults/Options.cmake
--- usd.orig/cmake/defaults/Options.cmake 2019-10-24 22:39:53.000000000 +0200
+++ external_usd/cmake/defaults/Options.cmake 2019-11-28 13:00:33.197957712 +0100
@@ -25,6 +25,7 @@
option(PXR_VALIDATE_GENERATED_CODE "Validate script generated code" OFF)
option(PXR_HEADLESS_TEST_MODE "Disallow GUI based tests, useful for running under headless CI systems." OFF)
option(PXR_BUILD_TESTS "Build tests" ON)
+option(PXR_BUILD_USD_TOOLS "Build commandline tools" ON)
option(PXR_BUILD_IMAGING "Build imaging components" ON)
option(PXR_BUILD_EMBREE_PLUGIN "Build embree imaging plugin" OFF)
option(PXR_BUILD_OPENIMAGEIO_PLUGIN "Build OpenImageIO plugin" OFF)
diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
--- usd.orig/cmake/defaults/Packages.cmake 2019-10-24 22:39:53.000000000 +0200
+++ external_usd/cmake/defaults/Packages.cmake 2019-11-28 13:00:33.185957483 +0100
@@ -21,11 +10,11 @@ diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defau
add_definitions(${TBB_DEFINITIONS})
# --math
diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base/lib/plug/initConfig.cpp
--- usd.orig/pxr/base/lib/plug/initConfig.cpp 2019-10-24 22:39:53.000000000 +0200
+++ external_usd/pxr/base/lib/plug/initConfig.cpp 2019-12-11 11:00:37.643323127 +0100
@@ -69,8 +69,38 @@
diff -x .git -ur usd.orig/pxr/base/plug/initConfig.cpp external_usd/pxr/base/plug/initConfig.cpp
--- usd.orig/pxr/base/plug/initConfig.cpp.orig 2020-06-12 17:20:07.478199779 +0200
+++ external_usd/pxr/base/plug/initConfig.cpp 2020-06-12 17:25:28.648588552 +0200
@@ -69,10 +69,40 @@
ARCH_CONSTRUCTOR(Plug_InitConfig, 2, void)
{
+ /* The contents of this constructor have been moved to usd_initialise_plugin_path(...) */
@@ -50,7 +39,9 @@ diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base
+usd_initialise_plugin_path(const char *datafiles_usd_path)
+{
std::vector<std::string> result;
std::vector<std::string> debugMessages;
+ // Add Blender-specific paths. They MUST end in a slash, or symlinks will not be treated as directory.
+ if (datafiles_usd_path != NULL && datafiles_usd_path[0] != '\0') {
+ std::string datafiles_usd_path_str(datafiles_usd_path);
@@ -60,14 +51,14 @@ diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base
+ result.push_back(datafiles_usd_path_str);
+ }
+
// Determine the absolute path to the Plug shared library.
// Any relative paths specified in the plugin search path will be
// anchored to this directory, to allow for relocatability.
@@ -94,9 +124,24 @@
_AppendPathList(&result, installLocation, sharedLibPath);
// Determine the absolute path to the Plug shared library. Any relative
// paths specified in the plugin search path will be anchored to this
// directory, to allow for relocatability. Note that this can fail when pxr
@@ -114,9 +144,24 @@
_AppendPathList(&result, installLocation, binaryPath);
#endif // PXR_INSTALL_LOCATION
- Plug_SetPaths(result);
- Plug_SetPaths(result, debugMessages);
-}
+ if (!TfGetenv("PXR_PATH_DEBUG").empty()) {
+ printf("USD Plugin paths: (%zu in total):\n", result.size());
@@ -75,10 +66,10 @@ diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base
+ printf(" %s\n", path.c_str());
+ }
+ }
+ Plug_SetPaths(result);
+ Plug_SetPaths(result, debugMessages);
}
PXR_NAMESPACE_CLOSE_SCOPE
+
+/* Workaround to make it possible to pass a path at runtime to USD. */
@@ -90,37 +81,6 @@ diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base
+ PXR_NS::usd_initialise_plugin_path(datafiles_usd_path);
+}
+}
diff -x .git -ur usd.orig/pxr/usd/CMakeLists.txt external_usd/pxr/usd/CMakeLists.txt
--- usd.orig/pxr/usd/CMakeLists.txt 2019-10-24 22:39:53.000000000 +0200
+++ external_usd/pxr/usd/CMakeLists.txt 2019-11-28 13:00:33.197957712 +0100
@@ -1,6 +1,5 @@
set(DIRS
lib
- bin
plugin
)
@@ -8,3 +7,8 @@
add_subdirectory(${d})
endforeach()
+if (PXR_BUILD_USD_TOOLS)
+ add_subdirectory(bin)
+else()
+ message(STATUS "Skipping commandline tools because PXR_BUILD_USD_TOOLS=OFF")
+endif()
diff -Naur external_usd_orig/pxr/base/lib/tf/preprocessorUtils.h external_usd/pxr/base/lib/tf/preprocessorUtils.h
--- external_usd_orig/pxr/base/lib/tf/preprocessorUtils.h 2019-10-24 14:39:53 -0600
+++ external_usd/pxr/base/lib/tf/preprocessorUtils.h 2020-01-14 09:30:18 -0700
@@ -189,7 +189,7 @@
/// Exapnds to 1 if the argument is a tuple, and 0 otherwise.
/// \ingroup group_tf_Preprocessor
/// \hideinitializer
-#if defined(ARCH_OS_WINDOWS)
+#if defined(ARCH_COMPILER_MSVC)
#define TF_PP_IS_TUPLE(sequence) \
BOOST_VMD_IS_TUPLE(sequence)
#else
diff -Naur external_usd_base/cmake/macros/Public.cmake external_usd/cmake/macros/Public.cmake
--- external_usd_base/cmake/macros/Public.cmake 2019-10-24 14:39:53 -0600
+++ external_usd/cmake/macros/Public.cmake 2020-01-11 13:33:29 -0700

View File

@@ -1,22 +0,0 @@
--- x264-snapshot-20180811-2245-stable\configure 2018-08-11 14:45:05 -0600
+++ external_x264\configure 2018-08-11 23:51:35 -0600
@@ -396,7 +396,7 @@
# list of all preprocessor HAVE values we can define
CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
- MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R BITDEPTH8 BITDEPTH10"
+ MSA MMAP WINRT VSX ARM_INLINE_ASM BITDEPTH8 BITDEPTH10"
# parse options
@@ -1071,10 +1071,6 @@
define HAVE_LOG2F
fi
-if cc_check 'string.h' '' 'strtok_r(0, 0, 0);' ; then
- define HAVE_STRTOK_R
-fi
-
if [ "$SYS" != "WINDOWS" ] && cpp_check "sys/mman.h unistd.h" "" "defined(MAP_PRIVATE)"; then
define HAVE_MMAP
fi

View File

@@ -8,7 +8,7 @@ Code signing is done as part of INSTALL target, which makes it possible to sign
files which are aimed into a bundle and coming from a non-signed source (such as
libraries SVN).
This is achieved by specifying `slave_codesign.cmake` as a post-install script
This is achieved by specifying `worker_codesign.cmake` as a post-install script
run by CMake. This CMake script simply involves an utility script written in
Python which takes care of an actual signing.

View File

@@ -40,8 +40,8 @@ class Builder:
# Buildbot runs from build/ directory
self.blender_dir = os.path.abspath(os.path.join('..', 'blender.git'))
self.build_dir = os.path.abspath(os.path.join('..', 'build', name))
self.install_dir = os.path.abspath(os.path.join('..', 'install', name))
self.build_dir = os.path.abspath(os.path.join('..', 'build'))
self.install_dir = os.path.abspath(os.path.join('..', 'install'))
self.upload_dir = os.path.abspath(os.path.join('..', 'install'))
# Detect platform
@@ -51,7 +51,7 @@ class Builder:
elif name.startswith('linux'):
self.platform = 'linux'
if is_tool('scl'):
self.command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
self.command_prefix = ['scl', 'enable', 'devtoolset-9', '--']
else:
self.command_prefix = []
elif name.startswith('win'):
@@ -78,27 +78,26 @@ class VersionInfo:
blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
self.version = "%d.%d" % (version_number // 100, version_number % 100)
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH'))
version_numbers = (version_number // 100, version_number % 100, version_number_patch)
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
# Final release
self.full_version = self.version + self.version_char
self.full_version = self.version
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
if len(self.version_char) == 0:
self.full_version = self.version + version_cycle
else:
self.full_version = self.version + self.version_char + '-' + version_cycle
self.full_version = self.version + version_cycle
self.is_development_build = False
else:
# Development build
self.full_version = self.version + self.version_char + '-' + self.hash
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):

View File

@@ -48,6 +48,7 @@ import shutil
import subprocess
import time
import tarfile
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -121,21 +122,10 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
# Consider this an input of the code signing server.
unsigned_storage_dir: Path
# Information about archive which contains files which are to be signed.
#
# This archive is created by the buildbot worked and acts as an input for
# the code signing server.
unsigned_archive_info: ArchiveWithIndicator
# Storage where signed files are stored.
# Consider this an output of the code signer server.
signed_storage_dir: Path
# Information about archive which contains signed files.
#
# This archive is created by the code signing server.
signed_archive_info: ArchiveWithIndicator
# Platform the code is currently executing on.
platform: util.Platform
@@ -146,50 +136,44 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
# Unsigned (signing server input) configuration.
self.unsigned_storage_dir = absolute_shared_storage_dir / 'unsigned'
self.unsigned_archive_info = ArchiveWithIndicator(
self.unsigned_storage_dir, 'unsigned_files.tar', 'ready.stamp')
# Signed (signing server output) configuration.
self.signed_storage_dir = absolute_shared_storage_dir / 'signed'
self.signed_archive_info = ArchiveWithIndicator(
self.signed_storage_dir, 'signed_files.tar', 'ready.stamp')
self.platform = util.get_current_platform()
"""
General note on cleanup environment functions.
It is expected that there is only one instance of the code signer server
running for a given input/output directory, and that it serves a single
buildbot worker.
By its nature, a buildbot worker only produces one build at a time and
never performs concurrent builds.
This leads to a conclusion that when starting in a clean environment
there shouldn't be any archives remaining from a previous build.
However, it is possible to have various failure scenarios which might
leave the environment in a non-clean state:
- Network hiccup which makes buildbot worker to stop current build
and re-start it after connection to server is re-established.
Note, this could also happen during buildbot server maintenance.
- Signing server might get restarted due to updates or other reasons.
Requiring manual interaction in such cases is not something good to
require, so here we simply assume that the system is used the way it is
intended to and restore environment to a prestine clean state.
"""
def cleanup_environment_for_builder(self) -> None:
self.unsigned_archive_info.clean()
self.signed_archive_info.clean()
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even mor etricky.
pass
def cleanup_environment_for_signing_server(self) -> None:
# Don't clear the requested to-be-signed archive since we might be
# restarting signing machine while the buildbot is busy.
self.signed_archive_info.clean()
# TODO(sergey): Revisit need of cleaning up the existing files.
# In practice it wasn't so helpful, and with multiple clients
# talking to the same server it becomes even mor etricky.
pass
def generate_request_id(self) -> str:
"""
Generate an unique identifier for code signing request.
"""
return str(uuid.uuid4())
def archive_info_for_request_id(
self, path: Path, request_id: str) -> ArchiveWithIndicator:
return ArchiveWithIndicator(
path, f'{request_id}.tar', f'{request_id}.ready')
def signed_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.signed_storage_dir, request_id)
def unsigned_archive_info_for_request_id(
self, request_id: str) -> ArchiveWithIndicator:
return self.archive_info_for_request_id(
self.unsigned_storage_dir, request_id)
############################################################################
# Buildbot worker side helpers.
@@ -232,7 +216,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
if self.check_file_is_to_be_signed(file)]
return files_to_be_signed
def wait_for_signed_archive_or_die(self) -> None:
def wait_for_signed_archive_or_die(self, request_id) -> None:
"""
Wait until archive with signed files is available.
@@ -240,13 +224,19 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
is still no responce from the signing server the application will exit
with a non-zero exit code.
"""
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
timeout_in_seconds = self.config.TIMEOUT_IN_SECONDS
time_start = time.monotonic()
while not self.signed_archive_info.is_ready():
while not signed_archive_info.is_ready():
time.sleep(1)
time_slept_in_seconds = time.monotonic() - time_start
if time_slept_in_seconds > timeout_in_seconds:
self.unsigned_archive_info.clean()
unsigned_archive_info.clean()
raise SystemExit("Signing server didn't finish signing in "
f"{timeout_in_seconds} seconds, dying :(")
@@ -303,13 +293,19 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
return
logger_builder.info('Found %d files to sign.', len(files))
request_id = self.generate_request_id()
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
pack_files(files=files,
archive_filepath=self.unsigned_archive_info.archive_filepath)
self.unsigned_archive_info.tag_ready()
archive_filepath=unsigned_archive_info.archive_filepath)
unsigned_archive_info.tag_ready()
# Wait for the signing server to finish signing.
logger_builder.info('Waiting signing server to sign the files...')
self.wait_for_signed_archive_or_die()
self.wait_for_signed_archive_or_die(request_id)
# Extract signed files from archive and move files to final location.
with TemporaryDirectory(prefix='blender-buildbot-') as temp_dir_str:
@@ -317,7 +313,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
logger_builder.info('Extracting signed files from archive...')
extract_files(
archive_filepath=self.signed_archive_info.archive_filepath,
archive_filepath=signed_archive_info.archive_filepath,
extraction_dir=unpacked_signed_files_dir)
destination_dir = path
@@ -327,19 +323,44 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
unpacked_signed_files_dir, destination_dir)
logger_builder.info('Removing archive with signed files...')
self.signed_archive_info.clean()
signed_archive_info.clean()
############################################################################
# Signing server side helpers.
def wait_for_sign_request(self) -> None:
def wait_for_sign_request(self) -> str:
"""
Wait for the buildbot to request signing of an archive.
Returns an identifier of signing request.
"""
# TOOD(sergey): Support graceful shutdown on Ctrl-C.
while not self.unsigned_archive_info.is_ready():
logger_server.info(
f'Waiting for a request directory {self.unsigned_storage_dir} to appear.')
while not self.unsigned_storage_dir.exists():
time.sleep(1)
logger_server.info(
'Waiting for a READY indicator of any signing request.')
request_id = None
while request_id is None:
for file in self.unsigned_storage_dir.iterdir():
if file.suffix != '.ready':
continue
request_id = file.stem
logger_server.info(f'Found READY for request ID {request_id}.')
if request_id is None:
time.sleep(1)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
while not unsigned_archive_info.is_ready():
time.sleep(1)
return request_id
@abc.abstractmethod
def sign_all_files(self, files: List[AbsoluteAndRelativeFileName]) -> None:
"""
@@ -348,7 +369,7 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
NOTE: Signing should happen in-place.
"""
def run_signing_pipeline(self):
def run_signing_pipeline(self, request_id: str):
"""
Run the full signing pipeline starting from the point when buildbot
worker have requested signing.
@@ -360,9 +381,14 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
with TemporaryDirectory(prefix='blender-codesign-') as temp_dir_str:
temp_dir = Path(temp_dir_str)
signed_archive_info = self.signed_archive_info_for_request_id(
request_id)
unsigned_archive_info = self.unsigned_archive_info_for_request_id(
request_id)
logger_server.info('Extracting unsigned files from archive...')
extract_files(
archive_filepath=self.unsigned_archive_info.archive_filepath,
archive_filepath=unsigned_archive_info.archive_filepath,
extraction_dir=temp_dir)
logger_server.info('Collecting all files which needs signing...')
@@ -374,11 +400,11 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
logger_server.info('Packing signed files...')
pack_files(files=files,
archive_filepath=self.signed_archive_info.archive_filepath)
self.signed_archive_info.tag_ready()
archive_filepath=signed_archive_info.archive_filepath)
signed_archive_info.tag_ready()
logger_server.info('Removing signing request...')
self.unsigned_archive_info.clean()
unsigned_archive_info.clean()
logger_server.info('Signing is complete.')
@@ -389,11 +415,11 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
while True:
logger_server.info('Waiting for the signing request in %s...',
self.unsigned_storage_dir)
self.wait_for_sign_request()
request_id = self.wait_for_sign_request()
logger_server.info(
'Got signing request, beging signign procedure.')
self.run_signing_pipeline()
f'Beging signign procedure for request ID {request_id}.')
self.run_signing_pipeline(request_id)
############################################################################
# Command executing.

View File

@@ -1,37 +0,0 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Runs on buildbot slave, rsync zip directly to buildbot server rather
# than using upload which is much slower
import buildbot_utils
import os
import sys
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
# rsync, this assumes ssh keys are setup so no password is needed
local_zip = "buildbot_upload.zip"
remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/"
remote_zip = remote_folder + "buildbot_upload_" + builder.name + ".zip"
command = ["rsync", "-avz", local_zip, remote_zip]
buildbot_utils.call(command)

View File

@@ -30,7 +30,7 @@ from tempfile import TemporaryDirectory, NamedTemporaryFile
from typing import List
BUILDBOT_DIRECTORY = Path(__file__).absolute().parent
CODESIGN_SCRIPT = BUILDBOT_DIRECTORY / 'slave_codesign.py'
CODESIGN_SCRIPT = BUILDBOT_DIRECTORY / 'worker_codesign.py'
BLENDER_GIT_ROOT_DIRECTORY = BUILDBOT_DIRECTORY.parent.parent
DARWIN_DIRECTORY = BLENDER_GIT_ROOT_DIRECTORY / 'release' / 'darwin'

View File

@@ -33,7 +33,7 @@ else()
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/slave_codesign.py"
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/worker_codesign.py"
"${CMAKE_INSTALL_PREFIX}"
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE exit_code

View File

@@ -25,7 +25,7 @@ import buildbot_utils
def get_cmake_options(builder):
post_install_script = os.path.join(
builder.blender_dir, 'build_files', 'buildbot', 'slave_codesign.cmake')
builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake')
config_file = "build_files/cmake/config/blender_release.cmake"
options = ['-DCMAKE_BUILD_TYPE:STRING=Release',
@@ -35,7 +35,7 @@ def get_cmake_options(builder):
options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
elif builder.platform == 'win':
options.extend(['-G', 'Visual Studio 15 2017 Win64'])
options.extend(['-G', 'Visual Studio 16 2019', '-A', 'x64'])
options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + post_install_script])
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"

View File

@@ -18,7 +18,7 @@
# <pep8 compliant>
# Runs on buildbot slave, creating a release package using the build
# Runs on buildbot worker, creating a release package using the build
# system and zipping it into buildbot_upload.zip. This is then uploaded
# to the master in the next buildbot step.
@@ -110,7 +110,7 @@ def pack_mac(builder):
release_dir = os.path.join(builder.blender_dir, 'release', 'darwin')
buildbot_dir = os.path.join(builder.blender_dir, 'build_files', 'buildbot')
bundle_script = os.path.join(buildbot_dir, 'slave_bundle_dmg.py')
bundle_script = os.path.join(buildbot_dir, 'worker_bundle_dmg.py')
command = [bundle_script]
command += ['--dmg', package_filepath]
@@ -167,7 +167,7 @@ def pack_linux(builder):
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
py_target = os.path.join(builder.install_dir, info.short_version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name

View File

@@ -1,65 +0,0 @@
# - Find HDF5 library
# Find the native HDF5 includes and libraries
# This module defines
# HDF5_INCLUDE_DIRS, where to find hdf5.h, Set when HDF5_INCLUDE_DIR is found.
# HDF5_LIBRARIES, libraries to link against to use HDF5.
# HDF5_ROOT_DIR, The base directory to search for HDF5.
# This can also be an environment variable.
# HDF5_FOUND, If false, do not try to use HDF5.
#
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If HDF5_ROOT_DIR was defined in the environment, use it.
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
ENDIF()
SET(_hdf5_SEARCH_DIRS
${HDF5_ROOT_DIR}
/opt/lib/hdf5
)
FIND_LIBRARY(HDF5_LIBRARY
NAMES
hdf5
HINTS
${_hdf5_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_PATH(HDF5_INCLUDE_DIR
NAMES
hdf5.h
HINTS
${_hdf5_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG HDF5_LIBRARY HDF5_INCLUDE_DIR)
IF(HDF5_FOUND)
SET(HDF5_LIBRARIES ${HDF5_LIBRARY})
SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
ENDIF(HDF5_FOUND)
MARK_AS_ADVANCED(
HDF5_INCLUDE_DIR
HDF5_LIBRARY
)
UNSET(_hdf5_SEARCH_DIRS)

View File

@@ -48,7 +48,14 @@ SET(_openimagedenoise_FIND_COMPONENTS
# These are needed when building statically
SET(_openimagedenoise_FIND_STATIC_COMPONENTS
common
# These additional library names change between versions, we list all of them
# so builds work with multiple versions. Missing libraries are skipped.
dnnl_cpu
dnnl_common
dnnl_cpu # Second time because of circular dependency
mkldnn
dnnl
)
SET(_openimagedenoise_LIBRARIES)

View File

@@ -11,6 +11,7 @@ set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)

View File

@@ -15,6 +15,7 @@ set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_EMBREE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEVICE_OPTIX OFF CACHE BOOL "" FORCE)
set(WITH_DRACO OFF CACHE BOOL "" FORCE)
@@ -52,6 +53,7 @@ set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_TBB OFF CACHE BOOL "" FORCE)
set(WITH_USD OFF CACHE BOOL "" FORCE)
if(UNIX AND NOT APPLE)
set(WITH_GHOST_XDND OFF CACHE BOOL "" FORCE)

View File

@@ -12,6 +12,7 @@ set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)

View File

@@ -437,7 +437,6 @@ function(SETUP_LIBDIRS)
if(WITH_ALEMBIC)
link_directories(${ALEMBIC_LIBPATH})
link_directories(${HDF5_LIBPATH})
endif()
if(WITH_GHOST_WAYLAND)
@@ -756,8 +755,7 @@ function(get_blender_version)
# - BLENDER_VERSION (major.minor)
# - BLENDER_VERSION_MAJOR
# - BLENDER_VERSION_MINOR
# - BLENDER_SUBVERSION (used for internal versioning mainly)
# - BLENDER_VERSION_CHAR (a, b, c, ...or empty string)
# - BLENDER_VERSION_PATCH
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
# So cmake depends on BKE_blender.h, beware of inf-loops!
@@ -767,25 +765,15 @@ function(get_blender_version)
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}")
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
if(NOT ${_out_version} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
endif()
if(NOT ${_out_subversion} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
endif()
# clumsy regex, only single char are ok but it could be unset
string(LENGTH "${_out_version_char}" _out_version_char_len)
if(NOT _out_version_char_len EQUAL 1)
set(_out_version_char "")
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
if(NOT ${_out_version_patch} MATCHES "[0-9]+")
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH")
endif()
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
@@ -795,23 +783,11 @@ function(get_blender_version)
math(EXPR _out_version_major "${_out_version} / 100")
math(EXPR _out_version_minor "${_out_version} % 100")
# for packaging, alpha to numbers
string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty)
if(${_out_version_char_empty})
set(_out_version_char_index "0")
else()
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
list(FIND _char_ls ${_out_version_char} _out_version_char_index)
math(EXPR _out_version_char_index "${_out_version_char_index} + 1")
endif()
# output vars
set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE)
set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE)
set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE)
set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE)
set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE)
set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE)
endfunction()

View File

@@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation")
set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR})
set(MINOR_VERSION ${BLENDER_VERSION_MINOR})
set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX})
set(PATCH_VERSION ${BLENDER_VERSION_PATCH})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})

View File

@@ -265,14 +265,8 @@ endif()
if(WITH_ALEMBIC)
find_package_wrapper(Alembic)
if(WITH_ALEMBIC_HDF5)
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
find_package_wrapper(HDF5)
endif()
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
if(NOT ALEMBIC_FOUND)
set(WITH_ALEMBIC OFF)
set(WITH_ALEMBIC_HDF5 OFF)
endif()
endif()

View File

@@ -190,7 +190,7 @@ if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC")
endif()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152")
set(PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
@@ -478,7 +478,7 @@ if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_BUILD)
add_definitions(-DOIIO_STATIC_DEFINE)
add_definitions(-DOIIO_NO_SSE=1)
endif()
@@ -539,10 +539,10 @@ if(WITH_OPENIMAGEDENOISE)
set(OPENIMAGEDENOISE_LIBRARIES
optimized ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise.lib
optimized ${OPENIMAGEDENOISE_LIBPATH}/common.lib
optimized ${OPENIMAGEDENOISE_LIBPATH}/mkldnn.lib
optimized ${OPENIMAGEDENOISE_LIBPATH}/dnnl.lib
debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib
debug ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib
debug ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib)
debug ${OPENIMAGEDENOISE_LIBPATH}/dnnl_d.lib)
set(OPENIMAGEDENOISE_DEFINITIONS)
endif()

View File

@@ -7,15 +7,14 @@ BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char
SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$"
else
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion
VERSION=$VERSION-$blender_version_cycle
SUBMODULE_EXCLUDE="^$" # dummy regex
fi

View File

@@ -119,4 +119,24 @@ Examples
To try these examples, just copy them into Blenders text editor and execute them.
To keep the examples relatively small, they just register a draw function that can't easily be removed anymore.
Blender has to be restarted in order to delete the draw handlers.
3D Lines with Single Color
--------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})
def draw():
shader.bind()
shader.uniform_float("color", (1, 1, 0, 1))
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,41 +1,65 @@
"""
Rendering the 3D View into a Texture
------------------------------------
Custom Shader for dotted 3D Line
--------------------------------
The scene has to have a camera for this example to work.
You could also make this independent of a specific camera,
but Blender does not expose good functions to create view and projection matrices yet.
In this example the arc length (distance to the first point on the line) is calculated in every vertex.
Between the vertex and fragment shader that value is automatically interpolated
for all points that will be visible on the screen.
In the fragment shader the ``sin`` of the arc length is calculated.
Based on the result a decision is made on whether the fragment should be drawn or not.
"""
import bpy
import bgl
import gpu
from gpu_extras.presets import draw_texture_2d
from random import random
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
WIDTH = 512
HEIGHT = 256
vertex_shader = '''
uniform mat4 u_ViewProjectionMatrix;
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
in vec3 position;
in float arcLength;
out float v_ArcLength;
void main()
{
v_ArcLength = arcLength;
gl_Position = u_ViewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float u_Scale;
in float v_ArcLength;
void main()
{
if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard;
gl_FragColor = vec4(1.0);
}
'''
coords = [Vector((random(), random(), random())) * 5 for _ in range(5)]
arc_lengths = [0]
for a, b in zip(coords[:-1], coords[1:]):
arc_lengths.append(arc_lengths[-1] + (a - b).length)
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'LINE_STRIP',
{"position": coords, "arcLength": arc_lengths},
)
def draw():
context = bpy.context
scene = context.scene
view_matrix = scene.camera.matrix_world.inverted()
projection_matrix = scene.camera.calc_matrix_camera(
context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)
offscreen.draw_view3d(
scene,
context.view_layer,
context.space_data,
context.region,
view_matrix,
projection_matrix)
bgl.glDisable(bgl.GL_DEPTH_TEST)
draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Scale", 10)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,65 +0,0 @@
"""
Custom Shader for dotted 3D Line
--------------------------------
In this example the arc length (distance to the first point on the line) is calculated in every vertex.
Between the vertex and fragment shader that value is automatically interpolated
for all points that will be visible on the screen.
In the fragment shader the ``sin`` of the arc length is calculated.
Based on the result a decision is made on whether the fragment should be drawn or not.
"""
import bpy
import gpu
from random import random
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
vertex_shader = '''
uniform mat4 u_ViewProjectionMatrix;
in vec3 position;
in float arcLength;
out float v_ArcLength;
void main()
{
v_ArcLength = arcLength;
gl_Position = u_ViewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float u_Scale;
in float v_ArcLength;
void main()
{
if (step(sin(v_ArcLength * u_Scale), 0.5) == 1) discard;
gl_FragColor = vec4(1.0);
}
'''
coords = [Vector((random(), random(), random())) * 5 for _ in range(5)]
arc_lengths = [0]
for a, b in zip(coords[:-1], coords[1:]):
arc_lengths.append(arc_lengths[-1] + (a - b).length)
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'LINE_STRIP',
{"position": coords, "arcLength": arc_lengths},
)
def draw():
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Scale", 10)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,19 +1,45 @@
"""
3D Lines with Single Color
--------------------------
Triangle with Custom Shader
---------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
coords = [(1, 1, 1), (-2, 0, 0), (-2, -1, 3), (0, 1, 1)]
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords})
vertex_shader = '''
uniform mat4 viewProjectionMatrix;
in vec3 position;
out vec3 pos;
void main()
{
pos = position;
gl_Position = viewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float brightness;
in vec3 pos;
void main()
{
gl_FragColor = vec4(pos * brightness, 1.0);
}
'''
coords = [(1, 1, 1), (2, 0, 0), (-2, -1, 3)]
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": coords})
def draw():
shader.bind()
shader.uniform_float("color", (1, 1, 0, 1))
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("viewProjectionMatrix", matrix)
shader.uniform_float("brightness", 0.5)
batch.draw(shader)

View File

@@ -1,45 +1,29 @@
"""
Triangle with Custom Shader
---------------------------
Wireframe Cube using Index Buffer
---------------------------------
"""
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
vertex_shader = '''
uniform mat4 viewProjectionMatrix;
coords = (
(-1, -1, -1), (+1, -1, -1),
(-1, +1, -1), (+1, +1, -1),
(-1, -1, +1), (+1, -1, +1),
(-1, +1, +1), (+1, +1, +1))
in vec3 position;
out vec3 pos;
indices = (
(0, 1), (0, 2), (1, 3), (2, 3),
(4, 5), (4, 6), (5, 7), (6, 7),
(0, 4), (1, 5), (2, 6), (3, 7))
void main()
{
pos = position;
gl_Position = viewProjectionMatrix * vec4(position, 1.0f);
}
'''
fragment_shader = '''
uniform float brightness;
in vec3 pos;
void main()
{
gl_FragColor = vec4(pos * brightness, 1.0);
}
'''
coords = [(1, 1, 1), (2, 0, 0), (-2, -1, 3)]
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": coords})
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)
def draw():
shader.bind()
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("viewProjectionMatrix", matrix)
shader.uniform_float("brightness", 0.5)
shader.uniform_float("color", (1, 0, 0, 1))
batch.draw(shader)

View File

@@ -1,30 +1,39 @@
"""
Wireframe Cube using Index Buffer
---------------------------------
Mesh with Random Vertex Colors
------------------------------
"""
import bpy
import gpu
import bgl
import numpy as np
from random import random
from gpu_extras.batch import batch_for_shader
coords = (
(-1, -1, -1), (+1, -1, -1),
(-1, +1, -1), (+1, +1, -1),
(-1, -1, +1), (+1, -1, +1),
(-1, +1, +1), (+1, +1, +1))
mesh = bpy.context.active_object.data
mesh.calc_loop_triangles()
indices = (
(0, 1), (0, 2), (1, 3), (2, 3),
(4, 5), (4, 6), (5, 7), (6, 7),
(0, 4), (1, 5), (2, 6), (3, 7))
vertices = np.empty((len(mesh.vertices), 3), 'f')
indices = np.empty((len(mesh.loop_triangles), 3), 'i')
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)
mesh.vertices.foreach_get(
"co", np.reshape(vertices, len(mesh.vertices) * 3))
mesh.loop_triangles.foreach_get(
"vertices", np.reshape(indices, len(mesh.loop_triangles) * 3))
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
batch = batch_for_shader(
shader, 'TRIS',
{"pos": vertices, "color": vertex_colors},
indices=indices,
)
def draw():
shader.bind()
shader.uniform_float("color", (1, 0, 0, 1))
bgl.glEnable(bgl.GL_DEPTH_TEST)
batch.draw(shader)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,39 +1,26 @@
"""
Mesh with Random Vertex Colors
------------------------------
2D Rectangle
------------
"""
import bpy
import gpu
import bgl
import numpy as np
from random import random
from gpu_extras.batch import batch_for_shader
mesh = bpy.context.active_object.data
mesh.calc_loop_triangles()
vertices = (
(100, 100), (300, 100),
(100, 200), (300, 200))
vertices = np.empty((len(mesh.vertices), 3), 'f')
indices = np.empty((len(mesh.loop_triangles), 3), 'i')
indices = (
(0, 1, 2), (2, 1, 3))
mesh.vertices.foreach_get(
"co", np.reshape(vertices, len(mesh.vertices) * 3))
mesh.loop_triangles.foreach_get(
"vertices", np.reshape(indices, len(mesh.loop_triangles) * 3))
vertex_colors = [(random(), random(), random(), 1) for _ in range(len(mesh.vertices))]
shader = gpu.shader.from_builtin('3D_SMOOTH_COLOR')
batch = batch_for_shader(
shader, 'TRIS',
{"pos": vertices, "color": vertex_colors},
indices=indices,
)
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
def draw():
bgl.glEnable(bgl.GL_DEPTH_TEST)
shader.bind()
shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
batch.draw(shader)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

View File

@@ -1,25 +1,36 @@
"""
2D Rectangle
------------
2D Image
--------
To use this example you have to provide an image that should be displayed.
"""
import bpy
import gpu
import bgl
from gpu_extras.batch import batch_for_shader
vertices = (
(100, 100), (300, 100),
(100, 200), (300, 200))
IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
indices = (
(0, 1, 2), (2, 1, 3))
shader = gpu.shader.from_builtin('2D_IMAGE')
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"pos": ((100, 100), (200, 100), (200, 200), (100, 200)),
"texCoord": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
if image.gl_load():
raise Exception()
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, image.bindcode)
shader.bind()
shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
shader.uniform_int("image", 0)
batch.draw(shader)

View File

@@ -1,37 +1,86 @@
"""
2D Image
--------
Generate a texture using Offscreen Rendering
--------------------------------------------
To use this example you have to provide an image that should be displayed.
#. Create an :class:`gpu.types.GPUOffScreen` object.
#. Draw some circles into it.
#. Make a new shader for drawing a planar texture in 3D.
#. Draw the generated texture using the new shader.
"""
import bpy
import gpu
import bgl
from mathutils import Matrix
from gpu_extras.batch import batch_for_shader
from gpu_extras.presets import draw_circle_2d
IMAGE_NAME = "Untitled"
image = bpy.data.images[IMAGE_NAME]
# Create and fill offscreen
##########################################
shader = gpu.shader.from_builtin('2D_IMAGE')
offscreen = gpu.types.GPUOffScreen(512, 512)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
with gpu.matrix.push_pop():
# reset matrices -> use normalized device coordinates [-1, 1]
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
amount = 10
for i in range(-amount, amount + 1):
x_pos = i / amount
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
# Drawing the generated texture in 3D space
#############################################
vertex_shader = '''
uniform mat4 modelMatrix;
uniform mat4 viewProjectionMatrix;
in vec2 position;
in vec2 uv;
out vec2 uvInterp;
void main()
{
uvInterp = uv;
gl_Position = viewProjectionMatrix * modelMatrix * vec4(position, 0.0, 1.0);
}
'''
fragment_shader = '''
uniform sampler2D image;
in vec2 uvInterp;
void main()
{
gl_FragColor = texture(image, uvInterp);
}
'''
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"pos": ((100, 100), (200, 100), (200, 200), (100, 200)),
"texCoord": ((0, 0), (1, 0), (1, 1), (0, 1)),
"position": ((-1, -1), (1, -1), (1, 1), (-1, 1)),
"uv": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
if image.gl_load():
raise Exception()
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, image.bindcode)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, offscreen.color_texture)
shader.bind()
shader.uniform_int("image", 0)
shader.uniform_float("modelMatrix", Matrix.Translation((1, 2, 3)) @ Matrix.Scale(3, 4))
shader.uniform_float("viewProjectionMatrix", bpy.context.region_data.perspective_matrix)
shader.uniform_float("image", 0)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

View File

@@ -1,23 +1,28 @@
"""
Generate a texture using Offscreen Rendering
--------------------------------------------
Copy Offscreen Rendering result back to RAM
-------------------------------------------
#. Create an :class:`gpu.types.GPUOffScreen` object.
#. Draw some circles into it.
#. Make a new shader for drawing a planar texture in 3D.
#. Draw the generated texture using the new shader.
This will create a new image with the given name.
If it already exists, it will override the existing one.
Currently almost all of the execution time is spent in the last line.
In the future this will hopefully be solved by implementing the Python buffer protocol
for :class:`bgl.Buffer` and :class:`bpy.types.Image.pixels` (aka ``bpy_prop_array``).
"""
import bpy
import gpu
import bgl
import random
from mathutils import Matrix
from gpu_extras.batch import batch_for_shader
from gpu_extras.presets import draw_circle_2d
# Create and fill offscreen
##########################################
IMAGE_NAME = "Generated Image"
WIDTH = 512
HEIGHT = 512
RING_AMOUNT = 10
offscreen = gpu.types.GPUOffScreen(512, 512)
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
@@ -26,61 +31,20 @@ with offscreen.bind():
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
amount = 10
for i in range(-amount, amount + 1):
x_pos = i / amount
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
for i in range(RING_AMOUNT):
draw_circle_2d(
(random.uniform(-1, 1), random.uniform(-1, 1)),
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
buffer = bgl.Buffer(bgl.GL_BYTE, WIDTH * HEIGHT * 4)
bgl.glReadBuffer(bgl.GL_BACK)
bgl.glReadPixels(0, 0, WIDTH, HEIGHT, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)
offscreen.free()
# Drawing the generated texture in 3D space
#############################################
vertex_shader = '''
uniform mat4 modelMatrix;
uniform mat4 viewProjectionMatrix;
in vec2 position;
in vec2 uv;
out vec2 uvInterp;
void main()
{
uvInterp = uv;
gl_Position = viewProjectionMatrix * modelMatrix * vec4(position, 0.0, 1.0);
}
'''
fragment_shader = '''
uniform sampler2D image;
in vec2 uvInterp;
void main()
{
gl_FragColor = texture(image, uvInterp);
}
'''
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(
shader, 'TRI_FAN',
{
"position": ((-1, -1), (1, -1), (1, 1), (-1, 1)),
"uv": ((0, 0), (1, 0), (1, 1), (0, 1)),
},
)
def draw():
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, offscreen.color_texture)
shader.bind()
shader.uniform_float("modelMatrix", Matrix.Translation((1, 2, 3)) @ Matrix.Scale(3, 4))
shader.uniform_float("viewProjectionMatrix", bpy.context.region_data.perspective_matrix)
shader.uniform_float("image", 0)
batch.draw(shader)
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
if not IMAGE_NAME in bpy.data.images:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
image.scale(WIDTH, HEIGHT)
image.pixels = [v / 255 for v in buffer]

View File

@@ -1,50 +1,41 @@
"""
Copy Offscreen Rendering result back to RAM
-------------------------------------------
Rendering the 3D View into a Texture
------------------------------------
This will create a new image with the given name.
If it already exists, it will override the existing one.
Currently almost all of the execution time is spent in the last line.
In the future this will hopefully be solved by implementing the Python buffer protocol
for :class:`bgl.Buffer` and :class:`bpy.types.Image.pixels` (aka ``bpy_prop_array``).
The scene has to have a camera for this example to work.
You could also make this independent of a specific camera,
but Blender does not expose good functions to create view and projection matrices yet.
"""
import bpy
import gpu
import bgl
import random
from mathutils import Matrix
from gpu_extras.presets import draw_circle_2d
import gpu
from gpu_extras.presets import draw_texture_2d
IMAGE_NAME = "Generated Image"
WIDTH = 512
HEIGHT = 512
RING_AMOUNT = 10
HEIGHT = 256
offscreen = gpu.types.GPUOffScreen(WIDTH, HEIGHT)
with offscreen.bind():
bgl.glClear(bgl.GL_COLOR_BUFFER_BIT)
with gpu.matrix.push_pop():
# reset matrices -> use normalized device coordinates [-1, 1]
gpu.matrix.load_matrix(Matrix.Identity(4))
gpu.matrix.load_projection_matrix(Matrix.Identity(4))
for i in range(RING_AMOUNT):
draw_circle_2d(
(random.uniform(-1, 1), random.uniform(-1, 1)),
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
def draw():
context = bpy.context
scene = context.scene
buffer = bgl.Buffer(bgl.GL_BYTE, WIDTH * HEIGHT * 4)
bgl.glReadBuffer(bgl.GL_BACK)
bgl.glReadPixels(0, 0, WIDTH, HEIGHT, bgl.GL_RGBA, bgl.GL_UNSIGNED_BYTE, buffer)
view_matrix = scene.camera.matrix_world.inverted()
offscreen.free()
projection_matrix = scene.camera.calc_matrix_camera(
context.evaluated_depsgraph_get(), x=WIDTH, y=HEIGHT)
offscreen.draw_view3d(
scene,
context.view_layer,
context.space_data,
context.region,
view_matrix,
projection_matrix)
bgl.glDisable(bgl.GL_DEPTH_TEST)
draw_texture_2d(offscreen.color_texture, (10, 10), WIDTH, HEIGHT)
if not IMAGE_NAME in bpy.data.images:
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
image = bpy.data.images[IMAGE_NAME]
image.scale(WIDTH, HEIGHT)
image.pixels = [v / 255 for v in buffer]
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

View File

@@ -1,2 +1,2 @@
Sphinx==1.8.5
sphinx_rtd_theme==0.4.3
Sphinx==3.1.1
sphinx_rtd_theme==0.5.0

View File

@@ -427,7 +427,7 @@ offers a set of extensive examples, including advanced features.
Return evaluator parameters
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetMap.xml>`_
.. seealso:: `OpenGL Docs <https://www.opengl.org/sdk/docs/man2/xhtml/glGetMap.xml>`__
:type target: Enumerated constant
:arg target: Specifies the symbolic name of a map.

View File

@@ -1,5 +1,5 @@
..
This document is appended to the auto generated bmesh api doc to avoid clogging up the C files with details.
This document is appended to the auto generated BMesh API doc to avoid clogging up the C files with details.
to test this run:
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- \
--partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
@@ -19,25 +19,24 @@ Submodules:
Introduction
------------
This API gives access the blenders internal mesh editing api, featuring geometry connectivity data and
This API gives access the Blender's internal mesh editing API, featuring geometry connectivity data and
access to editing operations such as split, separate, collapse and dissolve.
The features exposed closely follow the C API,
giving python access to the functions used by blenders own mesh editing tools.
giving Python access to the functions used by Blender's own mesh editing tools.
For an overview of BMesh data types and how they reference each other see:
`BMesh Design Document <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`_ .
`BMesh Design Document <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`__.
.. note::
**Disk** and **Radial** data is not exposed by the python api since this is for internal use only.
**Disk** and **Radial** data is not exposed by the Python API since this is for internal use only.
.. warning:: TODO items are...
* add access to BMesh **walkers**
* add custom-data manipulation functions add/remove/rename.
- add access to BMesh **walkers**.
- add custom-data manipulation functions add, remove or rename.
Example Script
@@ -46,55 +45,52 @@ Example Script
.. literalinclude:: __/__/__/release/scripts/templates_py/bmesh_simple.py
Stand-Alone Module
^^^^^^^^^^^^^^^^^^
Standalone Module
^^^^^^^^^^^^^^^^^
The bmesh module is written to be standalone except for :mod:`mathutils`
The BMesh module is written to be standalone except for :mod:`mathutils`
which is used for vertex locations and normals.
The only other exception to this are when converting mesh data to and from :class:`bpy.types.Mesh`.
Mesh Access
-----------
There are 2 ways to access BMesh data, you can create a new BMesh by converting a mesh from
:class:`bpy.types.BlendData.meshes` or by accessing the current edit mode mesh.
see: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively.
There are two ways to access BMesh data, you can create a new BMesh by converting a mesh from
:class:`bpy.types.BlendData.meshes` or by accessing the current Edit-Mode mesh.
See: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively.
When explicitly converting from mesh data python **owns** the data, that is to say -
that the mesh only exists while python holds a reference to it,
and the script is responsible for putting it back into a mesh data-block when the edits are done.
When explicitly converting from mesh data Python **owns** the data, that means that
the mesh only exists while Python holds a reference to it.
The script is responsible for putting it back into a mesh data-block when the edits are done.
Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend file,
Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend-file,
a BMesh can be created, edited and freed without the user ever seeing or having access to it.
Unlike edit mode, the bmesh module can use multiple BMesh instances at once.
Unlike Edit-Mode, the BMesh module can use multiple BMesh instances at once.
Take care when dealing with multiple BMesh instances since the mesh data can use a lot of memory, while a mesh that
python owns will be freed in when the script holds no references to it,
its good practice to call :class:`bmesh.types.BMesh.free` which will remove all the mesh data immediately and disable
further access.
Take care when dealing with multiple BMesh instances since the mesh data can use a lot of memory.
While a mesh that the Python script owns will be freed when the script holds no references to it,
it's good practice to call :class:`bmesh.types.BMesh.free` which will remove all the mesh data immediately
and disable further access.
EditMode Tessellation
^^^^^^^^^^^^^^^^^^^^^
Edit-Mode Tessellation
^^^^^^^^^^^^^^^^^^^^^^
When writing scripts that operate on editmode data you will normally want to re-calculate the tessellation after
running the script, this needs to be called explicitly.
The BMesh its self does not store the triangulated faces, they are stored in the :class:`bpy.types.Mesh`,
When writing scripts that operate on Edit-Mode data you will normally want to re-calculate the tessellation after
running the script, this needs to be called explicitly.
The BMesh itself does not store the triangulated faces, instead they are stored in the :class:`bpy.types.Mesh`,
to refresh tessellation triangles call :class:`bpy.types.Mesh.calc_loop_triangles`.
CustomData Access
-----------------
BMesh has a unified way to access mesh attributes such as UV's vertex colors, shape keys, edge crease etc.
BMesh has a unified way to access mesh attributes such as UVs, vertex colors, shape keys, edge crease, etc.
This works by having a **layers** property on BMesh data sequences to access the custom data layers
which can then be used to access the actual data on each vert, edge, face or loop.
This works by having a **layers** property on bmesh data sequences to access the custom data layers which can then be
used to access the actual data on each vert/edge/face/loop.
Here are some examples ...
Here are some examples:
.. code-block:: python
@@ -139,27 +135,27 @@ Here are some examples ...
Keeping a Correct State
-----------------------
When modeling in blender there are certain assumptions made about the state of the mesh.
When modeling in Blender there are certain assumptions made about the state of the mesh:
* hidden geometry isn't selected.
* when an edge is selected, its vertices are selected too.
* when a face is selected, its edges and vertices are selected.
* duplicate edges / faces don't exist.
* faces have at least 3 vertices.
- Hidden geometry isn't selected.
- When an edge is selected, its vertices are selected too.
- When a face is selected, its edges and vertices are selected.
- Duplicate edges / faces don't exist.
- Faces have at least three vertices.
To give developers flexibility these conventions are not enforced,
however tools must leave the mesh in a valid state else other tools may behave incorrectly.
yet tools must leave the mesh in a valid state or else other tools may behave incorrectly.
Any errors that arise from not following these conventions is considered a bug in the script,
not a bug in blender.
not a bug in Blender.
Selection / Flushing
^^^^^^^^^^^^^^^^^^^^
As mentioned above, it is possible to create an invalid selection state
(by selecting a state and then de-selecting one of its vertices's for example), mostly the best way to solve this is to
flush the selection after performing a series of edits. this validates the selection state.
(by selecting a state and then deselecting one of its vertices for example),
mostly the best way to solve this is to flush the selection
after performing a series of edits. This validates the selection state.
Module Functions

View File

@@ -3,94 +3,84 @@
Reference API Usage
*******************
Blender has many interlinking data types which have an auto-generated reference api which often has the information
Blender has many interlinking data types which have an auto-generated reference API which often has the information
you need to write a script, but can be difficult to use.
This document is designed to help you understand how to use the reference api.
This document is designed to help you understand how to use the reference API.
Reference API Scope
===================
The reference API covers :mod:`bpy.types`, which stores types accessed via :mod:`bpy.context` - *The user context*
or :mod:`bpy.data` - *Blend file data*.
The reference API covers :mod:`bpy.types`, which stores types accessed via :mod:`bpy.context` -- *the user context*
or :mod:`bpy.data` -- *blend-file data*.
Other modules such as :mod:`bmesh` and :mod:`aud` are not using Blenders data API
Other modules such as :mod:`bmesh` and :mod:`aud` are not using Blender's data API
so this document doesn't apply to those modules.
Data Access
===========
The most common case for using the reference API is to find out how to access data in the blend file.
Before going any further its best to be aware of ID Data-Blocks in Blender since you will often find properties
The most common case for using the reference API is to find out how to access data in the blend-file.
Before going any further its best to be aware of ID data-blocks in Blender since you will often find properties
relative to them.
ID Data
-------
ID Data-Blocks are used in Blender as top-level data containers.
ID data-blocks are used in Blender as top-level data containers.
From the user interface this isn't so obvious, but when developing you need to know about ID data-blocks.
ID data types include Scene, Group, Object, Mesh, Workspace, World, Armature, Image and Texture.
For a full list see the subclasses of :class:`bpy.types.ID`.
From the user interface this isn't so obvious, but when developing you need to know about ID Data-Blocks.
Here are some characteristics ID data-blocks share:
ID data types include Scene, Group, Object, Mesh, Screen, World, Armature, Image and Texture.
for a full list see the sub-classes of :class:`bpy.types.ID`
Here are some characteristics ID Data-Blocks share.
- ID's are blend file data, so loading a new blend file reloads an entire new set of Data-Blocks.
- ID's can be accessed in Python from ``bpy.data.*``
- IDs are blend-file data, so loading a new blend-file reloads an entire new set of data-blocks.
- IDs can be accessed in Python from ``bpy.data.*``.
- Each data-block has a unique ``.name`` attribute, displayed in the interface.
- Animation data is stored in ID's ``.animation_data``.
- ID's are the only data types that can be linked between blend files.
- ID's can be added/copied and removed via Python.
- ID's have their own garbage-collection system which frees unused ID's when saving.
- When a data-block has a reference to some external data, this is typically an ID Data-Block.
- Animation data is stored in IDs ``.animation_data``.
- IDs are the only data types that can be linked between blend-files.
- IDs can be added/copied and removed via Python.
- IDs have their own garbage-collection system which frees unused IDs when saving.
- When a data-block has a reference to some external data, this is typically an ID data-block.
Simple Data Access
------------------
Lets start with a simple case, say you want a python script to adjust the object's location.
In this simple case a Python script is used to adjust the object's location.
Start by collecting the information where the data is located.
Start by finding this setting in the interface ``Properties Window -> Object -> Transform -> Location``
From the button you can right click and select **Online Python Reference**, this will link you to:
:class:`bpy.types.Object.location`
Being an API reference, this link often gives little more information then the tool-tip, though some of the pages
First find this setting in the interface ``Properties editor -> Object -> Transform -> Location``.
From the button context menu select *Online Python Reference*, this will link you to:
:class:`bpy.types.Object.location`.
Being an API reference, this link often gives little more information then the tooltip, though some of the pages
include examples (normally at the top of the page).
But you now know that you have to use ``.location`` and that its an array of three floats.
At this point you may say *Now what?* - you know that you have to use ``.location`` and that its an array of 3 floats
but you're still left wondering how to access this in a script.
So the next step is to find out where to access objects, go down to the bottom of the page to the **References**
section, for objects there are many references, but one of the most common places to access objects is via the context.
It's easy to be overwhelmed at this point since there ``Object`` get referenced in so many places - modifiers,
functions, textures and constraints.
So the next step is to find out where to access objects, go down to the bottom of the page to the references section,
for objects there are many references, but one of the most common places to access objects is via the context.
It's easy to be overwhelmed at this point since there ``Object`` get referenced in so many places:
modifiers, functions, textures and constraints.
But if you want to access any data the user has selected
you typically only need to check the :mod:`bpy.context` references.
Even then, in this case there are quite a few though if you read over these - most are mode specific.
If you happen to be writing a tool that only runs in weight paint mode, then using ``weight_paint_object``
would be appropriate.
However to access an item the user last selected, look for the ``active`` members,
Having access to a single active member the user selects is a convention in Blender: eg. ``active_bone``,
``active_pose_bone``, ``active_node`` ... and in this case we can use - ``active_object``.
Even then, in this case there are quite a few though
if you read over these you'll notice that most are mode specific.
If you happen to be writing a tool that only runs in Weight Paint Mode,
then using ``weight_paint_object`` would be appropriate.
However, to access an item the user last selected, look for the ``active`` members,
Having access to a single active member the user selects is a convention in Blender:
e.g. ``active_bone``, ``active_pose_bone``, ``active_node``, etc. and in this case you can use ``active_object``.
So now we have enough information to find the location of the active object.
So now you have enough information to find the location of the active object.
.. code-block:: python
bpy.context.active_object.location
You can type this into the python console to see the result.
You can type this into the Python console to see the result.
The other common place to access objects in the reference is :class:`bpy.types.BlendData.objects`.
.. note::
@@ -100,7 +90,7 @@ The other common place to access objects in the reference is :class:`bpy.types.B
so the documentation points there.
With :mod:`bpy.data.objects`, this is a collection of objects so you need to access one of its members.
With :mod:`bpy.data.objects`, this is a collection of objects so you need to access one of its members:
.. code-block:: python
@@ -117,37 +107,34 @@ Here are some more complex examples:
.. code-block:: python
# access a render layers samples
bpy.context.scene.render.layers["RenderLayer"].samples
# Access the number of samples for the Cycles render engine.
bpy.context.scene.cycles.samples
# access to the current weight paint brush size
# Access to the current weight paint brush size.
bpy.context.tool_settings.weight_paint.brush.size
# check if the window is fullscreen
# Check if the window is full-screen.
bpy.context.window.screen.show_fullscreen
As you can see there are times when you want to access data which is nested
in a way that causes you to go through a few indirections.
The properties are arranged to match how data is stored internally (in Blender's C code) which is often logical
but not always quite what you would expect from using Blender.
So this takes some time to learn, it helps you understand how data fits together in Blender
which is important to know when writing scripts.
The properties are arranged to match how data is stored internally (in blenders C code) which is often logical but
not always quite what you would expect from using Blender.
So this takes some time to learn, it helps you understand how data fits together in Blender which is important
to know when writing scripts.
When starting out scripting you will often run into the problem where you're not sure how to access the data you want.
There are a few ways to do this.
When starting out scripting you will often run into the problem
where you're not sure how to access the data you want.
There are a few ways to do this:
- Use the Python console's auto-complete to inspect properties.
*This can be hit-and-miss but has the advantage
that you can easily see the values of properties and assign them to interactively see the results.*
- Copy the Data-Path from the user interface.
*Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
- Copy the data path from the user interface.
*Explained further in* :ref:`Copy Data Path <info_data_path_copy>`.
- Using the documentation to follow references.
*Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
*Explained further in* :ref:`Indirect Data Access <info_data_path_indirect>`.
.. _info_data_path_copy:
@@ -155,42 +142,36 @@ There are a few ways to do this.
Copy Data Path
--------------
Blender can compute the Python string to a property which is shown in the tool-tip, on the line below ``Python: ...``,
This saves having to use the API reference to click back up the references to find where data is accessed from.
There is a user-interface feature to copy the data-path which gives the path from an :class:`bpy.types.ID` data-block,
Blender can compute the Python string to a property which is shown in the tooltip,
on the line below ``Python: ...``. This saves having to open the API references to find where data is accessed from.
In the context menu is a copy data-path tool which gives the path from an :class:`bpy.types.ID` data-block,
to its property.
To see how this works we'll get the path to the Subdivision-Surface modifiers subdivision setting.
Start with the default scene and select the **Modifiers** tab, then add a **Subdivision-Surface** modifier to the cube.
Now hover your mouse over the button labeled **View**, The tool-tip includes :class:`bpy.types.SubsurfModifier.levels`
but we want the path from the object to this property.
To see how this works you'll get the path to the Subdivision Surface modifiers *Levels* setting.
Start with the default scene and select the Modifiers tab, then add a Subdivision Surface modifier to the cube.
Now hover your mouse over the button labeled *Levels Viewport*,
The tooltip includes :class:`bpy.types.SubsurfModifier.levels` but you want the path from the object to this property.
Note that the text copied won't include the ``bpy.data.collection["name"].`` component since its assumed that
you won't be doing collection look-ups on every access and typically you'll want to use the context rather
then access each :class:`bpy.types.ID` instance by name.
Type in the ID path into a Python console :mod:`bpy.context.active_object`.
Include the trailing dot and don't hit "enter", yet.
Include the trailing dot and don't execute the code, yet.
Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
So now you should have the answer:
Now in the button's context menu select *Copy Data Path*, then paste the result into the console:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels
Hit "enter" and you'll get the current value of 1. Now try changing the value to 2:
Press :kbd:`Return` and you'll get the current value of 1. Now try changing the value to 2:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels = 2
bpy.context.active_object.modifiers["Subsurf"].levels = 2
You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
You can see the value update in the Subdivision Surface modifier's UI as well as the cube.
.. _info_data_path_indirect:
@@ -198,51 +179,45 @@ You can see the value update in the Subdivision-Surface modifier's UI as well as
Indirect Data Access
--------------------
For this example we'll go over something more involved, showing the steps to access the active sculpt brushes texture.
This more advanced example shows the steps to access the active sculpt brushes texture.
For example, if you want to access the texture of a brush via Python to adjust its ``contrast``.
Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
#. Start in the default scene and enable Sculpt Mode from the 3D Viewport header.
#. From the Sidebar expand the Brush Settings panel's *Texture* subpanel and add a new texture.
*Notice the texture data-block menu itself doesn't have very useful links (you can check the tooltips).*
#. The contrast setting isn't exposed in the Sidebar, so view the texture in the properties editor:
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tooltips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties editor select the Texture tab.
- Select brush texture.
- Expand the *Colors* panel to locate the *Contrast* number field.
#. Open the context menu of the contrast field and select *Online Python Reference*.
This takes you to ``bpy.types.Texture.contrast``. Now you can see that ``contrast`` is a property of texture.
#. To find out how to access the texture from the brush check on the references at the bottom of the page.
Sometimes there are many references, and it may take some guesswork to find the right one,
but in this case it's ``Brush.texture``.
- In the properties button select the Texture context.
- Select the Brush icon to show the brush texture.
- Expand the *Colors* panel to locate the *Contrast* button.
- Right click on the contrast button and select **Online Python Reference**
This takes you to ``bpy.types.Texture.contrast``
- Now we can see that ``contrast`` is a property of texture,
so next we'll check on how to access the texture from the brush.
- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
some guess work to find the right one, but in this case its obviously ``Brush.texture``.
#. Now you know that the texture can be accessed from ``bpy.data.brushes["BrushName"].texture``
but normally you *won't* want to access the brush by name, instead you want to access the active brush.
So the next step is to check on where brushes are accessed from via the references.
In this case there it is simply ``bpy.context.brush``.
*Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
*but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
- So the next step is to check on where brushes are accessed from via the **References**.
In this case there is simply ``bpy.context.brush`` which is all we need.
Now you can use the Python console to form the nested properties needed to access brush textures contrast:
*Context -> Brush -> Texture -> Contrast*.
Now you can use the Python console to form the nested properties needed to access brush textures contrast,
logically we now know.
*Context -> Brush -> Texture -> Contrast*
Since the attribute for each is given along the way we can compose the data path in the python console:
Since the attribute for each is given along the way you can compose the data path in the Python console:
.. code-block:: python
bpy.context.brush.texture.contrast
There can be multiple ways to access the same data, which you choose often depends on the task.
An alternate path to access the same setting is...
An alternate path to access the same setting is:
.. code-block:: python
bpy.context.sculpt.brush.texture.contrast
Or access the brush directly...
Or access the brush directly:
.. code-block:: python
@@ -251,27 +226,24 @@ Or access the brush directly...
If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects
the tool to operate on what they have selected.
For automation you are more likely to use :mod:`bpy.data` since you want to be able to access specific data and manipulate
it, no matter what the user currently has the view set at.
For automation you are more likely to use :mod:`bpy.data` since you want to be able to access specific data and
manipulate it, no matter what the user currently has the view set at.
Operators
=========
Most key-strokes and buttons in Blender call an operator which is also exposed to python via :mod:`bpy.ops`,
Most hotkeys and buttons in Blender call an operator which is also exposed to Python via :mod:`bpy.ops`.
To see the Python equivalent hover your mouse over the button and see the tool-tip,
eg ``Python: bpy.ops.render.render()``,
If there is no tool-tip or the ``Python:`` line is missing then this button is not using an operator and
can't be accessed from Python.
To see the Python equivalent hover your mouse over the button and see the tooltip,
e.g ``Python: bpy.ops.render.render()``,
If there is no tooltip or the ``Python:`` line is missing then this button is not using an operator
and can't be accessed from Python.
If you want to use this in a script you can press :kbd:`Control-C` while your mouse is over the button to copy it to the
clipboard.
You can also right click on the button and view the **Online Python Reference**, this mainly shows arguments and
their defaults however operators written in Python show their file and line number which may be useful if you
If you want to use this in a script you can press :kbd:`Ctrl-C` while your mouse is over the button
to copy it to the clipboard.
You can also use button's context menu and view the *Online Python Reference*, this mainly shows arguments and
their defaults, however, operators written in Python show their file and line number which may be useful if you
are interested to check on the source code.
.. note::
@@ -280,21 +252,18 @@ are interested to check on the source code.
for more on this see :ref:`using operators <using_operators>`.
Info View
---------
Info Editor
-----------
Blender records operators you run and displays them in the **Info** space.
This is located above the file-menu which can be dragged down to display its contents.
Blender records operators you run and displays them in the Info editor.
Select the Scripting workspace that comes default with Blender to see its output.
You can perform some actions and see them show up -- delete a vertex for example.
Select the **Script** screen that comes default with Blender to see its output.
You can perform some actions and see them show up - delete a vertex for example.
Each entry can be selected (Right-Mouse-Button),
then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
Each entry can be selected, then copied :kbd:`Ctrl-C`, usually to paste in the text editor or Python console.
.. note::
Not all operators get registered for display,
zooming the view for example isn't so useful to repeat so its excluded from the output.
To display *every* operator that runs see :ref:`Show All Operators <info_show_all_operators>`
To display *every* operator that runs see :ref:`Show All Operators <info_show_all_operators>`.

View File

@@ -3,38 +3,34 @@
Best Practice
*************
When writing your own scripts python is great for new developers to pick up and become productive,
but you can also pick up odd habits or at least write scripts that are not easy for others to understand.
When writing your own scripts Python is great for new developers to pick up and become productive,
but you can also pick up bad practices or at least write scripts that are not easy for others to understand.
For your own work this is of course fine,
but if you want to collaborate with others or have your work included with blender there are practices we encourage.
but if you want to collaborate with others or have your work included with Blender there are practices we encourage.
Style Conventions
=================
For Blender/Python development we have chosen to follow python suggested style guide to avoid mixing styles
amongst our own scripts and make it easier to use python scripts from other projects.
For Blender Python development we have chosen to follow Python suggested style guide to avoid mixing styles
among our own scripts and make it easier to use Python scripts from other projects.
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to Blender.
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
This style guide is known as `pep8 <https://www.python.org/dev/peps/pep-0008/>`__
and here is a brief listing of pep8 criteria:
This style guide is known as pep8 and can be found `here <https://www.python.org/dev/peps/pep-0008/>`_
- Camel caps for class names: MyClass
- All lower case underscore separated module names: my_module
- Indentation of 4 spaces (no tabs)
- Spaces around operators: ``1 + 1``, not ``1+1``
- Only use explicit imports (no wildcard importing ``*``)
- Don't use multiple statements on a single line: ``if val: body``, separate onto two lines instead.
A brief listing of pep8 criteria.
- camel caps for class names: MyClass
- all lower case underscore separated module names: my_module
- indentation of 4 spaces (no tabs)
- spaces around operators. ``1 + 1``, not ``1+1``
- only use explicit imports, (no importing ``*``)
- don't use single line: ``if val: body``, separate onto 2 lines instead.
As well as pep8 we have other conventions used for blender python scripts.
As well as pep8 we have additional conventions used for Blender Python scripts:
- Use single quotes for enums, and double quotes for strings.
Both are of course strings, but in our internal API enums are unique items from a limited set. eg.
Both are of course strings, but in our internal API enums are unique items from a limited set, e.g:
.. code-block:: python
@@ -42,14 +38,14 @@ As well as pep8 we have other conventions used for blender python scripts.
bpy.context.scene.render.filepath = "//render_out"
- pep8 also defines that lines should not exceed 79 characters,
we felt this is too restrictive so this is optional per script.
we have decided that this is too restrictive so it is optional per script.
Periodically we run checks for pep8 compliance on blender scripts,
for scripts to be included in this check add this line as a comment at the top of the script.
Periodically we run checks for pep8 compliance on Blender scripts,
for scripts to be included in this check add this line as a comment at the top of the script:
``# <pep8 compliant>``
To enable line length checks use this instead.
To enable line length checks use this instead:
``# <pep8-80 compliant>``
@@ -59,85 +55,79 @@ User Interface Layout
Some notes to keep in mind when writing UI layouts:
- UI code is quite simple. Layout declarations are there to easily create a decent layout.
UI code is quite simple. Layout declarations are there to easily create a decent layout.
The general rule here is: If you need more code for the layout declaration,
than for the actual properties, then you are doing it wrong.
General rule here: If you need more code for the layout declaration,
then for the actual properties, you do it wrong.
Example layouts:
.. rubric:: Example layouts:
- layout()
``layout()``
The basic layout is a simple top-to-bottom layout.
The basic layout is a simple Top -> Bottom layout.
.. code-block:: python
.. code-block:: python
layout.prop()
layout.prop()
layout.prop()
layout.prop()
``layout.row()``
Use ``row()``, when you want more than one property in a single line.
- layout.row()
.. code-block:: python
Use row(), when you want more than 1 property in one line.
row = layout.row()
row.prop()
row.prop()
.. code-block:: python
``layout.column()``
Use ``column()``, when you want your properties in a column.
row = layout.row()
row.prop()
row.prop()
.. code-block:: python
- layout.column()
col = layout.column()
col.prop()
col.prop()
Use column(), when you want your properties in a column.
``layout.split()``
This can be used to create more complex layouts.
For example, you can split the layout and create two ``column()`` layouts next to each other.
Do not use split, when you simply want two properties in a row. Use ``row()`` instead.
.. code-block:: python
.. code-block:: python
col = layout.column()
col.prop()
col.prop()
split = layout.split()
- layout.split()
col = split.column()
col.prop()
col.prop()
This can be used to create more complex layouts.
For example you can split the layout and create two column() layouts next to each other.
Don't use split, when you simply want two properties in a row. Use row() for that.
col = split.column()
col.prop()
col.prop()
.. code-block:: python
split = layout.split()
col = split.column()
col.prop()
col.prop()
col = split.column()
col.prop()
col.prop()
Declaration names:
.. rubric:: Declaration names:
Try to only use these variable names for layout declarations:
- row for a row() layout
- col for a column() layout
- split for a split() layout
- flow for a column_flow() layout
- sub for a sub layout (a column inside a column for example)
:row: for a ``row()`` layout
:col: for a ``column()`` layout
:split: for a ``split()`` layout
:flow: for a ``column_flow()`` layout
:sub: for a sub layout (a column inside a column for example)
Script Efficiency
=================
List Manipulation (General Python Tips)
---------------------------------------
Searching for list items
Searching for List Items
^^^^^^^^^^^^^^^^^^^^^^^^
In Python there are some handy list functions that save you having to search through the list.
Even though you are not looping on the list data **python is**,
Even though you are not looping on the list data **Python is**,
so you need to be aware of functions that will slow down your script by searching the whole list.
.. code-block:: python
@@ -150,23 +140,21 @@ so you need to be aware of functions that will slow down your script by searchin
Modifying Lists
^^^^^^^^^^^^^^^
In python we can add and remove from a list, this is slower when the list length is modified,
especially at the start of the list, since all the data after the index of
modification needs to be moved up or down 1 place.
The most simple way to add onto the end of the list is to use
``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to
remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
In Python you can add and remove from a list, this is slower when the list length is modified,
especially at the start of the list, since all the data after the index of
modification needs to be moved up or down one place.
The fastest way to add onto the end of the list is to use
``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and
to remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(index)``
for list removal, but these are slower.
Sometimes its faster (but more memory hungry) to just rebuild the list.
Say you want to remove all triangular polygons in a list.
Rather than...
Sometimes it's faster (but less memory efficient) to just rebuild the list.
For example if you want to remove all triangular polygons in a list.
Rather than:
.. code-block:: python
@@ -179,7 +167,7 @@ Rather than...
polygons.pop(p_idx) # remove the triangle
It's faster to build a new list with list comprehension.
It's faster to build a new list with list comprehension:
.. code-block:: python
@@ -189,14 +177,14 @@ It's faster to build a new list with list comprehension.
Adding List Items
^^^^^^^^^^^^^^^^^
If you have a list that you want to add onto another list, rather than...
If you have a list that you want to add onto another list, rather than:
.. code-block:: python
for l in some_list:
my_list.append(l)
Use...
Use:
.. code-block:: python
@@ -205,9 +193,7 @@ Use...
Note that insert can be used when needed,
but it is slower than append especially when inserting at the start of a long list.
This example shows a very sub-optimal way of making a reversed list.
This example shows a very suboptimal way of making a reversed list:
.. code-block:: python
@@ -219,7 +205,6 @@ This example shows a very sub-optimal way of making a reversed list.
Python provides more convenient ways to reverse a list using the slice method,
but you may want to time this before relying on it too much:
.. code-block:: python
some_reversed_list = some_list[::-1]
@@ -228,12 +213,10 @@ but you may want to time this before relying on it too much:
Removing List Items
^^^^^^^^^^^^^^^^^^^
Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)``
Use ``my_list.pop(index)`` rather than ``my_list.remove(list_item)``.
This requires you to have the index of the list item but is faster since ``remove()`` will search the list.
Here is an example of how to remove items in 1 loop,
removing the last items first, which is faster (as explained above).
Here is an example of how to remove items in one loop,
removing the last items first, which is faster (as explained above):
.. code-block:: python
@@ -247,7 +230,7 @@ removing the last items first, which is faster (as explained above).
This example shows a fast way of removing items,
for use in cases where you can alter the list order without breaking the scripts functionality.
This works by swapping 2 list items, so the item you remove is always last.
This works by swapping two list items, so the item you remove is always last:
.. code-block:: python
@@ -260,64 +243,59 @@ This works by swapping 2 list items, so the item you remove is always last.
my_list.pop()
When removing many items in a large list this can provide a good speedup.
When removing many items in a large list this can provide a good speed-up.
Avoid Copying Lists
^^^^^^^^^^^^^^^^^^^
When passing a list/dictionary to a function,
When passing a list or dictionary to a function,
it is faster to have the function modify the list rather than returning
a new list so python doesn't have to duplicate the list in memory.
a new list so Python doesn't have to duplicate the list in memory.
Functions that modify a list in-place are more efficient than functions that create new lists.
This is generally slower so only use for functions when it makes sense not to modify the list in place.
This is generally slower so only use for functions when it makes sense not to modify the list in place:
>>> my_list = some_list_func(my_list)
This is generally faster since there is no re-assignment and no list duplication.
This is generally faster since there is no re-assignment and no list duplication:
>>> some_list_func(vec)
Also note that passing a sliced list makes a copy of the list in python memory.
Also note that, passing a sliced list makes a copy of the list in Python memory:
>>> foobar(my_list[:])
If my_list was a large array containing 10000's of items, a copy could use a lot of extra memory.
If my_list was a large array containing 10,000's of items, a copy could use a lot of extra memory.
Writing Strings to a File (Python General)
------------------------------------------
Here are 3 ways of joining multiple strings into one string for writing.
This also applies to any area of your code that involves a lot of string joining.
Here are three ways of joining multiple strings into one string for writing.
This also applies to any area of your code that involves a lot of string joining:
String concatenation
This is the slowest option, do **not** use if you can avoid it, especially when writing data in a loop.
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
String formatting
Use this when you are writing string data from floats and ints.
>>> file.write("%s %s %s\n" % (str1, str2, str3))
String joining
Use to join a list of strings (the list may be temporary). In the following example, the strings are joined with
a space " " in between, other examples are "" or ", ".
>>> file.write(" ".join((str1, str2, str3, "\n")))
``String addition`` -
this is the slowest option, *don't use if you can help it, especially when writing data in a loop*.
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
``String formatting`` -
use this when you are writing string data from floats and ints.
>>> file.write("%s %s %s\n" % (str1, str2, str3))
``String join() function``
use to join a list of strings (the list may be temporary). In the following example, the strings are joined with a space " " in between, other examples are "" or ", ".
>>> file.write(" ".join([str1, str2, str3, "\n"]))
Join is fastest on many strings,
`string formatting <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`__
is quite fast too (better for converting data types). String arithmetic is slowest.
Join is fastest on many strings, string formatting is quite fast too (better for converting data types).
String concatenation is the slowest.
Parsing Strings (Import/Exporting)
@@ -333,36 +311,35 @@ Parsing Numbers
^^^^^^^^^^^^^^^
Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``,
float() will work for an int too but it is faster to read ints with int().
``float()`` will work for an int too but it is faster to read ints with ``int()``.
Checking String Start/End
^^^^^^^^^^^^^^^^^^^^^^^^^
If you are checking the start of a string for a keyword, rather than...
If you are checking the start of a string for a keyword, rather than:
>>> if line[0:5] == "vert ": ...
use...
Use:
>>> if line.startswith("vert "):
Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible
error with the slice length not matching the string length.
Using ``startswith()`` is slightly faster (around 5%) and also avoids a possible error
with the slice length not matching the string length.
my_string.endswith("foo_bar") can be used for line endings too.
``my_string.endswith("foo_bar")`` can be used for line endings too.
If you are unsure whether the text is upper or lower case, use the ``lower()`` or ``upper()`` string function.
If you are unsure whether the text is upper or lower case, use the ``lower()`` or ``upper()`` string function:
>>> if line.lower().startswith("vert ")
Use try/except Sparingly
------------------------
Error Handling
--------------
The **try** statement is useful to save time writing error checking code.
However **try** is significantly slower than an **if** since an exception has to be set each time,
However, **try** is significantly slower than an **if** since an exception has to be set each time,
so avoid using **try** in areas of your code that execute in a loop and runs many times.
There are cases where using **try** is faster than checking whether the condition will raise an error,
@@ -382,7 +359,7 @@ In cases where you know you are checking for the same value which is referenced
Time Your Code
--------------
While developing a script it is good to time it to be aware of any changes in performance, this can be done simply.
While developing a script it is good to time it to be aware of any changes in performance, this can be done simply:
.. code-block:: python

View File

@@ -4,7 +4,7 @@ Gotchas
*******
This document attempts to help you work with the Blender API in areas
that can be troublesome and avoid practices that are known to give instability.
that can be troublesome and avoid practices that are known to cause instability.
.. _using_operators:
@@ -12,13 +12,13 @@ that can be troublesome and avoid practices that are known to give instability.
Using Operators
===============
Blender's operators are tools for users to access, that Python can access them too is very useful
nevertheless operators have limitations that can make them cumbersome to script.
Blender's operators are tools for users to access, that can access with Python too which is very useful.
Still operators have limitations that can make them cumbersome to script.
Main limits are...
The main limits are:
- Can't pass data such as objects, meshes or materials to operate on (operators use the context instead)
- The return value from calling an operator gives the success (if it finished or was canceled),
- Can't pass data such as objects, meshes or materials to operate on (operators use the context instead).
- The return value from calling an operator is the success (if it finished or was canceled),
in some cases it would be more logical from an API perspective to return the result of the operation.
- Operators poll function can fail where an API function would raise an exception giving details on exactly why.
@@ -34,26 +34,23 @@ When calling an operator gives an error like this:
Which raises the question as to what the correct context might be?
Typically operators check for the active area type, a selection or active object they can operate on,
but some operators are more picky about when they run.
but some operators are more strict when they run.
In most cases you can figure out what context an operator needs
simply be seeing how it's used in Blender and thinking about what it does.
Unfortunately if you're still stuck - the only way to **really** know
what's going on is to read the source code for the poll function and see what its checking.
by examining how it's used in Blender and thinking about what it does.
If you're still stuck, unfortunately, the only way to eventually know what is causing the error is
to read the source code for the poll function and see what it is checking.
For Python operators it's not so hard to find the source
since it's included with Blender and the source file/line is included in the operator reference docs.
since it's included with Blender and the source file and line is included in the operator reference docs.
Downloading and searching the C code isn't so simple,
especially if you're not familiar with the C language but by searching the
operator name or description you should be able to find the poll function with no knowledge of C.
especially if you're not familiar with the C language but by searching the operator name or description
you should be able to find the poll function with no knowledge of C.
.. note::
Blender does have the functionality for poll functions to describe why they fail,
but its currently not used much, if you're interested to help improve our API
feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails.
but its currently not used much, if you're interested to help improve the API
feel free to add calls to ``CTX_wm_operator_poll_msg_set`` where its not obvious why poll fails, e.g:
>>> bpy.ops.gpencil.draw()
RuntimeError: Operator bpy.ops.gpencil.draw.poll() Failed to find Grease Pencil data to draw into
@@ -63,7 +60,7 @@ The operator still doesn't work!
--------------------------------
Certain operators in Blender are only intended for use in a specific context,
some operators for example are only called from the properties window where they check the current material,
some operators for example are only called from the properties editor where they check the current material,
modifier or constraint.
Examples of this are:
@@ -74,8 +71,8 @@ Examples of this are:
- :mod:`bpy.ops.buttons.file_browse`
Another possibility is that you are the first person to attempt to use this operator
in a script and some modifications need to be made to the operator to run in a different context,
if the operator should logically be able to run but fails when accessed from a script
in a script and some modifications need to be made to the operator to run in a different context.
If the operator should logically be able to run but fails when accessed from a script
it should be reported to the bug tracker.
@@ -85,22 +82,20 @@ Stale Data
No updates after setting values
-------------------------------
Sometimes you want to modify values from Python and immediately access the updated values, eg:
Sometimes you want to modify values from Python and immediately access the updated values, e.g:
Once changing the objects :class:`bpy.types.Object.location`
you may want to access its transformation right after from :class:`bpy.types.Object.matrix_world`,
but this doesn't work as you might expect.
Consider the calculations that might go into working out the object's final transformation, this includes:
Consider the calculations that might contribute to the object's final transformation, this includes:
- animation function curves.
- drivers and their Python expressions.
- constraints
- parent objects and all of their f-curves, constraints etc.
- Animation function curves.
- Drivers and their Python expressions.
- Constraints
- Parent objects and all of their F-curves, constraints, etc.
To avoid expensive recalculations every time a property is modified,
Blender defers making the actual calculations until they are needed.
Blender defers the evaluation until the results are needed.
However, while the script runs you may want to access the updated values.
In this case you need to call :class:`bpy.types.ViewLayer.update` after modifying values, for example:
@@ -110,44 +105,41 @@ In this case you need to call :class:`bpy.types.ViewLayer.update` after modifyin
bpy.context.view_layer.update()
Now all dependent data (child objects, modifiers, drivers... etc)
Now all dependent data (child objects, modifiers, drivers, etc.)
has been recalculated and is available to the script within active view layer.
Can I redraw during the script?
-------------------------------
Can I redraw during script execution?
-------------------------------------
The official answer to this is no, or... *"You don't want to do that"*.
To give some background on the topic...
To give some background on the topic:
While a script executes Blender waits for it to finish and is effectively locked until its done,
while in this state Blender won't redraw or respond to user input.
Normally this is not such a problem because scripts distributed with Blender
tend not to run for an extended period of time,
nevertheless scripts *can* take ages to execute and its nice to see what's going on in the view port.
nevertheless scripts *can* take a long time to complete and it would be nice to see progress in the viewport.
Tools that lock Blender in a loop and redraw are highly discouraged
since they conflict with Blenders ability to run multiple operators
When tools lock Blender in a loop redraw are highly discouraged
since they conflict with Blender's ability to run multiple operators
at once and update different parts of the interface as the tool runs.
So the solution here is to write a **modal** operator, that is - an operator which defines a modal() function,
See the modal operator template in the text editor.
So the solution here is to write a **modal** operator, which is an operator that defines a ``modal()`` function,
See the modal operator template in the text editor.
Modal operators execute on user input or setup their own timers to run frequently,
they can handle the events or pass through to be handled by the keymap or other modal operators.
Transform, Painting, Fly-Mode and File-Select are example of a modal operators.
Examples of a modal operators are Transform, Painting, Fly Navigation and File Select.
Writing modal operators takes more effort than a simple ``for`` loop
that happens to redraw but is more flexible and integrates better with Blenders design.
that contains draw calls but is more flexible and integrates better with Blender's design.
**Ok, Ok! I still want to draw from Python**
.. rubric:: Ok, Ok! I still want to draw from Python
If you insist - yes its possible, but scripts that use this hack won't be considered
for inclusion in Blender and any issues with using it won't be considered bugs,
this is also not guaranteed to work in future releases.
If you insist -- yes it's possible, but scripts that use this hack will not be considered
for inclusion in Blender and any issue with using it will not be considered a bug,
there is also no guaranteed compatibility in future releases.
.. code-block:: python
@@ -157,18 +149,18 @@ this is also not guaranteed to work in future releases.
Modes and Mesh Access
=====================
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode.
This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
When working with mesh data you may run into the problem where a script fails to run as expected in Edit-Mode.
This is caused by Edit-Mode having its own data which is only written back to the mesh when exiting Edit-Mode.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`)
but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
when the user is in Edit-Mode, where the mesh data is available but out of sync with the edit mesh.
In this situation you can...
- Exit edit-mode before running the tool.
- Exit Edit-Mode before running the tool.
- Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
- Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
- Report the context as incorrect and only allow the script to run outside edit-mode.
- Report the context as incorrect and only allow the script to run outside Edit-Mode.
.. _info_gotcha_mesh_faces:
@@ -176,24 +168,24 @@ In this situation you can...
N-Gons and Tessellation
=======================
Since 2.63 NGons are supported, this adds some complexity
Since 2.63 n-gons are supported, this adds some complexity
since in some cases you need to access triangles still (some exporters for example).
There are now 3 ways to access faces:
There are now three ways to access faces:
- :class:`bpy.types.MeshPolygon` -
this is the data structure which now stores faces in object mode
- :class:`bpy.types.MeshPolygon` --
this is the data structure which now stores faces in Object-Mode
(access as ``mesh.polygons`` rather than ``mesh.faces``).
- :class:`bpy.types.MeshLoopTriangle` -
- :class:`bpy.types.MeshLoopTriangle` --
the result of tessellating polygons into triangles
(access as ``mesh.loop_triangles``).
- :class:`bmesh.types.BMFace` -
the polygons as used in editmode.
- :class:`bmesh.types.BMFace` --
the polygons as used in Edit-Mode.
For the purpose of the following documentation,
these will be referred to as polygons, loop triangles and bmesh-faces respectively.
these will be referred to as polygons, loop triangles and BMesh-faces respectively.
5+ sided faces will be referred to as ``ngons``.
Faces with five or more sides will be referred to as ``ngons``.
Support Overview
@@ -216,58 +208,58 @@ Support Overview
- Unusable *(read-only)*.
- Best
* - Export/Output
- Good *(ngon support)*
- Good *(When ngons can't be used)*
- Good *(ngons, extra memory overhead)*
- Good *(n-gon support)*
- Good *(When n-gons cannot be used)*
- Good *(n-gons, extra memory overhead)*
.. note::
Using the :mod:`bmesh` API is completely separate API from :mod:`bpy`,
typically you would would use one or the other based on the level of editing needed,
typically you would use one or the other based on the level of editing needed,
not simply for a different way to access faces.
Creating
--------
All 3 datatypes can be used for face creation.
All three data types can be used for face creation:
- polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible,
- Polygons are the most efficient way to create faces but the data structure is *very* rigid and inflexible,
you must have all your vertices and faces ready and create them all at once.
This is further complicated by the fact that each polygon does not store its own verts,
This is further complicated by the fact that each polygon does not store its own vertices,
rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
- bmesh-faces are most likely the easiest way for new scripts to create faces,
since faces can be added one by one and the api has features intended for mesh manipulation.
- BMesh-faces are most likely the easiest way to create faces in new scripts,
since faces can be added one by one and the API has features intended for mesh manipulation.
While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
Editing
-------
Editing is where the 3 data types vary most.
Editing is where the three data types vary most.
- Polygons are very limited for editing,
changing materials and options like smooth works but for anything else
they are too inflexible and are only intended for storage.
- Tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
- BMesh-Faces are by far the best way to manipulate geometry.
- Tessfaces should not be used for editing geometry because doing so will cause existing n-gons to be tessellated.
- BMesh-faces are by far the best way to manipulate geometry.
Exporting
---------
All 3 data types can be used for exporting,
the choice mostly depends on whether the target format supports ngons or not.
All three data types can be used for exporting,
the choice mostly depends on whether the target format supports n-gons or not.
- Polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
- Tessfaces work well for exporting to formats which don't support ngons,
- Polygons are the most direct and efficient way to export providing they convert into the output format easily enough.
- Tessfaces work well for exporting to formats which don't support n-gons,
in fact this is the only place where their use is encouraged.
- BMesh-Faces can work for exporting too but may not be necessary if polygons can be used
since using bmesh gives some overhead because its not the native storage format in object mode.
since using BMesh gives some overhead because its not the native storage format in Object-Mode.
EditBones, PoseBones, Bone... Bones
===================================
Edit Bones, Pose Bones, Bone... Bones
=====================================
Armature Bones in Blender have three distinct data structures that contain them.
If you are accessing the bones through one of them, you may not have access to the properties you really need.
@@ -280,43 +272,41 @@ If you are accessing the bones through one of them, you may not have access to t
Edit Bones
----------
``bpy.context.object.data.edit_bones`` contains a editbones;
to access them you must set the armature mode to edit mode first (editbones do not exist in object or pose mode).
``bpy.context.object.data.edit_bones`` contains an edit bones;
to access them you must set the armature mode to Edit-Mode first (edit bones do not exist in Object or Pose-Mode).
Use these to create new bones, set their head/tail or roll, change their parenting relationships to other bones, etc.
Example using :class:`bpy.types.EditBone` in armature editmode:
This is only possible in edit mode.
Example using :class:`bpy.types.EditBone` in armature Edit-Mode
which is only possible in Edit-Mode:
>>> bpy.context.object.data.edit_bones["Bone"].head = Vector((1.0, 2.0, 3.0))
This will be empty outside of editmode.
This will be empty outside of Edit-Mode:
>>> mybones = bpy.context.selected_editable_bones
Returns an editbone only in edit mode.
Returns an edit bone only in Edit-Mode:
>>> bpy.context.active_bone
Bones (Object Mode)
Bones (Object-Mode)
-------------------
``bpy.context.object.data.bones`` contains bones.
These *live* in object mode, and have various properties you can change,
These *live* in Object-Mode, and have various properties you can change,
note that the head and tail properties are read-only.
Example using :class:`bpy.types.Bone` in object or pose mode:
Returns a bone (not an editbone) outside of edit mode
Example using :class:`bpy.types.Bone` in Object or Pose-Mode
returning a bone (not an edit bone) outside of Edit-Mode:
>>> bpy.context.active_bone
This works, as with blender the setting can be edited in any mode
This works, as with Blender the setting can be edited in any mode:
>>> bpy.context.object.data.bones["Bone"].use_deform = True
Accessible but read-only
Accessible but read-only:
>>> tail = myobj.data.bones["Bone"].tail
@@ -326,42 +316,42 @@ Pose Bones
``bpy.context.object.pose.bones`` contains pose bones.
This is where animation data resides, i.e. animatable transformations
are applied to pose bones, as are constraints and ik-settings.
are applied to pose bones, as are constraints and IK-settings.
Examples using :class:`bpy.types.PoseBone` in object or pose mode:
Examples using :class:`bpy.types.PoseBone` in Object or Pose-Mode:
.. code-block:: python
# Gets the name of the first constraint (if it exists)
bpy.context.object.pose.bones["Bone"].constraints[0].name
# Gets the last selected pose bone (pose mode only)
# Gets the last selected pose bone (Pose-Mode only)
bpy.context.active_pose_bone
.. note::
Notice the pose is accessed from the object rather than the object data,
this is why blender can have 2 or more objects sharing the same armature in different poses.
this is why Blender can have two or more objects sharing the same armature in different poses.
.. note::
Strictly speaking PoseBone's are not bones, they are just the state of the armature,
Strictly speaking pose bones are not bones, they are just the state of the armature,
stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`,
the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
yet the real bones are accessible from the pose bones via :class:`bpy.types.PoseBone.bone`.
Armature Mode Switching
-----------------------
While writing scripts that deal with armatures you may find you have to switch between modes,
when doing so take care when switching out of edit-mode not to keep references
to the edit-bones or their head/tail vectors.
Further access to these will crash blender so its important the script
when doing so take care when switching out of Edit-Mode not to keep references
to the edit bones or their head/tail vectors.
Further access to these will crash Blender so its important the script
clearly separates sections of the code which operate in different modes.
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode,
however for operator access you may still need to enter pose mode.
This is mainly an issue with Edit-Mode since pose data can be manipulated without having to be in Pose-Mode,
yet for operator access you may still need to enter Pose-Mode.
Data Names
@@ -372,8 +362,7 @@ Naming Limitations
------------------
A common mistake is to assume newly created data is given the requested name.
This can cause bugs when you add some data (normally imported) then reference it later by name.
This can cause bugs when you add data (normally imported) then reference it later by name:
.. code-block:: python
@@ -383,7 +372,7 @@ This can cause bugs when you add some data (normally imported) then reference it
bpy.data.meshes[meshid]
Or with name assignment...
Or with name assignment:
.. code-block:: python
@@ -397,12 +386,12 @@ Data names may not match the assigned values if they exceed the maximum length,
Its better practice not to reference objects by names at all,
once created you can store the data in a list, dictionary, on a class etc,
once created you can store the data in a list, dictionary, on a class, etc;
there is rarely a reason to have to keep searching for the same data by name.
If you do need to use name references, its best to use a dictionary to maintain
a mapping between the names of the imported assets and the newly created data,
this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
this way you don't run this risk of referencing existing data from the blend-file, or worse modifying it.
.. code-block:: python
@@ -421,17 +410,14 @@ this way you don't run this risk of referencing existing data from the blend fil
Library Collisions
------------------
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects,
meshes, scenes etc the same thing by accident.
However when linking in library data from another blend file naming collisions can occur,
Blender keeps data names unique (:class:`bpy.types.ID.name`) so you can't name two objects,
meshes, scenes, etc., the same by accident.
However, when linking in library data from another blend-file naming collisions can occur,
so its best to avoid referencing data by name at all.
This can be tricky at times and not even blender handles this correctly in some case
(when selecting the modifier object for eg you can't select between multiple objects with the same name),
but its still good to try avoid problems in this area.
This can be tricky at times and not even Blender handles this correctly in some case
(when selecting the modifier object for e.g. you can't select between multiple objects with the same name),
but its still good to try avoiding these problems in this area.
If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this.
.. code-block:: python
@@ -454,18 +440,17 @@ If you need to select between local and library data, there is a feature in ``bp
Relative File Paths
===================
Blenders relative file paths are not compatible with standard Python modules such as ``sys`` and ``os``.
Blender's relative file paths are not compatible with standard Python modules such as ``sys`` and ``os``.
Built-in Python functions don't understand Blender's ``//`` prefix which denotes the blend-file path.
Built in Python functions don't understand blenders ``//`` prefix which denotes the blend file path.
A common case where you would run into this problem is when exporting a material with associated image paths.
A common case where you would run into this problem is when exporting a material with associated image paths:
>>> bpy.path.abspath(image.filepath)
When using blender data from linked libraries there is an unfortunate complication
since the path will be relative to the library rather than the open blend file.
When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
When using Blender data from linked libraries there is an unfortunate complication
since the path will be relative to the library rather than the open blend-file.
When the data block may be from an external blend-file pass the library argument from the :class:`bpy.types.ID`.
>>> bpy.path.abspath(image.filepath, library=image.library)
@@ -478,19 +463,15 @@ Unicode Problems
Python supports many different encodings so there is nothing stopping you from
writing a script in ``latin1`` or ``iso-8859-15``.
See `PEP 263 <https://www.python.org/dev/peps/pep-0263/>`__.
See `pep-0263 <https://www.python.org/dev/peps/pep-0263/>`_
However this complicates matters for Blender's Python API because ``.blend`` files don't have an explicit encoding.
To avoid the problem for Python integration and script authors we have decided all strings in blend files
However, this complicates matters for Blender's Python API because ``.blend`` files don't have an explicit encoding.
To avoid the problem for Python integration and script authors we have decided all strings in blend-files
**must** be ``UTF-8``, ``ASCII`` compatible.
This means assigning strings with different encodings to an object names for instance will raise an error.
Paths are an exception to this rule since we cannot ignore the existence of non ``UTF-8`` paths on users file-system.
This means seemingly harmless expressions can raise errors, eg.
Paths are an exception to this rule since the existence of non-UTF-8 paths on user's file system cannot be ignored.
This means seemingly harmless expressions can raise errors, e.g:
>>> print(bpy.data.filepath)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 10-21: ordinal not in range(128)
@@ -501,7 +482,7 @@ This means seemingly harmless expressions can raise errors, eg.
TypeError: bpy_struct: item.attr= val: Object.name expected a string type, not str
Here are 2 ways around filesystem encoding issues:
Here are two ways around file-system encoding issues:
>>> print(repr(bpy.data.filepath))
@@ -512,11 +493,11 @@ Here are 2 ways around filesystem encoding issues:
Unicode encoding/decoding is a big topic with comprehensive Python documentation,
to avoid getting stuck too deep in encoding problems - here are some suggestions:
to keep it short about encoding problems -- here are some suggestions:
- Always use utf-8 encoding or convert to utf-8 where the input is unknown.
- Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead.
- Use ``os.fsencode()`` / ``os.fsdecode()`` instead of built in string decoding functions when operating on paths.
- Always use UTF-8 encoding or convert to UTF-8 where the input is unknown.
- Avoid manipulating file paths as strings directly, use ``os.path`` functions instead.
- Use ``os.fsencode()`` or ``os.fsdecode()`` instead of built-in string decoding functions when operating on paths.
- To print paths or to include them in the user interface use ``repr(path)`` first
or ``"%r" % path`` with string formatting.
@@ -528,11 +509,11 @@ to avoid getting stuck too deep in encoding problems - here are some suggestions
some importers do this.
Strange errors using 'threading' module
=======================================
Strange Errors when Using the 'Threading' Module
================================================
Python threading with Blender only works properly when the threads finish up before the script does.
By using ``threading.join()`` for example.
Python threading with Blender only works properly when the threads finish up before the script does,
for example by using ``threading.join()``.
Here is an example of threading supported by Blender:
@@ -571,8 +552,8 @@ Here is an example of threading supported by Blender:
t.join()
This an example of a timer which runs many times a second and moves
the default cube continuously while Blender runs **(Unsupported)**.
This an example of a timer which runs many times a second
and moves the default cube continuously while Blender runs **(Unsupported)**.
.. code-block:: python
@@ -592,33 +573,33 @@ the default cube continuously while Blender runs **(Unsupported)**.
Use cases like the one above which leave the thread running once the script finishes
may seem to work for a while but end up causing random crashes or errors in Blender's own drawing code.
So far, no work has gone into making Blender's Python integration thread safe,
so until its properly supported, best not make use of this.
So far, no work has been done to make Blender's Python integration thread safe,
so until it's properly supported, it's best not make use of this.
.. note::
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems,
the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Python threads only allow concurrency and won't speed up your scripts on multiprocessor systems,
the ``subprocess`` and ``multiprocess`` modules can be used with Blender to make use of multiple CPUs too.
Help! My script crashes Blender
===============================
**TL;DR:** Do not keep direct references to Blender data (of any kind) when modifying the container
of that data, and/or when some undo/redo may happen (e.g. during modal operators execution...).
:abbr:`TL;DR (Too long; didn't read.)` Do not keep direct references to Blender data (of any kind)
when modifying the container of that data, and/or when some undo/redo may happen
(e.g. during modal operators execution...).
Instead, use indices (or other data always stored by value in Python, like string keys...),
that allow you to get access to the desired data.
Ideally it would be impossible to crash Blender from Python
however there are some problems with the API where it can be made to crash.
Ideally it would be impossible to crash Blender from Python,
however, there are some problems with the API where it can be made to crash.
Strictly speaking this is a bug in the API but fixing it would mean adding memory verification
on every access since most crashes are caused by the Python objects referencing Blenders memory directly,
on every access since most crashes are caused by the Python objects referencing Blender's memory directly,
whenever the memory is freed or re-allocated, further Python access to it can crash the script.
But fixing this would make the scripts run very slow,
or writing a very different kind of API which doesn't reference the memory directly.
Here are some general hints to avoid running into these problems.
Here are some general hints to avoid running into these problems:
- Be aware of memory limits,
especially when working with large lists since Blender can crash simply by running out of memory.
@@ -631,16 +612,16 @@ Here are some general hints to avoid running into these problems.
- Modules or classes that remain active while Blender is used,
should not hold references to data the user may remove, instead,
fetch data from the context each time the script is activated.
- Crashes may not happen every time, they may happen more on some configurations/operating-systems.
- Be wary of recursive patterns, those are very efficient at hiding the issues described here.
- See last sub-section about `Unfortunate Corner Cases`_ for some known breaking exceptions.
- Crashes may not happen every time, they may happen more on some configurations or operating systems.
- Be careful with recursive patterns, those are very efficient at hiding the issues described here.
- See last subsection about `Unfortunate Corner Cases`_ for some known breaking exceptions.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See the `faulthandler docs <https://docs.python.org/dev/library/faulthandler.html>`_.
See the `Faulthandler docs <https://docs.python.org/dev/library/faulthandler.html>`__.
While the crash may be in Blenders C/C++ code,
While the crash may be in Blender's C/C++ code,
this can help a lot to track down the area of the script that causes the crash.
.. note::
@@ -654,7 +635,7 @@ Here are some general hints to avoid running into these problems.
in any possible way.
**Dont:**
.. rubric:: Do not:
.. code-block:: python
@@ -673,7 +654,7 @@ Here are some general hints to avoid running into these problems.
first_item.name = "foobar"
**Do:**
.. rubric:: Do:
.. code-block:: python
@@ -696,33 +677,31 @@ Here are some general hints to avoid running into these problems.
Undo/Redo
---------
Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Lamp... etc).
Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Light, etc.).
This example shows how you can tell undo changes the memory locations.
This example shows how you can tell undo changes the memory locations:
>>> hash(bpy.context.object)
-9223372036849950810
>>> hash(bpy.context.object)
-9223372036849950810
# ... move the active object, then undo
Move the active object, then undo:
>>> hash(bpy.context.object)
-9223372036849951740
As suggested above, simply not holding references to data when Blender is used
interactively by the user is the only way to ensure the script doesn't become unstable.
interactively by the user is the only way to make sure that the script doesn't become unstable.
Undo & Library Data
^^^^^^^^^^^^^^^^^^^
One of the advantages with Blenders library linking system that undo
One of the advantages with Blender's library linking system that undo
can skip checking changes in library data since it is assumed to be static.
Tools in Blender are not allowed to modify library data.
Python however does not enforce this restriction.
But Python does not enforce this restriction.
This can be useful in some cases, using a script to adjust material values for example.
But its also possible to use a script to make library data point to newly created local data,
@@ -733,13 +712,13 @@ So it's best to consider modifying library data an advanced usage of the API
and only to use it when you know what you're doing.
Edit Mode / Memory Access
Edit-Mode / Memory Access
-------------------------
Switching edit-mode ``bpy.ops.object.mode_set(mode='EDIT')`` / ``bpy.ops.object.mode_set(mode='OBJECT')``
Switching mode ``bpy.ops.object.mode_set(mode='EDIT')`` or ``bpy.ops.object.mode_set(mode='OBJECT')``
will re-allocate objects data,
any references to a meshes vertices/polygons/uvs, armatures bones,
curves points etc cannot be accessed after switching edit-mode.
any references to a meshes vertices/polygons/UVs, armatures bones,
curves points, etc. cannot be accessed after switching mode.
Only the reference to the data its self can be re-accessed, the following example will crash.
@@ -754,7 +733,7 @@ Only the reference to the data its self can be re-accessed, the following exampl
print(polygons)
So after switching edit-mode you need to re-access any object data variables,
So after switching mode you need to re-access any object data variables,
the following example shows how to avoid the crash above.
.. code-block:: python
@@ -770,7 +749,7 @@ the following example shows how to avoid the crash above.
These kinds of problems can happen for any functions which re-allocate
the object data but are most common when switching edit-mode.
the object data but are most common when switching mode.
Array Re-Allocation
@@ -791,21 +770,20 @@ internally the array which stores this data is re-allocated.
This can be avoided by re-assigning the point variables after adding the new one or by storing
indices to the points rather than the points themselves.
The best way is to sidestep the problem altogether add all the points to the curve at once.
This means you don't have to worry about array re-allocation and its faster too
since reallocating the entire array for every point added is inefficient.
The best way is to sidestep the problem altogether by adding all the points to the curve at once.
This means you don't have to worry about array re-allocation and it's faster too
since re-allocating the entire array for every added point is inefficient.
Removing Data
-------------
**Any** data that you remove shouldn't be modified or accessed afterwards,
this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints
along with objects, scenes, collections, bones.. etc.
this includes: F-curves, drivers, render layers, timeline markers, modifiers, constraints
along with objects, scenes, collections, bones, etc.
The ``remove()`` api calls will invalidate the data they free to prevent common mistakes.
The following example shows how this precaution works.
The ``remove()`` API calls will invalidate the data they free to prevent common mistakes.
The following example shows how this precaution works:
.. code-block:: python
@@ -818,7 +796,7 @@ The following example shows how this precaution works.
But take care because this is limited to scripts accessing the variable which is removed,
the next example will still crash.
the next example will still crash:
.. code-block:: python
@@ -835,8 +813,8 @@ Besides all expected cases listed above, there are a few others that should not
an issue but, due to internal implementation details, currently are:
- ``Object.hide_viewport``, ``Object.hide_select`` and ``Object.hide_render``:
Setting any of those booleans will trigger a rebuild of Collection caches, hence breaking
any current iteration over ``Collection.all_objects``.
Setting any of those Booleans will trigger a rebuild of Collection caches,
thus breaking any current iteration over ``Collection.all_objects``.
sys.exit
@@ -848,5 +826,5 @@ as if Blender is crashing since ``sys.exit()`` will close Blender immediately.
For example, the ``argparse`` module will print an error and exit if the arguments are invalid.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of Python code is quitting,
An dirty way of troubleshooting this is to set ``sys.exit = None`` and see what line of Python code is quitting,
you could of course replace ``sys.exit`` with your own function but manipulating Python in this way is bad practice.

View File

@@ -1,4 +1,3 @@
.. _info_overview:
*******************
@@ -6,24 +5,24 @@ Python API Overview
*******************
The purpose of this document is to explain how Python and Blender fit together,
covering some of the functionality that may not be obvious from reading the API
references and example scripts.
covering some of the functionality that may not be obvious from reading the API references
and example scripts.
Python in Blender
=================
Blender has an embedded Python interpreter which is loaded when Blender is started and stays
active while Blender is running. This interpreter runs scripts to draw the user interface
and is used for some of Blenders internal tools as well.
Blender has an embedded Python interpreter which is loaded when Blender is started
and stays active while Blender is running. This interpreter runs scripts to draw the user interface
and is used for some of Blender's internal tools as well.
Blender's embedded interpreter provides a typical Python environment, so code from tutorials
on how to write Python scripts can also be run with Blenders interpreter. Blender provides its
on how to write Python scripts can also be run with Blender's interpreter. Blender provides its
Python modules, such as :mod:`bpy` and :mod:`mathutils`, to the embedded interpreter so they can
be imported into a script and give access to Blender's data, classes, and functions. Scripts that
deal with Blender data will need to import the modules to work.
be imported into a script and give access to Blender's data, classes, and functions.
Scripts that deal with Blender data will need to import the modules to work.
Here is a simple example which moves a vertex attached to an object named **Cube**:
Here is a simple example which moves a vertex attached to an object named "Cube":
.. code-block:: python
@@ -31,7 +30,7 @@ Here is a simple example which moves a vertex attached to an object named **Cube
bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
This modifies Blender's internal data directly.
When you run this in the interactive console you will see the 3D viewport update.
When you run this in the interactive console you will see the 3D Viewport update.
The Default Environment
@@ -41,7 +40,7 @@ When developing your own scripts it may help to understand how Blender sets up i
Many Python scripts come bundled with Blender and can be used as a reference
because they use the same API that script authors write tools in.
Typical usage for scripts include: user interface, import/export,
scene manipulation, automation, defining your own toolset and customization.
scene manipulation, automation, defining your own tool set and customization.
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
The exact location of this directory depends on your installation.
@@ -54,8 +53,8 @@ Script Loading
This may seem obvious, but it is important to note the difference between
executing a script directly and importing a script as a module.
Extending Blender by executing a script directly means the classes that the script
defines remain available inside Blender after the script finishes execution.
Extending Blender by executing a script directly means the classes that the script defines
remain available inside Blender after the script finishes execution.
Using scripts this way makes future access to their classes
(to unregister them for example) more difficult compared to importing the scripts as modules.
When a script is imported as a module, its class instances will remain
@@ -63,12 +62,11 @@ inside the module and can be accessed later on by importing that module again.
For this reason it is preferable to avoid directly executing scripts that extend Blender by registering classes.
Here are some ways to run scripts directly in Blender:
Here are some ways to run scripts directly in Blender.
- Loaded in the text editor and press **Run Script**.
- Loaded in the text editor and press *Run Script*.
- Typed or pasted into the interactive console.
- Execute a Python file from the command line with Blender, eg:
- Execute a Python file from the command line with Blender, e.g:
.. code-block:: sh
@@ -77,24 +75,22 @@ Here are some ways to run scripts directly in Blender.
To run as modules:
- The obvious way, ``import some_module`` command from the text window or interactive console.
- Open as a text block and tick "Register" option, this will load with the blend file.
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
- define as an add-on, enabling the add-on will load it as a Python module.
- The obvious way, ``import some_module`` command from the text editor or interactive console.
- Open as a text data-block and check the *Register* option, this will load with the blend-file.
- Copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
- Define as an add-on, enabling the add-on will load it as a Python module.
Add-ons
-------
Some of Blenders functionality is best kept optional,
alongside scripts loaded at startup we have add-ons which are kept in their own directory ``scripts/addons``,
and only load on startup if selected from the user preferences.
The only difference between add-ons and built-in Python modules is that add-ons must contain a ``bl_info``
variable which Blender uses to read metadata such as name, author, category and URL.
The User Preferences add-on listing uses **bl_info** to display information about each add-on.
Some of Blender's functionality is best kept optional,
alongside scripts loaded at startup there are add-ons which are kept in their own directory ``scripts/addons``,
They are only loaded on startup if selected from the user preferences.
The only difference between add-ons and built-in Python modules is that add-ons must contain a ``bl_info`` variable
which Blender uses to read metadata such as name, author, category and project link.
The User Preferences add-on listing uses ``bl_info`` to display information about each add-on.
`See Add-ons <https://wiki.blender.org/index.php/Dev:Py/Scripts/Guidelines/Addons>`__
for details on the ``bl_info`` dictionary.
@@ -105,7 +101,7 @@ Integration through Classes
Running Python scripts in the text editor is useful for testing but you'll
want to extend Blender to make tools accessible like other built-in functionality.
The Blender Python api allows integration for:
The Blender Python API allows integration for:
- :class:`bpy.types.Panel`
- :class:`bpy.types.Menu`
@@ -114,13 +110,12 @@ The Blender Python api allows integration for:
- :class:`bpy.types.KeyingSet`
- :class:`bpy.types.RenderEngine`
This is intentionally limited. Currently, for more advanced features such as mesh modifiers,
object types, or shader nodes, C/C++ must be used.
For Python integration Blender defines methods which are common to all types.
This works by creating a Python subclass of a Blender class which contains variables and functions
specified by the parent class which are pre-defined to interface with Blender.
specified by the parent class which are predefined to interface with Blender.
For example:
@@ -137,22 +132,20 @@ For example:
bpy.utils.register_class(SimpleOperator)
First note that we subclass a member of :mod:`bpy.types`,
First note that it defines a subclass as a member of :mod:`bpy.types`,
this is common for all classes which can be integrated with Blender and
used so we know if this is an Operator and not a Panel when registering.
is used to distinguish an Operator from a Panel when registering.
Both class properties start with a ``bl_`` prefix.
This is a convention used to distinguish Blender properties from those you add yourself.
Next see the execute function, which takes an instance of the operator and the current context.
A common prefix is not used for functions.
Lastly the register function is called, this takes the class and loads it into Blender. See `Class Registration`_.
Regarding inheritance, Blender doesn't impose restrictions on the kinds of class inheritance used,
the registration checks will use attributes and functions defined in parent classes.
class mix-in example:
Class mix-in example:
.. code-block:: python
@@ -173,8 +166,8 @@ While ``__init__()`` and ``__del__()`` will be called if defined,
the class instances lifetime only spans the execution.
So a panel for example will have a new instance for every redraw,
for this reason there is rarely a cause to store variables in the panel instance.
Instead, persistent variables should be stored in Blenders
ata so that the state can be restored when Blender is restarted.
Instead, persistent variables should be stored in Blender's data
so that the state can be restored when Blender is restarted.
.. note::
@@ -182,15 +175,14 @@ ata so that the state can be restored when Blender is restarted.
So once the class is registered with Blender, instancing the class and calling the functions is left up to Blender.
In fact you cannot instance these classes from the script as you would expect with most Python API's.
To run operators you can call them through the operator api, eg:
To run operators you can call them through the operator API, e.g:
.. code-block:: python
import bpy
bpy.ops.object.simple_operator()
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc,
User interface classes are given a context in which to draw, buttons, window, file header, toolbar, etc.,
then they are drawn when that area is displayed so they are never called by Python scripts directly.
@@ -205,7 +197,7 @@ Module Registration
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions.
These are the *only* functions that Blender calls from your code, which is otherwise a regular Python module.
A simple Blender/Python module can look like this:
A simple Blender Python module can look like this:
.. code-block:: python
@@ -225,16 +217,15 @@ A simple Blender/Python module can look like this:
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items.
You can also use them for internal purposes setting up data for your own tools but take care
since register won't re-run when a new blend file is loaded.
since register won't re-run when a new blend-file is loaded.
The register/unregister calls are used so it's possible to toggle add-ons and reload scripts while Blender runs.
If the register calls were placed in the body of the script, registration would be called on import,
meaning there would be no distinction between importing a module or loading its classes into Blender.
This becomes problematic when a script imports classes from another module
making it difficult to manage which classes are being loaded and when.
The last 2 lines are only for testing:
The last two lines are only for testing:
.. code-block:: python
@@ -251,7 +242,6 @@ Class Registration
Registering a class with Blender results in the class definition being loaded into Blender,
where it becomes available alongside existing functionality.
Once this class is loaded you can access it from :mod:`bpy.types`,
using the ``bl_idname`` rather than the classes original name.
@@ -271,23 +261,23 @@ Using the function arguments ``def execute(self, context, spam)``, will raise an
``ValueError: expected Operator, SimpleOperator class "execute" function to have 2 args, found 3``
Using ``bl_idname = 1`` will raise.
Using ``bl_idname = 1`` will raise:
``TypeError: validating class error: Operator.bl_idname expected a string type, not int``
Inter Classes Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^
Inter-Class Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^
When customizing Blender you may want to group your own settings together,
after all, they will likely have to co-exist with other scripts.
To group these properties classes need to be defined,
for groups within groups or collections within groups
you can find yourself having to deal with order of registration/unregistration.
you can't avoid having to deal with the order of registration/unregistration.
Custom properties groups are themselves classes which need to be registered.
Say you want to store material settings for a custom engine.
For example, if you want to store material settings for a custom engine:
.. code-block:: python
@@ -311,7 +301,7 @@ Say you want to store material settings for a custom engine.
.. note::
*The class must be registered before being used in a property, failing to do so will raise an error:*
The class **must be** registered before being used in a property, failing to do so will raise an error:
``ValueError: bpy_struct "Material" registration error: my_custom_props could not register``
@@ -341,17 +331,17 @@ Say you want to store material settings for a custom engine.
if __name__ == "__main__":
register()
.. note::
.. important::
*The lower most class needs to be registered first and that unregister() is a mirror of register()*
The lower most class needs to be registered first and that ``unregister()`` is a mirror of ``register()``.
Manipulating Classes
^^^^^^^^^^^^^^^^^^^^
Properties can be added and removed as Blender runs,
normally happens on register or unregister but for some
special cases it may be useful to modify types as the script runs.
normally done on register or unregister but for some special cases
it may be useful to modify types as the script runs.
For example:
@@ -362,7 +352,7 @@ For example:
# remove
del bpy.types.Object.my_float
This works just as well for PropertyGroup subclasses you define yourself.
This works just as well for ``PropertyGroup`` subclasses you define yourself.
.. code-block:: python
@@ -370,7 +360,7 @@ This works just as well for PropertyGroup subclasses you define yourself.
pass
MyPropGroup.my_float: bpy.props.FloatProperty()
...this is equivalent to:
This is equivalent to:
.. code-block:: python
@@ -378,11 +368,11 @@ This works just as well for PropertyGroup subclasses you define yourself.
my_float: bpy.props.FloatProperty()
Dynamic Defined-Classes (Advanced)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dynamic Class Definition (Advanced)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In some cases the specifier for data may not be in Blender, renderman shader definitions
for example, and it may be useful to define them as types and remove them on the fly.
In some cases the specifier for data may not be in Blender, for example a external render engines shader definitions,
and it may be useful to define them as types and remove them on the fly.
.. code-block:: python

View File

@@ -1,19 +1,16 @@
.. _info_quickstart:
***********************
Quickstart Introduction
***********************
**********
Quickstart
**********
Preface
=======
This :abbr:`API (Application Programming Interface)` is generally stable
but some areas are still being extended and improved.
This API is generally stable but some areas are still being added and improved.
The Blender/Python API can do the following:
.. rubric:: Blender Python API features:
- Edit any data the user interface can (Scenes, Meshes, Particles etc.).
- Modify user preferences, key-maps and themes.
- Modify user preferences, keymaps and themes.
- Run tools with own settings.
- Create user interface elements such as menus, headers and panels.
- Create new tools.
@@ -21,10 +18,10 @@ The Blender/Python API can do the following:
- Create new rendering engines that integrate with Blender.
- Subscribe to changes to data and it's properties.
- Define new settings in existing Blender data.
- Draw in the 3D view using Python.
- Draw in the 3D Viewport using Python.
The Blender/Python API **can't** (yet)...
.. rubric:: (Still) missing features:
- Create new space types.
- Assign custom properties to every type.
@@ -33,22 +30,21 @@ The Blender/Python API **can't** (yet)...
Before Starting
===============
This document isn't intended to fully cover each topic.
Rather, its purpose is to familiarize you with Blender Python API.
This document its intended to familiarize you with Blender Python API
but not to fully cover each topic.
A quick list of helpful things to know before starting:
- Blender uses Python 3.x; some online documentation still assumes 2.x.
- Blender uses Python 3.x; some online documentation still assumes version 2.x.
- The interactive console is great for testing one-liners.
It also has autocompletion so you can inspect the API quickly.
- Button tool tips show Python attributes and operator names.
- Right clicking on buttons and menu items directly links to API documentation.
- For more examples, the text menu has a templates section where some example operators can be found.
- Button tooltips show Python attributes and operator names.
- The context menu of buttons directly links to this API documentation.
- More operator examples can be found in the text editor's template menu.
- To examine further scripts distributed with Blender, see:
| ``scripts/startup/bl_ui`` for the user interface,
| ``scripts/startup/bl_operators`` for operators.
- ``scripts/startup/bl_ui`` for the user interface.
- ``scripts/startup/bl_operators`` for operators.
Exact location depends on platform, see:
:ref:`directory layout docs <blender_manual:blender-directory-layout>`.
@@ -59,19 +55,14 @@ Running Scripts
The two most common ways to execute Python scripts are using the built-in
text editor or entering commands in the Python console.
Both the *Text Editor* and *Python Console* are space types you can select from the view header.
Both the *Text Editor* and *Python Console* are space types you can select from the header.
Rather than manually configuring your spaces for Python development,
you may prefer to use the *Scripting* screen, included default with Blender,
accessible from the top headers screen selector.
you can use the *Scripting* workspace accessible from the Topbar tabs.
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using *Run Script*.
The Python Console is typically used for typing in snippets and for testing to get immediate feedback,
but can also have entire scripts pasted into it.
Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
Scripts can also run from the command line with Blender but to learn scripting in Blender this isn't essential.
Key Concepts
@@ -80,14 +71,13 @@ Key Concepts
Data Access
-----------
Accessing DataBlocks
^^^^^^^^^^^^^^^^^^^^
Accessing Data-Blocks
^^^^^^^^^^^^^^^^^^^^^
Python accesses Blender's data in the same way as the animation system and user interface;
this implies that any setting that can be changed via a button can also be changed from Python.
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`.
This gives access to library data. For example:
You can access Blender's data with the Python API in the same way as the animation system or user interface;
this implies that any setting that can be changed via a button can also be changed with Python.
Accessing data from the currently loaded blend-file is done with the module :mod:`bpy.data`.
It gives access to library data, for example:
>>> bpy.data.objects
<bpy_collection[3], BlendDataObjects>
@@ -99,12 +89,11 @@ This gives access to library data. For example:
<bpy_collection[1], BlendDataMaterials>
About Collections
^^^^^^^^^^^^^^^^^
Accessing Collections
^^^^^^^^^^^^^^^^^^^^^
You'll notice that an index as well as a string can be used to access members of the collection.
Unlike Python's dictionaries, both methods are acceptable;
You will notice that an index as well as a string can be used to access members of the collection.
Unlike Python dictionaries, both methods are available;
however, the index of a member may change while running Blender.
>>> list(bpy.data.objects)
@@ -120,7 +109,7 @@ however, the index of a member may change while running Blender.
Accessing Attributes
^^^^^^^^^^^^^^^^^^^^
Once you have a data block, such as a material, object, collections etc.,
Once you have a data-block, such as a material, object, collection, etc.,
its attributes can be accessed much like you would change a setting using the graphical interface.
In fact, the tooltip for each button also displays the Python attribute
which can help in finding what settings to change in a script.
@@ -135,8 +124,8 @@ which can help in finding what settings to change in a script.
bpy.data.materials['MyMaterial']
For testing what data to access it's useful to use the "Console", which is its own space type.
This supports auto-complete, giving you a fast way to dig into different data in your file.
For testing what data to access it's useful to use the Python Console, which is its own space type.
This supports auto-complete, giving you a fast way to explore the data in your file.
Example of a data path that can be quickly found via the console:
@@ -149,8 +138,8 @@ Example of a data path that can be quickly found via the console:
Data Creation/Removal
^^^^^^^^^^^^^^^^^^^^^
Those of you familiar with other Python API's may be surprised that
new data-blocks in the bpy API can't be created by calling the class:
When you are familiar with other Python APIs you may be surprised that
new data-blocks in the bpy API cannot be created by calling the class:
>>> bpy.types.Mesh()
Traceback (most recent call last):
@@ -159,10 +148,10 @@ new data-blocks in the bpy API can't be created by calling the class:
This is an intentional part of the API design.
The Blender/Python API can't create Blender data that exists outside the main Blender database
(accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
The Blender Python API can't create Blender data that exists outside the main Blender database
(accessed through :mod:`bpy.data`), because this data is managed by Blender (save, load, undo, append, etc).
Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
Data is added and removed via methods on the collections in :mod:`bpy.data`, e.g:
>>> mesh = bpy.data.meshes.new(name="MyMesh")
>>> print(mesh)
@@ -174,14 +163,12 @@ Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
Custom Properties
^^^^^^^^^^^^^^^^^
Python can access properties on any datablock that has an ID
(data that can be linked in and accessed from :mod:`bpy.data`.
When assigning a property, you can make up your own names,
these will be created when needed or overwritten if they exist.
Python can access properties on any data-block that has an ID
(data that can be linked in and accessed from :mod:`bpy.data`).
When assigning a property, you can pick your own names,
these will be created when needed or overwritten if they already exist.
This data is saved with the blend file and copied with objects.
Example:
This data is saved with the blend-file and copied with objects, for example:
.. code-block:: python
@@ -201,10 +188,10 @@ Example:
del collection["MySettings"]
Note that these properties can only be assigned basic Python types.
Note that these properties can only be assigned basic Python types:
- int, float, string
- array of ints/floats
- array of ints or floats
- dictionary (only string keys are supported, values must be basic types too)
These properties are valid outside of Python. They can be animated by curves or used in driver paths.
@@ -218,18 +205,16 @@ it's more common to operate on the user's selection.
The context is always available from ``bpy.context`` and can be used to get the active object, scene,
tool settings along with many other attributes.
Common-use cases:
Some common use cases are:
>>> bpy.context.object
>>> bpy.context.selected_objects
>>> bpy.context.visible_bones
Note that the context is read-only.
These values cannot be modified directly,
though they may be changed by running API functions or by using the data API.
Note that the context is read-only, which means that these values cannot be modified directly.
But they can be changed by running API functions or by using the data API.
So ``bpy.context.active_object = obj`` will raise an error.
But ``bpy.context.view_layer.objects.active = obj`` works as expected.
The context attributes change depending on where they are accessed.
@@ -257,7 +242,7 @@ Examples:
.. tip::
The :ref:`Operator Cheat Sheet <blender_manual:bpy.ops.wm.operator_cheat_sheet>`.
The :ref:`Operator Cheat Sheet <blender_manual:bpy.ops.wm.operator_cheat_sheet>`
gives a list of all operators and their default values in Python syntax, along with the generated docs.
This is a good way to get an overview of all Blender's operators.
@@ -265,8 +250,8 @@ Examples:
Operator Poll()
^^^^^^^^^^^^^^^
Many operators have a "poll" function which may check that the cursor
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
Many operators have a "poll" function which checks if the cursor
is in a valid area or if the object is in the correct mode (Edit Mode, Weight Paint Mode, etc).
When an operator's poll function fails within Python, an exception is raised.
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error:
@@ -275,10 +260,10 @@ For example, calling ``bpy.ops.view3d.render_border()`` from the console raises
RuntimeError: Operator bpy.ops.view3d.render_border.poll() failed, context is incorrect
In this case the context must be the 3d view with an active camera.
In this case the context must be the 3D Viewport with an active camera.
To avoid using try/except clauses wherever operators are called you can call the operators
own ``poll()`` function to check if it can run in the current context.
To avoid using try-except clauses wherever operators are called, you can call the operators
own ``poll()`` function to check if it can run the operator in the current context.
.. code-block:: python
@@ -291,11 +276,10 @@ Integration
Python scripts can integrate with Blender in the following ways:
- By defining a rendering engine.
- By defining a render engine.
- By defining operators.
- By defining menus, headers and panels.
- By inserting new buttons into existing menus, headers and panels
- By inserting new buttons into existing menus, headers and panels.
In Python, this is done by defining a class, which is a subclass of an existing type.
@@ -306,56 +290,52 @@ Example Operator
.. literalinclude:: __/__/__/release/scripts/templates_py/operator_simple.py
Once this script runs, ``SimpleOperator`` is registered with Blender
and can be called from the operator search popup or added to the toolbar.
and can be called from Operator Search or added to the toolbar.
To run the script:
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it.
#. Start Blender
#. Press :kbd:`Ctrl-Right` twice to change to the Scripting layout.
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
#. Click on the button **Run Script**.
#. Start Blender and switch to the Scripting workspace.
#. Click the *New* button in the text editor to create a new text data-block.
#. Copy the code from above and paste it into the text editor.
#. Click on the *Run Script* button.
#. Move your cursor into the 3D Viewport,
open the :ref:`operator search menu <blender_manual:bpy.ops.wm.search_menu>`,
open the :ref:`Operator Search menu <blender_manual:bpy.ops.wm.search_menu>`,
and type "Simple".
#. Click on the "Simple Operator" item found in search.
.. seealso::
.. seealso:: The class members with the ``bl_`` prefix are documented in the API
reference :class:`bpy.types.Operator`
The class members with the ``bl_`` prefix are documented in the API reference :class:`bpy.types.Operator`.
.. note::
The output from the ``main`` function is sent to the terminal;
in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
Example Panel
-------------
Panels register themselves as a class, like an operator.
Panels are registered as a class, like an operator.
Notice the extra ``bl_`` variables used to set the context they display in.
.. literalinclude:: __/__/__/release/scripts/templates_py/ui_panel_simple.py
To run the script:
#. Highlight the above code then press :kbd:`Ctrl-C` to copy it.
#. Start Blender.
#. Click on the tab for the *Scripting* workspace.
#. Click the button labeled ``New`` to create a new text block.
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
#. Click on the button **Run Script**.
#. Start Blender and switch to the Scripting workspace.
#. Click the *New* button in the text editor to create a new text data-block.
#. Copy the code from above and paste it into the text editor.
#. Click on the *Run Script* button.
To view the results:
#. Select the the default cube.
#. Select the default cube.
#. Click on the Object properties icon in the buttons panel (far right; appears as a tiny cube).
#. Scroll down to see a panel named **Hello World Panel**.
#. Changing the object name also updates **Hello World Panel's** Name: field.
#. Scroll down to see a panel named "Hello World Panel".
#. Changing the object name also updates *Hello World Panel's* name: field.
Note the row distribution and the label and properties that are available through the code.
Note the row distribution and the label and properties that are defined through the code.
.. seealso:: :class:`bpy.types.Panel`
@@ -364,8 +344,7 @@ Types
=====
Blender defines a number of Python types but also uses Python native types.
Blender's Python API can be split up into 3 categories.
Blender's Python API can be split up into three categories.
Native Types
@@ -374,7 +353,7 @@ Native Types
In simple cases returning a number or a string as a custom type would be cumbersome,
so these are accessed as normal Python types.
- Blender float/int/boolean -> float/int/boolean
- Blender float, int, boolean -> float, int, boolean
- Blender enumerator -> string
>>> C.object.rotation_mode = 'AXIS_ANGLE'
@@ -393,11 +372,10 @@ so these are accessed as normal Python types.
Internal Types
--------------
Used for Blender data-blocks and collections: :class:`bpy.types.bpy_struct`
:class:`bpy.types.bpy_struct` is used for Blender data-blocks and collections.
Also for data that contains its own attributes: collections, meshes, bones, scenes, etc.
For data that contains its own attributes collections/meshes/bones/scenes... etc.
There are 2 main types that wrap Blenders data, one for data-blocks
There are two main types that wrap Blender's data, one for data-blocks
(known internally as ``bpy_struct``), another for properties.
>>> bpy.context.object
@@ -406,14 +384,13 @@ There are 2 main types that wrap Blenders data, one for data-blocks
>>> C.scene.objects
bpy.data.scenes['Scene'].objects
Note that these types reference Blender's data so modifying them is immediately visible.
Note that these types reference Blender's data so modifying them is visible immediately.
Mathutils Types
---------------
Used for vectors, quaternion, eulers, matrix and color types, accessible from :mod:`mathutils`
Accessible from :mod:`mathutils` are vectors, quaternions, Euler angles, matrix and color types.
Some attributes such as :class:`bpy.types.Object.location`,
:class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location`
can be accessed as special math types which can be used together and manipulated in various useful ways.
@@ -422,14 +399,13 @@ Example of a matrix, vector multiplication:
.. code-block:: python
bpy.context.object.matrix_world * bpy.context.object.data.verts[0].co
bpy.context.object.matrix_world @ bpy.context.object.data.verts[0].co
.. note::
mathutils types keep a reference to Blender's internal data so changes can
be applied back.
Example:
.. code-block:: python
@@ -449,13 +425,11 @@ Example of a matrix, vector multiplication:
Animation
=========
There are 2 ways to add keyframes through Python.
There are two ways to add keyframes through Python.
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user.
The first is through key properties directly, which is like inserting a keyframe from the button as a user.
You can also manually create the curves and keyframe data, then set the path to the property.
Here are examples of both methods.
Both examples insert a keyframe on the active object's Z axis.
Here are examples of both methods. Both insert a keyframe on the active object's Z axis.
Simple example:
@@ -467,7 +441,7 @@ Simple example:
obj.location[2] = 1.0
obj.keyframe_insert(data_path="location", frame=20.0, index=2)
Using Low-Level Functions:
Using low-level functions:
.. code-block:: python

View File

@@ -4,23 +4,22 @@ Tips and Tricks
***************
Here are various suggestions that you might find useful when writing scripts.
Some of these are just Python features that scripters may not have thought to use with Blender,
others are Blender specific.
Some of these are just Python features that you may not have thought to use with Blender,
others are Blender-specific.
.. _use_the_terminal:
Use The Terminal
Use the Terminal
================
When writing Python scripts, it's useful to have a terminal open,
this is not the built-in Python console but a terminal application which is used to start Blender.
There are 3 main uses for the terminal, these are:
The three main use cases for the terminal are:
- You can see the output of ``print()`` as your script runs, which is useful to view debug info.
- The error trace-back is printed in full to the terminal which won't always generate an error popup in
- The error traceback is printed in full to the terminal which won't always generate an report message in
Blender's user interface (depending on how the script is executed).
- If the script runs for too long or you accidentally enter an infinite loop,
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
@@ -28,26 +27,25 @@ There are 3 main uses for the terminal, these are:
.. note::
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the help menu.
On Windows the terminal can be enabled from the Help menu.
Interface Tricks
================
Access Operator Commands
------------------------
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops.[...])`` command
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops.[...]`` command
to run that button, a handy (hidden) feature is that you can press :kbd:`Ctrl-C` over
any menu item/button to copy this command into the clipboard.
any menu item or button to copy this command into the clipboard.
Access Data Path
----------------
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away.
To get this quickly you can right click on the setting and select select **Copy Data Path**,
To find the path from an :class:`ID` data-block to its setting isn't always so simple since it may be nested away.
To get this quickly open the context menu of the setting and select *Copy Data Path*,
if this can't be generated, only the property name is copied.
.. note::
@@ -62,11 +60,10 @@ if this can't be generated, only the property name is copied.
Show All Operators
==================
While Blender logs operators in the Info space,
this only reports operators with the ``REGISTER`` option enabeld so as not to flood the *Info* view
While Blender logs operators in the Info editor,
this only reports operators with the ``REGISTER`` option enabled so as not to flood the *Info* view
with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
However, for testing it can be useful to see **every** operator called in a terminal,
Yet for testing it can be useful to see **every** operator called in a terminal,
do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting Blender
or by setting :mod:`bpy.app.debug_wm` to ``True`` while Blender is running.
@@ -74,20 +71,18 @@ or by setting :mod:`bpy.app.debug_wm` to ``True`` while Blender is running.
Use an External Editor
======================
Blenders text editor is fine for small changes and writing tests but its not full featured,
Blender's text editor is fine for small changes and writing tests but its not full featured,
for larger projects you'll probably want to use a standalone editor or Python IDE.
Editing a text file externally and having the same text open in Blender does work but isn't that optimal
so here are 2 ways you can easily use an external file from Blender.
Using the following examples you'll still need textblock in Blender to execute,
Editing a text file externally and having the same text open in Blender does work
but isn't that optimal so here are two ways you can use an external file from Blender.
Using the following examples you'll still need text data-block in Blender to execute,
but reference an external file rather than including it directly.
Executing External Scripts
--------------------------
This is the equivalent to running the script directly, referencing a scripts path from a 2 line text-block.
This is the equivalent to running the script directly, referencing a scripts path from a two line code block.
.. code-block:: python
@@ -95,7 +90,7 @@ This is the equivalent to running the script directly, referencing a scripts pat
exec(compile(open(filename).read(), filename, 'exec'))
You might want to reference a script relative to the blend file.
You might want to reference a script relative to the blend-file.
.. code-block:: python
@@ -128,9 +123,10 @@ has to call a function in the module, in this case ``main()`` but it can be any
an advantage with this is you can pass arguments to the function from this
small script which is often useful for testing different settings quickly.
The other issue with this is the script has to be in Pythons module search path.
While this is not best practice - for testing you can extend the search path,
this example adds the current blend files directory to the search path, then loads the script as a module.
The other issue with this is the script has to be in Python's module search path.
While this is not best practice -- for testing purposes you can extend the search path,
this following example adds the current blend-files directory to the search path
and then loads the script as a module.
.. code-block:: python
@@ -148,42 +144,40 @@ this example adds the current blend files directory to the search path, then loa
myscript.main()
Don't Use Blender!
==================
While developing your own scripts Blenders interface can get in the way,
manually reloading, running the scripts, opening file import etc. adds overhead.
Use Blender without it's User Interface
=======================================
While developing your own scripts Blender's interface can get in the way,
manually reloading, running the scripts, opening file import, etc. adds overhead.
For scripts that are not interactive it can end up being more efficient not to use
Blenders interface at all and instead execute the script on the command line.
Blender's interface at all and instead execute the script on the command line.
.. code-block:: sh
blender --background --python myscript.py
You might want to run this with a blend file so the script has some data to operate on.
You might want to run this with a blend-file so the script has some data to operate on.
.. code-block:: sh
blender myscene.blend --background --python myscript.py
.. note::
Depending on your setup you might have to enter the full path to the Blender executable.
Once the script is running properly in background mode, you'll want to check the output of the script,
this depends completely on the task at hand however here are some suggestions.
this depends completely on the task at hand, however, here are some suggestions:
- render the output to an image, use an image viewer and keep writing over the same image each time.
- save a new blend file, or export the file using one of Blenders exporters.
- if the results can be displayed as text - print them or write them to a file.
- Render the output to an image, use an image viewer and keep writing over the same image each time.
- Save a new blend-file, or export the file using one of Blender's exporters.
- If the results can be displayed as text then print them or write them to a file.
While this can take a little time to setup, it can be well worth the effort
to reduce the time it takes to test changes - you can even have
to reduce the time it takes to test changes. You can even have
Blender running the script every few seconds with a viewer updating the results,
so no need to leave your text editor to see changes.
@@ -200,7 +194,7 @@ but to quickly setup your own custom pipeline or writing one-off scripts this ca
Examples include:
- Run The Gimp in batch mode to execute custom scripts for advanced image processing.
- Run Gimp in batch mode to execute custom scripts for advanced image processing.
- Write out 3D models to use external mesh manipulation tools and read back in the results.
- Convert files into recognizable formats before reading.
@@ -209,15 +203,16 @@ Bundled Python & Extensions
===========================
The Blender releases distributed from blender.org include a complete Python installation on all platforms,
this has the disadvantage that any extensions you have installed in your systems Python won't be found by Blender.
this has the disadvantage that any extensions you have installed on your system's Python environment
will not be found by Blender.
There are 2 ways around this:
There are two ways to work around this:
- Remove Blender Python sub-directory, Blender will then fallback on the systems Python and use that instead.
- Remove Blender Python subdirectory, Blender will then fallback on the system's Python and use that instead.
Depending on your platform,
you may need to explicitly reference the location of your Python installation using the
``PYTHONPATH`` environment variable, eg:
you may need to explicitly reference the location of your Python installation using
the ``PYTHONPATH`` environment variable, e.g:
.. code-block:: sh
@@ -226,21 +221,21 @@ There are 2 ways around this:
.. warning::
The Python (major, minor) version must match the one that Blender comes with.
Therefor can't use Python 3.6 with Blender built to use Python 3.7.
Therefor you can't use Python 3.6 with Blender built to use Python 3.7.
- Copy or link the extensions into Blender's Python sub-directory so Blender can access them,
you could also copy the entire Python installation into Blenders sub-directory,
- Copy or link the extensions into Blender's Python subdirectory so Blender can access them,
you can also copy the entire Python installation into Blender's subdirectory,
replacing the one Blender comes with.
This works as long as the Python versions match and the paths are created in the same relative locations.
Doing this has the advantage that you can redistribute this bundle to others with Blender
including any extensions you rely on.
Drop Into a Python Interpreter in Your Script
=============================================
Insert a Python Interpreter into your Script
============================================
In the middle of a script you may want to inspect some variables,
run some function and generally dig about to see what's going on.
In the middle of a script you may want to inspect variables,
run functions and inspect the flow.
.. code-block:: python
@@ -248,7 +243,7 @@ run some function and generally dig about to see what's going on.
code.interact(local=locals())
If you want to access both global and local variables do this...
If you want to access both global and local variables run this:
.. code-block:: python
@@ -266,7 +261,7 @@ The next example is an equivalent single line version of the script above which
``code.interact`` can be added at any line in the script
and will pause the script an launch an interactive interpreter in the terminal,
and will pause the script to launch an interactive interpreter in the terminal,
when you're done you can quit the interpreter and the script will continue execution.
@@ -279,13 +274,14 @@ The IPython prompt has auto-complete and some useful features that the standard
IPython.embed()
Admittedly this highlights the lack of any Python debugging support built into Blender, but its still handy to know.
Admittedly this highlights the lack of any Python debugging support built into Blender,
but its still a handy thing to know.
Advanced
========
Blender as a module
Blender as a Module
-------------------
From a Python perspective it's nicer to have everything as an extension
@@ -293,26 +289,22 @@ which lets the Python script combine many components.
Advantages include:
- you can use external editors/IDE's with Blenders Python API and execute scripts within the IDE
- You can use external editors or IDEs with Blender's Python API and execute scripts within the IDE
(step over code, inspect variables as the script runs).
- editors/IDE's can auto complete Blender modules & variables.
- existing scripts can import Blender API's without having to run inside Blender.
- Editors or IDEs can auto-complete Blender modules and variables.
- Existing scripts can import Blender APIs without having to be run inside of Blender.
This is marked advanced because to run Blender as a Python module requires a special build option.
For instructions on building see
`Building Blender as a Python module <https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule>`_
`Building Blender as a Python module <https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule>`__.
Python Safety (Build Option)
----------------------------
Since it's possible to access data which has been removed (see Gotcha's),
this can be hard to track down the cause of crashes.
Since it's possible to access data which has been removed (see :doc:`Gotchas <info_gotcha>`),
can make it hard to track down the cause of crashes.
To raise Python exceptions on accessing freed data (rather than crashing),
enable the CMake build option ``WITH_PYTHON_SAFETY``.
This enables data tracking which makes data access about 2x slower
This enables data tracking which makes data access about two times slower
which is why the option isn't enabled in release builds.

View File

@@ -83,6 +83,8 @@ import inspect
import shutil
import logging
from textwrap import indent
from platform import platform
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
@@ -357,7 +359,7 @@ INFO_DOCS = (
("info_tips_and_tricks.rst",
"Tips and Tricks: Hints to help you while writing scripts for Blender"),
("info_gotcha.rst",
"Gotcha's: some of the problems you may come up against when writing scripts"),
"Gotcha's: some of the problems you may encounter when writing scripts"),
("change_log.rst", "List of changes since last Blender release"),
)
@@ -403,32 +405,21 @@ MODULE_GROUPING = {
# -------------------------------BLENDER----------------------------------------
blender_version_strings = [str(v) for v in bpy.app.version]
is_release = bpy.app.version_cycle in {"rc", "release"}
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
if is_release:
# '2.62a'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char
else:
# '2.62.1'
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
# '2.83.0 Beta' or '2.83.0' or '2.83.1'
BLENDER_VERSION_DOTS = bpy.app.version_string
if BLENDER_REVISION != "Unknown":
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
# SHA1 Git hash
BLENDER_VERSION_HASH = BLENDER_REVISION
else:
# Fallback: Should not be used
BLENDER_VERSION_HASH = "Hash Unknown"
if is_release:
# '2_62a_release'
BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
else:
# '2_62_1'
BLENDER_VERSION_PATH = "_".join(blender_version_strings)
# '2_83'
BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1])
# --------------------------DOWNLOADABLE FILES----------------------------------
@@ -449,25 +440,30 @@ if ARGS.sphinx_build:
if ARGS.log:
SPHINX_BUILD_LOG = os.path.join(ARGS.output_dir, ".sphinx-build.log")
SPHINX_BUILD = ["sphinx-build",
"-w", SPHINX_BUILD_LOG,
SPHINX_IN, SPHINX_OUT]
SPHINX_BUILD = [
"sphinx-build",
"-w", SPHINX_BUILD_LOG,
SPHINX_IN, SPHINX_OUT,
]
# pdf build
if ARGS.sphinx_build_pdf:
SPHINX_OUT_PDF = os.path.join(ARGS.output_dir, "sphinx-out_pdf")
SPHINX_BUILD_PDF = ["sphinx-build",
"-b", "latex",
SPHINX_IN, SPHINX_OUT_PDF]
SPHINX_BUILD_PDF = [
"sphinx-build",
"-b", "latex",
SPHINX_IN, SPHINX_OUT_PDF,
]
SPHINX_MAKE_PDF = ["make", "-C", SPHINX_OUT_PDF]
SPHINX_MAKE_PDF_STDOUT = None
if ARGS.log:
SPHINX_BUILD_PDF_LOG = os.path.join(ARGS.output_dir, ".sphinx-build_pdf.log")
SPHINX_BUILD_PDF = ["sphinx-build", "-b", "latex",
"-w", SPHINX_BUILD_PDF_LOG,
SPHINX_IN, SPHINX_OUT_PDF]
SPHINX_BUILD_PDF = [
"sphinx-build", "-b", "latex",
"-w", SPHINX_BUILD_PDF_LOG,
SPHINX_IN, SPHINX_OUT_PDF,
]
sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", encoding="utf-8")
@@ -699,11 +695,13 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
doc = undocumented_message(module_name, type_name, identifier)
if type(descr) == GetSetDescriptorType:
fw(ident + ".. attribute:: %s\n\n" % identifier)
fw(ident + ".. attribute:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) == MemberDescriptorType: # same as above but use 'data'
fw(ident + ".. data:: %s\n\n" % identifier)
fw(ident + ".. data:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, doc, False)
fw("\n")
elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
@@ -743,11 +741,14 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
'''
# readonly properties use "data" directive, variables use "attribute" directive
if py_prop.fset is None:
fw(ident + ".. data:: %s\n\n" % identifier)
fw(ident + ".. data:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
else:
fw(ident + ".. attribute:: %s\n\n" % identifier)
fw(ident + ".. attribute:: %s\n" % identifier)
fw(ident + " :noindex:\n\n")
write_indented_lines(ident + " ", fw, py_prop.__doc__)
if py_prop.fset is None:
fw("\n")
fw(ident + " (readonly)\n\n")
else:
fw("\n")
@@ -913,7 +914,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
elif issubclass(value_type, (bool, int, float, str, tuple)):
# constant, not much fun we can do here except to list it.
# TODO, figure out some way to document these!
fw(".. data:: %s\n\n" % attribute)
fw(".. data:: %s\n" % attribute)
fw(" :noindex:\n\n")
write_indented_lines(" ", fw, "constant value %s" % repr(value), False)
fw("\n")
else:
@@ -1031,6 +1033,7 @@ context_type_map = {
"gpencil": ("GreasePencil", False),
"gpencil_data": ("GreasePencil", False),
"gpencil_data_owner": ("ID", False),
"hair": ("Hair", False),
"image_paint_object": ("Object", False),
"lattice": ("Lattice", False),
"light": ("Light", False),
@@ -1047,6 +1050,7 @@ context_type_map = {
"particle_settings": ("ParticleSettings", False),
"particle_system": ("ParticleSystem", False),
"particle_system_editable": ("ParticleSystem", False),
"pointcloud": ("PointCloud", False),
"pose_bone": ("PoseBone", False),
"pose_object": ("Object", False),
"scene": ("Scene", False),
@@ -1121,7 +1125,8 @@ def pycontext2sphinx(basepath):
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
fw(".. data:: %s\n\n" % prop.identifier)
fw(".. data:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1166,7 +1171,8 @@ def pycontext2sphinx(basepath):
i = 0
while char_array[i] is not None:
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
fw(".. data:: %s\n\n" % member)
fw(".. data:: %s\n" % member)
fw(" :noindex:\n\n")
member_type, is_seq = context_type_map[member]
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
unique.add(member)
@@ -1199,12 +1205,15 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
break
if ok:
return "".join(["* ``%s`` %s.\n" %
(identifier,
", ".join(escape_rst(val) for val in (name, description) if val),
)
for identifier, name, description in prop.enum_items
])
return "".join([
"* ``%s``\n"
"%s.\n" % (
identifier,
# Account for multi-line enum descriptions, allowing this to be a block of text.
indent(", ".join(escape_rst(val) for val in (name, description) if val) or "Undocumented", " "),
)
for identifier, name, description in prop.enum_items
])
else:
return ""
@@ -1271,7 +1280,7 @@ def pyrna2sphinx(basepath):
fw(ident + ":%s%s:\n\n" % (id_name, identifier))
if prop.name or prop.description:
fw(ident + " " + ", ".join(val for val in (prop.name, prop.description) if val) + "\n\n")
fw(indent(", ".join(val for val in (prop.name, prop.description) if val), ident + " ") + "\n\n")
# special exception, can't use generic code here for enums
if enum_text:
@@ -1310,7 +1319,7 @@ def pyrna2sphinx(basepath):
fw(title_string(title, "="))
fw(".. module:: %s\n\n" % struct_module_name)
fw(".. module:: %s.%s\n\n" % (struct_module_name, struct_id))
# docs first?, ok
write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
@@ -1369,9 +1378,11 @@ def pyrna2sphinx(basepath):
type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
# readonly properties use "data" directive, variables properties use "attribute" directive
if 'readonly' in type_descr:
fw(" .. data:: %s\n\n" % prop.identifier)
fw(" .. data:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
else:
fw(" .. attribute:: %s\n\n" % prop.identifier)
fw(" .. attribute:: %s\n" % prop.identifier)
fw(" :noindex:\n\n")
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1541,7 +1552,7 @@ def pyrna2sphinx(basepath):
fw(title_string(class_name, "="))
fw(".. module:: %s\n" % class_module_name)
fw(".. module:: %s.%s\n" % (class_module_name, class_name))
fw("\n")
if use_subclasses:
@@ -1715,7 +1726,7 @@ class PatchedPythonDomain(PythonDomain):
# end workaround
fw("def setup(app):\n")
fw(" app.add_stylesheet('css/theme_overrides.css')\n")
fw(" app.add_css_file('css/theme_overrides.css')\n")
fw(" app.add_domain(PatchedPythonDomain, override=True)\n\n")
file.close()

View File

@@ -36,16 +36,10 @@ fi
blender_srcdir=$(dirname -- $0)/../..
blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h"
blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}')
unset blender_version_header
if [ "$blender_version_cycle" = "release" ] ; then
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release"
else
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion
fi
BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)
SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION

View File

@@ -118,21 +118,19 @@ def main():
# III) Get Blender version info.
getver_file = os.path.join(tmp_dir, "blendver.txt")
getver_script = (
"import sys, bpy\n"
"with open(sys.argv[-1], 'w') as f:\n"
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
" is_beta = bpy.app.version_cycle in {'beta'}\n"
" branch = bpy.app.build_branch.split()[0].decode()\n"
" f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
)
getver_script = (r"""import sys, bpy
with open(sys.argv[-1], 'w') as f:
is_release = bpy.app.version_cycle in {'rc', 'release'}
is_beta = bpy.app.version_cycle in {'beta'}
branch = bpy.app.build_branch.split()[0].decode()
f.write('%d\n' % is_release)
f.write('%d\n' % is_beta)
f.write('%s\n' % branch)
f.write('%d.%d\n' % (bpy.app.version[0], bpy.app.version[1]))
f.write('%d.%d\n' % (bpy.app.version[0], bpy.app.version[1])
if (is_release or is_beta) else '%s\n' % branch)
f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))
""")
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd)

View File

@@ -52,7 +52,7 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_S16;
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
@@ -61,10 +61,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
SDL_AudioSpec format, obtained;
format.freq = m_specs.rate;
if(m_specs.format == FORMAT_U8)
switch(m_specs.format)
{
case FORMAT_U8:
format.format = AUDIO_U8;
else
break;
case FORMAT_S16:
format.format = AUDIO_S16SYS;
break;
case FORMAT_S32:
format.format = AUDIO_S32SYS;
break;
case FORMAT_FLOAT32:
format.format = AUDIO_F32SYS;
break;
default:
format.format = AUDIO_F32SYS;
break;
}
format.channels = m_specs.channels;
format.samples = buffersize;
format.callback = SDLDevice::SDL_mix;
@@ -75,14 +90,25 @@ SDLDevice::SDLDevice(DeviceSpecs specs, int buffersize) :
m_specs.rate = (SampleRate)obtained.freq;
m_specs.channels = (Channels)obtained.channels;
if(obtained.format == AUDIO_U8)
m_specs.format = FORMAT_U8;
else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
m_specs.format = FORMAT_S16;
else
switch(obtained.format)
{
case AUDIO_U8:
m_specs.format = FORMAT_U8;
break;
case AUDIO_S16SYS:
m_specs.format = FORMAT_S16;
break;
case AUDIO_S32SYS:
m_specs.format = FORMAT_S32;
break;
case AUDIO_F32SYS:
m_specs.format = FORMAT_FLOAT32;
break;
default:
SDL_CloseAudio();
AUD_THROW(DeviceException, "The sample format obtained from SDL is not supported.");
break;
}
create();

View File

@@ -37,223 +37,279 @@ set(INC_SYS
)
set(SRC
internal/ceres/array_utils.cc
internal/ceres/blas.cc
internal/ceres/block_evaluate_preparer.cc
internal/ceres/block_jacobian_writer.cc
internal/ceres/block_jacobi_preconditioner.cc
internal/ceres/block_random_access_dense_matrix.cc
internal/ceres/block_random_access_diagonal_matrix.cc
internal/ceres/block_random_access_matrix.cc
internal/ceres/block_random_access_sparse_matrix.cc
internal/ceres/block_sparse_matrix.cc
internal/ceres/block_structure.cc
internal/ceres/callbacks.cc
internal/ceres/c_api.cc
internal/ceres/cgnr_solver.cc
internal/ceres/compressed_col_sparse_matrix_utils.cc
internal/ceres/compressed_row_jacobian_writer.cc
internal/ceres/compressed_row_sparse_matrix.cc
internal/ceres/conditioned_cost_function.cc
internal/ceres/conjugate_gradients_solver.cc
internal/ceres/coordinate_descent_minimizer.cc
internal/ceres/corrector.cc
internal/ceres/covariance.cc
internal/ceres/covariance_impl.cc
internal/ceres/dense_normal_cholesky_solver.cc
internal/ceres/dense_qr_solver.cc
internal/ceres/dense_sparse_matrix.cc
internal/ceres/detect_structure.cc
internal/ceres/dogleg_strategy.cc
internal/ceres/dynamic_compressed_row_jacobian_writer.cc
internal/ceres/dynamic_compressed_row_sparse_matrix.cc
internal/ceres/evaluator.cc
internal/ceres/file.cc
internal/ceres/generated/partitioned_matrix_view_d_d_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_problem.cc
internal/ceres/gradient_problem_solver.cc
internal/ceres/implicit_schur_complement.cc
internal/ceres/is_close.cc
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/lapack.cc
internal/ceres/levenberg_marquardt_strategy.cc
internal/ceres/linear_least_squares_problems.cc
internal/ceres/linear_operator.cc
internal/ceres/linear_solver.cc
internal/ceres/line_search.cc
internal/ceres/line_search_direction.cc
internal/ceres/line_search_minimizer.cc
internal/ceres/line_search_preprocessor.cc
internal/ceres/local_parameterization.cc
internal/ceres/loss_function.cc
internal/ceres/low_rank_inverse_hessian.cc
internal/ceres/minimizer.cc
internal/ceres/normal_prior.cc
internal/ceres/parameter_block_ordering.cc
internal/ceres/partitioned_matrix_view.cc
internal/ceres/polynomial.cc
internal/ceres/preconditioner.cc
internal/ceres/preprocessor.cc
internal/ceres/problem.cc
internal/ceres/problem_impl.cc
internal/ceres/program.cc
internal/ceres/reorder_program.cc
internal/ceres/residual_block.cc
internal/ceres/residual_block_utils.cc
internal/ceres/schur_complement_solver.cc
internal/ceres/schur_eliminator.cc
internal/ceres/schur_jacobi_preconditioner.cc
internal/ceres/scratch_evaluate_preparer.cc
internal/ceres/solver.cc
internal/ceres/solver_utils.cc
internal/ceres/sparse_matrix.cc
internal/ceres/sparse_normal_cholesky_solver.cc
internal/ceres/split.cc
internal/ceres/stringprintf.cc
internal/ceres/triplet_sparse_matrix.cc
internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_strategy.cc
internal/ceres/types.cc
internal/ceres/wall_time.cc
internal/ceres/accelerate_sparse.cc
internal/ceres/array_utils.cc
internal/ceres/blas.cc
internal/ceres/block_evaluate_preparer.cc
internal/ceres/block_jacobian_writer.cc
internal/ceres/block_jacobi_preconditioner.cc
internal/ceres/block_random_access_dense_matrix.cc
internal/ceres/block_random_access_diagonal_matrix.cc
internal/ceres/block_random_access_matrix.cc
internal/ceres/block_random_access_sparse_matrix.cc
internal/ceres/block_sparse_matrix.cc
internal/ceres/block_structure.cc
internal/ceres/callbacks.cc
internal/ceres/canonical_views_clustering.cc
internal/ceres/c_api.cc
internal/ceres/cgnr_solver.cc
internal/ceres/compressed_col_sparse_matrix_utils.cc
internal/ceres/compressed_row_jacobian_writer.cc
internal/ceres/compressed_row_sparse_matrix.cc
internal/ceres/conditioned_cost_function.cc
internal/ceres/conjugate_gradients_solver.cc
internal/ceres/context.cc
internal/ceres/context_impl.cc
internal/ceres/coordinate_descent_minimizer.cc
internal/ceres/corrector.cc
internal/ceres/covariance.cc
internal/ceres/covariance_impl.cc
internal/ceres/cxsparse.cc
internal/ceres/dense_normal_cholesky_solver.cc
internal/ceres/dense_qr_solver.cc
internal/ceres/dense_sparse_matrix.cc
internal/ceres/detect_structure.cc
internal/ceres/dogleg_strategy.cc
internal/ceres/dynamic_compressed_row_jacobian_writer.cc
internal/ceres/dynamic_compressed_row_sparse_matrix.cc
internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
internal/ceres/eigensparse.cc
internal/ceres/evaluator.cc
internal/ceres/file.cc
internal/ceres/float_cxsparse.cc
internal/ceres/float_suitesparse.cc
internal/ceres/function_sample.cc
internal/ceres/generated/partitioned_matrix_view_d_d_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_problem.cc
internal/ceres/gradient_problem_solver.cc
internal/ceres/implicit_schur_complement.cc
internal/ceres/inner_product_computer.cc
internal/ceres/is_close.cc
internal/ceres/iterative_refiner.cc
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/lapack.cc
internal/ceres/levenberg_marquardt_strategy.cc
internal/ceres/linear_least_squares_problems.cc
internal/ceres/linear_operator.cc
internal/ceres/linear_solver.cc
internal/ceres/line_search.cc
internal/ceres/line_search_direction.cc
internal/ceres/line_search_minimizer.cc
internal/ceres/line_search_preprocessor.cc
internal/ceres/local_parameterization.cc
internal/ceres/loss_function.cc
internal/ceres/low_rank_inverse_hessian.cc
internal/ceres/minimizer.cc
internal/ceres/normal_prior.cc
internal/ceres/parallel_for_cxx.cc
internal/ceres/parallel_for_nothreads.cc
internal/ceres/parallel_for_openmp.cc
internal/ceres/parallel_utils.cc
internal/ceres/parameter_block_ordering.cc
internal/ceres/partitioned_matrix_view.cc
internal/ceres/polynomial.cc
internal/ceres/preconditioner.cc
internal/ceres/preprocessor.cc
internal/ceres/problem.cc
internal/ceres/problem_impl.cc
internal/ceres/program.cc
internal/ceres/reorder_program.cc
internal/ceres/residual_block.cc
internal/ceres/residual_block_utils.cc
internal/ceres/schur_complement_solver.cc
internal/ceres/schur_eliminator.cc
internal/ceres/schur_jacobi_preconditioner.cc
internal/ceres/schur_templates.cc
internal/ceres/scratch_evaluate_preparer.cc
internal/ceres/single_linkage_clustering.cc
internal/ceres/solver.cc
internal/ceres/solver_utils.cc
internal/ceres/sparse_cholesky.cc
internal/ceres/sparse_matrix.cc
internal/ceres/sparse_normal_cholesky_solver.cc
internal/ceres/split.cc
internal/ceres/stringprintf.cc
internal/ceres/subset_preconditioner.cc
internal/ceres/suitesparse.cc
internal/ceres/thread_pool.cc
internal/ceres/thread_token_provider.cc
internal/ceres/triplet_sparse_matrix.cc
internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_strategy.cc
internal/ceres/types.cc
internal/ceres/visibility_based_preconditioner.cc
internal/ceres/visibility.cc
internal/ceres/wall_time.cc
include/ceres/autodiff_cost_function.h
include/ceres/autodiff_local_parameterization.h
include/ceres/c_api.h
include/ceres/ceres.h
include/ceres/conditioned_cost_function.h
include/ceres/cost_function.h
include/ceres/cost_function_to_functor.h
include/ceres/covariance.h
include/ceres/crs_matrix.h
include/ceres/dynamic_autodiff_cost_function.h
include/ceres/dynamic_cost_function_to_functor.h
include/ceres/dynamic_numeric_diff_cost_function.h
include/ceres/fpclassify.h
include/ceres/gradient_checker.h
include/ceres/gradient_problem.h
include/ceres/gradient_problem_solver.h
include/ceres/internal/autodiff.h
include/ceres/internal/disable_warnings.h
include/ceres/internal/eigen.h
include/ceres/internal/fixed_array.h
include/ceres/internal/macros.h
include/ceres/internal/manual_constructor.h
include/ceres/internal/numeric_diff.h
include/ceres/internal/port.h
include/ceres/internal/reenable_warnings.h
include/ceres/internal/scoped_ptr.h
include/ceres/internal/variadic_evaluate.h
include/ceres/iteration_callback.h
include/ceres/jet.h
include/ceres/local_parameterization.h
include/ceres/loss_function.h
include/ceres/normal_prior.h
include/ceres/numeric_diff_cost_function.h
include/ceres/numeric_diff_options.h
include/ceres/ordered_groups.h
include/ceres/problem.h
include/ceres/rotation.h
include/ceres/sized_cost_function.h
include/ceres/solver.h
include/ceres/types.h
include/ceres/version.h
internal/ceres/array_utils.h
internal/ceres/blas.h
internal/ceres/block_evaluate_preparer.h
internal/ceres/block_jacobian_writer.h
internal/ceres/block_jacobi_preconditioner.h
internal/ceres/block_random_access_dense_matrix.h
internal/ceres/block_random_access_diagonal_matrix.h
internal/ceres/block_random_access_matrix.h
internal/ceres/block_random_access_sparse_matrix.h
internal/ceres/block_sparse_matrix.h
internal/ceres/block_structure.h
internal/ceres/callbacks.h
internal/ceres/casts.h
internal/ceres/cgnr_linear_operator.h
internal/ceres/cgnr_solver.h
internal/ceres/collections_port.h
internal/ceres/compressed_col_sparse_matrix_utils.h
internal/ceres/compressed_row_jacobian_writer.h
internal/ceres/compressed_row_sparse_matrix.h
internal/ceres/conjugate_gradients_solver.h
internal/ceres/coordinate_descent_minimizer.h
internal/ceres/corrector.h
internal/ceres/covariance_impl.h
internal/ceres/cxsparse.h
internal/ceres/dense_jacobian_writer.h
internal/ceres/dense_normal_cholesky_solver.h
internal/ceres/dense_qr_solver.h
internal/ceres/dense_sparse_matrix.h
internal/ceres/detect_structure.h
internal/ceres/dogleg_strategy.h
internal/ceres/dynamic_compressed_row_finalizer.h
internal/ceres/dynamic_compressed_row_jacobian_writer.h
internal/ceres/dynamic_compressed_row_sparse_matrix.h
internal/ceres/evaluator.h
internal/ceres/execution_summary.h
internal/ceres/file.h
internal/ceres/gradient_checking_cost_function.h
internal/ceres/gradient_problem_evaluator.h
internal/ceres/graph_algorithms.h
internal/ceres/graph.h
internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/is_close.h
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.h
internal/ceres/levenberg_marquardt_strategy.h
internal/ceres/linear_least_squares_problems.h
internal/ceres/linear_operator.h
internal/ceres/linear_solver.h
internal/ceres/line_search_direction.h
internal/ceres/line_search.h
internal/ceres/line_search_minimizer.h
internal/ceres/line_search_preprocessor.h
internal/ceres/low_rank_inverse_hessian.h
internal/ceres/map_util.h
internal/ceres/minimizer.h
internal/ceres/mutex.h
internal/ceres/parameter_block.h
internal/ceres/parameter_block_ordering.h
internal/ceres/partitioned_matrix_view.h
internal/ceres/partitioned_matrix_view_impl.h
internal/ceres/polynomial.h
internal/ceres/preconditioner.h
internal/ceres/preprocessor.h
internal/ceres/problem_impl.h
internal/ceres/program_evaluator.h
internal/ceres/program.h
internal/ceres/random.h
internal/ceres/reorder_program.h
internal/ceres/residual_block.h
internal/ceres/residual_block_utils.h
internal/ceres/schur_complement_solver.h
internal/ceres/schur_eliminator.h
internal/ceres/schur_eliminator_impl.h
internal/ceres/schur_jacobi_preconditioner.h
internal/ceres/scratch_evaluate_preparer.h
internal/ceres/small_blas.h
internal/ceres/solver_utils.h
internal/ceres/sparse_matrix.h
internal/ceres/sparse_normal_cholesky_solver.h
internal/ceres/split.h
internal/ceres/stl_util.h
internal/ceres/stringprintf.h
internal/ceres/suitesparse.h
internal/ceres/triplet_sparse_matrix.h
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.h
internal/ceres/visibility_based_preconditioner.h
internal/ceres/wall_time.h
include/ceres/autodiff_cost_function.h
include/ceres/autodiff_first_order_function.h
include/ceres/autodiff_local_parameterization.h
include/ceres/c_api.h
include/ceres/ceres.h
include/ceres/conditioned_cost_function.h
include/ceres/context.h
include/ceres/cost_function.h
include/ceres/cost_function_to_functor.h
include/ceres/covariance.h
include/ceres/crs_matrix.h
include/ceres/cubic_interpolation.h
include/ceres/dynamic_autodiff_cost_function.h
include/ceres/dynamic_cost_function.h
include/ceres/dynamic_cost_function_to_functor.h
include/ceres/dynamic_numeric_diff_cost_function.h
include/ceres/evaluation_callback.h
include/ceres/first_order_function.h
include/ceres/gradient_checker.h
include/ceres/gradient_problem.h
include/ceres/gradient_problem_solver.h
include/ceres/internal/array_selector.h
include/ceres/internal/autodiff.h
include/ceres/internal/disable_warnings.h
include/ceres/internal/eigen.h
include/ceres/internal/fixed_array.h
include/ceres/internal/householder_vector.h
include/ceres/internal/integer_sequence_algorithm.h
include/ceres/internal/line_parameterization.h
include/ceres/internal/memory.h
include/ceres/internal/numeric_diff.h
include/ceres/internal/parameter_dims.h
include/ceres/internal/port.h
include/ceres/internal/reenable_warnings.h
include/ceres/internal/variadic_evaluate.h
include/ceres/iteration_callback.h
include/ceres/jet.h
include/ceres/local_parameterization.h
include/ceres/loss_function.h
include/ceres/normal_prior.h
include/ceres/numeric_diff_cost_function.h
include/ceres/numeric_diff_options.h
include/ceres/ordered_groups.h
include/ceres/problem.h
include/ceres/rotation.h
include/ceres/sized_cost_function.h
include/ceres/solver.h
include/ceres/tiny_solver_autodiff_function.h
include/ceres/tiny_solver_cost_function_adapter.h
include/ceres/tiny_solver.h
include/ceres/types.h
include/ceres/version.h
internal/ceres/accelerate_sparse.h
internal/ceres/array_utils.h
internal/ceres/blas.h
internal/ceres/block_evaluate_preparer.h
internal/ceres/block_jacobian_writer.h
internal/ceres/block_jacobi_preconditioner.h
internal/ceres/block_random_access_dense_matrix.h
internal/ceres/block_random_access_diagonal_matrix.h
internal/ceres/block_random_access_matrix.h
internal/ceres/block_random_access_sparse_matrix.h
internal/ceres/block_sparse_matrix.h
internal/ceres/block_structure.h
internal/ceres/callbacks.h
internal/ceres/canonical_views_clustering.h
internal/ceres/casts.h
internal/ceres/cgnr_linear_operator.h
internal/ceres/cgnr_solver.h
internal/ceres/compressed_col_sparse_matrix_utils.h
internal/ceres/compressed_row_jacobian_writer.h
internal/ceres/compressed_row_sparse_matrix.h
internal/ceres/concurrent_queue.h
internal/ceres/conjugate_gradients_solver.h
internal/ceres/context_impl.h
internal/ceres/coordinate_descent_minimizer.h
internal/ceres/corrector.h
internal/ceres/covariance_impl.h
internal/ceres/cxsparse.h
internal/ceres/dense_jacobian_writer.h
internal/ceres/dense_normal_cholesky_solver.h
internal/ceres/dense_qr_solver.h
internal/ceres/dense_sparse_matrix.h
internal/ceres/detect_structure.h
internal/ceres/dogleg_strategy.h
internal/ceres/dynamic_compressed_row_finalizer.h
internal/ceres/dynamic_compressed_row_jacobian_writer.h
internal/ceres/dynamic_compressed_row_sparse_matrix.h
internal/ceres/dynamic_sparse_normal_cholesky_solver.h
internal/ceres/eigensparse.h
internal/ceres/evaluator.h
internal/ceres/execution_summary.h
internal/ceres/file.h
internal/ceres/float_cxsparse.h
internal/ceres/float_suitesparse.h
internal/ceres/function_sample.h
internal/ceres/gradient_checking_cost_function.h
internal/ceres/gradient_problem_evaluator.h
internal/ceres/graph_algorithms.h
internal/ceres/graph.h
internal/ceres/implicit_schur_complement.h
internal/ceres/inner_product_computer.h
internal/ceres/invert_psd_matrix.h
internal/ceres/is_close.h
internal/ceres/iterative_refiner.h
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.h
internal/ceres/levenberg_marquardt_strategy.h
internal/ceres/linear_least_squares_problems.h
internal/ceres/linear_operator.h
internal/ceres/linear_solver.h
internal/ceres/line_search_direction.h
internal/ceres/line_search.h
internal/ceres/line_search_minimizer.h
internal/ceres/line_search_preprocessor.h
internal/ceres/low_rank_inverse_hessian.h
internal/ceres/map_util.h
internal/ceres/minimizer.h
internal/ceres/pair_hash.h
internal/ceres/parallel_for.h
internal/ceres/parallel_utils.h
internal/ceres/parameter_block.h
internal/ceres/parameter_block_ordering.h
internal/ceres/partitioned_matrix_view.h
internal/ceres/partitioned_matrix_view_impl.h
internal/ceres/polynomial.h
internal/ceres/preconditioner.h
internal/ceres/preprocessor.h
internal/ceres/problem_impl.h
internal/ceres/program_evaluator.h
internal/ceres/program.h
internal/ceres/random.h
internal/ceres/reorder_program.h
internal/ceres/residual_block.h
internal/ceres/residual_block_utils.h
internal/ceres/schur_complement_solver.h
internal/ceres/schur_eliminator.h
internal/ceres/schur_eliminator_impl.h
internal/ceres/schur_jacobi_preconditioner.h
internal/ceres/schur_templates.h
internal/ceres/scoped_thread_token.h
internal/ceres/scratch_evaluate_preparer.h
internal/ceres/single_linkage_clustering.h
internal/ceres/small_blas_generic.h
internal/ceres/small_blas.h
internal/ceres/solver_utils.h
internal/ceres/sparse_cholesky.h
internal/ceres/sparse_matrix.h
internal/ceres/sparse_normal_cholesky_solver.h
internal/ceres/split.h
internal/ceres/stl_util.h
internal/ceres/stringprintf.h
internal/ceres/subset_preconditioner.h
internal/ceres/suitesparse.h
internal/ceres/thread_pool.h
internal/ceres/thread_token_provider.h
internal/ceres/triplet_sparse_matrix.h
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.h
internal/ceres/visibility_based_preconditioner.h
internal/ceres/visibility.h
internal/ceres/wall_time.h
)
set(LIB
@@ -263,44 +319,48 @@ set(LIB
if(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
list(APPEND SRC
internal/ceres/generated/partitioned_matrix_view_2_2_2.cc
internal/ceres/generated/partitioned_matrix_view_2_2_3.cc
internal/ceres/generated/partitioned_matrix_view_2_2_4.cc
internal/ceres/generated/partitioned_matrix_view_2_2_d.cc
internal/ceres/generated/partitioned_matrix_view_2_3_3.cc
internal/ceres/generated/partitioned_matrix_view_2_3_4.cc
internal/ceres/generated/partitioned_matrix_view_2_3_6.cc
internal/ceres/generated/partitioned_matrix_view_2_3_9.cc
internal/ceres/generated/partitioned_matrix_view_2_3_d.cc
internal/ceres/generated/partitioned_matrix_view_2_4_3.cc
internal/ceres/generated/partitioned_matrix_view_2_4_4.cc
internal/ceres/generated/partitioned_matrix_view_2_4_8.cc
internal/ceres/generated/partitioned_matrix_view_2_4_9.cc
internal/ceres/generated/partitioned_matrix_view_2_4_d.cc
internal/ceres/generated/partitioned_matrix_view_2_d_d.cc
internal/ceres/generated/partitioned_matrix_view_4_4_2.cc
internal/ceres/generated/partitioned_matrix_view_4_4_3.cc
internal/ceres/generated/partitioned_matrix_view_4_4_4.cc
internal/ceres/generated/partitioned_matrix_view_4_4_d.cc
internal/ceres/generated/schur_eliminator_2_2_2.cc
internal/ceres/generated/schur_eliminator_2_2_3.cc
internal/ceres/generated/schur_eliminator_2_2_4.cc
internal/ceres/generated/schur_eliminator_2_2_d.cc
internal/ceres/generated/schur_eliminator_2_3_3.cc
internal/ceres/generated/schur_eliminator_2_3_4.cc
internal/ceres/generated/schur_eliminator_2_3_6.cc
internal/ceres/generated/schur_eliminator_2_3_9.cc
internal/ceres/generated/schur_eliminator_2_3_d.cc
internal/ceres/generated/schur_eliminator_2_4_3.cc
internal/ceres/generated/schur_eliminator_2_4_4.cc
internal/ceres/generated/schur_eliminator_2_4_8.cc
internal/ceres/generated/schur_eliminator_2_4_9.cc
internal/ceres/generated/schur_eliminator_2_4_d.cc
internal/ceres/generated/schur_eliminator_2_d_d.cc
internal/ceres/generated/schur_eliminator_4_4_2.cc
internal/ceres/generated/schur_eliminator_4_4_3.cc
internal/ceres/generated/schur_eliminator_4_4_4.cc
internal/ceres/generated/schur_eliminator_4_4_d.cc
internal/ceres/generated/partitioned_matrix_view_2_2_2.cc
internal/ceres/generated/partitioned_matrix_view_2_2_3.cc
internal/ceres/generated/partitioned_matrix_view_2_2_4.cc
internal/ceres/generated/partitioned_matrix_view_2_2_d.cc
internal/ceres/generated/partitioned_matrix_view_2_3_3.cc
internal/ceres/generated/partitioned_matrix_view_2_3_4.cc
internal/ceres/generated/partitioned_matrix_view_2_3_6.cc
internal/ceres/generated/partitioned_matrix_view_2_3_9.cc
internal/ceres/generated/partitioned_matrix_view_2_3_d.cc
internal/ceres/generated/partitioned_matrix_view_2_4_3.cc
internal/ceres/generated/partitioned_matrix_view_2_4_4.cc
internal/ceres/generated/partitioned_matrix_view_2_4_6.cc
internal/ceres/generated/partitioned_matrix_view_2_4_8.cc
internal/ceres/generated/partitioned_matrix_view_2_4_9.cc
internal/ceres/generated/partitioned_matrix_view_2_4_d.cc
internal/ceres/generated/partitioned_matrix_view_2_d_d.cc
internal/ceres/generated/partitioned_matrix_view_3_3_3.cc
internal/ceres/generated/partitioned_matrix_view_4_4_2.cc
internal/ceres/generated/partitioned_matrix_view_4_4_3.cc
internal/ceres/generated/partitioned_matrix_view_4_4_4.cc
internal/ceres/generated/partitioned_matrix_view_4_4_d.cc
internal/ceres/generated/schur_eliminator_2_2_2.cc
internal/ceres/generated/schur_eliminator_2_2_3.cc
internal/ceres/generated/schur_eliminator_2_2_4.cc
internal/ceres/generated/schur_eliminator_2_2_d.cc
internal/ceres/generated/schur_eliminator_2_3_3.cc
internal/ceres/generated/schur_eliminator_2_3_4.cc
internal/ceres/generated/schur_eliminator_2_3_6.cc
internal/ceres/generated/schur_eliminator_2_3_9.cc
internal/ceres/generated/schur_eliminator_2_3_d.cc
internal/ceres/generated/schur_eliminator_2_4_3.cc
internal/ceres/generated/schur_eliminator_2_4_4.cc
internal/ceres/generated/schur_eliminator_2_4_6.cc
internal/ceres/generated/schur_eliminator_2_4_8.cc
internal/ceres/generated/schur_eliminator_2_4_9.cc
internal/ceres/generated/schur_eliminator_2_4_d.cc
internal/ceres/generated/schur_eliminator_2_d_d.cc
internal/ceres/generated/schur_eliminator_3_3_3.cc
internal/ceres/generated/schur_eliminator_4_4_2.cc
internal/ceres/generated/schur_eliminator_4_4_3.cc
internal/ceres/generated/schur_eliminator_4_4_4.cc
internal/ceres/generated/schur_eliminator_4_4_d.cc
)
else()
add_definitions(-DCERES_RESTRICT_SCHUR_SPECIALIZATION)
@@ -315,13 +375,9 @@ add_definitions(
-DCERES_NO_SUITESPARSE
-DCERES_NO_CXSPARSE
-DCERES_NO_LAPACK
-DCERES_NO_ACCELERATE_SPARSE
-DCERES_HAVE_RWLOCK
-DCERES_USE_CXX_THREADS
)
if(WITH_OPENMP)
add_definitions(
-DCERES_USE_OPENMP
)
endif()
blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

1095
extern/ceres/ChangeLog vendored

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,6 @@ fi
repo="https://ceres-solver.googlesource.com/ceres-solver"
branch="master"
#tag="1.4.0"
tag=""
tmp=`mktemp -d`
checkout="$tmp/ceres"
@@ -157,14 +156,10 @@ add_definitions(
-DCERES_NO_SUITESPARSE
-DCERES_NO_CXSPARSE
-DCERES_NO_LAPACK
-DCERES_NO_ACCELERATE_SPARSE
-DCERES_HAVE_RWLOCK
-DCERES_USE_CXX_THREADS
)
if(WITH_OPENMP)
add_definitions(
-DCERES_USE_OPENMP
)
endif()
blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}" "\${LIB}")
EOF

View File

@@ -1,29 +1,37 @@
include/ceres/autodiff_cost_function.h
include/ceres/autodiff_first_order_function.h
include/ceres/autodiff_local_parameterization.h
include/ceres/c_api.h
include/ceres/ceres.h
include/ceres/conditioned_cost_function.h
include/ceres/context.h
include/ceres/cost_function.h
include/ceres/cost_function_to_functor.h
include/ceres/covariance.h
include/ceres/crs_matrix.h
include/ceres/cubic_interpolation.h
include/ceres/dynamic_autodiff_cost_function.h
include/ceres/dynamic_cost_function.h
include/ceres/dynamic_cost_function_to_functor.h
include/ceres/dynamic_numeric_diff_cost_function.h
include/ceres/fpclassify.h
include/ceres/evaluation_callback.h
include/ceres/first_order_function.h
include/ceres/gradient_checker.h
include/ceres/gradient_problem.h
include/ceres/gradient_problem_solver.h
include/ceres/internal/array_selector.h
include/ceres/internal/autodiff.h
include/ceres/internal/disable_warnings.h
include/ceres/internal/eigen.h
include/ceres/internal/fixed_array.h
include/ceres/internal/macros.h
include/ceres/internal/manual_constructor.h
include/ceres/internal/householder_vector.h
include/ceres/internal/integer_sequence_algorithm.h
include/ceres/internal/line_parameterization.h
include/ceres/internal/memory.h
include/ceres/internal/numeric_diff.h
include/ceres/internal/parameter_dims.h
include/ceres/internal/port.h
include/ceres/internal/reenable_warnings.h
include/ceres/internal/scoped_ptr.h
include/ceres/internal/variadic_evaluate.h
include/ceres/iteration_callback.h
include/ceres/jet.h
@@ -37,8 +45,13 @@ include/ceres/problem.h
include/ceres/rotation.h
include/ceres/sized_cost_function.h
include/ceres/solver.h
include/ceres/tiny_solver_autodiff_function.h
include/ceres/tiny_solver_cost_function_adapter.h
include/ceres/tiny_solver.h
include/ceres/types.h
include/ceres/version.h
internal/ceres/accelerate_sparse.cc
internal/ceres/accelerate_sparse.h
internal/ceres/array_utils.cc
internal/ceres/array_utils.h
internal/ceres/blas.cc
@@ -63,21 +76,26 @@ internal/ceres/block_structure.cc
internal/ceres/block_structure.h
internal/ceres/callbacks.cc
internal/ceres/callbacks.h
internal/ceres/canonical_views_clustering.cc
internal/ceres/canonical_views_clustering.h
internal/ceres/c_api.cc
internal/ceres/casts.h
internal/ceres/cgnr_linear_operator.h
internal/ceres/cgnr_solver.cc
internal/ceres/cgnr_solver.h
internal/ceres/collections_port.h
internal/ceres/compressed_col_sparse_matrix_utils.cc
internal/ceres/compressed_col_sparse_matrix_utils.h
internal/ceres/compressed_row_jacobian_writer.cc
internal/ceres/compressed_row_jacobian_writer.h
internal/ceres/compressed_row_sparse_matrix.cc
internal/ceres/compressed_row_sparse_matrix.h
internal/ceres/concurrent_queue.h
internal/ceres/conditioned_cost_function.cc
internal/ceres/conjugate_gradients_solver.cc
internal/ceres/conjugate_gradients_solver.h
internal/ceres/context.cc
internal/ceres/context_impl.cc
internal/ceres/context_impl.h
internal/ceres/coordinate_descent_minimizer.cc
internal/ceres/coordinate_descent_minimizer.h
internal/ceres/corrector.cc
@@ -85,6 +103,7 @@ internal/ceres/corrector.h
internal/ceres/covariance.cc
internal/ceres/covariance_impl.cc
internal/ceres/covariance_impl.h
internal/ceres/cxsparse.cc
internal/ceres/cxsparse.h
internal/ceres/dense_jacobian_writer.h
internal/ceres/dense_normal_cholesky_solver.cc
@@ -102,11 +121,21 @@ internal/ceres/dynamic_compressed_row_jacobian_writer.cc
internal/ceres/dynamic_compressed_row_jacobian_writer.h
internal/ceres/dynamic_compressed_row_sparse_matrix.cc
internal/ceres/dynamic_compressed_row_sparse_matrix.h
internal/ceres/dynamic_sparse_normal_cholesky_solver.cc
internal/ceres/dynamic_sparse_normal_cholesky_solver.h
internal/ceres/eigensparse.cc
internal/ceres/eigensparse.h
internal/ceres/evaluator.cc
internal/ceres/evaluator.h
internal/ceres/execution_summary.h
internal/ceres/file.cc
internal/ceres/file.h
internal/ceres/float_cxsparse.cc
internal/ceres/float_cxsparse.h
internal/ceres/float_suitesparse.cc
internal/ceres/float_suitesparse.h
internal/ceres/function_sample.cc
internal/ceres/function_sample.h
internal/ceres/generated/partitioned_matrix_view_2_2_2.cc
internal/ceres/generated/partitioned_matrix_view_2_2_3.cc
internal/ceres/generated/partitioned_matrix_view_2_2_4.cc
@@ -118,10 +147,12 @@ internal/ceres/generated/partitioned_matrix_view_2_3_9.cc
internal/ceres/generated/partitioned_matrix_view_2_3_d.cc
internal/ceres/generated/partitioned_matrix_view_2_4_3.cc
internal/ceres/generated/partitioned_matrix_view_2_4_4.cc
internal/ceres/generated/partitioned_matrix_view_2_4_6.cc
internal/ceres/generated/partitioned_matrix_view_2_4_8.cc
internal/ceres/generated/partitioned_matrix_view_2_4_9.cc
internal/ceres/generated/partitioned_matrix_view_2_4_d.cc
internal/ceres/generated/partitioned_matrix_view_2_d_d.cc
internal/ceres/generated/partitioned_matrix_view_3_3_3.cc
internal/ceres/generated/partitioned_matrix_view_4_4_2.cc
internal/ceres/generated/partitioned_matrix_view_4_4_3.cc
internal/ceres/generated/partitioned_matrix_view_4_4_4.cc
@@ -138,17 +169,18 @@ internal/ceres/generated/schur_eliminator_2_3_9.cc
internal/ceres/generated/schur_eliminator_2_3_d.cc
internal/ceres/generated/schur_eliminator_2_4_3.cc
internal/ceres/generated/schur_eliminator_2_4_4.cc
internal/ceres/generated/schur_eliminator_2_4_6.cc
internal/ceres/generated/schur_eliminator_2_4_8.cc
internal/ceres/generated/schur_eliminator_2_4_9.cc
internal/ceres/generated/schur_eliminator_2_4_d.cc
internal/ceres/generated/schur_eliminator_2_d_d.cc
internal/ceres/generated/schur_eliminator_3_3_3.cc
internal/ceres/generated/schur_eliminator_4_4_2.cc
internal/ceres/generated/schur_eliminator_4_4_3.cc
internal/ceres/generated/schur_eliminator_4_4_4.cc
internal/ceres/generated/schur_eliminator_4_4_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/generate_eliminator_specialization.py
internal/ceres/generate_partitioned_matrix_view_specializations.py
internal/ceres/generate_template_specializations.py
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_checking_cost_function.h
@@ -157,12 +189,15 @@ internal/ceres/gradient_problem_evaluator.h
internal/ceres/gradient_problem_solver.cc
internal/ceres/graph_algorithms.h
internal/ceres/graph.h
internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.cc
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/inner_product_computer.cc
internal/ceres/inner_product_computer.h
internal/ceres/invert_psd_matrix.h
internal/ceres/is_close.cc
internal/ceres/is_close.h
internal/ceres/iterative_refiner.cc
internal/ceres/iterative_refiner.h
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.cc
@@ -190,14 +225,21 @@ internal/ceres/low_rank_inverse_hessian.h
internal/ceres/map_util.h
internal/ceres/minimizer.cc
internal/ceres/minimizer.h
internal/ceres/mutex.h
internal/ceres/normal_prior.cc
internal/ceres/pair_hash.h
internal/ceres/parallel_for_cxx.cc
internal/ceres/parallel_for.h
internal/ceres/parallel_for_nothreads.cc
internal/ceres/parallel_for_openmp.cc
internal/ceres/parallel_utils.cc
internal/ceres/parallel_utils.h
internal/ceres/parameter_block.h
internal/ceres/parameter_block_ordering.cc
internal/ceres/parameter_block_ordering.h
internal/ceres/partitioned_matrix_view.cc
internal/ceres/partitioned_matrix_view.h
internal/ceres/partitioned_matrix_view_impl.h
internal/ceres/partitioned_matrix_view_template.py
internal/ceres/polynomial.cc
internal/ceres/polynomial.h
internal/ceres/preconditioner.cc
@@ -222,14 +264,23 @@ internal/ceres/schur_complement_solver.h
internal/ceres/schur_eliminator.cc
internal/ceres/schur_eliminator.h
internal/ceres/schur_eliminator_impl.h
internal/ceres/schur_eliminator_template.py
internal/ceres/schur_jacobi_preconditioner.cc
internal/ceres/schur_jacobi_preconditioner.h
internal/ceres/schur_templates.cc
internal/ceres/schur_templates.h
internal/ceres/scoped_thread_token.h
internal/ceres/scratch_evaluate_preparer.cc
internal/ceres/scratch_evaluate_preparer.h
internal/ceres/single_linkage_clustering.cc
internal/ceres/single_linkage_clustering.h
internal/ceres/small_blas_generic.h
internal/ceres/small_blas.h
internal/ceres/solver.cc
internal/ceres/solver_utils.cc
internal/ceres/solver_utils.h
internal/ceres/sparse_cholesky.cc
internal/ceres/sparse_cholesky.h
internal/ceres/sparse_matrix.cc
internal/ceres/sparse_matrix.h
internal/ceres/sparse_normal_cholesky_solver.cc
@@ -239,7 +290,14 @@ internal/ceres/split.h
internal/ceres/stl_util.h
internal/ceres/stringprintf.cc
internal/ceres/stringprintf.h
internal/ceres/subset_preconditioner.cc
internal/ceres/subset_preconditioner.h
internal/ceres/suitesparse.cc
internal/ceres/suitesparse.h
internal/ceres/thread_pool.cc
internal/ceres/thread_pool.h
internal/ceres/thread_token_provider.cc
internal/ceres/thread_token_provider.h
internal/ceres/triplet_sparse_matrix.cc
internal/ceres/triplet_sparse_matrix.h
internal/ceres/trust_region_minimizer.cc
@@ -251,7 +309,10 @@ internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.cc
internal/ceres/trust_region_strategy.h
internal/ceres/types.cc
internal/ceres/visibility_based_preconditioner.cc
internal/ceres/visibility_based_preconditioner.h
internal/ceres/visibility.cc
internal/ceres/visibility.h
internal/ceres/wall_time.cc
internal/ceres/wall_time.h
config/ceres/internal/config.h

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
//
// Create CostFunctions as needed by the least squares framework, with
// Jacobians computed via automatic differentiation. For more
// information on automatic differentation, see the wikipedia article
// information on automatic differentiation, see the wikipedia article
// at http://en.wikipedia.org/wiki/Automatic_differentiation
//
// To get an auto differentiated cost function, you must define a class with a
@@ -54,7 +54,7 @@
// for a series of measurements, where there is an instance of the cost function
// for each measurement k.
//
// The actual cost added to the total problem is e^2, or (k - x'k)^2; however,
// The actual cost added to the total problem is e^2, or (k - x'y)^2; however,
// the squaring is implicitly done by the optimization framework.
//
// To write an auto-differentiable cost function for the above model, first
@@ -90,7 +90,7 @@
// Dimension of x ---------------+ |
// Dimension of y ------------------+
//
// In this example, there is usually an instance for each measumerent of k.
// In this example, there is usually an instance for each measurement of k.
//
// In the instantiation above, the template parameters following
// "MyScalarCostFunctor", "1, 2, 2", describe the functor as computing a
@@ -110,12 +110,8 @@
// Dimension of x ------------------------------------+ |
// Dimension of y ---------------------------------------+
//
// The framework can currently accommodate cost functions of up to 10
// independent variables, and there is no limit on the dimensionality
// of each of them.
//
// WARNING #1: Since the functor will get instantiated with different types for
// T, you must to convert from other numeric types to T before mixing
// T, you must convert from other numeric types to T before mixing
// computations with other variables of type T. In the example above, this is
// seen where instead of using k_ directly, k_ is wrapped with T(k_).
//
@@ -129,8 +125,9 @@
#ifndef CERES_PUBLIC_AUTODIFF_COST_FUNCTION_H_
#define CERES_PUBLIC_AUTODIFF_COST_FUNCTION_H_
#include <memory>
#include "ceres/internal/autodiff.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/sized_cost_function.h"
#include "ceres/types.h"
#include "glog/logging.h"
@@ -138,7 +135,7 @@
namespace ceres {
// A cost function which computes the derivative of the cost with respect to
// the parameters (a.k.a. the jacobian) using an autodifferentiation framework.
// the parameters (a.k.a. the jacobian) using an auto differentiation framework.
// The first template argument is the functor object, described in the header
// comment. The second argument is the dimension of the residual (or
// ceres::DYNAMIC to indicate it will be set at runtime), and subsequent
@@ -153,27 +150,15 @@ namespace ceres {
// of residuals for a single autodiff cost function at runtime.
template <typename CostFunctor,
int kNumResiduals, // Number of residuals, or ceres::DYNAMIC.
int N0, // Number of parameters in block 0.
int N1 = 0, // Number of parameters in block 1.
int N2 = 0, // Number of parameters in block 2.
int N3 = 0, // Number of parameters in block 3.
int N4 = 0, // Number of parameters in block 4.
int N5 = 0, // Number of parameters in block 5.
int N6 = 0, // Number of parameters in block 6.
int N7 = 0, // Number of parameters in block 7.
int N8 = 0, // Number of parameters in block 8.
int N9 = 0> // Number of parameters in block 9.
class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9> {
int... Ns> // Number of parameters in each parameter block.
class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
public:
// Takes ownership of functor. Uses the template-provided value for the
// number of residuals ("kNumResiduals").
explicit AutoDiffCostFunction(CostFunctor* functor)
: functor_(functor) {
CHECK_NE(kNumResiduals, DYNAMIC)
<< "Can't run the fixed-size constructor if the "
<< "number of residuals is set to ceres::DYNAMIC.";
explicit AutoDiffCostFunction(CostFunctor* functor) : functor_(functor) {
static_assert(kNumResiduals != DYNAMIC,
"Can't run the fixed-size constructor if the number of "
"residuals is set to ceres::DYNAMIC.");
}
// Takes ownership of functor. Ignores the template-provided
@@ -183,13 +168,10 @@ class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals,
// numbers of residuals at runtime.
AutoDiffCostFunction(CostFunctor* functor, int num_residuals)
: functor_(functor) {
CHECK_EQ(kNumResiduals, DYNAMIC)
<< "Can't run the dynamic-size constructor if the "
<< "number of residuals is not ceres::DYNAMIC.";
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>
::set_num_residuals(num_residuals);
static_assert(kNumResiduals == DYNAMIC,
"Can't run the dynamic-size constructor if the number of "
"residuals is not ceres::DYNAMIC.");
SizedCostFunction<kNumResiduals, Ns...>::set_num_residuals(num_residuals);
}
virtual ~AutoDiffCostFunction() {}
@@ -197,29 +179,28 @@ class AutoDiffCostFunction : public SizedCostFunction<kNumResiduals,
// Implementation details follow; clients of the autodiff cost function should
// not have to examine below here.
//
// To handle varardic cost functions, some template magic is needed. It's
// To handle variadic cost functions, some template magic is needed. It's
// mostly hidden inside autodiff.h.
virtual bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const {
bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const override {
using ParameterDims =
typename SizedCostFunction<kNumResiduals, Ns...>::ParameterDims;
if (!jacobians) {
return internal::VariadicEvaluate<
CostFunctor, double, N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>
::Call(*functor_, parameters, residuals);
return internal::VariadicEvaluate<ParameterDims>(
*functor_, parameters, residuals);
}
return internal::AutoDiff<CostFunctor, double,
N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>::Differentiate(
*functor_,
parameters,
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>::num_residuals(),
residuals,
jacobians);
}
return internal::AutoDifferentiate<kNumResiduals, ParameterDims>(
*functor_,
parameters,
SizedCostFunction<kNumResiduals, Ns...>::num_residuals(),
residuals,
jacobians);
};
private:
internal::scoped_ptr<CostFunctor> functor_;
std::unique_ptr<CostFunctor> functor_;
};
} // namespace ceres

View File

@@ -0,0 +1,151 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: sameeragarwal@google.com (Sameer Agarwal)
#ifndef CERES_PUBLIC_AUTODIFF_FIRST_ORDER_FUNCTION_H_
#define CERES_PUBLIC_AUTODIFF_FIRST_ORDER_FUNCTION_H_
#include <memory>
#include "ceres/first_order_function.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/jet.h"
#include "ceres/types.h"
namespace ceres {
// Create FirstOrderFunctions as needed by the GradientProblem
// framework, with gradients computed via automatic
// differentiation. For more information on automatic differentiation,
// see the wikipedia article at
// http://en.wikipedia.org/wiki/Automatic_differentiation
//
// To get an auto differentiated function, you must define a class
// with a templated operator() (a functor) that computes the cost
// function in terms of the template parameter T. The autodiff
// framework substitutes appropriate "jet" objects for T in order to
// compute the derivative when necessary, but this is hidden, and you
// should write the function as if T were a scalar type (e.g. a
// double-precision floating point number).
//
// The function must write the computed value in the last argument
// (the only non-const one) and return true to indicate
// success.
//
// For example, consider a scalar error e = x'y - a, where both x and y are
// two-dimensional column vector parameters, the prime sign indicates
// transposition, and a is a constant.
//
// To write an auto-differentiable FirstOrderFunction for the above model, first
// define the object
//
// class QuadraticCostFunctor {
// public:
// explicit QuadraticCostFunctor(double a) : a_(a) {}
// template <typename T>
// bool operator()(const T* const xy, T* cost) const {
// const T* const x = xy;
// const T* const y = xy + 2;
// *cost = x[0] * y[0] + x[1] * y[1] - T(a_);
// return true;
// }
//
// private:
// double a_;
// };
//
// Note that in the declaration of operator() the input parameters xy come
// first, and are passed as const pointers to arrays of T. The
// output is the last parameter.
//
// Then given this class definition, the auto differentiated FirstOrderFunction
// for it can be constructed as follows.
//
// FirstOrderFunction* function =
// new AutoDiffFirstOrderFunction<QuadraticCostFunctor, 4>(
// new QuadraticCostFunctor(1.0)));
//
// In the instantiation above, the template parameters following
// "QuadraticCostFunctor", "4", describe the functor as computing a
// 1-dimensional output from a four dimensional vector.
//
// WARNING: Since the functor will get instantiated with different types for
// T, you must convert from other numeric types to T before mixing
// computations with other variables of type T. In the example above, this is
// seen where instead of using a_ directly, a_ is wrapped with T(a_).
template <typename FirstOrderFunctor, int kNumParameters>
class AutoDiffFirstOrderFunction : public FirstOrderFunction {
public:
// Takes ownership of functor.
explicit AutoDiffFirstOrderFunction(FirstOrderFunctor* functor)
: functor_(functor) {
static_assert(kNumParameters > 0, "kNumParameters must be positive");
}
virtual ~AutoDiffFirstOrderFunction() {}
bool Evaluate(const double* const parameters,
double* cost,
double* gradient) const override {
if (gradient == nullptr) {
return (*functor_)(parameters, cost);
}
typedef Jet<double, kNumParameters> JetT;
internal::FixedArray<JetT, (256 * 7) / sizeof(JetT)> x(kNumParameters);
for (int i = 0; i < kNumParameters; ++i) {
x[i].a = parameters[i];
x[i].v.setZero();
x[i].v[i] = 1.0;
}
JetT output;
output.a = kImpossibleValue;
output.v.setConstant(kImpossibleValue);
if (!(*functor_)(x.data(), &output)) {
return false;
}
*cost = output.a;
VectorRef(gradient, kNumParameters) = output.v;
return true;
}
int NumParameters() const override { return kNumParameters; }
private:
std::unique_ptr<FirstOrderFunctor> functor_;
};
} // namespace ceres
#endif // CERES_PUBLIC_AUTODIFF_FIRST_ORDER_FUNCTION_H_

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,10 @@
#ifndef CERES_PUBLIC_AUTODIFF_LOCAL_PARAMETERIZATION_H_
#define CERES_PUBLIC_AUTODIFF_LOCAL_PARAMETERIZATION_H_
#include "ceres/local_parameterization.h"
#include <memory>
#include "ceres/internal/autodiff.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/local_parameterization.h"
namespace ceres {
@@ -107,21 +108,20 @@ namespace ceres {
template <typename Functor, int kGlobalSize, int kLocalSize>
class AutoDiffLocalParameterization : public LocalParameterization {
public:
AutoDiffLocalParameterization() :
functor_(new Functor()) {}
AutoDiffLocalParameterization() : functor_(new Functor()) {}
// Takes ownership of functor.
explicit AutoDiffLocalParameterization(Functor* functor) :
functor_(functor) {}
explicit AutoDiffLocalParameterization(Functor* functor)
: functor_(functor) {}
virtual ~AutoDiffLocalParameterization() {}
virtual bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const {
bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const override {
return (*functor_)(x, delta, x_plus_delta);
}
virtual bool ComputeJacobian(const double* x, double* jacobian) const {
bool ComputeJacobian(const double* x, double* jacobian) const override {
double zero_delta[kLocalSize];
for (int i = 0; i < kLocalSize; ++i) {
zero_delta[i] = 0.0;
@@ -133,20 +133,18 @@ class AutoDiffLocalParameterization : public LocalParameterization {
}
const double* parameter_ptrs[2] = {x, zero_delta};
double* jacobian_ptrs[2] = { NULL, jacobian };
return internal::AutoDiff<Functor, double, kGlobalSize, kLocalSize>
::Differentiate(*functor_,
parameter_ptrs,
kGlobalSize,
x_plus_delta,
jacobian_ptrs);
double* jacobian_ptrs[2] = {NULL, jacobian};
return internal::AutoDifferentiate<
kGlobalSize,
internal::StaticParameterDims<kGlobalSize, kLocalSize>>(
*functor_, parameter_ptrs, kGlobalSize, x_plus_delta, jacobian_ptrs);
}
virtual int GlobalSize() const { return kGlobalSize; }
virtual int LocalSize() const { return kLocalSize; }
int GlobalSize() const override { return kGlobalSize; }
int LocalSize() const override { return kLocalSize; }
private:
internal::scoped_ptr<Functor> functor_;
std::unique_ptr<Functor> functor_;
};
} // namespace ceres

View File

@@ -1,5 +1,5 @@
/* Ceres Solver - A fast non-linear least squares minimizer
* Copyright 2015 Google Inc. All rights reserved.
* Copyright 2019 Google Inc. All rights reserved.
* http://ceres-solver.org/
*
* Redistribution and use in source and binary forms, with or without
@@ -143,4 +143,4 @@ CERES_EXPORT void ceres_solve(ceres_problem_t* problem);
#include "ceres/internal/reenable_warnings.h"
#endif /* CERES_PUBLIC_C_API_H_ */
#endif /* CERES_PUBLIC_C_API_H_ */

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -36,12 +36,18 @@
#include "ceres/autodiff_cost_function.h"
#include "ceres/autodiff_local_parameterization.h"
#include "ceres/conditioned_cost_function.h"
#include "ceres/context.h"
#include "ceres/cost_function.h"
#include "ceres/cost_function_to_functor.h"
#include "ceres/covariance.h"
#include "ceres/crs_matrix.h"
#include "ceres/dynamic_autodiff_cost_function.h"
#include "ceres/dynamic_cost_function.h"
#include "ceres/dynamic_cost_function_to_functor.h"
#include "ceres/dynamic_numeric_diff_cost_function.h"
#include "ceres/evaluation_callback.h"
#include "ceres/gradient_checker.h"
#include "ceres/gradient_problem.h"
#include "ceres/gradient_problem_solver.h"
#include "ceres/iteration_callback.h"
@@ -49,6 +55,7 @@
#include "ceres/local_parameterization.h"
#include "ceres/loss_function.h"
#include "ceres/numeric_diff_cost_function.h"
#include "ceres/numeric_diff_options.h"
#include "ceres/ordered_groups.h"
#include "ceres/problem.h"
#include "ceres/sized_cost_function.h"

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -34,12 +34,12 @@
#ifndef CERES_PUBLIC_CONDITIONED_COST_FUNCTION_H_
#define CERES_PUBLIC_CONDITIONED_COST_FUNCTION_H_
#include <memory>
#include <vector>
#include "ceres/cost_function.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/types.h"
#include "ceres/internal/disable_warnings.h"
#include "ceres/types.h"
namespace ceres {
@@ -77,17 +77,19 @@ class CERES_EXPORT ConditionedCostFunction : public CostFunction {
// per-residual conditioner. Takes ownership of all of the wrapped cost
// functions, or not, depending on the ownership parameter. Conditioners
// may be NULL, in which case the corresponding residual is not modified.
//
// The conditioners can repeat.
ConditionedCostFunction(CostFunction* wrapped_cost_function,
const std::vector<CostFunction*>& conditioners,
Ownership ownership);
virtual ~ConditionedCostFunction();
virtual bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const;
bool Evaluate(double const* const* parameters,
double* residuals,
double** jacobians) const override;
private:
internal::scoped_ptr<CostFunction> wrapped_cost_function_;
std::unique_ptr<CostFunction> wrapped_cost_function_;
std::vector<CostFunction*> conditioners_;
Ownership ownership_;
};

56
extern/ceres/include/ceres/context.h vendored Normal file
View File

@@ -0,0 +1,56 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: vitus@google.com (Michael Vitus)
#ifndef CERES_PUBLIC_CONTEXT_H_
#define CERES_PUBLIC_CONTEXT_H_
namespace ceres {
// A global context for processing data in Ceres. This provides a mechanism to
// allow Ceres to reuse items that are expensive to create between multiple
// calls; for example, thread pools. The same Context can be used on multiple
// Problems, either serially or in parallel. When using it with multiple
// Problems at the same time, they may end up contending for resources
// (e.g. threads) managed by the Context.
class Context {
public:
Context() {}
Context(const Context&) = delete;
void operator=(const Context&) = delete;
virtual ~Context() {}
// Creates a context object and the caller takes ownership.
static Context* Create();
};
} // namespace ceres
#endif // CERES_PUBLIC_CONTEXT_H_

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -44,18 +44,18 @@
#ifndef CERES_PUBLIC_COST_FUNCTION_H_
#define CERES_PUBLIC_COST_FUNCTION_H_
#include <cstdint>
#include <vector>
#include "ceres/internal/macros.h"
#include "ceres/internal/port.h"
#include "ceres/types.h"
#include "ceres/internal/disable_warnings.h"
#include "ceres/internal/port.h"
namespace ceres {
// This class implements the computation of the cost (a.k.a. residual) terms as
// a function of the input (control) variables, and is the interface for users
// to describe their least squares problem to Ceres. In other words, this is the
// modelling layer between users and the Ceres optimizer. The signature of the
// modeling layer between users and the Ceres optimizer. The signature of the
// function (number and sizes of input parameter blocks and number of outputs)
// is stored in parameter_block_sizes_ and num_residuals_ respectively. User
// code inheriting from this class is expected to set these two members with the
@@ -64,6 +64,8 @@ namespace ceres {
class CERES_EXPORT CostFunction {
public:
CostFunction() : num_residuals_(0) {}
CostFunction(const CostFunction&) = delete;
void operator=(const CostFunction&) = delete;
virtual ~CostFunction() {}
@@ -115,29 +117,24 @@ class CERES_EXPORT CostFunction {
double* residuals,
double** jacobians) const = 0;
const std::vector<int32>& parameter_block_sizes() const {
const std::vector<int32_t>& parameter_block_sizes() const {
return parameter_block_sizes_;
}
int num_residuals() const {
return num_residuals_;
}
int num_residuals() const { return num_residuals_; }
protected:
std::vector<int32>* mutable_parameter_block_sizes() {
std::vector<int32_t>* mutable_parameter_block_sizes() {
return &parameter_block_sizes_;
}
void set_num_residuals(int num_residuals) {
num_residuals_ = num_residuals;
}
void set_num_residuals(int num_residuals) { num_residuals_ = num_residuals; }
private:
// Cost function signature metadata: number of inputs & their sizes,
// number of outputs (residuals).
std::vector<int32> parameter_block_sizes_;
std::vector<int32_t> parameter_block_sizes_;
int num_residuals_;
CERES_DISALLOW_COPY_AND_ASSIGN(CostFunction);
};
} // namespace ceres

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
//
// CostFunctionToFunctor is an adapter class that allows users to use
// SizedCostFunction objects in templated functors which are to be used for
// automatic differentiation. This allows the user to seamlessly mix
// automatic differentiation. This allows the user to seamlessly mix
// analytic, numeric and automatic differentiation.
//
// For example, let us assume that
@@ -38,16 +38,15 @@
// class IntrinsicProjection : public SizedCostFunction<2, 5, 3> {
// public:
// IntrinsicProjection(const double* observation);
// virtual bool Evaluate(double const* const* parameters,
// double* residuals,
// double** jacobians) const;
// bool Evaluate(double const* const* parameters,
// double* residuals,
// double** jacobians) const override;
// };
//
// is a cost function that implements the projection of a point in its
// local coordinate system onto its image plane and subtracts it from
// the observed point projection. It can compute its residual and
// either via analytic or numerical differentiation can compute its
// jacobians.
// jacobians either via analytic or numerical differentiation.
//
// Now we would like to compose the action of this CostFunction with
// the action of camera extrinsics, i.e., rotation and
@@ -87,594 +86,83 @@
#ifndef CERES_PUBLIC_COST_FUNCTION_TO_FUNCTOR_H_
#define CERES_PUBLIC_COST_FUNCTION_TO_FUNCTOR_H_
#include <cstdint>
#include <numeric>
#include <tuple>
#include <utility>
#include <vector>
#include "ceres/cost_function.h"
#include "ceres/dynamic_cost_function_to_functor.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/internal/parameter_dims.h"
#include "ceres/internal/port.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/types.h"
namespace ceres {
template <int kNumResiduals,
int N0, int N1 = 0, int N2 = 0, int N3 = 0, int N4 = 0,
int N5 = 0, int N6 = 0, int N7 = 0, int N8 = 0, int N9 = 0>
template <int kNumResiduals, int... Ns>
class CostFunctionToFunctor {
public:
// Takes ownership of cost_function.
explicit CostFunctionToFunctor(CostFunction* cost_function)
: cost_functor_(cost_function) {
CHECK_NOTNULL(cost_function);
CHECK(cost_function != nullptr);
CHECK(kNumResiduals > 0 || kNumResiduals == DYNAMIC);
// This block breaks the 80 column rule to keep it somewhat readable.
CHECK((!N1 && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) || // NOLINT
((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0))) // NOLINT
<< "Zero block cannot precede a non-zero block. Block sizes are "
<< "(ignore trailing 0s): " << N0 << ", " << N1 << ", " << N2 << ", "
<< N3 << ", " << N4 << ", " << N5 << ", " << N6 << ", " << N7 << ", "
<< N8 << ", " << N9;
const std::vector<int32>& parameter_block_sizes =
const std::vector<int32_t>& parameter_block_sizes =
cost_function->parameter_block_sizes();
const int num_parameter_blocks =
(N0 > 0) + (N1 > 0) + (N2 > 0) + (N3 > 0) + (N4 > 0) +
(N5 > 0) + (N6 > 0) + (N7 > 0) + (N8 > 0) + (N9 > 0);
const int num_parameter_blocks = ParameterDims::kNumParameterBlocks;
CHECK_EQ(static_cast<int>(parameter_block_sizes.size()),
num_parameter_blocks);
CHECK_EQ(N0, parameter_block_sizes[0]);
if (parameter_block_sizes.size() > 1) CHECK_EQ(N1, parameter_block_sizes[1]); // NOLINT
if (parameter_block_sizes.size() > 2) CHECK_EQ(N2, parameter_block_sizes[2]); // NOLINT
if (parameter_block_sizes.size() > 3) CHECK_EQ(N3, parameter_block_sizes[3]); // NOLINT
if (parameter_block_sizes.size() > 4) CHECK_EQ(N4, parameter_block_sizes[4]); // NOLINT
if (parameter_block_sizes.size() > 5) CHECK_EQ(N5, parameter_block_sizes[5]); // NOLINT
if (parameter_block_sizes.size() > 6) CHECK_EQ(N6, parameter_block_sizes[6]); // NOLINT
if (parameter_block_sizes.size() > 7) CHECK_EQ(N7, parameter_block_sizes[7]); // NOLINT
if (parameter_block_sizes.size() > 8) CHECK_EQ(N8, parameter_block_sizes[8]); // NOLINT
if (parameter_block_sizes.size() > 9) CHECK_EQ(N9, parameter_block_sizes[9]); // NOLINT
if (parameter_block_sizes.size() == num_parameter_blocks) {
for (int block = 0; block < num_parameter_blocks; ++block) {
CHECK_EQ(ParameterDims::GetDim(block), parameter_block_sizes[block])
<< "Parameter block size missmatch. The specified static parameter "
"block dimension does not match the one from the cost function.";
}
}
CHECK_EQ(accumulate(parameter_block_sizes.begin(),
parameter_block_sizes.end(), 0),
N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8 + N9);
CHECK_EQ(accumulate(
parameter_block_sizes.begin(), parameter_block_sizes.end(), 0),
ParameterDims::kNumParameters);
}
bool operator()(const double* x0, double* residuals) const {
CHECK_NE(N0, 0);
CHECK_EQ(N1, 0);
CHECK_EQ(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
template <typename T, typename... Ts>
bool operator()(const T* p1, Ts*... ps) const {
// Add one because of residual block.
static_assert(sizeof...(Ts) + 1 == ParameterDims::kNumParameterBlocks + 1,
"Invalid number of parameter blocks specified.");
return cost_functor_(&x0, residuals);
}
auto params = std::make_tuple(p1, ps...);
bool operator()(const double* x0,
const double* x1,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_EQ(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(2);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
return cost_functor_(parameter_blocks.get(), residuals);
}
// Extract residual pointer from params. The residual pointer is the
// last pointer.
constexpr int kResidualIndex = ParameterDims::kNumParameterBlocks;
T* residuals = std::get<kResidualIndex>(params);
bool operator()(const double* x0,
const double* x1,
const double* x2,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(3);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
return cost_functor_(parameter_blocks.get(), residuals);
}
// Extract parameter block pointers from params.
using Indices =
std::make_integer_sequence<int,
ParameterDims::kNumParameterBlocks>;
std::array<const T*, ParameterDims::kNumParameterBlocks> parameter_blocks =
GetParameterPointers<T>(params, Indices());
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(4);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(5);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
const double* x5,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(6);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
parameter_blocks[5] = x5;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
const double* x5,
const double* x6,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(7);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
parameter_blocks[5] = x5;
parameter_blocks[6] = x6;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
const double* x5,
const double* x6,
const double* x7,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(8);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
parameter_blocks[5] = x5;
parameter_blocks[6] = x6;
parameter_blocks[7] = x7;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
const double* x5,
const double* x6,
const double* x7,
const double* x8,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_NE(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const double*> parameter_blocks(9);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
parameter_blocks[5] = x5;
parameter_blocks[6] = x6;
parameter_blocks[7] = x7;
parameter_blocks[8] = x8;
return cost_functor_(parameter_blocks.get(), residuals);
}
bool operator()(const double* x0,
const double* x1,
const double* x2,
const double* x3,
const double* x4,
const double* x5,
const double* x6,
const double* x7,
const double* x8,
const double* x9,
double* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_NE(N8, 0);
CHECK_NE(N9, 0);
internal::FixedArray<const double*> parameter_blocks(10);
parameter_blocks[0] = x0;
parameter_blocks[1] = x1;
parameter_blocks[2] = x2;
parameter_blocks[3] = x3;
parameter_blocks[4] = x4;
parameter_blocks[5] = x5;
parameter_blocks[6] = x6;
parameter_blocks[7] = x7;
parameter_blocks[8] = x8;
parameter_blocks[9] = x9;
return cost_functor_(parameter_blocks.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0, JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_EQ(N1, 0);
CHECK_EQ(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
return cost_functor_(&x0, residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_EQ(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(2);
jets[0] = x0;
jets[1] = x1;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_EQ(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(3);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_EQ(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(4);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_EQ(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(5);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
const JetT* x5,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_EQ(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(6);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
jets[5] = x5;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
const JetT* x5,
const JetT* x6,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_EQ(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(7);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
jets[5] = x5;
jets[6] = x6;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
const JetT* x5,
const JetT* x6,
const JetT* x7,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_EQ(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(8);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
jets[5] = x5;
jets[6] = x6;
jets[7] = x7;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
const JetT* x5,
const JetT* x6,
const JetT* x7,
const JetT* x8,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_NE(N8, 0);
CHECK_EQ(N9, 0);
internal::FixedArray<const JetT*> jets(9);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
jets[5] = x5;
jets[6] = x6;
jets[7] = x7;
jets[8] = x8;
return cost_functor_(jets.get(), residuals);
}
template <typename JetT>
bool operator()(const JetT* x0,
const JetT* x1,
const JetT* x2,
const JetT* x3,
const JetT* x4,
const JetT* x5,
const JetT* x6,
const JetT* x7,
const JetT* x8,
const JetT* x9,
JetT* residuals) const {
CHECK_NE(N0, 0);
CHECK_NE(N1, 0);
CHECK_NE(N2, 0);
CHECK_NE(N3, 0);
CHECK_NE(N4, 0);
CHECK_NE(N5, 0);
CHECK_NE(N6, 0);
CHECK_NE(N7, 0);
CHECK_NE(N8, 0);
CHECK_NE(N9, 0);
internal::FixedArray<const JetT*> jets(10);
jets[0] = x0;
jets[1] = x1;
jets[2] = x2;
jets[3] = x3;
jets[4] = x4;
jets[5] = x5;
jets[6] = x6;
jets[7] = x7;
jets[8] = x8;
jets[9] = x9;
return cost_functor_(jets.get(), residuals);
return cost_functor_(parameter_blocks.data(), residuals);
}
private:
using ParameterDims = internal::StaticParameterDims<Ns...>;
template <typename T, typename Tuple, int... Indices>
static std::array<const T*, ParameterDims::kNumParameterBlocks>
GetParameterPointers(const Tuple& paramPointers,
std::integer_sequence<int, Indices...>) {
return std::array<const T*, ParameterDims::kNumParameterBlocks>{
{std::get<Indices>(paramPointers)...}};
}
DynamicCostFunctionToFunctor cost_functor_;
};

View File

@@ -1,5 +1,5 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2015 Google Inc. All rights reserved.
// Copyright 2019 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
@@ -31,12 +31,13 @@
#ifndef CERES_PUBLIC_COVARIANCE_H_
#define CERES_PUBLIC_COVARIANCE_H_
#include <memory>
#include <utility>
#include <vector>
#include "ceres/internal/port.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/types.h"
#include "ceres/internal/disable_warnings.h"
#include "ceres/internal/port.h"
#include "ceres/types.h"
namespace ceres {
@@ -60,7 +61,7 @@ class CovarianceImpl;
// Background
// ==========
// One way to assess the quality of the solution returned by a
// non-linear least squares solve is to analyze the covariance of the
// non-linear least squares solver is to analyze the covariance of the
// solution.
//
// Let us consider the non-linear regression problem
@@ -158,7 +159,7 @@ class CovarianceImpl;
// Gauge Invariance
// ----------------
// In structure from motion (3D reconstruction) problems, the
// reconstruction is ambiguous upto a similarity transform. This is
// reconstruction is ambiguous up to a similarity transform. This is
// known as a Gauge Ambiguity. Handling Gauges correctly requires the
// use of SVD or custom inversion algorithms. For small problems the
// user can use the dense algorithm. For more details see
@@ -183,7 +184,7 @@ class CovarianceImpl;
// Covariance::Options options;
// Covariance covariance(options);
//
// std::vector<std::pair<const double*, const double*> > covariance_blocks;
// std::vector<std::pair<const double*, const double*>> covariance_blocks;
// covariance_blocks.push_back(make_pair(x, x));
// covariance_blocks.push_back(make_pair(y, y));
// covariance_blocks.push_back(make_pair(x, y));
@@ -200,19 +201,19 @@ class CovarianceImpl;
class CERES_EXPORT Covariance {
public:
struct CERES_EXPORT Options {
Options()
#ifndef CERES_NO_SUITESPARSE
: algorithm_type(SUITE_SPARSE_QR),
// Sparse linear algebra library to use when a sparse matrix
// factorization is being used to compute the covariance matrix.
//
// Currently this only applies to SPARSE_QR.
SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type =
#if !defined(CERES_NO_SUITESPARSE)
SUITE_SPARSE;
#else
: algorithm_type(EIGEN_SPARSE_QR),
// Eigen's QR factorization is always available.
EIGEN_SPARSE;
#endif
min_reciprocal_condition_number(1e-14),
null_space_rank(0),
num_threads(1),
apply_loss_function(true) {
}
// Ceres supports three different algorithms for covariance
// Ceres supports two different algorithms for covariance
// estimation, which represent different tradeoffs in speed,
// accuracy and reliability.
//
@@ -229,23 +230,20 @@ class CERES_EXPORT Covariance {
// for small to moderate sized problems. It can handle
// full-rank as well as rank deficient Jacobians.
//
// 2. EIGEN_SPARSE_QR uses the sparse QR factorization algorithm
// in Eigen to compute the decomposition
// 2. SPARSE_QR uses the sparse QR factorization algorithm
// to compute the decomposition
//
// Q * R = J
//
// [J'J]^-1 = [R*R']^-1
//
// It is a moderately fast algorithm for sparse matrices.
//
// 3. SUITE_SPARSE_QR uses the SuiteSparseQR sparse QR
// factorization algorithm. It uses dense linear algebra and is
// multi threaded, so for large sparse sparse matrices it is
// significantly faster than EIGEN_SPARSE_QR.
//
// Neither EIGEN_SPARSE_QR not SUITE_SPARSE_QR are capable of
// computing the covariance if the Jacobian is rank deficient.
CovarianceAlgorithmType algorithm_type;
// SPARSE_QR is not capable of computing the covariance if the
// Jacobian is rank deficient. Depending on the value of
// Covariance::Options::sparse_linear_algebra_library_type, either
// Eigen's Sparse QR factorization algorithm will be used or
// SuiteSparse's high performance SuiteSparseQR algorithm will be
// used.
CovarianceAlgorithmType algorithm_type = SPARSE_QR;
// If the Jacobian matrix is near singular, then inverting J'J
// will result in unreliable results, e.g, if
@@ -270,7 +268,7 @@ class CERES_EXPORT Covariance {
// where min_sigma and max_sigma are the minimum and maxiumum
// singular values of J respectively.
//
// 2. SUITE_SPARSE_QR and EIGEN_SPARSE_QR
// 2. SPARSE_QR
//
// rank(J) < num_col(J)
//
@@ -278,7 +276,7 @@ class CERES_EXPORT Covariance {
// sparse QR factorization algorithm. It is a fairly reliable
// indication of rank deficiency.
//
double min_reciprocal_condition_number;
double min_reciprocal_condition_number = 1e-14;
// When using DENSE_SVD, the user has more control in dealing with
// singular and near singular covariance matrices.
@@ -313,9 +311,9 @@ class CERES_EXPORT Covariance {
//
// This option has no effect on the SUITE_SPARSE_QR and
// EIGEN_SPARSE_QR algorithms.
int null_space_rank;
int null_space_rank = 0;
int num_threads;
int num_threads = 1;
// Even though the residual blocks in the problem may contain loss
// functions, setting apply_loss_function to false will turn off
@@ -323,7 +321,7 @@ class CERES_EXPORT Covariance {
// function and in turn its effect on the covariance.
//
// TODO(sameergaarwal): Expand this based on Jim's experiments.
bool apply_loss_function;
bool apply_loss_function = true;
};
explicit Covariance(const Options& options);
@@ -352,10 +350,9 @@ class CERES_EXPORT Covariance {
// covariance computation. Please see the documentation for
// Covariance::Options for more on the conditions under which this
// function returns false.
bool Compute(
const std::vector<std::pair<const double*,
const double*> >& covariance_blocks,
Problem* problem);
bool Compute(const std::vector<std::pair<const double*, const double*>>&
covariance_blocks,
Problem* problem);
// Compute a part of the covariance matrix.
//
@@ -428,8 +425,8 @@ class CERES_EXPORT Covariance {
// a square matrix whose row and column count is equal to the sum of
// the sizes of the individual parameter blocks. The covariance
// matrix will be a row-major matrix.
bool GetCovarianceMatrix(const std::vector<const double *> &parameter_blocks,
double *covariance_matrix);
bool GetCovarianceMatrix(const std::vector<const double*>& parameter_blocks,
double* covariance_matrix) const;
// Return the covariance matrix corresponding to parameter_blocks
// in the tangent space if a local parameterization is associated
@@ -448,10 +445,10 @@ class CERES_EXPORT Covariance {
// blocks. The covariance matrix will be a row-major matrix.
bool GetCovarianceMatrixInTangentSpace(
const std::vector<const double*>& parameter_blocks,
double* covariance_matrix);
double* covariance_matrix) const;
private:
internal::scoped_ptr<internal::CovarianceImpl> impl_;
std::unique_ptr<internal::CovarianceImpl> impl_;
};
} // namespace ceres

Some files were not shown because too many files have changed in this diff Show More