Compare commits

..

5688 Commits

Author SHA1 Message Date
1ad4e704fe Gpencil: Solving redefinition errors in BKE_gpencil.h 2019-10-24 20:37:13 +08:00
e910924b37 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-10-24 20:36:28 +08:00
42eef8f81a Merge branch 'blender-v2.81-release' 2019-10-21 20:03:08 +11:00
6a1118092a Fix invalid property shortcuts being created
When there was no way to find the data-path from context
the shortcut was still being created.
It would evaluate to "context.(null)".

Now adding shortcuts will be disabled if the path can't be computed.
2019-10-21 19:57:43 +11:00
3af8f88539 Merge branch 'blender-v2.81-release' 2019-10-21 19:20:35 +11:00
34c835cbd1 Fix project from view crash before the GPU is initialized 2019-10-21 19:19:04 +11:00
95fddf1452 Merge branch 'blender-v2.81-release' 2019-10-21 15:07:22 +11:00
41ec25d27b Cleanup: style 2019-10-21 15:05:56 +11:00
7fa8c41693 Merge branch 'blender-v2.81-release' 2019-10-21 14:51:29 +11:00
3ceff8b7bc CMake: fix building as a Python module on macOS
Caused by c553b790fc
2019-10-21 14:48:17 +11:00
7242d79072 Merge branch 'blender-v2.81-release' 2019-10-21 02:58:45 +11:00
71538eaad6 Fix T70864: Separate loose parts runs indefinitely
Large objects with many separate pieces became unstably slow
(run for hours and not finish).

The entire original mesh was being duplicated twice per loose part.

In own tests, millions of vertices and thousands of loose parts
now run in around 5-15 seconds.
2019-10-21 02:47:07 +11:00
47d7f5e200 Shrinkwrap: improve numerical stability of Target Normal Project.
* Add proper adjustment for scale in the solver epsilon computation.
* Run at least one full iteration of the solver, even if the initial
  state meets the epsilon requirement.
* When applying offset, blend normal into the offset direction
  as the initial point moves very close to the target mesh.

Also random improvements to debug trace output in the console.
2019-10-20 16:53:21 +03:00
fed27c25aa Merge branch 'blender-v2.81-release' 2019-10-20 18:26:11 +11:00
98ab0f173c Mesh: add API functions for poly & loop removal
These existed for verts & edges, add for API completeness.
Also add ED_mesh_geometry_clear,
needed to reduce memory for edit-mesh separate.
2019-10-20 18:25:17 +11:00
b72a3146eb Merge branch 'blender-v2.81-release' 2019-10-20 16:43:57 +11:00
047c66279a Cleanup: missing declaration warnings 2019-10-20 16:42:49 +11:00
Charlie Jolly
c2a2cd13be GPencil: Primitive: Polyline Tool
T70927

Maniphest Tasks: T70927

Differential Revision: https://developer.blender.org/D6097
2019-10-19 12:27:40 +01:00
3de4446959 Merge branch 'blender-v2.81-release' 2019-10-18 16:43:09 +02:00
970d7ed860 Fix T70790: Crash in sculpt mode switching from two meshes after reload saved file
This fixes the crash, but it does not fix the core issue. The PBVH should
always be available when an object is in sculpt mode and tools should
not need to check for that.

Reviewed By: jbakker

Maniphest Tasks: T70790

Differential Revision: https://developer.blender.org/D6063
2019-10-18 16:41:41 +02:00
b13a2b8253 Merge branch 'blender-v2.81-release' 2019-10-18 16:26:34 +02:00
082fb6603d Fix T70839: Sculpt brushes stop affecting after using move, rotate or scale tools
Reviewed By: jbakker

Maniphest Tasks: T70839

Differential Revision: https://developer.blender.org/D6071
2019-10-18 16:24:50 +02:00
045256a554 Merge branch 'blender-v2.81-release' 2019-10-18 16:09:39 +02:00
6183688c35 Fix T70919: Proxies crash after building motion path
Was cause by recent fix for T65134 which assigned original object's
proxy_from to an evaluated pointer.

This is because motion path depsgraph does not include proxies, so
the pointer in an evaluated object was kept pointing to an original
object.
2019-10-18 16:06:23 +02:00
8148bf8cf0 Merge branch 'blender-v2.81-release' 2019-10-18 13:33:20 +02:00
725b59d9b4 Fix T70903: Opening splash screen from named app_template crashes
Caused by rB46102cf4e0c4 [which removed the check if the image can
actually be loaded].

Maniphest Tasks: T70903

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D6089
2019-10-18 13:29:54 +02:00
8378db40c7 Cycles: Fix out of memory when rendering some scenes with OptiX that work with CUDA
The OptiX implementation wasn't trying to allocate memory on the host if device allocation failed, while the CUDA implementation did. This copies the implementation over to OptiX to remedy that.

Differential Revision: https://developer.blender.org/D6068
2019-10-18 12:23:27 +02:00
959b40c2a8 Merge branch 'blender-v2.81-release' 2019-10-18 19:17:55 +11:00
16665ad753 Cleanup: remove unused viewport fx_settings 2019-10-18 19:10:25 +11:00
eb559f2b24 Merge branch 'blender-v2.81-release' 2019-10-18 18:51:46 +11:00
acd98599ff Fix T65397: Assigning shortcut to editor properties gives errors 2019-10-18 18:50:18 +11:00
3a3da6baa3 Merge branch 'blender-v2.81-release' 2019-10-17 17:41:55 +02:00
382e7ce9ec Fix T70678 Workbench: Smoke Sim display has incorrect offset
Fix the ray direction computation.
2019-10-17 17:40:30 +02:00
4142f3993c Fix T70811 EEVEE: Alpha clip/hashed cause wrong alpha values
Was caused by division not giving a fully opaque alpha value.
2019-10-17 17:40:30 +02:00
9378d46c4d Merge branch 'blender-v2.81-release' 2019-10-17 16:20:28 +02:00
ade2129f14 Fix T70901: Pose bone with Armature Constraint moves in wrong direction
A regression since previous fix for proxy. Restore old code for copying
values to an original pose channel.
2019-10-17 16:20:14 +02:00
77e38160fe Merge branch 'blender-v2.81-release' 2019-10-17 13:17:36 +02:00
9054b83402 Cleanup depsgraph access in particle_edit.c
'PE_set_data' / 'PE_set_view3d_data' would give us a depsgraph already,
so use it.

Also fix access to PEData->depsgraph without calling 'PE_set_data' prior.

Addresses concern raised in rBcf2c09002fae.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D6067
2019-10-17 13:17:05 +02:00
78f8270ad3 Volumetric: Debug Voxel Size and Location
When displaying the voxel size for an adaptive domain the resolution of the adaptive domain was used to calculate the world size of the voxel.
This patch changes this to use the initial size of the domain.

When using adaptive domain the overlay was not rendered in the right
place.

Thanks to sebbas for part of the patch!

Reviewed By: sebbas, fclem

Differential Revision: https://developer.blender.org/D6076
2019-10-17 12:19:30 +02:00
9d228c688d Volumetric: Debug Voxel Size and Location
When displaying the voxel size for an adaptive domain the resolution of the adaptive domain was used to calculate the world size of the voxel.
This patch changes this to use the initial size of the domain.

When using adaptive domain the overlay was not rendered in the right
place.

Thanks to sebbas for part of the patch!

Reviewed By: sebbas, fclem

Differential Revision: https://developer.blender.org/D6076
2019-10-17 12:16:03 +02:00
81cc57d90d Merge branch 'blender-v2.81-release' 2019-10-17 12:01:42 +02:00
f45127c6cb Fix T70740: Clicking on proxy bone makes original one jump to initial location
Caused by what appears to be a missing flush from evaluated bone back to
original, which then makes it so copy-on-write operation happening after
click (to synchronize selection flags) pushes original bone to its initial
position.

Differential Revision: https://developer.blender.org/D6051
2019-10-17 11:59:48 +02:00
d2b900e715 Merge branch 'blender-v2.81-release' 2019-10-17 11:59:22 +02:00
5115759fdd Cleanup: Fix naming of a function 2019-10-17 11:51:02 +02:00
bc42312100 Merge branch 'blender-v2.81-release' 2019-10-17 11:43:40 +02:00
d89b65cc91 Node shader wrapper: use 'Non-Color' profile for BW textures inputs.
All the single-value texture inputs of Principled BSDF node should use
non-color colorspace profile, not sRGB one (issue raised in
https://blender.stackexchange.com/questions/155617, thanks).

That also revealed another issue - since those color space settings are
stored at the image level itself, not the node one, we need to
duplicate those image data-blocks when we use same picture for e.g. base
color (sRGB) and specular (non-color) inputs...

For now using a basic mechanism for that, might generate several extra,
uneeded copies of the image ID, but that’s better than breaking custom
settings and such.

Note that while this will modify the behavior of the impporters using
that node wrapper, no change should be needed in IO add-ons themselves.
2019-10-17 11:43:11 +02:00
f9f507f9d8 Merge branch 'blender-v2.81-release' 2019-10-17 11:27:16 +02:00
dffe702d78 Fix T69182: Auto-Smooth does not work on Alembic meshes without normals
The auto-smoothing flag can now be used by artists when the Alembic file
does not contain custom loop normals.

- Auto-smoothing disabled: mesh is flat-shaded.
- Auto-smoothing enabled: works as usual; set angle to 180° to ensure
  a 100% smoothed mesh.
2019-10-17 11:26:33 +02:00
78cd3f7db9 Merge branch 'blender-v2.81-release' 2019-10-17 11:16:12 +02:00
2afbd14c59 Fix T70887: GPencil edit lines are not displayed in the right place
The lines were not using the matrix to calc the tarnsformation.
2019-10-17 11:15:22 +02:00
707d40e627 Merge branch 'blender-v2.81-release' 2019-10-17 10:23:17 +02:00
74db523a52 Fix T70739: Make Library Override doesn't re-target Armature constraints.
Missing one step (collection prop itself) in RNA hierarchy of properties
leading to those armature object pointers...
2019-10-17 10:21:52 +02:00
76e6d2f19d Cleanup: spelling
Also remove historic bftgl reference.
2019-10-17 12:40:36 +11:00
e7c02f14c7 Merge branch 'blender-v2.81-release' 2019-10-17 12:39:23 +11:00
85ddaaa16e Fix invalid flag check
Cast occurs first, making any flag enable this option.
2019-10-17 12:34:20 +11:00
dccf3acede Merge branch 'blender-v2.81-release' 2019-10-17 12:29:41 +11:00
3a51b27734 Cleanup: shadow warning 2019-10-17 12:28:35 +11:00
0c57373e2c Merge branch 'blender-v2.81-release' 2019-10-16 21:59:26 +02:00
812b30daf5 GPencil: Fix unreported performance issue with relative onion mode
When the relative mode was used, the calculation of the total number of vertices was not done and it was using the total number of vertices in the datablock. This worked for small files, but with complex files the time to allocate all the data was too long and the performance was very bad.

Now, for relative mode the real number of vertex is calculated.

Also fixed the same problem when onion and multiedit is enabled.
2019-10-16 21:56:25 +02:00
51429343a5 Merge branch 'blender-v2.81-release' 2019-10-16 20:18:17 +02:00
7e78fbf2de Fix assert and memleak in recent Skin Root Display patch
Caused by 4ddf3215a7
2019-10-16 20:16:53 +02:00
bb890d4f65 Merge branch 'blender-v2.81-release' 2019-10-16 19:06:22 +02:00
131ac2ec82 Fix T70249 EEVEE: Light bleeding on SSS translucency
This was caused by 2 things: Shadow map bias and aliasing.

It made the expected depth of the shadowmap further than the surface
itself in some cases. In normal time this leads to light leaking on normal
shadow mapping but here we need to always have the shadowmap depth above
the shading point.

To fix this, we use a 5 tap inflate filter using the minimum depth of all
5 samples. Using these 5 taps, we can deduce entrance surface derivatives
and there orientation towards the light ray. We use these derivatives to
bias the depth to avoid wrong depth at depth discontinuity in the shadowmap.

This bias can lead to some shadowleaks that are less distracting than the
lightleaks it fixes.

We also add a small bias to counteract the shadowmap depth precision.
2019-10-16 18:58:20 +02:00
4ddf3215a7 Fix T68380 Skin modifier root not displayed 2019-10-16 18:58:12 +02:00
8956666899 Fix T70543 Rigid Body Collision Shape Not Displayed In Viewport 2019-10-16 18:58:05 +02:00
Dalai Felinto
5da9ae9c0b Merge remote-tracking branch 'origin/blender-v2.81-release' 2019-10-16 12:37:03 -03:00
Dalai Felinto
3ff25fa80a Fix multi-object edit mode and local view/collections
Before this patch you could go to a local view with a single object,
while you had other objects also in edit mode, and your operators would
affect all objects even the ones outside your local view (same for local
collection).

Differential Revision: https://developer.blender.org/D6064
2019-10-16 12:31:27 -03:00
Jeroen Bakker
b0476f0631 Workbench: Background Dithering
Background dithering was introduced to solve banding issues on gradient backgrounds.
This patch will enable dithering based on the texture that is used for drawing.
Only when using a GPU_RGBA8 texture the dithering will be enabled.

This disables dithering for final rendering, vertex and texture paint modes.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D6056
2019-10-16 15:40:25 +02:00
e413b39a93 PyAPI: use public API's for module & builtin access
D6038 by @Dormouse
2019-10-16 23:16:51 +11:00
87539172ed Cleanup: warnings 2019-10-16 23:16:51 +11:00
Julian Eisel
b546263642 UI: Remember ID-Filter in-between File Browser calls
This adds the ID-Filters visible on append/link to the settings the file
browser remembers, potentially storing them in the Preferences.

Artists in the studio here requested this. They typically have to set up
the same or similar settings every time, so this saves them from that.
2019-10-16 14:06:48 +02:00
Julian Eisel
a3f7ae1b96 UI: Add missing workspace icon to link/append ID-Filters 2019-10-16 11:29:27 +02:00
Julian Eisel
a6b9e1dfdb Fix: Some ID-Filters not enabled on Link/Append
Caused by 9100982e80.
2019-10-16 11:26:04 +02:00
dcf57e34f3 GPencil: Fix unreported problem when use Onion Skin in several windows
The onion skin was nos displayed in secondary screens when disable the Onion switch or the Overlay in the main window.

Added a check to verify if the main overlay and onion switches are enabled in any screen in order to generate the cache data.

This is required to generate the onion skin and limit the times the cache is updated because the cache is generated only in the first screen and if the first screen has the onion disabled the cache for onion skin is not generated. The loop adds time, but always is faster than regenerate the cache all the times.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D6049
2019-10-16 10:33:39 +02:00
Stefan Werner
35a545b752 Cycles: Allow PTX targets for CUDA kernel build.
This is intended for developers on Windows primarily:
Now, CUDA architectures of type compute_xx are supported. This allows for quicker builds,
at the expense of the CUDA driver running ptxas the first time a kernel is loaded.

Differential Revision: https://developer.blender.org/D5953
2019-10-16 10:29:04 +02:00
76e8d2cc17 Merge branch 'blender-v2.81-release' 2019-10-16 19:15:52 +11:00
80f0bc99a9 Fix T70850: Scene.frame_set doesn't update camera from markers 2019-10-16 19:10:28 +11:00
4a77ddf146 Merge branch 'blender-v2.81-release' 2019-10-16 09:40:56 +02:00
0dcc5572d6 Fix (unreported) VSE scene strip should not be able to set the scene to
self

Spotted while looking into T70845

Reviewers: sergey, ISS, campbellbarton

Differential Revision: https://developer.blender.org/D6073
2019-10-16 09:38:48 +02:00
519f79e111 Merge branch 'blender-v2.81-release' 2019-10-16 15:59:06 +11:00
9dd5e3b6e8 Cleanup: define PY_SSIZE_T_CLEAN for Python
Silence deprecation warnings running with Python 3.8.
2019-10-16 15:58:32 +11:00
cc2bc3370b Merge branch 'blender-v2.81-release' 2019-10-16 15:02:46 +11:00
36b6fb5cd6 Cleanup: warnings building with Python 3.8 2019-10-16 14:44:36 +11:00
0e7fe872de Merge branch 'blender-v2.81-release' 2019-10-16 14:16:12 +11:00
01e2786bdd Fix incorrect limit check in button drawing
Regression in d617466d87
2019-10-16 14:13:34 +11:00
20b0bedb8b Merge branch 'blender-v2.81-release' 2019-10-16 14:10:23 +11:00
1094c3f276 RNA: region_to_view took int's instead of floats
Internally the function uses float's, RNA exposed args as int's.

Python3.8 warns about int/float conversion in toolbar drawing code.
2019-10-16 14:07:37 +11:00
8eb98392df Merge branch 'blender-v2.81-release' 2019-10-16 13:42:01 +11:00
a7cf7b114f Fix for building with Python 3.8 2019-10-16 13:39:29 +11:00
a8d001fef5 Merge branch 'blender-v2.81-release' 2019-10-15 15:02:45 -03:00
cfb6ffd48f Fix T70386: Crash when snapping to edges in specific situations
The callbacks get elements through indexes,
so make sure they're not "dirty".
2019-10-15 14:59:30 -03:00
e3282fecae Merge branch 'blender-v2.81-release' 2019-10-15 17:37:35 +02:00
2a9b162d94 Fix T70605: incorrect darken and lighten rgb mix mode
Differential Revision: https://developer.blender.org/D6058

Reviewers: brecht, fclem
2019-10-15 17:31:44 +02:00
4ace593196 Merge branch 'blender-v2.81-release' 2019-10-15 17:08:20 +02:00
c2a7e79047 Fix T70771: Texture nodes in Compositor causes infinite update 2019-10-15 17:07:53 +02:00
Dalai Felinto
622324f717 Merge remote-tracking branch 'origin/blender-v2.81-release'
Silly merge just to test new server-side git hook.
2019-10-15 10:55:18 -03:00
Dalai Felinto
cb4fa01fcf Fix GPL block in CMake file
(using this to test the new server-side git hook)
2019-10-15 10:54:13 -03:00
Dalai Felinto
6d8f5679db Merge branch 'blender-v2.81-release' 2019-10-15 10:42:42 -03:00
Dalai Felinto
7df7a8f3f1 Fix T70838: crash on cycles render after recent fix
My bad for not figuring out how to run our unittests since I got back to
Windows.
2019-10-15 10:18:11 -03:00
Julian Eisel
6934688f2c Merge branch 'blender-v2.81-release' 2019-10-15 14:59:59 +02:00
Julian Eisel
4d3a317258 Fix T70815: Missing tool settings redraw when using Annotate Tool 2019-10-15 14:56:50 +02:00
3db7f145df Merge branch 'blender-v2.81-release' 2019-10-15 20:30:11 +11:00
871845b979 Fix T70433: No shortcut in tooltip for viewport X-Ray
While not a bug exactly, it's useful to show the shortcut,
expose the operator in the UI instead of the property.
2019-10-15 20:27:04 +11:00
51750168f7 Merge branch 'blender-v2.81-release' 2019-10-15 11:18:29 +02:00
391b652be4 Cleanup: clang format for rBb77da65e8c4d 2019-10-15 11:16:55 +02:00
0473815d48 Merge branch 'blender-v2.81-release' 2019-10-15 11:03:32 +02:00
d54ccb90ab Fix T70667: crash playing animation (after deleting rigid body obj)
Was crashing due to RBW mssing shared->physics_world [which can happen
when undoing the deletion of the last object in the world].
This can be gained back by BKE_rigidbody_validate_sim_world.

Reviewed By: mont29

Maniphest Tasks: T70667

Differential Revision: https://developer.blender.org/D6037
2019-10-15 10:57:59 +02:00
3cdcd1fa9f Merge branch 'blender-v2.81-release' 2019-10-15 19:27:59 +11:00
171a47421d Fix T70590: Python Gizmo API misses opacity & anti-aliasing
Thanks to @mano-wii for finding root cause.
2019-10-15 19:24:40 +11:00
8bab53f5a0 Merge branch 'blender-v2.81-release' 2019-10-15 10:07:12 +02:00
b77da65e8c Fix T68700: Incorrect 'absolute' timing of animated masks in the Video
Sequence Editor

Code in 'seq_render_mask' will effectively do
BKE_mask_evaluate(mask_temp, mask->sfra + (cfra - fra_offset), true)
where 'fra_offset' is zero for absolute and seq->start for relative.

If we really want the scene's current frame (as advertised) if Mask Time
is set to Absolute (effectively ignoring the Mask Settings start/end) we
need to change the fra_offset from zero to mask->sfra.

Also BKE_animsys_evaluate_animdata should take mask->sfra into account
as well (otherwise mask animation [points] and other animation [e.g.
opacity] will run out of sync)

Reviewers: campbellbarton, ISS

Maniphest Tasks: T68700

Differential Revision: https://developer.blender.org/D5495
2019-10-15 10:06:14 +02:00
fba127619d Merge branch 'blender-v2.81-release' 2019-10-15 09:48:54 +02:00
fa76f08db5 Fix T70560: Large cones are created with double vertices (even though
the radius is zero)

Merge threshold for remove_doubles was hardcoded, now scaled by depth.

Reviewed By: campbellbarton

Maniphest Tasks: T70560

Differential Revision: https://developer.blender.org/D6001
2019-10-15 09:46:59 +02:00
23b3b5bc76 Merge branch 'blender-v2.81-release' 2019-10-15 18:29:42 +11:00
7fb12536b7 UI: increase precision for fps-base value
The default precision displayed 1.001 as 1.00,
leading to confusing final FPS values.

Fixes T70827
2019-10-15 18:25:49 +11:00
e2e95d56ff Merge branch 'blender-v2.81-release' 2019-10-15 17:30:07 +11:00
0500dcd711 Fix scan-fill normal flipping for displist & mask filling
Missed from fix for T70594 which reversed the normals,
Resolves T70809
2019-10-15 17:23:23 +11:00
364c1f4222 Merge branch 'blender-v2.81-release' 2019-10-15 15:21:09 +11:00
4fcdcbe38d Cleanup: pep8 for templates 2019-10-15 15:20:15 +11:00
52ccfdb953 Merge branch 'blender-v2.81-release' 2019-10-15 14:22:52 +11:00
46102cf4e0 Fix T70812: AppTemplate Splash image is not loading
Allow different splash heights, without this changes the the
default splash would stop app templates splash screen from loading.

This also allows the default splash height to change without
manually editing the layout.
2019-10-15 14:19:25 +11:00
Dalai Felinto
a4ef7a27d2 Merge branch 'blender-v2.81-release' 2019-10-14 22:47:07 -03:00
Dalai Felinto
abd7ad01b8 Cleanup: Fix warnings 2019-10-14 22:45:34 -03:00
Dalai Felinto
dc5fa12bd3 Cleanup: Use BKE_object_is_visible elsewhere 2019-10-14 22:45:33 -03:00
Dalai Felinto
280d6b03a7 Fix T70670: Hidden collections are still rendered by Cycles in the Viewport
Now local collections are fully working with cycles preview, while the
collection visibility bug is fixed.

Local collections were not working with cycles viewport even before the recent
commit to allow users to show collections that are hidden in the view layer.

It just got worse with said commit (0812949bbc).

Differential Revision: https://developer.blender.org/D6034
2019-10-14 22:45:33 -03:00
Dalai Felinto
af5cc8cbd4 Fix T69644 / T68586: objects flag unsynced when drag hidden collections
That would lead to crashes and other issues. The solution is not elegant
though, it involves resyncing all the collections again.

Differential Revision: https://developer.blender.org/D6043
2019-10-14 22:45:33 -03:00
Dalai Felinto
9100982e80 Fix Filebrowser Blender ID filter
When the filtering option was disable we should see all the datablock types.

Differential Revision: https://developer.blender.org/D6033
2019-10-14 22:45:33 -03:00
b2d83a0697 Merge branch 'blender-v2.81-release' 2019-10-15 12:29:45 +11:00
a9fbd05e7d Fix image undo restoring float/byte tiles into the wrong buffer type
This also resolves the (unlikely) issue of undo having uninitialized
zbuf data, now it's cleared instead.
2019-10-15 12:24:26 +11:00
c1db52def2 Merge branch 'blender-v2.81-release' 2019-10-15 12:06:11 +11:00
c412a54123 Docs: clarify writefile.c file format info 2019-10-15 12:04:59 +11:00
100af18955 Docs: clarify writefile.c format text 2019-10-15 12:02:40 +11:00
695cbf5eef Fix incorrect brush falloff flag use
Harmless currently since they're the same value,
would fail if other options were added.
2019-10-15 10:04:34 +11:00
Julian Eisel
9a85592dde Fix: First item in File Browser can't be renamed
Stupid mistake in 5edfde58fe.
2019-10-14 21:07:24 +02:00
519891c669 Merge branch 'blender-v2.81-release' 2019-10-14 18:48:16 +02:00
879d269e87 Py API doc generator: more tweaks to adapt to new release process.
Now we also create a 'version' symlink for master.
2019-10-14 18:46:50 +02:00
Julian Eisel
f55a5478e8 Merge branch 'blender-v2.81-release' 2019-10-14 18:16:54 +02:00
5ba41bea8a Fix autokeyframe not working on bones mirrored bones
The previous code for this didn't work as the MIRROR bone flag would be
cleared before the autokeyframe code was run.
2019-10-14 18:16:21 +02:00
Julian Eisel
760481518b UI: Add renaming to Node and VSE strip context menu
We should have that consistently everywhere the operation is available.
2019-10-14 18:13:58 +02:00
b8ca806b77 Fix autokeyframe not working on bones mirrored bones
The previous code for this didn't work as the MIRROR bone flag would be
cleared before the autokeyframe code was run.
2019-10-14 17:48:08 +02:00
2cdc187142 Merge branch 'blender-v2.81-release' 2019-10-14 17:40:06 +02:00
15539f7b6d Py API doc generator: tweak to handle new release process.
We need to handle beta stage in a specific way, since it's no longer
master, but not yet 'real' rc/release stage...

For now, only point to version dir of the API doc, but no need to create
any symlink (that way, 'current' remain pointing to 2.80 release, while
'2.81' is no longer a symlink to 'master', but its own actual doc).
2019-10-14 17:39:17 +02:00
6b6b27fd13 Update Py API link in help menu to point to version dir also in beta.
Now that we have beta and master in parallel, we cannot point to API doc
from master in beta builds of incoming release anymore.
2019-10-14 17:39:17 +02:00
Julian Eisel
5edfde58fe File Browser: Add F2 shortcut to rename files
Previously, we used Ctrl+Click for renaming, but since that shortcut is
now consistently used to add items to the selection, we can't use that.
In other cases we switched to F2 now, so it makes sense for the File
Browser too.
Further, AFAIK renaming was only possible through the context menu,
which makes it hard to discover in the right click select keymap (have
to press W).

Note that I had to do some internal changes to ensure the context menu
always acts on the clicked/hovered item, while the shortcut operates on
the active item. William and I agreed that this is likely the behavior
expected by most users.
2019-10-14 16:32:18 +02:00
ac52a53628 Merge branch 'blender-v2.81-release' 2019-10-14 15:56:58 +02:00
841e969580 GPencil: Fix unreported duplicated brushes
The eraser and fill brushes were duplicated due a bug introduced by versioning code.
2019-10-14 15:53:39 +02:00
df0ec670fb Merge branch 'blender-v2.81-release' 2019-10-14 15:46:52 +02:00
Julian Eisel
80fe0ac7ff Fix T70581: Node Wrangler output switching broken
When executing the node selection operator through Python, or in fact
any similar select operator with drag-all-selected support, the operator
was enabling modal execution, which should not be done in this case.
Reason was simply a wrong default for an internal property.
2019-10-14 12:11:13 +02:00
0fb55ff845 Fix T70787: Duplicating objects with custom property of type ID creates bogus links.
Note that the issue also affected animdata handling...

Checked all usages of the `BKE_libblock_copy_ex()` function, and
think never handling user count here is valid, although a bit risky
maybe. But other solution would be to add yet another copy flag, so
would rather go with that one for now.
2019-10-14 11:12:13 +02:00
e7367c607e Cleanup: Fix naming of a function 2019-10-14 10:45:35 +02:00
e8220dea60 GPU: prevent assert for zero length arrays
This could happen with the build modifier.
2019-10-14 18:39:16 +11:00
95f020c853 macOS: add opus to FFMPEG_LIBRARIES 2019-10-12 18:33:34 +03:00
bde328352b Cleanup: pep8 2019-10-12 10:26:37 +11:00
d105b620fa Cleanup: clang-format 2019-10-12 09:46:44 +11:00
5d7195ab8e Cleanup: warnings 2019-10-12 09:45:20 +11:00
60d02b336e Build: also use release branch for source/tools module 2019-10-11 21:43:45 +02:00
3842519a38 Revert "Merge branch 'master' into blender-v2.81-release"
This reverts commit 20b2acf336, reversing
changes made to f185cc0ca5.

Merges should only go form the release branch to master. For backporting
commits, use cherry-pick.
2019-10-11 21:31:58 +02:00
20b2acf336 Merge branch 'master' into blender-v2.81-release 2019-10-11 16:12:11 -03:00
f185cc0ca5 Fix T70729: Multi-object edit UV not transform all meshes
Detail that went unnoticed in rBbfc9d426bb95
2019-10-11 16:11:57 -03:00
4e3f186a8c Fix T70729: Multi-object edit UV not transform all meshes
Detail that went unnoticed in rBbfc9d426bb95
2019-10-11 15:55:35 -03:00
4bb8a3c111 Merge branch 'blender-v2.81-release' 2019-10-11 18:55:26 +02:00
1c2a20c84d Fix T70714: Crash when using OBJECT_OT_material_slot_assign op without UI.
There is no guarantee we can get any valid UI from the context, and that
operator can work without it.
2019-10-11 18:54:43 +02:00
1e5e65fa9f Fix T70695: Scene crashes Blender on open.
Note that this commit fixes the crash itself, but actual issue is *how*
that situation could happen (having insert override operation with local
'source' overriding data-block with an empty bone constraints stack...).
2019-10-11 18:54:15 +02:00
Alessio Monti di Sopra
ecd86c0587 UI: Fix grid scale text not having shadows in the 3d view infos
This commit adds a shadow to the grid scale info text in the 3d View,
to make it more visible like the rest of that section.

{F7798605}

Differential Revision: https://developer.blender.org/D6025
2019-10-11 12:28:35 -03:00
c5ecfd526e Cleanup: Remove unused variable 2019-10-11 15:50:42 +02:00
46e9fc9362 Cleanup: Strict compiler warnings 2019-10-11 15:01:34 +02:00
533a7e25db Add Probot Stale configuration file
This is a configuration of Blender mirror on Github which automatically
closes Pull requests and gives developers instructions how to submit patch
to an official code review.

Differential Revision: https://developer.blender.org/D6027
2019-10-11 14:13:29 +02:00
b57a89f062 Buildbot: don't add branch prefix when building release branches 2019-10-11 13:46:24 +02:00
Antonio Vazquez
5adb3b6882 GPencil: New Eyedropper tool for Material creation.
This patch is only for the eyedropper to create materials.

Options:
Click: Create Stroke Material
Shift+Click: Create Fill Material.
Shift+Ctrl+Click: Create Stroke and Fill Material.

Toolbar:

{F7718606}

Reviewed By: brecht, mendio

Differential Revision: https://developer.blender.org/D5688
2019-10-11 13:33:13 +02:00
ec295c1168 Merge branch 'blender-v2.81-release' 2019-10-11 13:29:43 +02:00
7d3ea8f12b Fix T69964: GPencil: Fill options are not shown on a properties editor
Differential Revision: https://developer.blender.org/D6041
2019-10-11 12:26:57 +01:00
74f9b9d144 GPencil: Remove curve objects after converting to strokes (unreported)
This was detected fixing T69459

Part of Differential Revision: https://developer.blender.org/D6045

Note: done in a separated commit to keep track of changes done not directly related to bug reported in T69459.
2019-10-11 13:18:39 +02:00
15ffa3e7db Fix T69459: Convert Curve to Grease Pencil clears Transform
Also changed to create a grease pencil object for each curve.

Part of differential revision: https://developer.blender.org/D6045
2019-10-11 13:13:43 +02:00
2b35ee3ea2 Fix issue in "make update" checking out submodule branch on buildbot 2019-10-11 13:11:10 +02:00
3f97d62072 Version bump to 2.81 Beta 2019-10-11 12:25:26 +02:00
67b1a15b3f Version bump to 2.82 alpha, master is now open for new features and changes 2019-10-11 12:23:15 +02:00
41d9cf225d Fix "make update" not using the right branch for source/tools 2019-10-11 12:22:28 +02:00
4b570f5b57 Version bump to 2.81.15 2019-10-11 12:17:32 +02:00
057c180c67 Docs: 2.81 release description for Linux appdata 2019-10-11 12:13:26 +02:00
88ba97558f Depsgraph: Inform when update or tag happens during evaluation
It is not allowed to do tagging or updates while dependency graph is
in the middle of evaluation.

This is something what is simple to violate from python code. This
change adds some sanity checks.

The request to update view layer or dependency graph will raise an
exception in Python now, so it's easy for scripters to notice.

Tagging for update will do silent return unless running with debug
command line argument. This is because it's a bit tricky to know
which exact dependency graph corresponds to a context from which
an update tag was triggered.

Differential Revision: https://developer.blender.org/D6035
2019-10-11 10:42:45 +02:00
c9d6eb4fb4 Depsgraph: Cleanup, promote is_evaluating query
This way it might be used for sanity checks in RNA API as well.
2019-10-11 10:42:45 +02:00
f9b7f3e930 Depsgraph: Don't use push-from-thread when scheduling graph
This isn't guaranteed that graph is scheduled from main thread,
so it is actually a miracle how it all worked.
2019-10-11 10:42:45 +02:00
2251c6e046 Fix T70191: Text button in popup doesn't work
F2 rename didn't work with mouse input.
2019-10-11 19:36:51 +11:00
f9cc51788b Cleanup: remove unused variable 2019-10-11 01:31:28 +02:00
00b6f8ef90 Fix T70715: sculpt brush jitter after recent TBB changes
Fix error in the splitting constructor, and some refactoring.
2019-10-11 01:26:56 +02:00
Dalai Felinto
b8f769fee8 Fix T64901: Nesting collection instances could clutter object display 2019-10-10 17:49:46 -03:00
b50b91c25d Cleanup: Fix wrong assert introduced by rBd98ae27f02c7 2019-10-10 20:16:22 +02:00
02f3014ec6 GPencil: Change Paint cursor to DOT
After doing some test, the cross cursor is too intrusive when you are drawing in grease pencil, so we decided to change by Dot cursor.

Reviewers: @brecht @mendio @pepeland @pablovazquez @billreynish
2019-10-10 20:04:39 +02:00
91a26ee745 Fix build error on macOS after recent changes for file delete 2019-10-10 18:30:47 +02:00
f3d9ea0a8a Fix build error on Windows after recent changes 2019-10-10 18:04:40 +02:00
6c302d6529 Sculpt: use TBB instead of BLI_task for multithreading
This solves performance issues on some computers where there is significant
threading overhead. Rather than doing the complicated work of optimizing our
own task scheduler, use TBB which appears to work well. The downside is that
we have another thread pool, but it is already there when using OpenVDB voxel
remesh.

For future releases we can switch to using TBB to replace our task scheduler
implementation entirely, and use the same thread pool for BLI_task, Cycles,
Mantaflow, etc.

Differential Revision: https://developer.blender.org/D6030
2019-10-10 17:36:12 +02:00
86042b7ced Build: add WITH_TBB option, in preparation of sculpt using it
It should no longer be tied to OpenVDB and OpenImageDenoise then.

Differential Revision: https://developer.blender.org/D6029
2019-10-10 17:35:35 +02:00
Robert Guetzkow
8825250f5a File Browser: add back Delete, which now moves files to the trash
In Blender 2.7 delete would permanently delete files, now this function is back
but using more standard behavior.

This patch includes code contributed by Kris (Metricity).

Differential Revision: https://developer.blender.org/D4585
2019-10-10 17:30:57 +02:00
826db891ab Node Shader wrapper: add access to the Emission color of Principled BSDF node.
This did not exist when that wrapper was created, but is supported by
many formats, so worth supporting it now. See also T70666.
2019-10-10 17:21:06 +02:00
8ada685581 Fix T70644 EEVEE: Bump issue with geometry node normal coordinate
Was caused by non-normalized coordinates (normals). Note this is not 100%
correct as the dFdx functions can be the same for packs of 4 pixels and the
derivated value can only be correct for one pixels.

This is because smoothed normals are a non-linear function (because of the
normalization).

The correct fix would be to do the dFdx offset BEFORE any normalization.
2019-10-10 16:57:28 +02:00
eac0f35845 Fix T65134: Duplicated proxies in several scenes don't work
This is something which worked in Blender 2.79.
Need to do special trickery to ensure peoxy_from points to a
proper object.

Differential Revision: https://developer.blender.org/D6040
2019-10-10 16:13:54 +02:00
Julian Eisel
1857aa32bd UI: Only hide locked transform manipulator axes for matching spaces
The manipulator would hide axes that were locked, even if the lock was
applied to a different space. That would lead to confusing behavior of
the manipulator. E.g.:
* Add armature
* Enter Pose Mode and select the bone
* Lock X and Y location in the Sidebar
* Enable the Move tool
* Only the Y axis is visible, but doesn't do anything on dragging
The manipulator would only show the Y axes, even though the lock is
applied to the bone's local Y axis, which matches the manipulators Z
axis.

Differential Revision: D6021

Reviewed by: Brecht van Lommel, William Reynish
2019-10-10 15:17:08 +02:00
Julian Eisel
cf192bdd43 Fix missing manipulator update when toggling bone lock 2019-10-10 15:08:35 +02:00
Julian Eisel
7c88d84515 Fix: Manipulator visible if root or tip of locked bone is selected
When an edit-bone was locked, we hid the transform manipulator for it.
But only if the bone itself was selected, not when the root or tip were
selected, even though they are locked then too. So this makes sure the
manipulator is shown in neither case.
2019-10-10 15:06:11 +02:00
e15ab630c6 Added little explanation of eModifierTypeType_(Non)Constructive
Thanks to @campbellbarton for the explanation.
2019-10-10 13:25:54 +02:00
35c707684b CMake: Allow to use pre-compiled CentOS libraries
The goal is to make it able to use pre-compiled CentOS libraries on a
more modern system. Main issue was that it's possible that the compiler
on a newer version is defaulting to different C++11 ABI.

This change makes it so that if there is NO native libraries in the
lib folder and there IS pre-compiled CentOS folder, it will be used and
compiler will be forced to old ABI.

Differential Revision: https://developer.blender.org/D6031
2019-10-10 10:39:53 +02:00
Antonio Vazquez
ea1174bde9 Annotations: Use flag to determine if the layer is a Ruler
Proposed fix for T70141.

Before, the ruler was using the name of the layer as key, but this is very weak because if the layer name changes, the layer gets an annotation layer.

Now, the layer is marked using a flag and now it's possible to rename it.

Reviewed By: dfelinto

Differential Revision: https://developer.blender.org/D6028
2019-10-10 08:13:32 +02:00
7e020e70d9 Fix T70691: Crash picking object from eyedropper
Caused by 828905190e
2019-10-10 16:41:34 +11:00
b548b3d57e Fix crash versioning file-selector tool region
Loading the file from T69967 was crashing.
2019-10-10 13:55:00 +11:00
3c5bf7d1dc PyAPI: update for change in tessellate_polygon 2019-10-10 11:30:50 +11:00
5910f9f9e9 Fix T70617: mesh.from_pydata() misses first edge if there are faces 2019-10-10 11:16:51 +11:00
dc2cd2d0dc Cleanup: clang-format, spelling 2019-10-10 10:29:50 +11:00
f61a8a2abd Fix T70614 EEVEE: Bump with texture connected to other branches don't work
Was caused by the bump node not being evaluated because the other branch
was evaluated before.

To fix this, we use fromnode instead of tonode.

Also we fix a potential issue with recursiveness because
ntree_shader_copy_branch() also use nodeChainIterBackwards() which would
reset the iter_flag in the middle of the parent iteration. Use iter_flag
as a bitflag for each iteration to fix this.
2019-10-10 00:31:47 +02:00
8163fda9fb Fix T70609 EEVEE: Shader using lots of nodegroups are slow to update 2019-10-09 23:47:56 +02:00
9bd62379d6 Fix T70659 Warning, Regression, slow vertex selection
This changes the fix for T70302 by reducing the number of things we discard.
2019-10-09 23:47:56 +02:00
fb46d273f8 Fix "make update" not working on buildbot after recent changes
The submodules don't have remote branches configured, skip that test since
we assume pulling from the "origin" remote anyway.
2019-10-09 21:48:43 +02:00
d95bb087d0 Sculpt: Fix wireframe drawing
With this commit sculpt mode draws the real mesh wireframe instead of the
triangulated version by ignoring non real edges when building the PBVH GPU buffers

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6032
2019-10-09 21:23:11 +02:00
e846852862 Fix T70596: Wrong default scale value for node wrapper tool.
This affected all exporter add-ons using that wrapper to handle the node
shaders... sigh...
2019-10-09 20:33:22 +02:00
bbd6ebf423 Fix T70677: Annotation converted to grease pencil remains unselectable
The problem was the new object was created byt the tag for update objects in depsgraph was not tagged.
2019-10-09 19:09:01 +02:00
b8e34355c1 GPU: Consider softpipe as software renderer 2019-10-09 16:47:16 +02:00
bc6f439e94 CUDA Wrangler: Fix strict compiler warning
Namely addresses -Wstringop-truncation

Not sure if there is anything to be done for strncpy.

Differential Revision: https://developer.blender.org/D6006
2019-10-09 16:27:27 +02:00
a630e46a58 Fix T70544: Mesh extracted from Mask crash Blender when using Dyntopo
This commit fixes an assert in mesh_runtime_check_normals_valid

Reviewed By: jbakker

Maniphest Tasks: T70544

Differential Revision: https://developer.blender.org/D6013
2019-10-09 16:20:03 +02:00
e79fc33fda Fix multires cursor not displaying the active vertex
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6026
2019-10-09 15:47:37 +02:00
06c5520bda Fix T70554: Snake Hook + Ctrl does not set the brush stroke in its normal direction
This commit also fixes the same issue in elastic deform

Reviewed By: jbakker

Maniphest Tasks: T70554

Differential Revision: https://developer.blender.org/D6014
2019-10-09 15:44:56 +02:00
ec9044e2b2 Fix Delaunay 2d valid bmesh mode bug.
Wasn't checking for repeated vertices.
Also, made choices of edges to keep more aesthetically pleasing.
2019-10-09 09:26:55 -04:00
7e7b205137 Build: prepare "make update" to work for new release cycle branching
Checking out release branches in submodules, and printing some more
informative messages when that fails.
2019-10-09 15:09:53 +02:00
6c9178b183 Fix T61432: Sampling Subframes not working 2.8
Uncommented subframe logic and added correct time getter function (with subframe part in frame) to subframe update function
2019-10-09 15:00:25 +02:00
4aabea8b87 Fix T70640 EEVEE: Alpha hashed material is darker when alpha is not 1.0
Predivide all radiance components as the alpha effect comes from the hashed
transparency (pixel rejection).
2019-10-09 14:56:21 +02:00
7790298f61 GPU: show one-time startup warnings for old Intel drivers with known issues
This is pretty conservative. We do not show warnings for e.g. HD 4000 with the
latest drivers as they appear to be working mostly fine even if unsupported,
and there is nothing the user can do to improve things.

Ref T70520
2019-10-09 13:41:26 +02:00
cf682b9dab GPU: show more descriptive labels on unsupported GPU dialog
Thanks to Ray Molenkamp for the help with the Windows implementation.

Fixes T70521

Differential Revision: https://developer.blender.org/D6023
2019-10-09 13:41:26 +02:00
26b1216629 CMake: Move software-gl to generic install procedure
Removes custom logic from buildbot's packing step.

This also removes icons/ folder, but CMake was already copying the
icons to the root of the install folder.
2019-10-09 13:07:40 +02:00
e0231b14d5 Deps: Fix wrong LLVM prefix used for Mesa
It made it Mesa to be compiled with swrast rather than with llvmpipe.
2019-10-09 12:51:31 +02:00
decdd70dfd Deps: Add libraries needed for Software GL
Only compiled on Linux.
2019-10-09 12:37:04 +02:00
0ae6a8570b Cleanup: typo, style 2019-10-09 20:14:29 +11:00
22996f3dbe Fix make deps libtool detection on macOS 2019-10-09 10:54:55 +02:00
2fd2bced56 Buildbot: Correction to previous commit
Off-by-one calculating parent folders.
2019-10-09 10:37:09 +02:00
06ff734d48 Buildbot: Attempt to point precompiled libraries to a correct folder
The CMAKE_SOURCES variable is not yet initialized when the buildbot
configuration is read. This is similar to the include of full release
configuration happening earlier in the file.
2019-10-09 10:34:12 +02:00
62a7e8d429 Buildbot: Point to pre-compiled CentOS 7 libraries 2019-10-09 09:50:58 +02:00
40a55be82c Buildbot: Checkout precomiled CentOS libraries 2019-10-09 09:42:42 +02:00
340b9c1dfc Fix missing clear of ID types tags
Got lost in previous optimization commit.
2019-10-09 09:38:56 +02:00
d3d6cd2e09 PyAPI: drop Vector requirement for tessellate_polygon
Use mathutils_array_parse which converts any sequence of numbers.
2019-10-09 17:28:49 +11:00
6ff60d9982 PyAPI: avoid normal calculation for tessellate_polygon
Use fixed normal for 2D input, no need to calculate it.
2019-10-09 17:08:51 +11:00
b718d659c9 Fix T70594: mathutils.geometry.tessellate_polygon flips triangles
Some scripts will need to be updated to support this.
2019-10-09 16:56:54 +11:00
95199dca1f Fix T70662: Batch rename adds "\" before "." 2019-10-09 15:13:58 +11:00
d77afcffa3 UI: hide text character options when out of edit-mode
These are overwritten when entering edit-mode so there is no use
in showing them in object mode.

Addresses T70566
2019-10-09 13:55:09 +11:00
8f210f0475 Fix text edit-mode character info initialization
Using EditFont.pos before it was set.
2019-10-09 13:52:30 +11:00
7468227aea Docs: clarify Mesh.from_pydata edges argument usage
Addresses T70617
2019-10-09 12:12:53 +11:00
Dalai Felinto
0812949bbc Local Collections: Allow users to show hidden collections
Users now can turn on in a viewport collections that are temporarily
hidden (eye) in the view layer.

Design task: T61327

As for the implementation, I had to decouple the visibility in the
depsgraph from the visibility in the view layer.

Also there is a "bug" that in a way was there before which is some
operators (e.g., writing a text inside of a text object, tab into edit
mode) run regardless of the visibility of the active object. The bug was
present already (with object type visibility restriction) in 2.80 so if
we decide to tackle it, can be done separately (I have a patch for it
though P1132).

Reviewed by: brecht (thank you)

Differential Revision: D5992
2019-10-08 19:16:05 -03:00
Richard Antalik
6d3c34fe9d Fix T69682: Render Audio ignores animation.
`sound_update_animation_flags_exec` didn't tag depsgraph to update.

Reviewed By: sergey

Maniphest Tasks: T69682

Differential Revision: https://developer.blender.org/D6000
2019-10-08 13:10:37 -07:00
234f346c2f Fix T70601: Lasso select not functioning correctly in Armature Edit Mode
This solution mimics the one used for pose by ignoring the bone line if either end is clipped.
2019-10-08 16:45:32 -03:00
576c782b11 Fix T70586 EEVEE: principled shader alpha bleeding issues
Avoid double multiplication by alpha on ssr/sss data.
2019-10-08 20:29:35 +02:00
47b95a2957 Fix T70561: bad custom normals in mirrored geometry.
Original code from rB1a9e698099b5 used a rather naive approach, now use
proper transpose of inverse of geometry transform for the normals.
2019-10-08 20:19:13 +02:00
d98ae27f02 Fix T68857 EditUV: Crash on Remesh modifier with 'Display in Edit Mode' 2019-10-08 18:42:26 +02:00
656228945e Fix T69363 EEVEE: Blender crash when using Edit mode for Ocean
Use same Mesh* as extraction. We always use the final mesh for shaded geom.
2019-10-08 18:37:38 +02:00
ed9f8bd956 CTest: Fix failing test BLI_expr_pylike_eval_test on clang/windows
clang got a little to aggressive discarding unused variables
see D6012 for details.

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

Reviewers: brecht, sergey, angavrilov
2019-10-08 09:46:09 -06:00
10ec207a6b Sculpt: support automasking, pose and mask expand for multires
These were the last remaining new sculpt tools that did not support multires.
Performance could be improved still, but it should work.

Fixes T68899
2019-10-08 17:44:46 +02:00
52c02dc311 Fix multires sculpt not setting the active vertex correctly
Also cleanup code to remove duplicated min_depth tracking, ray intersection
already does it.
2019-10-08 17:41:52 +02:00
899b7ff1de Cleanup: avoid converting from CCGElem to SubdivCCGCoord
The other direction is faster.
2019-10-08 17:41:52 +02:00
333293cad7 Cleanup: minor refactoring of mask expand and floodfill 2019-10-08 17:41:52 +02:00
7a1847f0e9 Fix T70585: Walk Navigation keyframe tweaks (still frame)
Walk Navigation was missing rotation keyframes on confirm (when animation
wasnt playing) after rB22bdd08dfd0.

Because for walk [in contrast to fly], the cursor is constantly warped
(WM_cursor_warp in walkEvent), we cant do something reasonable with
comparing mouse positions (to detect rotation) when mouse comes to rest.

Now remember if rotation changed at any time.

Also tweaked the insertion for location keyframes (which was always
happening even if the camera did not move), now checking the real dvec
(instead on relying on speed)

Reviewed By: dfelinto

Maniphest Tasks: T70585

Differential Revision: https://developer.blender.org/D6018
2019-10-08 16:26:37 +02:00
054ab92f8b Depsgraph: Avoid threading for trivial operations
Found this while looking into T70463, solves the high spinning times
mentioned in T70463#791026.

Sounds logical that iterating over an array to modify a single property
is faster than doing it in threads. But strangely, doing it for both
nodes and its components is still faster in threads here.

Gives extra speedup with a file mentioned in the report.

Reviewed By: brecht, mont29

Differential Revision: https://developer.blender.org/D6017
2019-10-08 16:06:46 +02:00
abc36cad83 Sculpt: Fix projection artifacts by changing the voxel remesh isovalue
This should fix most of the shrinkwrap artifacts when the preserve volume option is active. After this commit the default voxel remehser settings should not fail in the default cube.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D6010
2019-10-08 15:58:16 +02:00
31a4566685 Fix "make update" error with old git versions, for the buildbot
Just skip convenience test that checks if a rebase/merge is in progress.
2019-10-08 15:13:33 +02:00
df08fcebe8 Cleanup/fix for fix (c).
Sorry for the noise... For once building with everything hid the issue
instead of revealing it.
2019-10-08 14:45:50 +02:00
0b983169da Fix T70626: VSE: Slip Strip Operator doesn't refresh audio on confirm
Maniphest Tasks: T70626

Reviewed By: ISS, sergey

Differential Revision: https://developer.blender.org/D6016
2019-10-08 14:16:48 +02:00
Dalai Felinto
1ba4e472cd Fix build error (missing BKE_global.h) 2019-10-08 09:16:19 -03:00
270562fe12 Fix T70588: Playing animation (after deleting rigid body obj) crashes blender.
Fixing/working around another weakness of current RBW model... This is
not really nice, but it should work for now, and we cannot really do
anything else but that kind of monkey patching here anyway.
2019-10-08 11:53:44 +02:00
Julian Eisel
b1f1c8c33f Fix: region toggle operator being able to toggle regions it shouldn't
Only regions with alignment set should be toggle-able. If this is not
set, then the region is likely either a main region, or entirely hidden
by the user (not just collapsed).
2019-10-08 11:35:24 +02:00
ad876e728c Depsgraph: Cleanup, spelling in comment 2019-10-08 11:12:30 +02:00
9d13321831 Depsgraph: Perform early exit check prior to time tag
Evaluation is not entirely cheap even in the case when there is nothing tagged
in the scene. This is because of all the calculation of pending operations,
cleating runtime flags and so on.

This commit makes it so time operation is tagged for update prior to early exit
check. Improves playback speed in a scene without anything animated.

Maniphest Tasks: T70463

Differential Revision: https://developer.blender.org/D6002
2019-10-08 11:02:22 +02:00
fda1db5ba4 Depsgraph: Cleanup, de-duplicate time source tagging 2019-10-08 11:02:22 +02:00
ae777b0764 Depsgraph: Don't force time update when legacy flag 0 is used 2019-10-08 11:02:22 +02:00
Julian Eisel
95749f5d54 Fix T70522: Sidebars in Clip Editor work incorrectly in Dopesheet mode
Actually, in Dopesheet mode, the regions shouldn't be toggle-able at
all. For the user they should appear to not exist.
Previously the Movie Clip Editor archieved this by setting the region
alignments to NONE, which this restores.

Introduced in 6aef124e7d.
2019-10-08 10:33:48 +02:00
7f52eb287c Keymap: use right mouse for console context menu
Was using 'w' which doesn't work with text entry.
This matches the text editor.
2019-10-08 14:33:50 +11:00
f9a266a226 UI: support passing a function to WorkSpace.status_text_set()
This allows Python operators to draw icons and other UI elements
into the status bar.
2019-10-08 14:21:41 +11:00
a856c5eccf Fix T67753 EEVEE: Crash using transparent shadows with default material 2019-10-07 22:16:53 +02:00
da9ac42588 Cleanup: Change comment 2019-10-07 20:44:55 +02:00
b403b8196b Fix T70610: GPencil Remove Vertex Group don't reassign other groups
When removing a vertex group, the next groups were not reassigned because the loop upper limit was wrong.
2019-10-07 20:40:03 +02:00
Julian Eisel
7dea058546 UI: Move all Selected NLA-Strips when Dragging
Part of T57918. Selecting and dragging items were conflicting actions
previously when both were using the same mouse button. This avoids the
conflict.

See be2cd4bb53 for details on behavior.
2019-10-07 20:34:15 +02:00
ce22efb425 Paint: 2D paint brush stroke antialiasing
This commit enables antialiasing in 2D painting.
It also includes some fixes related to line drawing in the stroke spacing code.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5833
2019-10-07 19:47:40 +02:00
dccdc5df10 Fix T69933: Blender 2.81 doesn't import 2.80 preferences from quick setup screen 2019-10-07 19:41:58 +02:00
Ulysse Martin
e284654fbf Fix T70537: Documentation: bpygpu_offscreen_draw_view3d_doc not up to date 2019-10-07 14:39:27 -03:00
e5858cc5be Fix T70302 Crash on entering solid view after some specific steps 2019-10-07 19:22:41 +02:00
d2e4b13b9c CMake: Add support for building with OpenMP support for clang on windows.
mostly minor c/cxx/linker flags, only tested with clang 9.0.0

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

Reviewers: brecht, jesterking
2019-10-07 10:24:13 -06:00
fc9e921495 Simplify the quadriflow manifold mesh function for loops
No need to iterate over all polygons if we just want to iterate over all
face loops anyways.
2019-10-07 18:14:30 +02:00
0c0d2f3581 Fix T70406: crash editing keyframes while in sculpt mode 2019-10-07 18:04:35 +02:00
b91290fd2a Fix T70591: missing letters in statusbar keymap display after recent changes 2019-10-07 17:55:14 +02:00
d7465c23c7 Fix T70564: sculpt mask display missing with shape keys or deforming modifiers 2019-10-07 17:38:07 +02:00
e00a00db52 Cleanup: rename some sculpt variables for clarity 2019-10-07 17:38:07 +02:00
ad84f22628 Fix T70602: error baking with Cycles OpenCL after recent changes 2019-10-07 16:53:46 +02:00
78c0be9987 Fix T70452: Crash when clicking "Solve Camera Motion" in Motion Tracking 2019-10-07 15:41:52 +02:00
525a8bdf1d Sculpt/Paint: Invert curve alpha overlay
Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D5998
2019-10-07 15:26:05 +02:00
afb9bdc320 Sculpt: Update only modified grids on multires undo
This makes multires undo much faster and fixes the viewport lag after and undo operation.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5994
2019-10-07 15:24:25 +02:00
29707e3437 Fix T70387: Sculpting with Original Normal rips edges
Reviewed By: brecht

Maniphest Tasks: T70387

Differential Revision: https://developer.blender.org/D5982
2019-10-07 15:22:32 +02:00
4761028fc7 Fix T70508: Wrong snapping default in Node Editor 2019-10-07 10:02:12 -03:00
7a100a3f60 Fix T70555: Crash when attempting to create an override for an object with a cloth modifier.
Was not taking into account the case where pointer RNA prop is valid,
but has no data (i.e. is a 'null' pointer)...
2019-10-07 13:17:56 +02:00
2cb5078ce2 Update NUMA API library to latest version
Brings support of PPC and S390 platforms, which are required to have
Blender compiled on all ports of Debian.
2019-10-07 12:59:51 +02:00
cc1614123e Fix T70476: Sculpting with Subsurf on top produces artifacts
The issue was caused by crazy space distortion orientation happening
for subsurf modifier.

Solved by making it so subsurf only deforms the surface but keeps
matrices as-is. This is not fully mathematically correct, but is better
that the fall-back solution which was doing wrong matrices anyway.
Also, this is closer to have subsurf was handled prior to the
related changes.

Reviewed By: brecht, pablodp606

Differential Revision: https://developer.blender.org/D5991
2019-10-07 12:43:57 +02:00
d4c452ff39 Fix T70573: Crash on enter Cycles render preview with 'Scene world'
disabled and no world assigned to scene

BlenderSync::sync_world still relied on a blender world (mixes the world
viewport color with the studio light), for now just take black if no
world is present.

Maybe we should we use the theme color in the future here (seems eevee
does this in that case) -- we'd have to pass down `b_userpref` from
`BlenderSession::render` down to `sync_data > sync_shaders > sync_world`
then afaics.

Reviewed By: jbakker, brecht

Maniphest Tasks: T70573

Differential Revision: https://developer.blender.org/D6005
2019-10-07 12:26:25 +02:00
60f0a94ab2 Cleanup: clang-format 2019-10-07 15:22:22 +11:00
805ba9fc81 CMake: add GCC 9.2 -Wabsolute-value warning 2019-10-07 12:22:05 +11:00
fae0685113 Cleanup: quiet warnings 2019-10-07 12:22:05 +11:00
54a9649e26 Fix T70582: Gpencil crash when use Shift+Alt+LMB
This keymap was the old polygon mode for old grease pencil and now this have been replaced with Line tool. As this code was not ready for this keymap, the code gets out of control and fails. The solution is to remove this deprecated keymap.
2019-10-06 16:05:42 +02:00
4707f1982d Fix T70568, T70570: wrong AMD driver warning dialog
Remove this entry for now until we have more carefully verified the list.
2019-10-05 22:51:59 +02:00
0905af68ec Fix T70539: file folder color preference not saved
Please always bump the subversion for cases like this.
2019-10-05 22:51:59 +02:00
a498a5494c UI: Split sculpt mask operators into own menu
Differential Revision: https://developer.blender.org/D5997

Reviewers: Brecht van Lommel, Pablo Dobarro
2019-10-05 22:17:22 +02:00
Jeroen Bakker
0bdf4e2f2d Show Background Image Beneath Transparent Objects (Cycles only)
Camera background images were not shown under transparent objects.
This patch performs an alpha under for background images for cycles.

In order to see the difference the Film transparency needs to be turned on.

Note that workbench and EEVEE still needs to be adapted as they don't
write store alpha value in the viewport.

Side note. This implementation is already an improvement of the current behavior, what users are requesting. (Show background images underneath cycles viewport rendering.) It is clear that this patch still needs to be extended to workbench and eevee. For now that should be marked as a known limitation.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5437
2019-10-05 17:18:53 +02:00
629a1c1639 Fix T70418: Text Underline stays Flat on TextCurve Extrude
Underline was implemented in rBa07394ef2cfd.
It seems that the extrude feature never worked.

Ref T70418

Reviewed By: mont29

Maniphest Tasks: T70418

Differential Revision: https://developer.blender.org/D5972
2019-10-05 11:35:57 -03:00
ab519b91b2 Make this link again; needs more work for orbis to work. 2019-10-04 18:33:20 -04:00
1f6a34161d make_deps: Fix building ffmpeg on windows
I have no explanation on why this is needed, but it refused to
find opus without it.
2019-10-04 14:09:50 -06:00
7c2affd350 Fix: Headless build 2019-10-04 13:23:26 -06:00
Dalai Felinto
5287eaac5b Small cleanup 2019-10-04 14:11:13 -03:00
f35bfbb25e Sculpt: mesh filter, mask filter and dirty mask now work with multires
Thanks to Sergey's neighbor access functions.

Mesh filter still needs some improvements to handle open boundaries better.
2019-10-04 19:01:03 +02:00
8f1f756b83 Subdiv CCG: add utility functions for accessing multires vertex neighbors
This is to be used by the new sculpting tools.
2019-10-04 19:00:57 +02:00
bebdb6c824 Fix assert when deleting a RBW constraint object.
Side-reported in T70505.

Code did not ensure deleted object was removed from the RBW constraints
collection, leading to some invalid status (object in constraints
collection but without relevant contraints data).

Also fixed another issue - code deleting RBW objects would try to remove
any constraint one using it as target, in a very bad and broken way,
since you cannot iterate over objects of a collection while removing
some... Now instead just NULLify relevant pointers... I hope it works,
otherwise we'll have to take a different approach.

Needless to stress again how weak the whole RBW code is in general, and
regarding same object being used by RBW in more than one scene in particular,
that is known broken situation anyway.
2019-10-04 18:57:14 +02:00
3c14628381 Cleanup: make context menu last in keymaps 2019-10-05 02:45:37 +10:00
fc517cb079 Cleanup: formatting for text highlighter 2019-10-05 02:43:03 +10:00
dfcda05242 Fix T70467: large cursors option on Linux not showing clear crosshair
Not a great solution, but reverting back to what we had before the recent
changes for this specific case.
2019-10-04 18:02:55 +02:00
Julian Eisel
db66c33efe Fix T70462: Shift+Click on neighbour folder enters it
In fact, the operator implementation seems to have some issues, which is
why this behaved so glitchy. But for properly set up keymaps it should
work fine.
2019-10-04 17:28:45 +02:00
1fa56e72ec Fixed copy-paste error in install_deps.sh 2019-10-04 17:11:23 +02:00
Pedro Reis
eeba31e2ca Fix T69910: crash when using a hotkey for a new or open recent file
Differential Revision: https://developer.blender.org/D5839
2019-10-04 16:57:48 +02:00
Julian Eisel
809ab298f1 UI: Move all Selected Markers when Dragging
Part of T57918. Selecting and dragging items were conflicting actions
previously when both were using the same mouse button. This avoids the
conflict.

See 056fcdfe7bbed3 for details on behavior.
2019-10-04 16:46:32 +02:00
Julian Eisel
d4d036ae14 UI: Move all Selected Dopesheet Keys when Dragging
Part of T57918. Selecting and dragging items were conflicting actions
previously when both were using the same mouse button. This avoids the
conflict.

See 056fcdfe7bbed3 for details on behavior.
2019-10-04 16:46:32 +02:00
Julian Eisel
1f5ae1a5a5 UI: Move all Selected Strips and Strip Handles when Dragging
Part of T57918. Selecting and dragging items were previously conflicting
actions when both were using the same mouse button. This avoids the
conflict.

See 056fcdfe7bbed3 for details on behavior.
2019-10-04 16:46:32 +02:00
Julian Eisel
5f51e78172 Node Editor: Use new operator utilities for node selection and dragging
Previous commit moved most of this code into more general/generic
utility functions, so we can use that in the Node Editor now.
2019-10-04 16:46:32 +02:00
Julian Eisel
be2cd4bb53 WM: Utilities for select operators to work with click-dragging items
Based on work by Bastien and Brecht in the Node Editor, this adds more
generalized support for selecting items so that click+drag actions on
items (nodes, makers, dopesheet keys, etc.) works as wanted.
Note that this only adds the barebones to support this in other editors,
it's not used yet (will be done in followup commits).

The behavior is supposed to work as follows:
* Clicking an unselected item immediately selects it, and deselects
  other items (doesn't wait for release events).
* Click+drag on an unselected item immediately selects it, deselects
  others and drags it in one go (don't require selecting it first!).
* Click+drag on a selected item won't change the selection state (and
  won't send an undo push) and start dragging all selected items as soon
  as the drag event is recognized.
* Clicking on a selected item will still deselect others, but that will
  only happen on mouse release, when we know the intention is not to drag
  the item.

Included in: https://developer.blender.org/D5979

Reviewed by: Brecht van Lommel, William Reynish
2019-10-04 16:46:32 +02:00
0bcada85b3 Fix T67212: No smooth blending in "Push Pose from Breakdown" and "Relax Pose to Breakdown"
The previous method produced non smooth interpolation results and it was
very hard to control. (At least for me it seemed to be broken until I
actually took a look at what the code actually did)

Now we simply linearly interpolate between the breakdown position and
the current bone data.

Reviewed By: Sybren, Hjalti

Differential Revision: http://developer.blender.org/D5892
2019-10-04 16:40:09 +02:00
b9736e8e12 Add Opus audio library and configure FFmpeg to use it
Opus support was enabled in 2ddfd51810. This commit adds the Opus
library and configures FFmpeg to be compiled with Opus support.

NOTE: It may be required to run `cmake -U '*FFMPEG_LIBRARIES*' .` in
your Blender build directory in order to refresh the `FFMPEG_LIBRARIES`
setting and add libopus.
2019-10-04 16:30:01 +02:00
6d8c053187 Fix T70514: VP9 not working
This issue was two-fold:

- In the VPX library build script: missing `--enable-vp8` and
  `--enable-vp9` meant that the choice to enable these codecs or not was
  left to the library's `configure` script, rather than an explicit choice.
  On the build-bot it chose to not enable them.
- Missing pkgconfig paths passed to the FFmpeg build script

Thanks @brecht for helping out.
2019-10-04 16:30:01 +02:00
663d23dd9d Fix T70463 GPU: Very Slow Workbench/Eevee Performance 2019-10-04 16:29:51 +02:00
56dd7feb06 GPU: Platform Support Level
Adds a check when starting blender if your platform is supported. We use a blacklist
as drivers are updated more regular then blender (stable releases).

The mechanism detects if the support level changed or has been validated by the user previously.
Changes can happen due to users updating their drivers, but also when we change the support
level in our code base.

When the user has seen the limited support level message it is saved in the user config.
It would be better to have a system specific config section, but currently not clear
what could benefit from that.

When the platform is unsupported or has limited support a dialog box will appear including a link
to our user manual describing what to do.

**Windows**
Windows uses the MessageBox that is provided by the windows kernel.

**X11**
We use a very lowlevel messagebox for X11. It is very limited in use and can be fine tuned when needed.

**SDL/APPLE**
There is no implementation for SDL or APPLE at this moment as the platform support feature targets mostly Windows users.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5955
2019-10-04 16:23:39 +02:00
OmarSquircleArt
45745f7862 Fix: Gain socket is not available in ridged multifractal.
The gain socket in the Musgrave node should be available in the ridged
multifractal mode. The logic for the availability was incorrect.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5989
2019-10-04 16:07:28 +02:00
295f888433 Fix T70504: Moving nodes in the node editor stops after hotkey is lifted
This basically reverts 540eb2dc1e for an alternative solution that
only enforforces release_confirm [ignoring the preference] on mouse for
the node editor.

Approved by @brecht in T70504.
2019-10-04 15:55:08 +02:00
40492251f2 Fix T70454: Environment Texture Node Properties "reload" and "packing" not working
The bug was basically just caused by a missing 'edit_image' and
'edit_image_user' pointer in context for
'node_shader_buts_tex_environment_ex'.
So adding the following there would be enough to fix the bug:
uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
uiLayoutSetContextPointer(layout, "edit_image_user", &iuserptr);

However, I would suggest using the full-flegged uiTemplateImage (just as
'node_shader_buts_tex_image_ex' does -- instead of a "handmade" subset)
for the following consistency reasons:
- Layout was using single column for image textures, but not environment
textures
- Save / Discard feature on editing the image was there for image
textures, but not environment textures
- Environment textures: Color Space was displayed on node (but not
properties)
- Environment textures: Animation / Sequence settings were displayed on
node (but not properties)

Cant think of a reason for _not_ displaying the whole set for
environment textures (just as for regular image textures)?

Maniphest Tasks: T70454

Differential Revision: https://developer.blender.org/D5988
2019-10-04 15:31:54 +02:00
d590db8370 Sculpt: Clay Strips brush tweaks
- Fix accumulate by allowing normal radius greater than one. Now it works as it should and it should be enabled by default
- Make the square test sharper. This gives a lot more definition to the brush, even when working with fewer polygons

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5984
2019-10-04 15:28:00 +02:00
2b55a1da50 Fix T70499: Can't change Brush Texture Rotation without holding the Shift key.
Reviewed By: brecht

Maniphest Tasks: T70499

Differential Revision: https://developer.blender.org/D5985
2019-10-04 15:24:40 +02:00
OmarSquircleArt
8afa93d82d Fix: Clamping in Map Range node works incorrectly.
The clamp option in the Map Range node doesn't work correctly when the
inputs are linked. The code didn't put that into considration.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5987
2019-10-04 15:21:46 +02:00
f025b625f4 Fix T70095: Quadriflow crash running on a messy mesh
Quadriflow does not support non manifold meshes. (Edges with > 3
connected faces and discontinuous face normal directions)

While it does sometimes "work" in these configurations, the results are
not good and in most cases it just flat out will crash.

Added a sanity check to make sure that the input mesh is manifold.

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5877
2019-10-04 14:25:34 +02:00
19b0f69009 Fix T70481: Segfault printing 'private data' evaluated IDs.
This commit solves the bug itself (code was broken when real_id owner of
the private data ID could not be found), and generates a more sensible
representation for all evaluated IDs, makes no sense to display them as
being part of `bpy.data....`!
2019-10-04 12:27:10 +02:00
ba10cd4922 LibOverride: Fix last main issue with overriding custom properties.
Now, custom props defined as overriddable can be overridden, saved,
reloaded, etc. That fixes the last main issue with them.

Note that custom props still have a lot of glitches and weirdness in
their overriding behavior, but for now the most important is finally
achieved, will let them rest and settle a bit, those have been
incredibly painful to tame... :(
2019-10-04 12:27:10 +02:00
837653d735 LibOverride: Fix bad handling of 'store' callback in IDProps case.
We need same kind of default handling for IDProps as we already have for
the diff callback.
2019-10-04 12:27:10 +02:00
03bf290eae GPencil: Reduce VBO memory footprint when using modifiers
Before, the modifiers were evaluated in Draw Engine and this required to calculate a factor to increase the VBO size.

Now, the modifiers are evaluated in Depsgraph and the Draw Engine receives the evaluated stroke with the final number of vertices. As the number of vertices is the final value already, if Draw Manager increases the number with the modifiers only increases the memory with empty space because never would be used. This commit removes this double calculation, reducing the memory usage and removes a loop to calculate the size by modifier too.

Also, the function getDuplicationFactor() has been removed because is not required anymore.
2019-10-04 10:20:15 +02:00
fbc096cf07 Fix expanding paths ignoring data-block libraries
- Image views.
- Sequencer text strip font.
- Text check for modified/reload.
- Collada image export.
- Brush icons.
2019-10-04 07:03:53 +10:00
Kai Jægersen
8096190d11 Text: make selection and cursor editable from RNA 2019-10-04 06:31:32 +10:00
e54747a18c Correct error in last commit 2019-10-04 06:12:27 +10:00
Kai Jægersen
d289a2d4a9 Text: add Text.cursor_set(...)
Place the cursor, optionally set selection.
2019-10-04 06:10:43 +10:00
Kai Jægersen
bf2d92b277 Text: add Text.select_set(...)
Support setting the selection for a text buffer
with support for negative indices, select_set(1, 1, -1, -1)
selects the entire buffer.
2019-10-04 06:00:08 +10:00
2ba8adca4f CMake: quiet warning in quad reflow 2019-10-04 06:00:08 +10:00
6ac2a2061f Fix: Unit tests on windows.
Problem was twofold

1) `GENERATOR_IS_MULTI_CONFIG` is a property not a variable so
the test for it would always be false, unless you set a custom
CMAKE_INSTALL_PREFIX (like the buildbot does) the unit tests
would have a wrong working directory and complain about missing
dlls or blender executable

2) Tests added outside of `/test` (like libmv) would have no working
folder set since the variable would not be visible for them.

consulted @sergey who voiced the opinion that duplicating the code
to the test macro was slightly less evil than moving it to the main
CMakeLists.txt
2019-10-03 11:34:04 -06:00
79ca5ad368 Fix T70484: GPencil particles crash when original stroke is hidden
Due the internal design of the drawing engine and the special requirements for 2D inside 3D, it's required to keep the original stroke visible in order to display the particles. If the original stroke is hidden, the particles are hidden too.

This commit only fix the segmentation fault. Make visible the particles when the original is hidden would require a complete redesign and maybe would break some 2D features.
2019-10-03 19:03:40 +02:00
Julian Eisel
edffb0e9b1 UI: Register File Browser as Child/Dialog-Window for the OS
For many users, this will make the File Browser window behave more like
what they would expect. It addresses the issue of the File Browser
becoming hidden behind the main window by clicking anywhere in the
latter. It communicates the interruptive, but temporary nature of the
operation a bit better.
Further, on tiling window managers the File Browser now opens as
floating by default, like in other applications.

Note that this also makes sure the File Browser is always opened as
separate window, so it doesn't re-use the Preferences, or any other
temporary window anymore. This seems to have been a common annoyance.

More concretely, this makes the File Browser window behave as follows:
* Stays on top of its parent Blender window, but not on top of
  non-Blender windows.
* Minimizes with its parent window
* Can be moved independently
* Doesn't add an own item in task bars
* Doesn't block other Blender windows (we may want to have this though)
* Opens as floating window for tiling window managers (e.g. i3wm/Sway)

Further notes:
* When opening a file browser from the Preference window (or any
  temporary window), the main window, as the file browsers parent is
  moved on top of the Preferences, which makes it seem like the
  Preferences were closed. This is the general issue of bad secondary
  window handling as window activation changes. I made it so that the
  window is moved back once the file browser is closed.
  This behavior is confusing and would be nice to avoid. It's a separate
  issue though.
* On most window managers on Linux the temporary window can not be
  minimized and maximized, they disable that for dialog windows.
* On Windows and macOS, only minimizing is disabled, as there is no
  decent way yet to restore a window if it's not shown in the taskbar.

Reviewed By: Brecht van Lommel, Campbell Barton, William Reynish
Edits and macOS implementation by Brecht.

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

Part of T69652.
2019-10-03 17:50:27 +02:00
35ae1da16c Mesh: simple extract mask optimizations
- Avoid per-vertex custom-data lookup
- Break once a face has a mask vertex.
2019-10-04 01:14:25 +10:00
1e273dbc3c Fix extract mask freed memory use & leak 2019-10-04 01:14:25 +10:00
67f9b94291 Fix sculpt normal update in SculptDraw brush
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5981
2019-10-03 16:57:27 +02:00
8c991bf63a UI: Add Buttons to Shader Editor Slots Popover
Assign, select, deselect buttons added when in edit mode to complete the functionality
of the shader editor vs. the properties panel.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D5768
2019-10-03 10:29:25 -04:00
a6ad80d9e8 Fix T70125: crash on startup in Linux with some tablet types connected 2019-10-03 15:36:50 +02:00
3bbe01dad3 Fix T70299: Grab brush not working as expected when Ctrl is press
Reviewed By: brecht

Maniphest Tasks: T70299

Differential Revision: https://developer.blender.org/D5920
2019-10-03 15:34:54 +02:00
ae7bea265d Fix T66312: Undo does not restore normals correctly in sculpt mode
Reviewed By: brecht

Maniphest Tasks: T66312

Differential Revision: https://developer.blender.org/D5895
2019-10-03 15:31:24 +02:00
6db6267d85 Sculpt: Disable remesh operators with Multires
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5964
2019-10-03 15:28:35 +02:00
d6c440bd7a Fix T69227: Ignore inbetween mouse events in Snake Hook
Reviewed By: brecht

Maniphest Tasks: T69227

Differential Revision: https://developer.blender.org/D5977
2019-10-03 15:26:50 +02:00
8a1f4fc8a7 Fix T70102: Mask Extract bad solution
Reviewed By: brecht

Maniphest Tasks: T70102

Differential Revision: https://developer.blender.org/D5978
2019-10-03 15:25:19 +02:00
11768d1c9f Fix T70466 Rendering error when drawing multi-material meshes 2019-10-03 14:44:43 +02:00
9a4042bed8 Subdiv CCG: Cleanup, remove unused data from adjacency storage
Makes it easier to initialze adjacency, avoid extra re-allocations during
initialization, reduces memory footprint.
2019-10-03 12:36:01 +02:00
0cc45eaac4 OpenSubdiv: Add accessor to vertex edges via refiner C-API 2019-10-03 12:36:01 +02:00
f6a90f018c i18n: Add Slovak language. 2019-10-03 11:11:37 +02:00
514c9d14e4 Fix T68945: VSE - Improper audio on frame 1
This has already been fixed in 8d207cdc3b
as fix for T52472: VSE Audio Volume not set immediately, but I failed to
backport it to upstream audaspace which is the reason the problem was
back.
2019-10-03 10:26:48 +02:00
Anthony Eriksson
4ccf02764c Fix T69216: "assert" not highlighted in text editor
Workaround limitations of formatting code by putting longest names first.

Differential Revision: https://developer.blender.org/D5613
2019-10-03 03:11:55 +02:00
540eb2dc1e Fix T69288: release confirms preference should not affect node editor
Was missing from new macro operators.
2019-10-03 03:11:55 +02:00
93e8c962fc Cleanup: unused structs, struct members 2019-10-03 07:39:45 +10:00
c07eaa3384 Cleanup: argument naming, redundant NULL checks 2019-10-03 07:32:28 +10:00
fcdd851858 Fix memory leak in loop-cut error case 2019-10-03 07:32:28 +10:00
d1d21dac51 Fix assert in image crop 2019-10-03 07:32:28 +10:00
6002e2f061 Fix incorrect flag check in gpencil subdiv modifier 2019-10-03 07:32:28 +10:00
14114b37e7 Fix pointer assignment 2019-10-03 07:32:28 +10:00
b87123cf2f Fix F-Key icon display 2019-10-03 07:32:28 +10:00
fb9024bded Fix error in opensubdiv topology refiner face matching check 2019-10-03 07:32:28 +10:00
Richard Antalik
2b29bf25fc Fix T69924: Prefetch stops when moving playhead
Fix T70194: Prefetch freezes Blender in some cases

- Initialize depsgraph in isolated bmain struct.
- Fix prefetching range (forgot in initial prefetch commit).
- Fix crash - Add check if prefetch job is initialized and running.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5899
2019-10-02 13:48:39 -07:00
aabd8701e9 Implement a user preference for the default Auto Handle Smoothing mode.
The default was changed with an initial implementation of the feature.

With the feedback from animators, having a behavior which affects curves
outside of a changing range is not convenient for professional animators
working on high quality character animation. On the other hand, automatic
smoothing is better for casual animation of object motion.

This change adds an ability to change the default via User Preferences.

Differential Revision: https://developer.blender.org/D5875
2019-10-02 20:42:37 +03:00
d1a1302b01 UI: add NLA track and channel theme color
Patch contributed by Paul (Thirio).

Differential Revision: https://developer.blender.org/D5967
2019-10-02 18:56:34 +02:00
03506ee4d1 UI: use consistent text box theme colors in search popups
This solves an issues where these text fields would use menu background colors,
making it difficult to create a correct theme.

Default theme looks the same, only Blender Light now shows a dark text field.

Patch contributed by Paul (Thirio).

Differential Revision: https://developer.blender.org/D5906
2019-10-02 18:56:32 +02:00
de4ebcbe43 Fix T70390: dyntopo smooth shading broken after recent changes
Made the code fully thread safe now.
2019-10-02 18:28:26 +02:00
a1f16ba67f Use PBVH_FullyMasked flag in mesh filter
We don't need to filter the fully masked nodes here after adding the flag

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5973
2019-10-02 16:58:53 +02:00
02ad256f9a Fix T70414 EEVEE: Crash with 2 viewports, UV edit and sync selection 2019-10-02 16:56:22 +02:00
3734ae5d54 Fix T70331 Node group passthrough is broken 2019-10-02 16:56:22 +02:00
f8f28dc784 Workaround for NVidia broken driver
This disable the indirect drawcall on all Nvidia hardware.

This has to be until nvidia fixes their drivers or instruct us
how to correctly fix the issue.

Related to T70011 Various display issues on NVIDIA
after draw call batching.
2019-10-02 16:56:22 +02:00
d596a6368c Preference: option to use OS-Key to emulate MMB
Alt-LMB is used in quite a few areas now, see T69323
using OS-Key allows these conflicts to be avoided.

Currently disabled for WIN32, since it conflicts with the start menu.
2019-10-03 00:25:06 +10:00
2e97d50d2d Fix T70409: Propagate Pose not updating correctly
The Action was changed without tagging it as such in the depsgraph.
Thanks @sergey for the sanity check!
2019-10-02 16:08:56 +02:00
3052229264 Fix T70358: Use face count in Quadriflow by default
Reviewed By: brecht

Maniphest Tasks: T70358

Differential Revision: https://developer.blender.org/D5958
2019-10-02 16:04:48 +02:00
606af693fb Fix T70310: Difficult to change brush size from big to small
Changing this values should only support horizontal movement as we are no longer trying to match the size of the cursor and the size of the circle preview in the widget.

Reviewed By: brecht

Maniphest Tasks: T70310

Differential Revision: https://developer.blender.org/D5931
2019-10-02 16:00:10 +02:00
29f25da769 Fix T70324: Layer Brush has bad behaviours and create artifacts
Reviewed By: brecht

Maniphest Tasks: T70324

Differential Revision: https://developer.blender.org/D5934
2019-10-02 15:58:35 +02:00
fb62c578bc Fix default cursor blue color
The previous one was too light

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D5959
2019-10-02 15:57:00 +02:00
ed59c32b0c Fix bug in nearest_vertex_get_finalize
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5965
2019-10-02 15:55:11 +02:00
Antonio Vazquez
ddd40985e7 Fix T70399: Grease Pencil Canvas Grid Overlay Broken after DRW refactor
Now the grid matrix is calculated when the shading group is created.

Also, the grid pass is only created when needed and reduce memory usage when the scene is not using grease pencil objects.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5966
2019-10-02 15:33:20 +02:00
31473070b3 Fix T70443: Crash on sculpting with 'Curve' Stroke Method
Caused by rBc31a849a1474.

Reviewed By: brecht

Maniphest Tasks: T70443

Differential Revision: https://developer.blender.org/D5970
2019-10-02 14:59:11 +02:00
6b38c8a1ac Fix T70441: crash after deleting a material output node
Caused by 5c79f2d0fb.
If no valid node_start is provided, we can just skip (e.g.
'ntree_shader_bump_branches' is not done then, but this is not
neccessary without a valid eevee output node anyways...).

Maniphest Tasks: T70441

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5969
2019-10-02 14:01:07 +02:00
9b034355e4 Fix T70405: Geometry node not linking manual derivatives
Maniphest Tasks: T70405

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5954
2019-10-02 13:55:59 +02:00
0091b84df0 Fix T70268: Render failures with Vector pass active with OptiX in Cycles
Rendering would produce invalid results or crash if the Vector pass was active but motion blur was inactive. This caused the OptiX BVH to be built with motion (because objects reported motion available), but the pipeline to be built without motion support (since with disabled motion blur this is not in the list of requested features). The two are not compatible and therefore caused issues. This patch fixes that by not building the BVH with motion if motion blur is not active (which makes sense).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5968
2019-10-02 13:23:29 +02:00
Yevgeny Makarov
97ba7f3c32 UI: use consistent names and menu organization for blending modes
The Python API is unchanged and remains compatible.

Differential Revision: https://developer.blender.org/D5830
2019-10-02 13:03:27 +02:00
02877bdf39 Python API: remove unnecessary ELASTIC_DEFORM_ prefix from enum identifiers 2019-10-02 13:01:36 +02:00
01c824ac88 Revert "UI: use correct singular and plural nouns in report messages"
Convention is to use (s) postfix for cases where there can be one or multiple,
so stay consistent with that.

This reverts commit 3e8276311e.
2019-10-02 12:54:56 +02:00
a434b30667 Fix building QuadriFlow with Clang on Windows
Boost 1.68 has a bug in its type_traits where it does not include the right
header for the is_assignable macro when building with Clang. Temporarily work
around it until we upgrade to a newer Boost version that fixes it.

Differential Revision: https://developer.blender.org/D5962
2019-10-02 12:40:55 +02:00
Stefan Werner
f97a64aa9b Fix T70252: Reverting to macOS 10.11 compatible API. 2019-10-02 10:22:26 +02:00
3b23685c7d Cleanup: simplify node modal select implementation
Ref T63994
2019-10-01 21:51:21 +02:00
Dalai Felinto
ec85f0e6a5 Silence remesh building warning 2019-10-01 15:46:28 -03:00
34bd23dbb7 MSVC: Support Building clang+ninja+VS2019
1) Clang was given the wrong VS version to emulate when used in
combination with VS2019 causing build issues.

2) The erroneous supplied parameter `-std::c++11`caused CMake to
fail running its compiler detection scripts.
2019-10-01 12:36:11 -06:00
Yevgeny Makarov
c06350d8a7 UI: "text not found" message in text editor, change type from ERROR to WARNING
Differential Revision: https://developer.blender.org/D5736
2019-10-01 20:32:16 +02:00
Yevgeny Makarov
6348ca9da0 UI: tweak layout of boid brain panel
Differential Revision: https://developer.blender.org/D5684
2019-10-01 20:29:33 +02:00
Sebastian Koenig
32d778a773 Keymap: make plane track corners draggable with lmb
Previously when clicking and dragging with LMB you would only move the entire
plane track. In order to move the corners independently you would have to use
your right mouse button. This would also prevent the context menu to show up.

Now LMB click and drag on corners moves them. If you LMB click and drag one of
the 4 edges of the plane track you would move the entire plane track.

Differential Revision: https://developer.blender.org/D5519
2019-10-01 20:23:24 +02:00
Miguel Porces
cca1649b20 Nodes: discard hidden sockets when grouping a single node.
At the moment, grouping a single node that has hidden sockets, exposes all
sockets in the node group. This patch just filters hidden sockets, so that
the node group's interface remains the same as the node being grouped.

Differential Revision: https://developer.blender.org/D5533
2019-10-01 20:21:17 +02:00
Yevgeny Makarov
b196c42d4a UI: use full width for ID blocks in lattice properties
Differential Revision: https://developer.blender.org/D5722
2019-10-01 20:18:48 +02:00
Yevgeny Makarov
3e8276311e UI: use correct singular and plural nouns in report messages
Differential Revision: https://developer.blender.org/D5729
2019-10-01 20:18:48 +02:00
Jean Da Costa
17f6b4d0f8 Sculpt: slight topology rake performance inprovement.
Produces almost the same result but takes in account all the edges instead
of only four, which gets rid of the need to select specific edges. Also,
added a check to prevent it from destroying boundaries.

Differential Revision: https://developer.blender.org/D5763
2019-10-01 20:18:48 +02:00
Yevgeny Makarov
cd9da385b0 UI: fix misaligned popover arrow near the region edge
Differential Revision: https://developer.blender.org/D5872
2019-10-01 20:10:46 +02:00
Colin Basnett
f0f189de76 Fix ImBuf.load failure showing filename as garbage bytes
Differential Revision: https://developer.blender.org/D5879
2019-10-01 20:10:46 +02:00
Yevgeny Makarov
9cda01caf7 UI: don't align popover buttons with opened popovers
Differential Revision: https://developer.blender.org/D5890
2019-10-01 20:10:46 +02:00
b1b4e00076 Fix T70315: Blender exit with code -6 with message Attempt to free NULL pointer.
This is not actually fixing the real issue here, PackedFile structs are
never supposed to have a NULL pointer - and in that monster .blend file,
the pointer is not NULL, but the actual data chunk has been lost
somehow, so it gets NULL during read process.

Very unlikely we ever know how such corrupted .blend was created though
(there's probably a fair chance that this is not even due to a bug in
Blender, but rather a glitch in filesystem or something).

So for now, ensure at read time that we get a coherent state (i.e.
remove any read PackedFile that would have a NULL data field), and add a
few asserts in relevant code to check we never get NULL data pointer
here.
2019-10-01 20:08:04 +02:00
8dd9172aa2 Fix "motion_blur" tests with OptiX in Cycles
Curves with motion blur produced wrong results with OptiX (T69801). This is because the AABBs for the motion steps were calculated from incorrect attribute data because the offset into the attribute data array was incorrect.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5961
2019-10-01 20:01:51 +02:00
6700027863 Fix T70328: Crash when editing loopcuts with AutoMerge & Split option 2019-10-01 14:54:32 -03:00
72666ae3e7 Brush: default the strength to 1.0
This applies to all paint modes except sculpt and grease pencil brushes.

When painting color or weight it's best to paint the color
the user has selected, without them having to make multiple strokes.
2019-10-02 03:37:29 +10:00
710e4847a0 Cleanup: remove redundant id lookups in versioning code 2019-10-02 03:37:29 +10:00
9f4dca8963 Fix mismatch in brush default versioning
Assign a variable to avoid repetition and having this happen again.
2019-10-02 03:37:28 +10:00
Stefan Werner
5eebd7cc1f Cycles: Fixed Camera inside volumes with Embree turned on.
The Embree backend did not properly recognize when the camera was
inside a volume and ended up ignoring those.
2019-10-01 19:35:56 +02:00
a513586cd2 Cleanup: remove ED_image_paint_tile_remove_masks_all
Masks are now temporary, not part of the persistent undo tiles.
Now they're always freed after the stroke.
2019-10-02 02:13:50 +10:00
8ce14aa21f Cleanup: rename image undo_tile to paint_tile
Clearer because they're no longer the same as undo tiles.
2019-10-02 02:04:37 +10:00
7aff48add0 Cleanup: move image undo into space_image/
This isn't just used for painting.
2019-10-02 01:45:37 +10:00
cc092e9ab0 Cleanup: name of image poll function 2019-10-02 01:45:37 +10:00
825a93d7cd Fix T70317: Equal clip range crashing in Hue Correct & RGB Curves Nodes
It takes many changes to support the drawing of zero-sized curves.
Best skip these cases to avoid crash.
Blender 2.79 had no support either.
2019-10-01 12:26:47 -03:00
b155ece0c0 Image: add resize operator
Now possible with new image undo,
was added for testing but seems generally useful.
2019-10-02 00:44:17 +10:00
151cc02b6f Image: support storing full image buffers for each undo step
Update image undo to store buffers for each step:

- Undo buffers share tiles to avoid using too much memory.
- Undo support for different sized buffers
  allowing operations such as crop or resize.
- Paint tiles have been split into separate API/storage.
- Painting speed wont be impacted significantly
  since storing the extra tiles is done after the stroke & only
  for the first undo step.

Resolves T61263, see D5939 for details.
2019-10-02 00:44:17 +10:00
bdd142bc02 Cleanup: convert some macros to functions 2019-10-01 16:36:29 +02:00
2bddf44b11 Cleanup: avoid multiple active vertex loops 2019-10-01 16:21:10 +02:00
96561dbdf0 Sculpt: enable 3D paint cursor for multires 2019-10-01 16:10:38 +02:00
2090b3e5ac Cleanup: internal sculpt refactoring related to multires, no user visible changes 2019-10-01 16:10:38 +02:00
6b3887da4d Cleanup: slightly more efficient access to PBVH multires grid key 2019-10-01 16:10:38 +02:00
b1baebd022 Cleanup: abstract sculpt floodfill code 2019-10-01 16:10:38 +02:00
8a23657f0f Cleanup: avoid accessors, reduce memory usage, multithread dirty mask 2019-10-01 16:10:38 +02:00
5e98187ddb Cleanup: make sculpt vertex random access API read-only 2019-10-01 16:10:38 +02:00
d3c88336cd Cleanup: prefer PBVH iterator over random vertex access in some places 2019-10-01 16:10:38 +02:00
0230148fb7 Cleanup: avoid unnecessary brush radius test in mask expand 2019-10-01 16:10:38 +02:00
81cc2fd1c1 Cleanup: don't go through sculpt accessor functions multiple times 2019-10-01 16:10:38 +02:00
46285e36e9 Cleanup: compiler warning 2019-10-01 16:10:38 +02:00
1524f414db BLI: optimize GSQueue implementation to allocate in chunks, like BLI_Stack 2019-10-01 16:10:38 +02:00
574265f52f Fix T70206 Texture Paint: UV shadow doesnt show up 2019-10-01 16:02:14 +02:00
5c79f2d0fb Fix T70325 EEVEE: Performance regression with large nodetrees
This was caused by nodeChainIter which is not linear complexity.
Introduce nodeChainIterBackwards to iterate backwards faster.
2019-10-01 16:02:14 +02:00
cba1bdc400 Fix T66641: Certain drivers fail to copy when copying a full scene.
The core of the issue here is that 'make single user' functions still
does its own, manual and quite partial, remapping of IDs, which covers
all most common cases but cannot consider *all* possible ID usages
(especially when it comes to drivers or custom properties, that can
essentially point to any kind of data-blocks).

This fix is merely a band-aid, there is no way to fully solve this
without a complete rewrite of that area of code to make use of modern ID
management code.
2019-10-01 14:48:33 +02:00
f983606063 Cleanup: remove unused variables 2019-10-01 12:55:25 +02:00
e82ac9e596 Fix T70376: Lattice point looses state on modeswitch when shape keys are
present

Selection state of lattice points as well as their weight were not kept
when going in and out of editmode, code would just copy positions.
Now copy the whole BPoint instead.

Reviewers: campbellbarton

Maniphest Tasks: T70376

Differential Revision: https://developer.blender.org/D5948
2019-10-01 12:53:23 +02:00
c9b9803a77 RNA: add check for zero step arguments
Avoids errors like T70281 slipping through.
2019-10-01 20:30:18 +10:00
ba798e0412 Image/Clip Space: Add view center to cursor operators
D5932 by @a.monti with edits
2019-10-01 20:20:53 +10:00
3370af2dc1 Fix T70281: Changing Default interpolation also changes curve of new drivers
Having a constant FCurve doesn't make sense for drivers; either linear
or Bezier should be used. Since the code is already creating a Bezier
curve, I just added the flag to not look at the user preferences in this
case.

Reviewed by: angavrilov

Differential Revision: https://developer.blender.org/D5921
2019-10-01 11:56:32 +02:00
2746fbc935 Fix T70397: Dilate/Erode 'distance' increment/decrement arrows not
working

Since rB78b56fa7d973 we always have to specify a valid step value.
2019-10-01 10:24:07 +02:00
b0e7108eda Cleanup: use doxy sections for clip_ops.c 2019-10-01 18:03:33 +10:00
4101d3e400 UI: Changes to Paint Cursors
Changes to cursors that can be used for painting and sculpting.

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

Reviewed by Brecht Van Lommel
2019-09-30 16:46:05 -07:00
60a827a2a9 UI: Update paint crosshair for Mac
This is based on feedback from users.
Only affects Mac for now, Windows will be committed separately.
2019-10-01 00:00:06 +02:00
9411b0a3c7 Cleanup: use PyC_StringEnum to path access functions
This gives better error messages, simplify code.
2019-10-01 05:19:38 +10:00
aba6fc8208 ImBuf Py API: implement resize method argument 2019-10-01 05:18:30 +10:00
07feb6e814 PyC API: utility to parse a string as an RNA like enum
More convenient than comparing strings,
with the advantage that errors don't need to repeat expected values.
2019-10-01 05:18:25 +10:00
Julian Eisel
ddb157999e UI: Remember File Browser Display Options in Preferences
This makes it so that some display related properties of the file
browser state are remembered in the Preferences. Otherwise, users often
end up doing the same set up work over and over again, so this is a
nice way to save users some work.
It's typical for other file browsers to remember their state too, so
another benefit is having a more conventional behavior, meeting user
expectations better.

Some points:
 * We currently store: Window size, display type, thumbnail size,
   enabled details-columns, sort options, "Show Hidden" option. More can
   be added easily.
 * No changes are stored to the Preferences if "Auto-save Preferences"
   is disabled. This is how Quick Favorites behave too and it's a
   reasonable way to make this behavior optional.
 * The Preferences are only saved to permanent memory upon closing
   Blender, following existing convention of Preferences and Quick
   Favorites.
 * If settings weren't actually changed, Preference saving is skipped.
 * Only temporary file browsers save their state (invoked through
   actions like open or save), not regular file browser editors. These
   are usually used for different purposes and workflows.
 * Removes "Show Thumbnails" Preferences option. It would need some
   special handling, possibly introducing bugs. For users, this
   simplifies behavior and should make things more predictable.
   Left in DNA data in case we decide to bring it back.

Reviewers: brecht, #user_interface, billreynish, campbellbarton

Reviewed By: #user_interface, William Reynish, Campbell Barton, Brecht
             van Lommel (quick first pass review in person)

Maniphest Tasks: T69460

Differential Revision: https://developer.blender.org/D5893
2019-09-30 19:27:02 +02:00
5940f6b3d9 Fix T58683: Reload Scripts breaks toolbar button formatting
Add a function which clears internal cached operator pointers,
run before reloading scripts.
2019-10-01 01:59:31 +10:00
68c2f7a2d0 Revert "Fix T58683: Reload Scripts breaks toolbar button formatting."
This reverts commit ba90d2efa5.

This can be resolved without adding a boolean to all operator types
to check if it's "WM_OT_tool_set_by_id".
2019-10-01 01:57:51 +10:00
6a6ac502f2 Cleanup: unused arguments 2019-10-01 01:57:51 +10:00
bb0b46f78c GPU: Make sure workaround is supported
`context_local_shaders_workaround` is only supported on OpenGL 4.1 or higher.
2019-09-30 12:15:31 -03:00
7dc70feb63 GPencil: Fix unreported keymap missing for Extrude tool
For some reason this keymap was removed and is required to avoid console warnings.
2019-09-30 17:13:31 +02:00
fae5348307 Fix T70375: Typo in label (Height used instead of High).
Also, use Title Caps for labels...
2019-09-30 16:03:21 +02:00
e8f6f70846 PBVH: PBVH_FullyMasked and PBVH_FullyUnmasked flags
This commit introduces flags to tag the PBVH nodes as fully masked or unmasked. This is used in do_brush_actions to filter fully masked nodes during a stroke. Other tools can also be updated to use this flags.
Sculpt updates now require a flag to update the mask or the vertex coordinates.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5935
2019-09-30 15:58:03 +02:00
3dc027add3 Fix T70385: Pose brush breaks when using pose origin offset
Reviewed By: jbakker

Maniphest Tasks: T70385

Differential Revision: https://developer.blender.org/D5945
2019-09-30 15:45:27 +02:00
b89a1687ce Fix "denoise_animation" tests with OptiX in Cycles
The OptiX device only loads the denoising kernels when the "use_denoising" feature is active. This was not set by the calling code however and therefore they were never loaded and attempting to launch them failed (see T69801).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5946
2019-09-30 15:38:07 +02:00
61efeb6df9 Fix PBVH search callback in pose and elastic deform
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5947
2019-09-30 14:58:22 +02:00
6b419c18b0 Sculpt: Only redraw nodes where the mask changed
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5923
2019-09-30 14:37:19 +02:00
91f6aa6a57 Fix memory leak after using OptiX in Cycles
The "optix_devices" array was not freed on exit, which caused a memory leak (see T69801).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5944
2019-09-30 14:05:40 +02:00
04ef62177f UI: Use paint crosshair cursor in all paint & sculpt modes
Currently, we use the crosshair cursor in Sculpt mode, but not in the other paint modes.

  - Sculpt Mode: This crosshair cursor is too weighty.
  - Texture, Weight, Vertex Paint: Using the arrow cursor for painting is not right.

This commit makes the following changes:

  - Use the new special paint crosshair instead
  - Use this cursor in all paint modes, not just Sculpt

Reviewed by: Brecht

Differential Revision: https://developer.blender.org/D5940
2019-09-30 13:33:54 +02:00
56854bd177 Fix RNA's "editable" func regarding IDProps and override.
`RNA_property_overridable_get()` need the original RNA property (i.e.
the actual IDProp in case it is one), not the 'proxy' type property
returned by `rna_ensure_property()` for IDProps.

Makes custom properties of library overrides editable at last, now we
only have to keep them overridden values!
2019-09-30 11:01:29 +02:00
64c8e9a219 macOS: don't require python3 to be installed to run "make update"
And fall back to python3 from our libraries for other commands, once checked
out with make update.
2019-09-30 10:51:17 +02:00
a6a0a09197 Cleanup: spelling 2019-09-30 17:07:05 +10:00
Stefan Werner
04133ee863 Revert "macOS: Replaced OSSpinLock with os_unfair_lock."
This reverts commit 9d282d7a8d.
os_unfair_lock requires macOS 10.12 or newer.
2019-09-30 08:29:17 +02:00
64c222ff58 Fix T69334: VSE Very low framerate
Revert "Sequencer: use Alpha Over blend mode by default"

This reverts commit 7c6c5b40ca.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5943
2019-09-29 16:17:56 -07:00
cdcb844d27 Fix T69684: Sound Strip "Pan" function is misleading
Gray-out pan property when sound mono property is unset.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D5806
2019-09-29 16:14:42 -07:00
ff10ff782b Fix wrong sculpt flat shaded normals after recent optimizations 2019-09-29 23:43:16 +02:00
24be998b98 Fix T70345: wrong transforms of objects after recent NVIDIA workaround
This reverts commit 44d042094e and adds a
simpler workaround for just the node links display issue. There are other
issues though so this is not a full workaround.
2019-09-29 21:10:12 +02:00
56fe8239ab Fix T70320: View clipping doesn't hide extra wireframe 2019-09-30 04:50:22 +10:00
3a3e5fb365 Fix T69935: Silence Win32 OS Error Dialogs
Call SetErrorMode() at startup to prevent error mode dialogs.

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

Reviewed by Brecht Van Lommel
2019-09-29 11:43:24 -07:00
Julian Eisel
98c0d16da5 UI: Use responive layout for upper bar in file browser
The upper bar (containing file path, navigation and display buttons) may
now be split into two rows as horizontal space is reduced.
The first row contains the navigation related buttons, the lower one the
filter and display related ones.

Mainly solves the issue where the file path and search buttons became
barely usable in tight layouts, but generally makes things better for
such cases.
2019-09-29 20:37:51 +02:00
Julian Eisel
57519f237a UI: Let file browser tool/bookmarks region push upper bar in
Main reason for doing this is that the navigation buttons are very
close to the file list now, making them much faster to reach.

Initially we let the upper bar (the one with the file path, navigation
and display buttons) use full area width, because designs back then had
more horizontal space problems. The designs have changed meanwhile, and
horizontal space is less of an issue.

However, when the file browser is shrunk horizontally, or if it's open
in a small area (e.g. see "Shading" workspace), having the tool region
open brings back the space issues. But even the file list layout becomes
problematic then, and the same issue was present before the new file
browser design, so we've decided this is an acceptable tradeoff.
2019-09-29 20:37:51 +02:00
02c4410a37 Cleanup: use doxy sections for image_ops.c 2019-09-30 03:47:54 +10:00
Julian Eisel
f8b57dbb81 Keymaps: Don't show confirm prompt when creating directories
* We don't show the prompt when invoked through the button either
* Creating directories isn't a destructive action and it's not dangerous
* The prompt is annoying and users often requested getting rid of it

This change is applied to both, the default and the industry compatible
keymap.
2019-09-29 18:45:52 +02:00
860854b07f Fix (workaround) memory leak cancelling sculpt mask expand 2019-09-29 16:22:09 +02:00
0fd3723b95 Fix small memory leaks in some sculpt tools
Also use MEM_SAFE_FREE to simplify code.
2019-09-29 16:22:09 +02:00
0ffb96f701 Sculpt: minor optimizations for GPU draw buffer filling
Ref T70295
2019-09-29 16:22:09 +02:00
9b0fd5ef2a Sculpt: only update draw buffers for visible nodes during paint stroke
Also applies to some other sculpt tools like filter and mask expand.

The full update happens after the paint stroke is finished, so it does not
happen on view navigation, which would cause a delay.

Ref T70295

Differential Revision: https://developer.blender.org/D5922
2019-09-29 16:22:09 +02:00
f6fc863acd Sculpt: multithread GPU draw buffer filling for workbench
This improves performance of some sculpt tools, particularly those that modify
many vertices like filter and mask tools, or use brushes with large radius.

For mask expand it can make updates up to 2x faster on heavy meshes, but for
most tools it's more on the order of 1-1.1x. There are bigger bottlenecks to
solve, like normal updates.

Ref T70295

Differential Revision: https://developer.blender.org/D5926
2019-09-29 15:28:15 +02:00
c931a0057f Sculpt: use dynamic scheduling and chunk size 1 for multithreading
This is under the assumptions that each node has enough work to avoid
the threading overhead, while also having a possible variable amount of
work. For example most of the vertices being masked or outside of the
brush radius.

Improves performance by about 10% for tools like mesh filter on an
entire 3 million poly mesh, tested on a quad core.

Ref T68873
2019-09-29 15:27:37 +02:00
8b00a73620 Cleanup: move sculpt parallel range threading test into function
Easier to experiment with different settings this way.
2019-09-29 15:27:37 +02:00
1ca105ebdc Sculpt: disable workbench anti-aliasing during stroke painting
This mostly happens automatically anyway since there is usually not enough
time left over for it. But when it does it happen it breaks partial redraw,
and may also have a negative impact on responsiveness.

Ref T70295
2019-09-29 15:27:37 +02:00
c31a849a14 Fix wrong sculpt cursor drawing when using "ignore_background_click"
Not all the necessary state got restored.
2019-09-29 15:04:10 +02:00
ba90d2efa5 Fix T58683: Reload Scripts breaks toolbar button formatting.
Assuming it's actually necessary to do this check very efficiently,
replace the hack based on caching a pointer, with a different one
that caches the string comparison result in the operator object.
2019-09-29 09:28:02 +03:00
44d042094e GPU: Workaround for broken node links on NVidia drivers
Related to T70011 and T70008
2019-09-29 01:19:45 +02:00
2c7365aec7 Fix unnecessary use of atomics in PBVH normal update 2019-09-28 12:29:52 +02:00
5bace9f5dd Cleanup: compiler warnings 2019-09-28 12:29:52 +02:00
b192c01254 Fix build error on Windows 2019-09-28 12:29:07 +02:00
7ea1b8451e Drivers: fix transform channel panel for W rotation and quaternions. 2019-09-28 10:31:51 +03:00
775a13dea0 RNA: fix the name of the parent inverse matrix in Data API Outliner view. 2019-09-28 10:14:46 +03:00
a2457dd7bb Debug: add 888 and 889 debug values for redraw and PBVH node visualizatons
More convenient to use the debug menu than having to modify code every time.
2019-09-28 01:35:53 +02:00
1c1a3198af EEVEE: Speedup: Don't request orco layer if not needed
Should speed up eevee mesh update a tiny bit in certain particular cases
(deform modifier + (shader using texcoord (but not generated output) OR
principled bsdf OR geometry node (except tangent output))).
2019-09-28 00:44:16 +02:00
ad22d3111f Fix T70226 EEVEE: Crash/Assert entering edit mode with instanced meshes...
... and modifiers.

This was caused by wrong mesh being taken into account when in edit mode.
2019-09-28 00:44:16 +02:00
6cbfa8d511 GPencil: Fix compiler warning 2019-09-27 23:23:25 +02:00
1b36c91831 Cleanup: Remove // comments 2019-09-27 23:15:09 +02:00
972edc93d7 Cleanup: Remove blank at the end of tooltip 2019-09-27 23:05:29 +02:00
8ac21cb40a fix:wrong python pdb copied for Windows-VS when building for pydebug 2019-09-27 22:59:08 +02:00
50931192aa UI: small tweaks to sculpt tool icons
Snake Hook: make it more clearly different from Grab, and also better communicate what it can do
Pose: remove arrow, which was hard to see anyway
Pinch: make arrows larger and more visible
2019-09-27 21:12:13 +02:00
387fe3607d UI: Add high quality cursors on macOS
This adds the same high quality cursors on macOS as we have on Windows.

These are stored as 32*32 pt PDFs, same as the built-in OS cursors

Reviewed by: Brecht Van Lommel

Differential Revision: https://developer.blender.org/D5907
2019-09-27 20:41:22 +02:00
e51b93473a Fix T70247 Crash on enter edit mode with UV editor opened 2019-09-27 19:45:27 +02:00
be985bdde2 Sculpt: Sculpt cursor UX improvements
This commit introduces the following changes:
- Invert the direction of the brush strength WM control. It was working in the opposite direction to any other control in Blender. Now dragging to the right increases the strength.
- Increase the alpha of the cursor
- Remove the font shadow of the numbers in the WM control. It was adding too much visual noise when rendered on top of the brush alpha
- Add a second circle to preview the strength in the cursor
- Increase the resolution of the cursor circles. Now they look smooth even when working with large brush sizes.
- Add a line preview to display the brush curve
- Don't offset the cursor preview when changing size and strength

Reviewed By: billreynish, brecht

Differential Revision: https://developer.blender.org/D5889
2019-09-27 19:16:03 +02:00
c372318165 Voxel remesh: Enable adaptivity
This commit enables OpenVDB adaptivity in the voxel remesher. It can be useful to reduce the polygon count if you want to switch to dyntopo after using the voxel remesher workflow.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5918
2019-09-27 19:12:51 +02:00
82136bb36e Sculpt: Use func_finalize instead of mutex
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5905
2019-09-27 18:41:24 +02:00
6a74b7c14b Sculpt: Pose brush origin offset
With the previous behavior, it was impossible to manipulate areas with a lot of complex shapes like fingers, as the pose origin was calculated only with the topology inside the radius.
With pose offset, the previous method is used to calculate the direction of the "bone", and an extra offset is added on top of it. This way you can set the pose origin in the correct place in this kind of situations. The pose factor grows to fit the new rotation origin.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5841
2019-09-27 18:35:42 +02:00
7ae549448e Fix T70291: Sculpt remesh inverts normal when fix poles is activated
Reviewed By: brecht

Maniphest Tasks: T70291

Differential Revision: https://developer.blender.org/D5916
2019-09-27 17:50:12 +02:00
9df9fb3324 Fix T56497: Snake hook sculpt brush slips off and affects the part of the mesh behind
We should not be updating the cache true location there.
This commit also fixes the snake hook default alpha.

Reviewed By: brecht

Maniphest Tasks: T56497

Differential Revision: https://developer.blender.org/D5915
2019-09-27 17:48:28 +02:00
97f4d4c66e Fix T70280: QuadriFlow remesh with "Use Paint Symmetry" and "Smooth Normals" may give wrong normals
Reviewed By: jbakker

Maniphest Tasks: T70280

Differential Revision: https://developer.blender.org/D5904
2019-09-27 17:46:56 +02:00
2bef8c5ea8 Sculpt: Enable accumulate in scrape brush
This fixes some artifacts when working on curved surfaces. Previous
behavior was with accumulate on, so that is now the default.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5826
2019-09-27 17:45:13 +02:00
7bbdc6996a Fix T69941 Assert selecting UVs
Was caused by DRW_mesh_batch_cache_get_edituv_faces_stretch_area called
after DRW_mesh_batch_cache_create_requested. So it was created on the wrong
object/mesh.
2019-09-27 17:19:00 +02:00
b22afef72c Cleanup: Replace 'add mode' short for driver FCurve creation with an enum
The 'add mode' was a `short` between -1 and 2 inclusive, and magic numbers
sprinkled throughout the code. It's now an enum with descriptive names.

No functional changes.
2019-09-27 17:02:39 +02:00
3c7707b49f GPencil: New Brush default settings
This patch replaces D5787. Now instead to replace the startup.blend file, all the changes are done in versioning and moved to shared module to be reused by Brush reset.

Reviewers: brecht, mendio

Reviewed By: brecht

Subscribers: pepeland, mendio

Differential Revision: https://developer.blender.org/D5913
2019-09-27 16:52:50 +02:00
c69a771851 GPencil: Simplify smooth average factor calculation
As always uses 4 points, don't need to do calculations for that and also it was wrong with 3 points.
2019-09-27 16:43:31 +02:00
df3891ed81 Fix T69377 Texture flickering when selecting in solid viewport (AMD Pro driver)
Workaround that does not fix the real issue.

The bug is caused by glBufferData inside
DRW_instance_buffer_finish > GPU_vertbuf_use
but only after the selection code which resets the number of items in
idatalist->pool_buffers.

I don't understand why this is happening as the vbo ids are all valid and
no error is reported. What is even more strange, is that it affects another
vbo which has no connection with the ones in DRW_instance_buffer_finish.
2019-09-27 15:31:18 +02:00
c601839176 Fix T70106 Objects with multiple materials are not displaying correctly
Seems to be an issue with OSX and loading objects matrices from uniform
buffers.

Using legacy path for that reason.
2019-09-27 15:31:18 +02:00
12688a6636 GPencil: New smart smooth for strokes
When using the samples, the interpolated points get abrupt steps because the system cannot receive all events in a short period of time.

This is more noticeable when the samples are set to 10 and the pen is moved very fast. The problem with post-processing smooth is that is applied to all stroke and this removes details.

The smart smooth is automatic and detect only the segments in the stroke where the system was unable to capture all movements and apply a smooth algorithm.
2019-09-27 15:28:32 +02:00
770e91703d Fix part of T70295: sculpt drawing not clipping PBVH behind the camera
Use all 6 clipping planes for drawing.
2019-09-27 14:59:41 +02:00
d3a98b2c3b Fix part of T70295: sculpt drawing not clipping PBVH nodes outside of viewport
As before in 2.7, this only works for optimized drawing in workbench mode.
2019-09-27 14:29:40 +02:00
0901a72b6b Cleanup: use consistent clipping plane sign convention 2019-09-27 14:24:49 +02:00
c5db0272d4 Fix T70276: View animation with jpeg 2000 image will crash player
Since our ffmpeg is built with openjpeg support and thus can decode jpeg
2000 (in both J2K and JP2 codec flavors as well as high bitdepths), added
these extensions to the supported list.

Also IMB_ispic > IMB_ispic_type > imb_is_a_jp2 was only testing for jp2,
now do both jp2/j2k.

Reviewers: brecht

Maniphest Tasks: T70276

Differential Revision: https://developer.blender.org/D5909
2019-09-27 12:02:08 +02:00
4b206d9a51 Cleanup: remove unused function 2019-09-27 18:04:44 +10:00
92686c667e Cleanup: structs, cmake file lists 2019-09-27 12:45:54 +10:00
7ae85b54d7 Cleanup: clang-format 2019-09-27 12:37:53 +10:00
c43018cdc0 Fix T69814: Grease Pencil Onion Skin Loop doesn't work as expected
The first element of the loop was not calculated for all onion modes. For select mode the first selected is used, for other modes the first frame in the layer is used.
2019-09-26 18:04:36 +02:00
7ac581cb1b Cleanup: clang format for particle loop macros
See https://developer.blender.org/D5903

Reviewers: JacquesLucke
2019-09-26 17:55:51 +02:00
b0d3ed3d20 clang-format: add particle loop macros
This is so the '{' will be on the same line for those as well.

Reviewers: JacquesLucke

Differential Revision: https://developer.blender.org/D5903
2019-09-26 17:52:49 +02:00
db4571f3c3 Fix T68645: Hair Particle Edit - Particle Mirror crash when children are
visible in the viewport

Seems to be an issue of not correctly freeing the PTCacheEdit (see
T68645 for details), after discussion with sergey we went with the quick
and dirty fix to free the path cache early for now. Other solution of
freeing it in 'psys_cache_paths' for the non-evaluated psys [which would
also fix the particle delete, then undo crash from T69000] needs more
deep investigation and, possibly, reconsideration.

Reviewers: sergey

Maniphest Tasks: T68645

Differential Revision: https://developer.blender.org/D5755
2019-09-26 17:35:17 +02:00
cf2c09002f Fix T69488: Hair particles: rekey disolves the hair then crashes
Caused by rB914427afd512.

Since above commit 'pe_get_current' checks for an active depsgraph. This
caused the skipping of handling
`PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL`for everything calling
`PE_get_current` (this passes a NULL depsgraph as opposed to
`PE_create_current`). So we now pass a depsgraph here as well...

Note there are two RNA cases where we pass NULL, namely
- rna_ParticleEdit_editable_get
- rna_ParticleEdit_hair_get
I guess these should be fine though (no functional change to current
master)

Reviewers: sergey

Maniphest Tasks: T69488

Differential Revision: https://developer.blender.org/D5752
2019-09-26 17:27:43 +02:00
6a33e3b990 Cleanup: compiler warnings 2019-09-26 17:25:16 +02:00
a933237d68 Fix accumulate in Draw Sharp brush
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5814
2019-09-26 16:56:34 +02:00
e5c9bf3aa2 Quadriflow: Symmetry support
This patch adds paint symmetry support to Quadriflow. It bisects and mirrors the input and the output from the remesher to build the final mesh using the preserve boundary option.
This is also an important performance improvement in Quadriflow because it only needs to process half of the mesh with half the resolution.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5855
2019-09-26 16:43:35 +02:00
b7f27996e7 Cleanup: fix compiler warnings 2019-09-26 16:32:27 +02:00
09dc7bce37 Fix Cycles bake panel showing for other renderers, after recent changes 2019-09-26 16:30:41 +02:00
454c1a5de4 Voxel Remesh: Fix poles and preserve volume
This commit fixes most of the issues we currently have in the voxel remesher. Mesh volume is preserved when doing multiple iterations, so the sculpt won't shrink and smooth each time you run the remesher. Mesh topology is much better, fixing most issues related to mask extraction and other topology based operations.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5863
2019-09-26 16:30:25 +02:00
da84bd3c11 Cleanup: cursor header file 2019-09-26 16:26:04 +02:00
da63ac5576 Cleanup: remove unused cursors without high resolution image 2019-09-26 16:26:04 +02:00
a0d4c2e607 Sculpt: Brush default settings
- Update default values of current tools
  - Create default values for new sculpt tools
  - Update the color of the cursor to match the color of the tool icon

Reviewed By: jbakker, brecht

Maniphest Tasks: T68745

Differential Revision: https://developer.blender.org/D5813
2019-09-26 16:15:18 +02:00
4d89667663 Fix sequencer Metadata panel sidebar panel to show at the bottom, not the top 2019-09-26 16:07:36 +02:00
7c544626b7 Sculpt: UI fixes and improvements
- Fix vertical spacing in grab brush grab active vertex option
- Move Remesher popover in the top bar to the right of Dyntopo
- Move topology automasking to the options subpanel
- Remove voxel remesher button from the topbar
- Add default shortcut to voxel remesher [Ctrl R]
- Add default shortcut to quadriflow [Ctrl Alt R]
- Add set pivot position operator to the sculpt menu

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D5880
2019-09-26 16:01:54 +02:00
5603725389 Fix T70126: Can't Snap To Vertex With Rigidbody
The idea is to ignore dependency which comes via rigid body solver.

Reviewers: mano-wii

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D5900
2019-09-26 15:25:21 +02:00
5a7fee8132 RNA Manual Reference Update 2019-09-26 09:22:06 -04:00
0ac7b51dee Fix T70107 EEVEE: Crash using Irradiance Volume with Curve inside
This was more of a general nvidia driver bug. Was caused by a
drawcall that had 0 vertex count. This worked in normal drawcalls
but not in indirect drawcalls.
2019-09-26 15:48:29 +02:00
c525d0e3ae Object Mode: Fix missing ubo assert with irradiance grid 2019-09-26 15:48:29 +02:00
e02ecd599b Fix T70259: Hair particle point selection if 'use_fade_time' is set
If fade_time is used, particles would be flagged PEK_HIDE (depending on
time settings), but since this is not respected in drawing in 2.8 yet
the user would have no indication of them keys being hidden.
Also doing this for hair doesnt make much sense anyways...

Reviewers: jacqueslucke

Maniphest Tasks: T70259

Differential Revision: https://developer.blender.org/D5901
2019-09-26 15:01:06 +02:00
39d855f8f3 Fix particle lasso selecting non-visible keys
Even though hidden/faded keys are not supported in drawing in 2.8 yet,
the selection tools should not be able to select non-visible keys.

Spotted while looking into T70259

Reviewers: JacquesLucke

Differential Revision: https://developer.blender.org/D5902
2019-09-26 14:41:36 +02:00
b07db54cad Cleanup: clang-format 2019-09-26 14:37:30 +02:00
e56f71d03f Grease Pencil: use standard eraser and paint brush cursors
Ref D5197
2019-09-26 14:31:52 +02:00
47fdac8ad9 WM: always use standard cursors from GHOST when available, over custom ones
Fixes T62417: poorly visible cursors on high Windows DPI displays

Ref D5197
2019-09-26 14:31:51 +02:00
583beea3ee WM: refresh custom cursors designs, add a few more cursors
Cursors designed by Duarte Farrajota Ramos.

Also fixes misnamed vertical and horizontal split cursors.

Ref D5197
2019-09-26 14:31:50 +02:00
b29ad7c91a WM: clean up cursors constants and code
There was a mix of old and new constants. Now have one list of WM_CURSOR_*
cursor types, using GHOST standard cursors when available and otherwise falling
back to our custom cursors.

Ref D5197
2019-09-26 14:31:48 +02:00
3bf4610347 GHOST: refresh standard cursors available for platforms
* Add more standard cursor types, that platforms can optionally support.
* Remove a few unused cursor types that were not properly supported and
  would show the wrong cursor when used.
* Add native cursor files for Windows. These scale well with DPI and have
  anti-aliasing. Designed by Duarte Farrajota Ramos.

Ref D5197
2019-09-26 14:31:47 +02:00
6292cab193 GHOST: add GHOST_HasWindowCursorShape() to test if standard cursor exists
Ref D5197
2019-09-26 14:31:43 +02:00
bab6ede286 Fix (unreported) (2d) paint cursor always drawing in half alpha
Own mistake in rB078fcc62534c (should only switch to half alpha if we
draw the second pressure circle as well...)
2019-09-26 14:19:47 +02:00
f547c396e1 Fix T70260: Stencil Paint Overlay Broken
own error in rB078fcc62534c (doing the overlay only in 3d painting)
2019-09-26 14:19:47 +02:00
cbf2d23ff2 CleanUp
Removed unused define in `edit_mesh_mode.c`
2019-09-26 13:32:55 +02:00
24afa26a50 Clean up
Unused framebuffers in `edit_mesh_mode.c`
2019-09-26 12:56:20 +02:00
bb74bd243f Code Cleanup
Removed unused shading groups in `edit_mesh_mode.c`
2019-09-26 12:37:39 +02:00
ae5bf4c2c8 Fix T67732: metadata "Include Labels" checkbox doesn't work when "Use Strip Metadata" is checked
The 'metadata from sequencer strip' system was using the
`stampdata_from_template()` function, which ignored the 'Use Labels'
setting.
2019-09-26 12:05:40 +02:00
8a7085b9d4 Fix T70163: Error painting with Subdivision at end of stack
Deformation of subdivision surface modifier was using wrong coordinates
for the coarse mesh: as the modifier flow goes the coordinates are to be
taken from the input array of coordinates.
2019-09-26 12:01:52 +02:00
ee47075449 Fix: T70251 update license from gplv2 to v3 in exe properties 2019-09-25 14:42:53 -06:00
f9d7f690b2 Fix T69639: Bevel Info bar Width value not affected by Unit Scale 2019-09-25 17:05:53 -03:00
abc8d6b12c Cleanup: Modernize Smooth modifier code.
Simplify it a bit, hopefully make it clearer, better var names, use
proper types for arrays of vectors, etc.

No behavioral change expected (except for corner-case of vertices being
used by more than 255 edges, which were sort of 'clamped' to those 255
first edges for the smoothed position computation previously, now we use
proper integer, which fixes that bug).
2019-09-25 21:51:13 +02:00
Laurent Noel
ae755c0167 Windows: Fill ProductVersion of blender executable
On windows, the ProductVersion field of the blender executable was empty,
see [1] for more information. This field might be required by windows
tools such as SCCM agent to track usage statistics.

It seems that it was due to the BLEN_VER_RC_STR macro used in
winblender.rc not being a string.

[1] https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource

Differential Revision: https://developer.blender.org/D5896
2019-09-25 12:06:20 -06:00
9e62cca29d Fix T69542: Corrective Smooth modifier breaks when drivers are involved
Previously the cache for the modifier would not be invalidated if
modifier settings were changed with drivers or keyframes.

Now we compare the current setting with the ones used to generate the
cache and invalidate the cache if they differ.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D5694
2019-09-25 16:47:51 +02:00
b393b13524 Fix T70231: GPencil - Moving very fast tablet pen gets ugly stroke ends
When move very fast the pen using a tablet, the end of the strokes was very ugly if the sampling was enabled. The reason for that is the last point and the previous one was interpolated in distance, but not in pressure and strength.

This commit uses several processes to get better endings:

a) If the pressure at the end of the stroke is very low, this part of the stroke is removed. This is a common issue with some tablet that send events with very low pressure when the pen is raised from drawing surface.
b)  The interpolated points created by sampling are interpolated in strength and pressure to get a smooth transition.
c) Active smooth also uses the strength. Before only pressure was used.
2019-09-25 16:13:57 +02:00
f8da7218be Fix T70187: GPU Driver: Merge Vertices Crashes ATI/Linux/OpenSource
This has been tested with 18.2.2, 19.0.8 and 19.3.0~develop.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5886
2019-09-25 15:57:34 +02:00
b651ac6531 Removed auto generated config.h file from quadriflow
The config.h file is autogenerated during compile by a 3rd party library
quadriflow uses. Now we put this file in the build directory to avoid
adding this to the git repository in the future.
2019-09-25 15:55:36 +02:00
f9ef0e1bde Fix T67342 EEVEE: Uninitialized buffer when changing screen size
Was caused by some drawcall not being done if the volumetric resolve pass
was drawn (using dual source blending seems to be the cause).
Not sure why this is needed since it is still reset before the next
drawcall.
2019-09-25 15:37:42 +02:00
7d09c943f6 make.bat: Fix rebuilds with custom build directory.
When calling make.bat multiple times to rebuild blender
make.bat failed to rebuild if a custom build dir was set.

reported and fixed on chat by @dgsantana
2019-09-25 07:17:06 -06:00
1ca5c8491d Pose paste: avoid auto-keying on unselected bones when 'selection only' is enabled
The `pose_bone_do_paste()` function is documented to only return a
non-NULL pointer on a successful paste, and the one caller that checks
the return value is expecting this behaviour. However, before this
commit, when a valid pose channel was found, 'Selected Only' was
enabled, and the bone was not selected, the function would still return
non-NULL. This resulted in auto-keying pose channels that were not
pasted.

Reviewed by: angavrilov

Differential Revision: https://developer.blender.org/D5891
2019-09-25 15:07:57 +02:00
2507b6a489 Added missing documentation for options parameter in keyframe_insert()
The RNA docstring of `keyframe_insert()` didn't mention the `options`
parameter in the function signature.

No functional changes.
2019-09-25 15:04:20 +02:00
615d5fa2fb Motion paths: Use minimal possible dependency graph
This change makes it so motion paths are using minimal possible
dependency graph which is sufficient to evaluate required motion
path targets.

Disclaimer: granularity is done on ID level, but it is possible
to go more granular if really needed.

Brings time down to 0.5 sec when updating motion path for the
Rain animation file used for benchmarks in the previous commits.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5874
2019-09-25 14:40:06 +02:00
eb2ed0ea7a Depsgraph: Implement builder from given set of IDs
The title explains it all actually: this commit introduces special
dependency graph builder API which builds graph which is sufficient
to evaluate given set of IDs.
2019-09-25 14:40:06 +02:00
6aadfa243d Depsgraph: Mark build methods as virtual
Allows to override behavior in a subclasses.

Currently no functional changes. The penalty of calls being virtual
should be neglectable.
2019-09-25 14:40:06 +02:00
c0855f77c0 Depsgraph: Move proxy group and from building to own function
Currently no functional changes, but allows to make it more clear to
implement depsgraph construction from a given subset of scene.
2019-09-25 14:40:06 +02:00
e7507c16e8 Motion paths: Limit updates to changed frame range only
The idea is to only update parts of motion paths which lies between
keyframes around changed frame.

The changed frames are considered to be from second previous to
second next one to work correctly with bezier handles interpolation.

Brings updates in the Rain test animation file from around 11 sec
down to 1 sec.
2019-09-25 14:40:05 +02:00
4db2a08281 Motion paths: Refactor, make update range more explicit
Allows to have a higher versatility in the API.

Should be no functional changes.
2019-09-25 14:40:05 +02:00
c77a0d7dc6 Motion paths: Cleanup, de-duplicate code 2019-09-25 14:40:05 +02:00
7b83ea5c6d LibOverride: tweaks to custom props UI.
For now, do not allow to add custom props to overriding IDs (this should
be possible in the future, by getting basic correct behavior here is
already fairly hard, no reason to complicate things even more).

Also, properly disallow editing of existing custom props in overriding IDs.
2019-09-25 14:27:47 +02:00
1c624a1219 LibOverride: Fix 'overridable' flag desapearing when setting IDProp from py code.
Do not see any reason not to copy over the flag of the old, existing
IDProp to the new one when assigning (e.g. `C.object['prop'] = 0.5`
would nuke that IDProp flag).
2019-09-25 14:27:47 +02:00
1201352217 LibOverride: Fix several issues in handling of overridable status for IDProps.
The triple possible status of an PropertyRNA (actual C-defined prop,
py-defined IDprop behaving similar ot RNA one, or actual 'pure' custom
prop) is really confusing... Not to mention the _RNA_UI ugly thingy on
top of that. :/
2019-09-25 14:27:47 +02:00
ef60cf8fca Cleanup: remove override's 'static' references in some py API docs strings. 2019-09-25 14:27:47 +02:00
a1e40087c5 Cycles: Fix undefined behavior which can causes crashes with a misaligned address error
Cycles casts a pointer from ShaderDataTinyStorage to ShaderData, these structs by default had different alignments however (the former was 1-byte aligned, the latter 16-byte). This caused undefined behavior on at least the CUDA platform. Forcing both structs to use the same alignment fixes this.

CUDA toolkits newer than 10.1 run into this because of a compiler optimization.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5883
2019-09-25 14:22:21 +02:00
900a9a4b06 Sculpt: Cleanup, use more suitable utility function
No functional changes, just more clear semantic and shorter call.
2019-09-25 12:44:42 +02:00
d6dcf5b1ff Sculpt: Fix crash hovering mouse onto multire surface
The check around function which is only supposed to be used for
non-multires case was gone after aea8c0102a.
2019-09-25 12:43:27 +02:00
fae122f12f Sculpt: Cleanup, grant expected usage with asserts
Don't just rely on a comment next top the code, do an assert as well.

Also, don't use `default` since that silences compiler warnings when
new enumerators are added and related code is to be verified.

More switch statements might need an adjustment, but this is something
what is easier to go over by Pablo.
2019-09-25 12:40:10 +02:00
9fff5c2965 Fix T70236: voronoi misspelling in description 2019-09-25 10:26:57 +02:00
fbfa904bce Fix T69573: Driver Value does not slide along the actual value in the Driver Editor
This change is two-fold:

- Ensure the result of the F-Curve evaluation is stored on the FCurve
  object. This was done in 2.79 but lost when we moved to more granular
  per-curve evaluation from the depsgraph.
- Flush this result from the CoW copy back to the original.

Reviewed by: sergey

Differential Revision: https://developer.blender.org/D5888
2019-09-25 10:32:14 +02:00
d0279f7d36 Cleanup: use const for image blending functions 2019-09-25 17:19:08 +10:00
Dalai Felinto
3142ae19d2 Fix T70080: Newly created objects not visible with local collections
The tricky part here is to support a hidden parent and a "visible" child
collection. In this case the object should obviously be invisible. It is
all working now.
2019-09-24 14:25:42 -03:00
9dced206dd Cleanup: removed 7-year-old commented-out code marked 'for now' 2019-09-24 18:22:46 +02:00
c6995b3095 Fix T70004 EEVEE: Texture Coordinate Node in world shader render artifacts 2019-09-24 18:21:39 +02:00
dcee994af6 Tracking: Highlight keyframes in path visualization
This gives better idea of what's going on with your track. Example:

{F693806}

Color of keyframes are configurable from theme editor of clip editor.

Reviewers: keir, brecht, Severin

Differential Revision: https://developer.blender.org/D2772
2019-09-24 17:20:16 +02:00
9a0a556d3b Fix T70202: Typo error in message 2019-09-24 16:16:31 +02:00
a2cc855dba Fix T68736 EEVEE: Loose subsurface node breaks shader 2019-09-24 16:11:53 +02:00
f94f4e1d79 Fix T66555: Handler render init ignores output placeholders
Blender now calls render hooks before taking copy of `scene->r` in
`RE_RenderAnim()`.

A change to the render output filename made in the render-init hook
would not be picked up by by the copy. As a result, placeholders were
touched using the old name, whereas the rendered images would be saved
with the new filename.

Reviewers: sergey

Maniphest Tasks: T66555

Differential Revision: https://developer.blender.org/D5887
2019-09-24 15:59:06 +02:00
aea8c0102a Fix T70140: Topology Automasking and 2D Falloff don't work correctly together
Reviewed By: jbakker

Maniphest Tasks: T70140

Differential Revision: https://developer.blender.org/D5878
2019-09-24 15:51:47 +02:00
a9d3e95bea Fix T69875: Sculpt Scene Spacing breaks with Adjust Strength for Spacing enabled
Reviewed By: jbakker

Maniphest Tasks: T69875

Differential Revision: https://developer.blender.org/D5849
2019-09-24 15:49:23 +02:00
a7904dff4b Fix crash in dynamic mesh preview edge list update
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5824
2019-09-24 15:47:03 +02:00
Dalai Felinto
0dd83b385e Fix T70046: Linked instanced collections not working with local collections 2019-09-24 10:34:03 -03:00
Dalai Felinto
8cb8853ebc Make new objects (from enabled collections or append) visible to local views
This fix T67162.
2019-09-24 10:34:03 -03:00
561dfd12be Fix T70124: Motion path not drawn for Armature in Object Mode 2019-09-24 15:33:32 +02:00
22abc205ac Fix T69743: Armature display issues with Intel 5x0 GPU
Apparently this workaround solves the problem.
2019-09-24 08:47:15 -03:00
bf61f217e7 GPencil: Fix wrong icon for Brush presets
It was using the old 2.7 icon.
2019-09-24 13:17:28 +02:00
4e7faf5ffa GPencil: Keep Options panels open by default 2019-09-24 10:36:43 +02:00
9c62ac562c Cleanup: clang-format 2019-09-24 10:15:43 +02:00
36683475d1 Fix T68457: Cycles OpenCL Displacement Shading
When doing simple scenes the displacement shading failed during final
rendering when the displacement method is set to `Displacement + Bump`.

When this option is enabled the shader uses the Vector math
node. This node is part of the node group level 1. When doing simple
shading only using nodes that are part of the node group level
0 the shading was rendered black.

This only happened in final rendering as there the OpenCL programs are
optimized to save registries. Viewport rendering rendered correctly

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5859
2019-09-24 09:44:19 +02:00
5a6ab6f594 UI: Small tweaks to sculpt tool icons
Draw Sharp: More pronounced difference between it and Draw
Mask: Fits in with other similar tools
Border Hide: Fits in with other similar tools
Pinch: Much better communicates what it does
Simplify: Fix a small issue with caused by inverted normals
2019-09-23 22:20:21 +02:00
Daniel Grosse
14acac0bb7 Fix T70013: slow OpenGL calls for every vertex and weight painting step
Stroke update use now the location from Strokecache instead of the mouse
position.

Differential Revision: https://developer.blender.org/D5861
2019-09-23 17:18:15 +02:00
2713921e8a Fix T70143: GPencil Multiframe selection is not updated when use Box select in Dopesheet
Differential Revision: https://developer.blender.org/D5868
2019-09-23 17:03:45 +02:00
e2e567e0b4 Fix file browser new directory prompting for confirmation
This is only needed for the case where it's automatically done when entering a
file path that does not exist, not when pressing the button.
2019-09-23 16:44:06 +02:00
a168c3d282 Modifiers: every modifier now copies mesh settings, fixing texture space issues
Modifier stack evaluation would copy mesh settings other than mesh topology
automatically, outside of the individual modifier evaluation. This leads to hard
to understand code, and makes it unclear which settings are available in following
modifiers, and which only after the entire stack is evaluated.

Now every modifier is responsible to ensure the mesh it outputs preserves materials,
texture space and other settings, or alters them as needed.

Fixes T64739: incorrect texture space for various modifiers

Differential Revision: https://developer.blender.org/D5808
2019-09-23 16:27:23 +02:00
69ad44d5b4 Cleanup: remove unimplemented texture space rotation variables 2019-09-23 16:27:23 +02:00
9208146199 Cleanup: remove Mesh.bb and Curve.bb, no reason for these to be persistent
These were only strictly valid for texture space calculation, don't store them
since they should not be used after that. Only store a flag to indicate if the
auto texture space has been evaluated.

In the future it might make sense to store bounding boxes at the mesh level to
speed up bounding box computation for multiple objects using the same mesh, but
then it will need to be implemented differently.
2019-09-23 16:27:23 +02:00
5c89c689db Fix selection and snapping misusing texture space as boundbox
This fixes the regression from T70103 introduced by the fix for T70103.
2019-09-23 16:27:03 +02:00
8634c4646e GPencil: Use correct comparison for non-bit values 2019-09-23 12:55:16 +02:00
1d1ef2e797 Revert part of "GPencil: Invert Paste operator and make Paste to Active default"
This commit accidentally undid a bunch of previous commits. Only the intended
changes are left now.
2019-09-23 11:09:00 +02:00
3a1b0c0f30 ShaderNodeTree: Add flatten function to get rid of nodegroups
This makes a lot of shader node wiring code less complex.

This only add the flatten mechanism (which fixes T69672).

~~Cleanup to remove the complexity in ntree_shader_relink_displacement,
ntree_shader_bump_branches and ntree_shader_tag_nodes will be commited
separately.~~(already included)

The code is only added for shader nodes for now but could be exported to
other internal nodetree types in the future.

Cleanup: Node Shader Tree: Remove GPUmaterial special nodegroup handling

Reviewers: brecht

Reviewed By: brecht

Maniphest Tasks: T69672

Differential Revision: https://developer.blender.org/D5829
2019-09-23 11:34:34 +02:00
4987f28ed2 Fix T70177: Crash when calling to_track_quat() without arguments 2019-09-23 09:46:31 +02:00
73a6fcfa80 ImBuf: add planes, channels attributes
D5857 by @cmbasnett
2019-09-23 09:56:46 +10:00
381a274909 Cleanup: use braces 2019-09-23 09:36:12 +10:00
4031bc1478 Cleanup: quote use 2019-09-23 09:35:27 +10:00
a083ddf49b Sequencer: correct fcurve map usage 2019-09-23 09:31:08 +10:00
52bdf522af Fix T69593: Color strip won't update
Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D5803
2019-09-22 13:38:39 -07:00
2e55171e71 Fix T69564: Empty fcurve prevents waveform drawing
Add check if fcurve is empty to skip fcurve evaluation.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D5805
2019-09-22 13:38:39 -07:00
29a7b1b64d VSE: Remove the use of eval in Fades operators
Fix security issue introduced in rB2ec025d7be3c

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D5807
2019-09-22 13:38:39 -07:00
d025119aeb Fix T69352: Audio strips don't update when changing frame_start
Tag depsgraph update as a part of cache invalidation.

Author: mdewanchand

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D5718
2019-09-22 13:38:38 -07:00
aa697496e9 UI: Updated Sculpt Simplify tool icon
Fits better with the other tool icons.
2019-09-22 21:36:18 +02:00
012b5e6b22 Cleanup: MOD_explode: Sanitize code some more.
This happens to be a non-behavioral change, but previous code here was
*very* confusing, and only ended up generating expected results by mere
chance (since `facepa[i]` == `totpart` in case the face has no (valid)
particle, i.e. `pa == NULL`)...
2019-09-22 18:51:45 +02:00
591c1a1372 Cleanup: MOD_Explode: sanitize face-without-particle case.
Systematically reset particle pointer to NULL and use it to detect
invalid particle case, instead of checking value of the face's
particle index everywhere in a confusing and prone-to-bug way
(see T70150 and previous commit).

No behavioral change expected here.
2019-09-22 18:48:00 +02:00
6eea69a7ad Fix T70150: Explode modifier crashes with empty vertex group.
There’s be a lot to say about that explode modifier code, for now just
follow other places in code... But the handling of 'invalid'/'unkown'
particle case is... quiet confusing to say the least.
2019-09-22 18:29:05 +02:00
981b063473 UI: Move new sculpt mode tools to correct places in toolbar
Follows general logic, and are placed next to similar tools.
2019-09-22 15:10:15 +02:00
41853a566e UI: Add missing toolbar icons for Sculpt Mode 2019-09-22 14:54:14 +02:00
22a478e5ee GPencil: Fix missing last point when sculpt in Multiframe
This was a mistake when fixed the problem with multiframe sculpt. I missed change the index and use active point in the check.
2019-09-22 13:16:02 +02:00
b3aa8f0fad Mathutils: expose the swing + twist Quaternion decomposition to Python.
This decomposition is useful in rigging, and involves a math trick.
2019-09-22 13:19:33 +03:00
c71be416e0 GPencil: Performance improvement for Multiframe and Onion Skin
Before when Onion or Multiframe was enabled the VBO length was the total of points on the object for all frames and this results in a big size when the scene had a lot of frames.

Now, the size of VBO length is calculated more precisely and reduce the time to alloc the VBO.This also reduce memory footprint.
2019-09-21 19:21:37 +02:00
886adbbe49 Cleanup: Fix comment mistake 2019-09-21 17:18:11 +02:00
a5b15931c3 GPencil: Apply transformed rotation only if needed
If there aren't modifiers or they are not transform type, the rotation is not needed.
2019-09-21 16:13:30 +02:00
ef45d1c8cd GPencil: Use Object location instead of 3D cursor for Grab Brush
Instead to use the 3D cursor as reference point (legacy code), it would be better use the object location.

Tested by: @pepeland
2019-09-21 10:48:40 +02:00
cdf489d101 GPencil: Remove Sculpt rotation effect for multiframe sculpt
As multiframe does not use modifiers, this is not required and only gets weird results.

Related to T70116
2019-09-21 10:29:25 +02:00
35114b0e4e GPencil: More changes to use original data in multiframe sculpt
Related to T70116
2019-09-21 10:29:25 +02:00
c4cc4b5794 GPencil: Multiframe Show only Edit lines was inverted
The flag was working in the oposite mode.

Related to T70116
2019-09-21 10:29:25 +02:00
db7b3de918 GPencil: Copy temp color in multiframe
As the evaluated data is not calculated in multiframe, needs to have the original colors.

Related to T70116
2019-09-21 10:29:25 +02:00
bf4fa5792d GPencil: Rename function 2019-09-21 10:29:25 +02:00
b1cac03fe5 GPencil: Fix error in previous commit
Related to T70116
2019-09-21 10:29:25 +02:00
fe9d522273 GPencil: Use evaluated or original data in Sculpt for Multiframe
The evaluated frame is only available when the frame is the active one.

Related to T70116
2019-09-21 10:29:25 +02:00
c8443d8340 GPencil: Fix unreported select not working in multiframe mode
The selection was not working because the evaluated frame was only working for active frame, so when the evaluation was changed to use eval data instead of original data, the data was not available and the loop did not use it.

Related to T70116
2019-09-21 10:29:24 +02:00
3fcedae8c8 Cleanup: extra semicolon, comma warnings 2019-09-21 11:34:39 +10:00
3589701f6d Cleanup: unused headers in editors 2019-09-21 10:18:29 +10:00
7926e8ea4c Revert "Modifiers: every modifier now copies mesh settings, fixing texture space issues"
This reverts commit e7a514369f, it introduces
a bug in selection in edit mode.

Fixes T70103: can't select extruded Vertex

Ref T64739
2019-09-21 00:35:46 +02:00
bf14e323e6 Fix build error in debug build on macOS
NDEBUG is the standard define, not DEBUG.
2019-09-20 23:41:54 +02:00
Julian Eisel
ac15bf1646 UI: Avoid file browser directory change if path didn't change
E.g. entering the file path field and then pressing enter without any
change would call an unneccesary directory change, causing flickering.
So the main point of this is to avoid flickering.

Without this the text field could also be used to refresh the file list,
but for that we have a proper button.
2019-09-20 20:47:39 +02:00
Julian Eisel
adfe68e202 UI: Replace big options button in file browser
The big options button in the lower left is now gone, it's replaced by a
smaller icon toggle button in the upper right.
That means I could also remove code for the region we had just for this
button.
I also added versioning code for the removal, to make sure the region is
removed cleanly when reading old files.
2019-09-20 17:42:08 +02:00
8c60205bef Fix T70109: Crash with the Data Transfer Modifier (with any 'Edge Data' option)
The BVHTree was erroneously marked as not cached.
2019-09-20 12:18:22 -03:00
Julian Eisel
f0ec7c2ec6 UI: Use vertical file list for "Recover Auto Save"
Pablo and William agreed that the main purpose of the layout should be
to list files in a way that it's easy see which files were
created/modified when. Previously it was set to "Long List" to show the
modification time, now the vertical list is much better suited. The time
is shown anyway.
2019-09-20 16:20:44 +02:00
c460b7e0c6 Fix T70112: Spot cone prevents selection 2019-09-21 00:19:09 +10:00
Julian Eisel
2f1e8f4b97 Remove redundant file bookmarks region toggle operator
For the default keymap we were only using the regular toolshelf
operator, doing this for the industry compatible keymap too now (we
could even remove it there, we don't use it in other editors).

Since we "now" have proper operators for toggling regions, this specific
one is totally redundant.
2019-09-20 15:54:59 +02:00
Julian Eisel
b20182e334 Refactor: Ensure there's always a valid file editor tool region
So far the file browser code had some lazy creation for the tool region,
even though it should always be there. The only reason I can see for
this is compatiblity. So I simply added versioning code to add the
region in case it's not there. Now we should be able to savely assume
the tool region to be there, whithout any unusual lazy-creation.
2019-09-20 15:35:28 +02:00
Julian Eisel
d1cc340e56 Rewrite file region handling for non-editor mode
This makes it so that regions only needed when the file browser is
invoked as an operation (e.g. Ctrl+O rather than a regular editor) are
lazy created then, and removed if the file browser is changed into a
regular editor then (e.g. Ctrl+O over regular file browser editor ->
Cancel).

That should remove some troublesome assumptions and makes versioning
redundant.
It also fixes the issue of an empty execute region at the bottom after
cancelling a file operation invoked from a regular file browser editor.
2019-09-20 15:18:25 +02:00
Yevgeny Makarov
7a83b64f7b UI: Fix Capitalization
Differential Revision: https://developer.blender.org/D5716
2019-09-20 14:31:24 +02:00
Himanshi Kalra
60af4d207b UI: Incorrect info message after batch rename
Differential Revision: https://developer.blender.org/D5744
2019-09-20 14:15:32 +02:00
c8b293ec05 Fix T69097: Empty context menu for dimensions
Adjust empty menu check to skip the menu title.
2019-09-20 21:05:28 +10:00
f431c19954 Cleanup: discarded-qualifier warning 2019-09-20 21:05:28 +10:00
Pedro Reis
fb6ef2ec8d Fix T69486: Reloading file in text editor marks file as modified
Differential Revision: https://developer.blender.org/D5847
2019-09-20 12:46:26 +02:00
Julian Eisel
f5dc979a7e Cleanup: Add/use utility to remove regions 2019-09-20 12:28:15 +02:00
Julian Eisel
09b728ff3e Fix empty file options region in regular editor
This would happen when opening a file browser as regular editor, opening
a temporary file browser from there (e.g. Ctrl+O) and cancelling the
operation.
In some cases this would cause most of the editor to be filled with an
empty operator options region:
* Go to Shading workspace
* File -> Append
* Cancel
2019-09-20 12:13:28 +02:00
078fcc6253 Fix paint cursor drawing asserts
The new paint cursor (introduced in rBe0c792135adf) mixed 3d and 2d
drawing leading to asserts [e.g. when tablet pressure sensitivity was
enabled for size, see D5820 also].

We could get away with always drawing in 3D [using vertformat with
comp_len 3 / GPU_SHADER_3D_UNIFORM_COLOR / imm_draw_circle_wire_3d],
even if in the Image Editor, but this patch clearly separates what is
drawn in 3d and what is in 2d.

part of T69957

Reviewers: jbakker

Differential Revision: https://developer.blender.org/D5836
2019-09-20 11:56:53 +02:00
fde8682d96 Fix T69995: Object Drawtype Set To Solid Issues
When setting an object draw type to Solid it always used the Material
color mode. This change only sets the material color when the viewport
is set to display textures.
2019-09-20 11:21:41 +02:00
44d0c868bf Fix T70101: Displace modifier handles empty vertex group incorrectly 2019-09-20 10:41:49 +02:00
f83a8a61ff Fix T69600: Bridge edges creates UV's with wrong rotation 2019-09-20 18:29:19 +10:00
cd236bc22d Fix T69355: Closing window stops video but not audio 2019-09-20 16:37:07 +10:00
01cb4f9862 Fix T65264: Quick Favorite use in node-editor
Each node tree type now has it's own quick-favorites.
2019-09-20 14:56:08 +10:00
3794d9ef6e Fix T69797: Shear gizmo doesn't update on pivot point change 2019-09-20 14:11:43 +10:00
9dd64cb088 Fix T67174: Weight paint gradient has empty redo panel 2019-09-20 12:49:13 +10:00
fd51d5d412 Mesh: support face-maps when joining
Resolves T64320
2019-09-20 12:09:22 +10:00
6dc7cefb78 Fix T69999: Active element pivot crashes without active object 2019-09-20 10:23:47 +10:00
5356577e4c Cleanup: shadow warning 2019-09-20 10:23:37 +10:00
Julian Eisel
c8df6f2cf9 Fix Preferences opens file browser in wrong window
Steps to reproduce were:
* Open Preferences in a new window (Edit -> Preferences)
* Set file browsers to open fullscreen (Interface->Editors->Temporary
  Windows)
* Open a file browser in the Preferences (e.g. Add-ons -> Install)
The file browser would be opened in the parent window, rather than the
preferences.
2019-09-19 22:35:48 +02:00
27642f24e1 Fix T69855: 3DView glitches involving depth buffer
The problem is that `DST.vmempool->passes` was not cleared, so passes
previously created in another drw function were being reused.
2019-09-19 17:25:25 -03:00
b11272a007 DRW: Deduplicate drw_draw_depth_loop functions 2019-09-19 17:25:25 -03:00
Julian Eisel
4a5af65fe9 Fix T70048: Assert when cancelling Append window
If the file browser was opened from an existing file browser editor
(using File -> Append would make the mouse hover the file browser in the
 Shading workspace), we need special handling for closing the fullscreen
area.
This change brings back the old way of handling fullscreen closing.
2019-09-19 20:21:42 +02:00
3791d7abfd UI: Consistent Tooltip for Add Torus Operator
Changes "Add" to "Construct" to be consistent with the other
primitive mesh add operations.
2019-09-19 13:52:46 -04:00
f4f190a399 Fix T69971 EEVEE: Bump does not work using a UVMap node as input
This fixes both the attribute and the uvmap node. Some other nodes are not
supported but I think it makes little sense.
2019-09-19 19:43:28 +02:00
5e2f0adb1b UI: layout support for fixed size buttons, and use for file browser open/cancel
Not exposed to Python API yet, this should get more detailed testing with different
layouts before that happens.

Ref T69652
2019-09-19 18:40:58 +02:00
Julian Eisel
ee12af9c97 Fix T70074: Missing file execute region in some files (crashes)
I'm not sure how a .blend file could get into this state, but apparently
for some files saved with versions of Blender after the file browser
changes, the execute region would not have been created. File browser
code assumes this region to be there however.
Luckily I found a file with which I could recreate the issue. My guess
is that the error only happens with files that were stored before
certain versioning fixes were done after the file browser redesign.

To fix this, we just let the versioning code for the execute region run
even with newest files. We can run this safely, it only acts if the
execute region actually doesn't exist.
2019-09-19 18:03:05 +02:00
5883b6fde2 Fix T70021: Alembic incomplete crease import
Creases are stored by the vertex indices of the edges. Sometimes they
were stored with (v1, v2) when the edge itself was stored with (v2, v1).
We now search for both orientations.

Sorting the vertex indices before searching avoids the second search
altogether when loading the example file of T70021.
2019-09-19 17:36:18 +02:00
c1612ca114 Fix T67471: hidden particle emitter occludes in Cycles rendered viewport 2019-09-19 17:31:53 +02:00
ee44f8a289 Fix T67724: Cycles renders metaballs with wrong texture space 2019-09-19 17:31:53 +02:00
08b0c08577 Fix the rest of T68666: Animated mesh UVs, vertex colors don’t update on
time change

followup to 815ca2310f, this one fixes the RNA_MeshLoopColor case, adds
RNA_VertexGroupElement and RNA_LatticePoint.

coop with @sergey, thx.

Fixes T68666
2019-09-19 17:22:49 +02:00
2480c9236f Fix T69610: Outliner doesn't update for text new and unlink
Redraw the outliner when text data-blocks are created and unlinked. This
also fixes a crash when unlinking.
2019-09-19 09:14:27 -06:00
fb09d229dd Alembic: Fix compiler error on Windows
Error was introduced in 34143e4510.
2019-09-19 17:10:50 +02:00
b5702d9bc0 Fix T55403: Alembic: export of animated child hairs
The parent hairs were written to Alembic even when the 'Parent Particles'
checkbox (`use_parent_particles`) was disabled. In this case the parent
hairs were not correct in Blender's memory, and thus also not correct in
the exported Alembic file. The Alembic exporter now respects this setting
and doesn't write the parent hairs when 'Parent Particles' is off.
2019-09-19 16:59:10 +02:00
931d280af7 Fix buffer overflow using bbone segment interpolation
Do proper segment clamping to a proper value.

Thanks Brecht for pair-coding!
2019-09-19 16:55:14 +02:00
1bf0384111 Fix T70077: GPenci Controls points are not displayed in right location
The problem was the unit matrix was not set in the uniform variable.
2019-09-19 16:38:24 +02:00
d0c772f68b Fix T69853: Object orientation is wrong with some AMD deprecated drivers.
This solution only reuses the performance workaround made for Intel.
But the original problem was not solved.
Not much we can do to solve it.
2019-09-19 11:18:18 -03:00
cb5ed2e5f4 Manpage gen script: fix for python < 3.7, and missing Blender build info.
Python3.7 is still fairly recent, not all distro use it as system python
yet, fallback to code compatible up to py3.5.

Also, often distro builds of Blender do not have the buildinfo, in that
case fallback to `SOURCE_DATE_EPOCH` envvar, and as last resort to
current time, as in orig patch D5756 (we still use blender builddate
when available).

Issues raised in recent own rBcd5c70630318.
2019-09-19 15:57:33 +02:00
815ca2310f Fix part of T68666: Animated mesh UVs, vertex colors don’t update on time change 2019-09-19 15:56:02 +02:00
34143e4510 Fix T70070: Path always absolute when importing Alembic
Importing an Alembic file with a relative path is now also possible.
2019-09-19 15:55:19 +02:00
Julian Eisel
1353158aa2 Fix crash in local collections with excluded layer
Steps to reproduce were:
* Add a new collection
* Put an object into it
* Exclude the selection (the checkbox in front of the name)
* Enable "Local Collections" in any viewport
-> Crash

Did not skip the excluded collections, causing an unsuccessful object
lookup (returned null-pointer).
2019-09-19 15:42:48 +02:00
3c09e4d8cc Fix T69993: vertex instancing only works on original vertices
This behavior was accidentally changed in 3e6f37b9, now it works compatible
with 2.79 again.
2019-09-19 15:27:02 +02:00
3977854c70 Cleanup: rename anim::duration to anim::duration_in_frames
Units should be explicit, and not left to be guessed by the reader.

The field is only used in a single C file, so it's a relatively low-risk
change.
2019-09-19 15:26:17 +02:00
71f2229b0d Fix T68091: Adding a corrupt video crashes/confuses Blender
The problematic video from T68091 clearly has an invalid stream duration
(it would be 55 centuries long if interpreted at 30 FPS, and given that
it was recorded with an Android 9 device, it's unlikely that recording
started that long ago). I've added a heuristic to check the stream
duration against the container duration; if the stream is more than 4x
longer than the container, Blender now falls back to the container
duration.

We could use MIN(stream duration, container duration), but there might
be video files out there where the container duration is less precise
than the stream duration; they are measured in different units of time
(microseconds for the container vs. frames for the stream).

Includes a unit test for the above heuristic.

Reviewed by: jbakker

Differential revision: https://developer.blender.org/D5853
2019-09-19 15:12:53 +02:00
fba35aa8c5 Use FFmpeg's own av_guess_frame_rate() function instead of guessing ourselves
This was introduced in FFmpeg lavf 55.1.100 in 2013. For systems that are
still on LibAV or older FFmpeg there is a fallback implementation that
performs the same guess as we did before in `av_get_r_frame_rate_compat()`.
2019-09-19 15:12:53 +02:00
1e09dd094b Cleanup: don't index the same array multiple times
There is now a clearer distinction between `video_stream` (the stream itself)
and `video_stream_index` (its index), and no more repetition of accessing
the same item of an array. This also makes the code a bit more readable in
preparation for an upcoming functional change.
2019-09-19 15:12:53 +02:00
2f6a064765 Fix T70068: sculpt mode hide masked not working after show all 2019-09-19 14:40:33 +02:00
441f6cf020 Fix T64855: smooth view not working in Eevee rendered mode 2019-09-19 14:09:49 +02:00
8927d416f6 Fix missing 3D viewport solid shading mode request for UVs and vertex colors
This probably fixes no current issues, because there is another one causing
these to be computed unnecessarily.
2019-09-19 14:03:03 +02:00
87ebc4ef4f Fix T70060: Add bgl wrapper for glVertexAttribIPointer 2019-09-19 12:54:37 +02:00
745088cb30 userdef_defaults for 'Render In' and 'File Browser'
Otherwise --factory-startup would e.g render as `Keep User Interface`
(which is supposed to be `New Window` by default)

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5851
2019-09-19 12:07:24 +02:00
658d7eeed2 Clean-up/safety check in new BKE_mesh_copy_settings().
From rBe7a514369fe70, since I did not have time to do proper review
in D5808...

Note that we could also consider that shallow copy of src should never
be dst of that function and add some asserts instead. For now going the
safest and simplest way though.
2019-09-19 12:06:07 +02:00
7a78bc5d24 Cleanup: Spelling in comment 2019-09-19 11:51:25 +02:00
5e332fd700 Fix T67934: Weight paint doesn't work with Subsurf/Multires
This is a regression since PBVH was introduced for weight paint.

The solution is: treat subsurf and multires modifiers as deforming
ones for the weight painting. This is an easiest solution to make
PBVH use subdivided location of original vertices.

This change could simplify some of the weight paint by removing
the grids check, since PBVH is not supposed to be built from grids
in this case anymore.

Differential Revision: https://developer.blender.org/D5751
2019-09-19 11:51:25 +02:00
74d27bb0ef Subdiv: Add vertex deformation callback to multires/subsurf
Currently unused but the intention is to use this to hook up these
modifiers to a generic deformed PBVH to make it easier to sculpt or
paint on a subdivided mesh.
2019-09-19 11:51:25 +02:00
65d8c771c7 Subdiv: Add deformation-only subdivision
Is intended to be used to generate an array of coordinates of coarse vertices
placed to the final subdivided position.
2019-09-19 11:51:25 +02:00
b2333a3534 Subdiv: Cleanup, comments 2019-09-19 11:51:25 +02:00
659ccd9cd2 Fix T66154: viewlayer hide/exclude settings getting lost for linked collections
The problem was that the object and collection pointers in Base and
LayerCollection would get lost of file read. Normally such ID pointers would
be resolved by pointing to an ID_ID placeholder which has the datablock name,
and then replacing it will the real datablock. However ID_ID is only written
for directly linked datablocks.

This adds the concept of an indirectly linked datablock with a weak reference
to it. For this we write an ID_ID_WEAK_REF code, which is a reference that
will only be resolved if the datablock was read for another reason.

Differential Revision: https://developer.blender.org/D4416
2019-09-19 11:32:35 +02:00
e7a514369f Modifiers: every modifier now copies mesh settings, fixing texture space issues
Modifier stack evaluation would copy mesh settings other than mesh topology
automatically, outside of the individual modifier evaluation. This leads to hard
to understand code, and makes it unclear which settings are available in following
modifiers, and which only after the entire stack is evaluated.

Now every modifier is responsible to ensure the mesh it outputs preserves materials,
texture space and other settings, or alters them as needed.

Fixes T64739: incorrect texture space for various modifiers

Differential Revision: https://developer.blender.org/D5808
2019-09-19 11:32:35 +02:00
5516e52fad Fix QuadriFlow build error on FreeBSD and compiler warnings on Linux 2019-09-19 11:30:08 +02:00
6f4e595e9b Fix T68852: Link select crashes after knife project
Knife project switches out of vertex selection mode, but wouldnt do this
for all participating meshes.
Logic in edbm_select_linked_pick would switch the viewcontext multiple
times and the meshes selectmode was not in sync then, leading e.g.
finding a vertex in 'unified_findnearest' (because last of the meshes
selectmode was SCE_SELECT_VERTEX), but then later in
'EDBM_elem_from_selectmode' other meshes selectmode was not matching
SCE_SELECT_VERTEX, leading to crash...

Reviewers: campbellbarton

Maniphest Tasks: T68852

Differential Revision: https://developer.blender.org/D5536
2019-09-19 11:27:51 +02:00
1888990934 Cleanup: Remove redundant name checking
The BKE function already does this checking.
2019-09-19 11:23:57 +02:00
05de43d843 Fix T70009: GPencil copied layer is linked to its original layer
As the layer and frame memory was duplicated, the pointers were connected to old data. This was solved when saved the file, but this was a bug. Also this required a duplication and clean all listbase items.

Now, instead to duplicate and clear memory for layers and frames, just create a new layer and frame. This solution fix the problem, it's faster and also keeps the code cleaner.
2019-09-19 10:38:15 +02:00
4e9aadac5e Fix T70033: Crash editing keymap operator
Expanding operator names could buffer overrun.
2019-09-19 17:15:19 +10:00
86590b90aa Cleanup: use uint,ushort,uchar for modifiers 2019-09-19 13:33:44 +10:00
d8a7e5ee32 Cleanup: spelling 2019-09-19 13:19:53 +10:00
741d7d60ed Cleanup: Manpage: use 'https' blender.org URL instead of 'http' one. 2019-09-18 23:04:23 +02:00
cd5c706303 Blender manpage generator: use blender build date instead of current time.
It makes much more sense to use the build timestamp of the Blender
binary used to generate that manpage, than the current time.

As a bonus, when Blender building makes use of the SOURCE_DATE_EPOCH envvar
(through CMake, since previous commit), this also propagate automatically
to that man page.

Inspired by D5756 by Bernhard M. Wiedemann (@bmwiedemann), thanks.
2019-09-18 23:04:23 +02:00
Bernhard M. Wiedemann
ea6c9f17bd Use cmake TIMESTAMP for BUILD_DATE+TIME
Use cmake TIMESTAMP for BUILD_DATE+TIME
this simplifies code a lot
and even makes it more portable to other platforms

TIMESTAMP is available since cmake-2.8.11 ; blender already requires
cmake>=3.5 so that is fine.

Note that with CMake>=3.8, if defined, the SOURCE_DATE_EPOCH envvar
will be used by CMake here.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Differential Revision: https://developer.blender.org/D5760
2019-09-18 23:04:23 +02:00
6f7a64b57f GPencil: Create blank texture only once by engine
This texture is used for missing textures as replace.

Differential Revision: https://developer.blender.org/D5845
2019-09-18 20:55:38 +02:00
e7fde3a0f3 Fix transforming paint curve edit points also doing
ED_sculpt_end_transform in sculpt mode

followup to rB67310ed97618, thx @mano-wii for the heads up.
2019-09-18 19:58:42 +02:00
85acd72c9b Fix remesher operator poll function
This commit also removes the name "voxel" from the messages because this function
is now used for the voxel remesher and quadriflow.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5842
2019-09-18 19:45:58 +02:00
67310ed976 Fix T70006: crash when transforming paint curve edit points in sculpt mode
This was caused by rB309cd047ef46.
Above commit introduced code that would skip early for sculptmode
(leaving out the neccessary createTransPaintCurveVerts).

Reviewers: pablodp606, jbakker, mano-wii

Maniphest Tasks: T70006

Differential Revision: https://developer.blender.org/D5837
2019-09-18 19:27:47 +02:00
383c4ba3d8 Fix excessive dependency graph evaluation while painting strokes
Particularly noticeable when vertex painting with a subsurf modifier.

In some cases every sculpt or paint stroke step would evaluate the dependency
graph. This should only happen for redraws. Now more selectively choose if the
dependency graph should be evaluated to initialize the view context. Doing it
in the view context evaluation is somewhat hidden, now it's more explicit.

Differential Revision: https://developer.blender.org/D5844
2019-09-18 18:19:27 +02:00
3e230cecf0 Depsgraph: Cleanup, spelling in comment 2019-09-18 17:56:22 +02:00
296c03a389 Subvid: Initial support of subdiv topology query
Just some higher level functions to access topology information.
2019-09-18 17:56:22 +02:00
acf1c027ce Subdiv: Cleanup, split function into smaller ones 2019-09-18 17:56:22 +02:00
2409a9f0af BLI_tasks: simplify/generalize heuristic computing default chunk size.
That code is simpler and more general (not limited to some specific
values of thread numbers). It still gives similar default chunk size as
what we had before, but handles smoother increase steps, and higher
number of threads, by keeping increasing the chunk size.

No functional change expected from that commit.
2019-09-18 17:38:08 +02:00
84bd9e284e GPencil: Fix unreported error using Grab sculpt in empty frame
When the grab brush was used in an empty frame, a new frame was created, but as the depsgraph was no tagged, the evaluated data was wrong and the Grab hash failed.
2019-09-18 17:37:55 +02:00
77f1f13663 GPU: AMD: Remove workaround that doesn't work 2019-09-18 12:33:23 -03:00
f9beb1bef1 Fix (unreported) missing viewport update deleting a particle
If children hairs were displayed in particle editmode, these would not
update when a particle was deleted.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D5840
2019-09-18 17:19:33 +02:00
a9a8eedd16 Fix T65816: Alembic export of procedural mesh results in a static mesh and crashes
The static mesh issue described in T65816 has been resolved by @Sergey
in T60094.

This commit fixes the last bit of the puzzle, which was two-fold:
- A missing depsgraph update when setting `orig_object.data = new_mesh`
  from Python. Thanks @Sergey for providing the fix :)
- Properly locking the interface while exporting. This prevents crashes
  as described in T60094. The previous approach of calling
  `BKE_spacedata_draw_locks()` was not enough.
2019-09-18 17:08:33 +02:00
a1318d2415 Fix T69580: Smooth brush freezes on highpoly mesh
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5831
2019-09-18 16:40:58 +02:00
4dbea85a3f Fix preference for file browser and new window not being saved
The subversion should just be bumped for cases like this, it doesn't cost
anything and functioning correctly is most important.
2019-09-18 16:36:07 +02:00
6278ab59bc Revert "UI: Open file browser in fullscreen by default"
This reverts commit b962aca800. We may revert
to the fullscreen file browser if it's not good enough by the time of the 2.81
release. But then it first needs some changes since the in between state now
is not good enough either.
2019-09-18 16:36:07 +02:00
16a384b485 Fix T69984: Cursor curve Alpha doesn't display curves other than Custom
Reviewed By: jbakker

Maniphest Tasks: T69984

Differential Revision: https://developer.blender.org/D5823
2019-09-18 16:37:13 +02:00
04843d1572 Sculpt: Split original normal into original normal and plane
This allows to create different effects with some brushes that use the sculpt plane.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5818
2019-09-18 16:34:24 +02:00
Julian Eisel
b962aca800 UI: Open file browser in fullscreen by default
Fullscreen as in, maximized area.

This may be a temporary change until we consider the temporary window
mode as working well enough.
Note that you can still enable the windowed mode in the Preferences
(Interface > Editors > Temporary Windows).
2019-09-18 14:51:40 +02:00
Julian Eisel
f5bbaf55ac UI: Preference for file browser as fullscreen area
Addes a Preference setting to choose between opening new file browsers
in a maximized area (like with the old file browser) or in a new window
(like the new one).
2019-09-18 14:37:11 +02:00
Julian Eisel
cac756a92a UI: Move render display type to Preferences
Moves the render display type (to choose between rendering in a new
window, in a fullscreen area, in an Image Editor, etc) from the scene to
the preferences.
2019-09-18 14:32:21 +02:00
Julian Eisel
95373e2749 Refactor temp-space opening for optional fullscreen mode
Will be put to use in followup commits.
2019-09-18 14:22:50 +02:00
e2cbf8b117 Cleanup: minor changes to paint undo
Use a shared tile freeing function.
2019-09-18 18:49:53 +10:00
8c0dea72b6 Fix segfault when polling OBJECT_OT_voxel_remesh without active object
The active object can be `NULL`, which causes a segfault in
`BKE_object_is_in_editmode(NULL)` (and if that were made NULL-safe, the
segfault would happen further down in `object_remesh_poll()`).
2019-09-18 10:23:42 +02:00
dc6cec65af Cleanup: includes for readfile.c 2019-09-18 13:29:08 +10:00
OmarSquircleArt
9609840b5e Fix T69989: Correct Mapping node min/max versioning.
The old min/max options specified the target min/max values, they didn't
act as min/max operators. So the versioning code should be adjusted
accordingly.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5828
2019-09-17 21:54:09 +02:00
e13a2cde28 GPU: Comment incorrect asserts
These asserts are too simple and triggers false positive.
2019-09-17 19:56:43 +02:00
3009429c90 Fix T69809, T69810: sculpt gone or crashing after render
Make a distinction between flush sculpt changes for rendering, and forcing
sculpt data structures to be rebuilt after mesh changes. Also don't use PBVH
for renders.
2019-09-17 19:20:08 +02:00
884a385287 GPU: Fix broken assert 2019-09-17 16:22:11 +02:00
41d6d1463f Fix paint cursor crash
The new paint cursor (introduced in rBe0c792135adf) could crash for 2d
painting without an active object.

Note there are still drawing asserts (because we are mixing 2d and 3d
drawing in 'paint_draw_cursor'), but these will be handled in a seperate
commit.

part of T69957

Reviewers: jbakker

Maniphest Tasks: T69957

Differential Revision: https://developer.blender.org/D5820
2019-09-17 15:43:05 +02:00
3a08153d7a DRW: Refactor to support draw call batching
Reviewers: brecht

Differential Revision: D4997
2019-09-17 15:16:43 +02:00
41299bce93 Fix T69808: crash using custom Node.draw_label
Start happening after 9ecbd67dfb, but code was already wrong.
2019-09-17 15:12:14 +02:00
71803f2c94 Fix T69687: Edit Curve culling
Curve edit points could disappear when the deformed curve is out of view
area. Fix similar to rB0f983e854052.

Reviewers: jbakker

Maniphest Tasks: T69687

Differential Revision: https://developer.blender.org/D5748
2019-09-17 15:03:53 +02:00
fb39f1776f Fix enabled dynamic size in pose brush
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5816
2019-09-17 14:59:49 +02:00
0927e7b835 Sculpt: Rename pinch to magnify in some brushes
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5815
2019-09-17 14:56:44 +02:00
54b690897e Fix topology automasking when starting from a boundary vertex
When starting automaking from a boundary vertex it was only updating the automasking factor in connected boundary vertices. This also fixes other similar functions like mask expand or dynamic mesh preview.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5812
2019-09-17 14:52:48 +02:00
58214ab52a Sculpt: Add pose origin preview to the Pose Brush
This commit makes the pose brush easier to control. It also includes a refactor of the pose brush init code.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D5761
2019-09-17 14:46:45 +02:00
9be5a94cf3 Fix part of T69728: drawing glitches with sculpt dynamic mesh preview
Depth test must default to off for drawing outside the 3D viewport and
overlays like cursors.
2019-09-17 12:24:31 +02:00
398de6a86f Alembic: fix updating of GUI when export progress is made
The `do_update` variable wasn't set after changing the `progress`
variable, causing the GUI only to update on redraw (f.e. when the user
was waving the mouse around).
2019-09-17 14:10:47 +02:00
a3c8afc7cd Cleanup: Alembic: use pointers instead of references when passing progress variables
Using pointers instead of references when passing progress variables
makes the C++ code more in line with the C code (as it doesn't transform
pointer parameters to reference parameters). Also makes it easier to
spot when a common Blender pattern is implemented incorrectly (fix will
be in the next commit).
2019-09-17 14:09:42 +02:00
c25f5a375e Fix T61313: gravity not displayed correct when changing unit scale
Display of velocity and acceleration units should be affected by unit scale.
Arguably the behavior of the physics simulation should be for gravity to remain
constant, but such design changes are outside the scope of bug fixing. At least
the UI should correctly reflect what the physics simulation will do.
2019-09-17 13:43:00 +02:00
8f662e84e0 Fix T69716: Can't select geometry hidden by faces created by modifiers
This kind of reverts rBc060a835 that was committed without discussion.
2019-09-17 08:26:57 -03:00
6ee2d10005 Fix T69974: crashes in .blend files where 3D viewport was split
This was caused by a missing copy of the recently adding 3D viewport shading
ID properties.
2019-09-17 13:20:11 +02:00
df5fae1fcc Fix T69963: GPencil Hotkeys (1,2,3) do not work to switch Select Mode in Edit Mode 2019-09-17 13:07:29 +02:00
271c6794d6 Cycles: Viewport Rendering Memory Improvement
Small memory reduction change by only storing the pixels of the combined
pass when it is being shown in the viewport. Previously the combined pass
was always calculated and present in the output buffer. The combined pass
will still be calculated.

It is a limitation in Blender that Cycles always had a combined pass.
This patch will remove the limitation from the code base of Cycles.
Blender still has the limitation, but will always request the combined
renderpass when doing final rendering.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5784
2019-09-17 11:24:55 +02:00
11b0c2080c UI: use unique name for install add-on operator
Was called "Install", which isn't useful in operator search.
2019-09-17 18:18:50 +10:00
aca58ae970 Tracking: Early output when drawing 0 path points
The rumors says that immBegin() will assert fail on 0 count. Not sure where exactly
that happens (can't reproduce that), but early output can't hurt.
2019-09-17 09:31:21 +02:00
e40dc53c44 Fix T69960: Track path tries to draw negative point counts 2019-09-17 09:29:56 +02:00
2b1e0c038c Tracking: Restore check for marker being disabled
A regression since refactor from yesterday which made it so path is displayed at
a frame where marker is disabled.
2019-09-17 09:29:13 +02:00
bac3184540 Tracking: Use proper wrapper around line width and point size 2019-09-17 09:18:22 +02:00
76650402f3 Fix T69931: Materials with keyframes duplicated by 'make single user' are linked.
Another sneaky bite from the infamous private ID data: While those
monsters are not in bmain, the actions used by their animdata are
regular cute little ID's, living with the herd in the safe and sound
Main DB...

So we have to be careful not to propagate the nasty black magic
required to handle the formers when we duplicate their animdata.

Saying it again: private ID datablocks should never have had their own
animdata & actions, this is endless issue also with RNA paths... And
makes copying of animation between materials and such needlessly
complicated.
2019-09-16 23:02:38 +02:00
7a0ca9f98f Cleanup/sanitize a bit Action copying within BKE_animdata_copy().
Whole animdata copying code would need much more love, but we can as
well sanitize some pieces of it when we hit them, for now.
2019-09-16 23:02:38 +02:00
8b53445e8d Fix T69612: Two instances of Bridge Edge Loops entries in Edge Context Menu 2019-09-16 22:36:09 +02:00
Julian Eisel
28ee0f97c3 UI: Open file options region for more operations
Open the file options region for image saving, linking and appending.
2019-09-16 18:35:27 +02:00
Julian Eisel
8d6b0eda5d UI: Show in-/decrement buttons for exporters
As per Brecht's suggestion, use the check_existing property to control
visibility of the '+' and '-' icons. It is typically set for save
operations.

Adds another FileSelectParams flag (to avoid duplicated propertie
lookups) and removes the recently introduced
FileSelectParams.action_type again.

Fixes T69881.
2019-09-16 18:25:31 +02:00
3618b2c359 Fix part of T65397: accidentally assigning shortcuts gives errors
This is not a proper solution, that will come later, this avoids the main
problematic error for now.
2019-09-16 14:33:19 +02:00
39e760fa1d Fix eevee volumetrics distribution at 1.0
reported in T69662

Reviewers: fclem

Differential Revision: https://developer.blender.org/D5809
2019-09-16 13:16:25 +02:00
9d2c8aa3c4 Tracking: Refactor path drawing code
Split into set of smaller functions, making it easier to tweak behavior.

Should be no functional changes.
2019-09-16 12:54:48 +02:00
7b9093e768 Cleanup: Spelling in comment 2019-09-16 12:54:48 +02:00
Julian Eisel
af9ca138ba Fix T69755: 'Enter' over file name not working
Was breaking event handling at the wrong place.
2019-09-16 12:46:56 +02:00
94ecad5809 Cleanup: Use const variables 2019-09-16 10:51:25 +02:00
95b60634c7 GPencil: Enable subdiv for 2-point strokes.
It makes sense when adding points to a straight line, e.g. for creating thickness variation in later modifiers.
2019-09-16 10:40:32 +02:00
345fb22ea3 Fix T64238: Scene Full Copy: Cameras bound to markers does not update.
That's exactly why we should get rid of all those 'custom cases'
remapping code, it's hard enough to keep a single place
(library_query.c) up to date and 100% valid, but having more areas doing
their own remapping is just impossible to maintain... Some day...
2019-09-16 10:03:41 +02:00
330a37f389 Revert "PyAPI: expose OperatorType.modal_keymap"
This reverts commit b53ee963b1.

Full support for defining modal enums and access through events
is more involved, revert for now.
2019-09-16 16:42:25 +10:00
f97eb0e338 Cleanup: use fixed indent in Python
Reduce right-shift.
2019-09-16 16:17:46 +10:00
b53ee963b1 PyAPI: expose OperatorType.modal_keymap
Support assigning modal keymaps once the operator is registered.
2019-09-16 16:05:53 +10:00
6cb1e38c87 ImBuf Py API: add filepath access
D5804 by @cmbasnett with setter support added.
2019-09-16 10:39:24 +10:00
367ce71b47 ImBuf Py API: rename filename to filepath
Match RNA image naming.
2019-09-16 10:31:08 +10:00
b043bef000 Cleanup: quiet warning -Wparentheses 2019-09-16 04:34:31 +10:00
00319df9fc Fix bl_app_override keyword argument use
D5737 by @cmporces
2019-09-16 04:31:22 +10:00
4a6f43d47b UI: Add extra file browser icons
Desktop, External Drive & Network Drive

These were already in the icon sheet, but not added in the Blender side.
2019-09-15 19:12:54 +02:00
bdc94ef4b9 Fix T69883: Deleting keyframe crashes blender
When delete in multiframe node the active frame gets NULL.
2019-09-15 18:56:57 +02:00
8e62fdbcbd UI: Add XYZ mirroring to the Tool Settings viewport header for Edit and Weight Paint modes
Previously, only X mirror was available here, but since we can now mirror on Y and Z, these should also be added.
2019-09-15 15:43:30 +02:00
87c0179857 Industry Compat keymap: Use Ctrl/Cmd + Up/Left/Right for navigating the file browser in addition to Alt
Windows generally uses Alt, and Mac uses Cmd. This commit makes both possible.
2019-09-15 12:29:25 +02:00
55e02e7931 Fix T69877: missing dependency update when setting PoseBone.custom_shape. 2019-09-15 11:15:58 +03:00
c9048e8e41 Sequencer: disable fades add/remove until eval() use is removed
2ec025d7be introduced 'eval()' on blend
file data-paths which can be used for code injection.
2019-09-15 10:59:31 +10:00
e2df789c48 fix: (unreported) When converting nurbs or curves to Mesh the generated UVMap is now named 'UVMap' 2019-09-14 23:16:38 +02:00
e9c18ea982 Cleanup: redundant code from recent sequence fade operator
No need to define class variables which are all overwritten,
also use __slots__ to avoid mistakes.

Remove redundant length check too.
2019-09-15 05:57:59 +10:00
14c160334d Cleanup: remove duplicate information in docstring
No need to document all options in the doc-string
since each option has it's own description.
2019-09-15 05:43:34 +10:00
19fc50ca6f Cleanup: pep8, unused args, indentation 2019-09-15 05:35:42 +10:00
96ff40859d Cleanup: quiet unused arg warning 2019-09-15 05:26:15 +10:00
2743eaf24e Cleanup: pep8
Quiet pylint warnings on keymaps.
2019-09-15 05:18:05 +10:00
Stefan Werner
2b9f4bcfa0 macOS: Replaced deprecated Cocoa API calls.
Most of these calls were replaced with the successors as suggested
by Xcode's Fix-It. Functionality should not be affected.
This reduces the number of warnings when building on macOS.
2019-09-14 20:27:16 +02:00
Stefan Werner
9d282d7a8d macOS: Replaced OSSpinLock with os_unfair_lock.
OSSplinLock is a deprecated API, os_unfair_lock is its successor.
This reduces the number of warnings when building on macOS.
2019-09-14 20:23:29 +02:00
ea70bd2abf MSVC: Fix macro collision with MSVC Headers
Picked up while investigating a build error on the functions branch
which seems to use this specific header in a way master doesn't.

The problem:

The MSVC headers define a `_CONCAT` macro, so does BLI_kdtree_imp.h
however at the end `BLI_kdtree_imp.h` undefines the macro making the
MS headers that still rely on it "unhappy".

Who's fault is this:

Ours, C99 Spec says

```
7.1.3 Reserved identifiers

- All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.

...

if the program removes (with #undef) any macro definition of an identifier in the first
group listed above, the behavior is undefined.
```

So we should not have defined it, and we definitely should not
have undefined it.

We have *tons* of these violations, although fixing them would be great
at one point lots of them are in /extern or in the 3rd party deps,
I'd rather deal with them on a case by case basis when it actually
causes issues.

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

Reviewers: campbellbarton, JacquesLucke
2019-09-14 09:59:42 -06:00
5fe14f32cf Quiet self assignment warning 2019-09-14 17:00:19 +02:00
5055a55bc4 VSE: quiet missing prototype warnings 2019-09-14 16:54:59 +02:00
7aeedf71b8 UI: quiet warning when drawing markers
The compiler was warning that it assumed that
crfa - 4 < cfra is always true even though that might not
be the case due to overflow. This patch just removes
the condition that caused the assumption.
2019-09-14 16:52:56 +02:00
38cc53a168 BLI: make Map.add_or_modify more powerful
The function now allows custom return types defined
by the callbacks. This can be useful when a user of the
data structure has to implement some custom behavior.
2019-09-14 16:25:17 +02:00
d6057b919d BLI: add utility to print VectorSet stats 2019-09-14 15:03:25 +02:00
a98760f7da BLI: speedup adding to VectorSet by removing a check 2019-09-14 14:41:19 +02:00
5b00ecf70b BLI: remove non const accessors in VectorSet
With this the values could have been changed without
updating the hash table.
2019-09-14 13:30:24 +02:00
dd8a70c246 BLI: add missing include 2019-09-14 12:44:23 +02:00
e73030e336 BLI: rename SetVector to VectorSet
The structure is a set built on top of a vector and not the other
way around.
2019-09-14 12:37:58 +02:00
79e1165bd7 BLI: Improve forwarding semantics of some data structures
This makes it possible to use e.g. `std::unique_ptr` in a map.
2019-09-14 12:11:14 +02:00
f60406ff25 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-09-14 15:29:28 +08:00
Stefan Werner
ca76ecfa0e Cleanup: clang-format 2019-09-14 09:26:51 +02:00
2ec025d7be VSE: Add operators to add and remove fades
Fades add:
Adds or updates a fade animation for either visual or audio strips.
    Fade options:
    - In, Out, In and Out create a fade animation of the given duration from
    the start of the sequence, to the end of the sequence, or on boths sides
    - From playhead: the fade animation goes from the start of sequences under the playhead to the playhead
    - To playhead: the fade animation goes from the playhead to the end of sequences under the playhead
    By default, the duration of the fade is 1 second.

Fades clear:
Removes fade animation from selected sequences.
Removes opacity or volume animation on selected sequences and resets the
property to a value of 1.0. Works on all types of sequences.

Author: gdquest

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D5166
2019-09-13 17:24:42 -07:00
a960dc4519 BLF: make library glyph cache handling thread-safe
Functions that utilize glyph cache should lock and unlock cache by
calling `blf_glyph_cache_acquire()` and `blf_glyph_cache_release()`.
Function `blf_glyph_cache_acquire()` will create glyph cache, if it doesn't exist.
Locking mutex is global and shared by all fonts.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5701
2019-09-13 17:24:42 -07:00
ab3a9dc1ed VSE: prefetching
When enabled prefetching(preview panel>view settings), a pernament running job
is created, that will render frames in the background until the cache is full.
If the cache is not filled fast enough, prefetch job suspends itself
at the last moment and will wait until it has chance to "catch up".
Effectively this will decouple rendering to separate thread, so rendering
itself is a bit faster.
Cache recycling behavior will be changed to "free furthest frame to the left
of playhead if possible, otherwise rightmost frame".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5386
2019-09-13 17:24:42 -07:00
0547a77536 Cleanup: use const args, variables 2019-09-14 08:12:53 +10:00
d30ec73d76 Cleanup: undeclared variable warnings, extra semicolon 2019-09-14 08:05:57 +10:00
1cdfc1d199 Fix T69857: image.load() API function does not load pixels
Broke after recent changes for DNA default initialization.
2019-09-13 23:07:08 +02:00
fd5c1972cd Revert "DRW: Refactor to support draw call batching"
This reverts commit ce34a6b0d7.
2019-09-13 23:03:10 +02:00
Stefan Werner
c80564ef9f macOS: Enabled posix_memalign() like on other Unix platforms. 2019-09-13 22:49:26 +02:00
57e0e520e8 Fix (unreported) 'smooth vertex colors' operator not respecting vertex
paint mask selection

followup to rBr27bbe7cbd9b, might as well make this consistent across
all the color operations [with the exception of 'Dirty Vertex Colors'
which is python]

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5786
2019-09-13 22:29:14 +02:00
89cc5c2bd3 Fix Particles: Keyed Physics crash when clicking on a particle slot
without a valid target

rB95b9680597f5 introduced code that would skip creation of GPUVertBuf
for ParticlePointCache if the keyed physics would not have a valid
target. Missing vertex buffer would lead to assert/crash.

This code is now removed (dont see a reason why this was done? afaict
2.79 also just displayed the particles without physics in this case and
this seems to be working just fine in 2.8 as well)

part of T69741

Reviewers: fclem

Maniphest Tasks: T69741

Differential Revision: https://developer.blender.org/D5781
2019-09-13 22:15:58 +02:00
Stefan Werner
2520f78971 Fixed macOS build, header cleanup was too agressive. 2019-09-13 21:29:05 +02:00
83e4991c16 Cleanup: unused headers for readfile, versioning 2019-09-14 05:21:25 +10:00
dc1f002fb7 Cleanup: unused headers for the windowmanager 2019-09-14 05:06:03 +10:00
5d4cbbb16c UI: don't mark batch rename as internal
Prevented it showing in operator search.
2019-09-14 02:39:58 +10:00
0ab550d8e0 UI: rename transform options
When added to quick-favourites, these names are used which
didn't make much sense out of the panel context.
2019-09-14 02:03:49 +10:00
Dalai Felinto
92736a7b75 Per-Viewport Collection Visibility
Support per-viewport collection visibility options.

Note 1: There is no way to show a collection that was not visible before
due to depsgraph. Otherwise we would risk having all the collections in
the depsgraph and I believe this is not the idea.

An alternative would be to have a new depsgraph for viewports that are
not local. Something to keep in mind if we do per-viewport current frame
in the future.

So for now what we do is to only allow collections visibility to be
disabled/hidden in this mode.

Note 2: hide_viewport (the eye icon) doesn't really matter for
depsgraph. So after the merge we can still ignore it to show the
collections locally in a viewport with no problems for the depsgraph.

Reviewers: brecht, sergey
Subscribers: billreynish

Related task: T61327
Differential Revision: https://developer.blender.org/D5611
2019-09-13 12:37:35 -03:00
ce34a6b0d7 DRW: Refactor to support draw call batching
Reviewers: brecht

Differential Revision: D4997
2019-09-13 17:32:18 +02:00
f7e8b58098 Fix BLI_bvhtree_overlap_ex assert 2019-09-13 12:19:54 -03:00
23a4149778 Fix "minimum twist" curve flipping issue
Correct the code to actually do what the comment says.
This fixes an issue where the curve would flip 180 degrees under certain
conditions.
2019-09-13 17:18:35 +02:00
6b0d1ef7e1 Cleanup: compiler warnings 2019-09-13 16:51:51 +02:00
27b82bbb75 Fix T69816: Using Transform gizmos in Sculpt Mode while MultiRes is activated crashes Blender
Reviewed By: jbakker

Maniphest Tasks: T69816

Differential Revision: https://developer.blender.org/D5779
2019-09-13 16:43:05 +02:00
f71d89bb04 Fix T69804: Transform tools in sculpt mode fails with transformed objects
Reviewed By: mano-wii

Maniphest Tasks: T69804

Differential Revision: https://developer.blender.org/D5777
2019-09-13 16:30:06 +02:00
0ec6564668 Cleanup: unused headers (GPU) 2019-09-14 00:22:24 +10:00
59f9c39f74 Fix T69846: Segment fault converting Curves to GPencil strokes
The problem was when the material slot had something, but the material was NULL.
2019-09-13 16:22:02 +02:00
d4fb850366 Fix T69829: Gpencil sample memory leaks. 2019-09-13 21:43:40 +08:00
Anthony Eriksson
77399283d4 Fix T69037: Automerge is greyed-out in popover
Split "use_mesh_automerge_and_split" and "double_threshold" into their
own column so .active doesn't have to be applied for the entire layout.

Reviewers: billreynish, mano-wii

Differential Revision: https://developer.blender.org/D5618
2019-09-13 09:29:50 -03:00
fcf94c772f UI: don't show decorators in Remesh panel 2019-09-13 14:06:41 +02:00
27bbe7cbd9 Fix vertex paint: color transform operators not respecting vertex paint
mask selection

for 'Invert', 'Levels', 'Hue saturation Value' and 'Bright/Contrast',
face mask was respected, but vertex mask wasnt...

Same code as done in 'Set Vertex Colors'.

reported in T69835

Reviewers: brecht

Maniphest Tasks: T69835

Differential Revision: https://developer.blender.org/D5783
2019-09-13 13:30:55 +02:00
cf858e7738 Cleanup: Use bool instead of int 2019-09-13 13:19:22 +02:00
f795bdbf21 Cleanup: use header guards 2019-09-13 21:12:43 +10:00
9e60e86057 Cleanup: clang-format 2019-09-13 21:12:43 +10:00
Joep Peters
95ef6dfa9e UI: use pageup/down and home/end to scroll to start/end of menus
Differential Revision: https://developer.blender.org/D5582
2019-09-13 13:06:06 +02:00
f7ee2348c0 Fix Particles Keyed Physics target UI greyed out
Picking the 'Target Object' as well as the 'System' number was greyed
out as long as 'Use Timing' was disabled. 'Use Timing' is unrelated for
the above two, these should always be active...

part of T69741

Reviewers: sergey

Maniphest Tasks: T69741

Differential Revision: https://developer.blender.org/D5782
2019-09-13 12:38:49 +02:00
f85ea4ae3c BLI: add non-const lookup methods for StringMap 2019-09-13 12:28:19 +02:00
08539312b2 BLI: add some missing methods to Map and SetVector 2019-09-13 12:10:40 +02:00
592a3d7b47 Tracking: Perform tracking and solving from a locked interface
Solves stability issues with possibly doing destructive changes to the
tracking setup. Locking interface is the simplest and most reliable way
to avoid crashes.

It is still possible to run non-destructive changes such as clip view
navigation. More operations can be marked as safe if needed.

Fixes T67012: Software closes when a processing marker is deleted
2019-09-13 11:59:34 +02:00
49c36d3430 Tracking: Move Lock Selection to an own operator
There are no functional changes as far as users are concerned,
just allows to mark operator as safe to be run from a locked
interface.
2019-09-13 11:59:34 +02:00
11b776d215 Tracking: Mark view operators as safe for locked interface 2019-09-13 11:59:34 +02:00
fa26012f51 Tracking: Cleanup, use bool type instead of int 2019-09-13 11:59:34 +02:00
a2b52dc571 Cycles: add Optix device backend
This uses hardware-accelerated raytracing on NVIDIA RTX graphics cards.

It is still currently experimental. Most features are supported, but a few
are still missing like baking, branched path tracing and using CPU memory.
https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Cycles#NVIDIA_RTX

For building with Optix support, the Optix SDK must be installed. See here for
build instructions:
https://wiki.blender.org/wiki/Building_Blender/CUDA

Differential Revision: https://developer.blender.org/D5363
2019-09-13 11:50:11 +02:00
53932f1f06 Cycles: add Optix support in the kernel
This adds all the kernel side changes for the Optix backend.

Ref D5363
2019-09-13 11:46:22 +02:00
7eb293a37b Build: output log file to tests/log.txt when running "make test" 2019-09-13 11:46:22 +02:00
577239d2ce GPencil: Fix unreported memory leak for weights
As the total of points was changed before free memory, if the total was lower than before, the remaining points were not released.
2019-09-13 11:18:48 +02:00
bb7c858598 BLI: make more integer type conversions explicit 2019-09-13 11:03:49 +02:00
394318da74 BLI: fix some integer conversions 2019-09-13 10:39:37 +02:00
57e55906f0 Add QuadriFlow remesher 2019-09-13 10:36:05 +02:00
1c44d08a69 BLI: new C++ hash table data structures
This commit adds some new hashing based data structures to blenlib.
All of them use open addressing with probing currently.
Furthermore, they support small object optimization, but it is not
customizable yet. I'll add support for this when necessary.
The following main data structures are included:

**Set**
A collection of values, where every value must exist at most once.
This is similar to a Python `set`.

**SetVector**
A combination of a Set and a Vector. It supports fast search for
elements and maintains insertion order when there are no deletes.
All elements are stored in a continuous array. So they can be
iterated over using a normal `ArrayRef`.

**Map**
A set of key-value-pairs, where every key must exist at most once.
This is similar to a Python `dict`.

**StringMap**
A special map for the case when the keys are strings. This case is
fairly common and allows for some optimizations. Most importantly,
many unnecessary allocations can be avoided by storing strings in
a single buffer. Furthermore, the interface of this class uses
`StringRef` to avoid unnecessary conversions.

This commit is a continuation of rB369d5e8ad2bb7.
2019-09-13 10:06:02 +02:00
8d12c2a836 UI: Fix Mask popover crumpled
Make popover wider and image ID widget full width, like in textures properties.
Not ideal but at least the image name can be read now, until the ID widget
gets a more compact redesign.

Fixes T67748
2019-09-13 00:20:59 +02:00
7137d1470a Docs: update link 2019-09-13 07:46:25 +10:00
bc109be34c Object Mode: don't use origin axis helpers for selection 2019-09-13 06:34:36 +10:00
b6838fd04f Revert "BLI: fix unregistering timer with same id twice"
This reverts commit a1d61c1c84.
Put by error
2019-09-12 22:23:07 +02:00
d7f594ae3a GPencil: New set of Brush icons
Added: Airbrush and Chisel
Changed: Marker

Design: @mendio

Subscribers: mendio

Differential Revision: https://developer.blender.org/D5774
2019-09-12 22:15:19 +02:00
a1d61c1c84 BLI: fix unregistering timer with same id twice 2019-09-12 22:14:23 +02:00
0672cc884c macOS fix typo on Frameworks dir 2019-09-12 23:13:52 +03:00
85a6c07670 macOS fix T67686 , use absolute path to load 3Dconnexion framework 2019-09-12 22:46:49 +03:00
6472662d66 Build: add "make test" command for Windows, output log file
Differential Revision: https://developer.blender.org/D5715
2019-09-12 20:23:03 +02:00
38d62a195b Fix build error on Windows 2019-09-12 19:58:11 +02:00
3062f341b3 BLI: fix illegal zero sized array 2019-09-12 18:46:31 +02:00
852c727073 Transform: AutoMerge & Split: Create and merge vertices at edge intersections
Differential Revision: D5635
2019-09-12 13:32:44 -03:00
ca5e1615a1 BMesh: New tool BM_mesh_intersect_edges
Along with the new utility `BM_vert_weld_linked_wire_edges_into_linked_faces`
2019-09-12 13:32:44 -03:00
f9ef59ccc8 BLIKdopBVH: New BLI_bvhtree_overlap_ex utility 2019-09-12 13:32:44 -03:00
5b2cebf49b Fix T69752: Texture paint sampling colors always 'merged down'
Rgression from rBaf4dcc6073fa.

paint_sample_color > imapaint_pick_face uses the the selection buffer
(DRW_select_buffer_sample_point) and to get flat colors [select_id_flat] we
need to be in SCE_SELECT_FACE mode. This was already fine if you had
'Face Selection Masking' turned on, but got colors including lighting
when turned of [select_id_uniform].

There was already an exception in 'select_cache_init' that turns on
SCE_SELECT_FACE for weightpaint, we just need this for texture paint
(vertex paint) as well... Also moved the logic into
select_id_get_object_select_mode.

Note we were also asserting here:
BLI_assert failed: /blender/source/blender/draw/engines/select/
select_engine.c:174, select_cache_init(), at 'e_data.context.select_mode
!= 0'

Note also this is not working correctly for vertexpaint (yet), but has
been discussed in T69752 and there is a solution by @mano-wii in P1032.

Reviewers: mano-wii

Subscribers: mano-wii

Maniphest Tasks: T69752

Differential Revision: https://developer.blender.org/D5775
2019-09-12 18:23:36 +02:00
OmarSquircleArt
2ea82e86ca Shading: Add Vertex Color node.
This patch adds a new Vertex Color node. The node also returns the alpha
of the vertex color layer as an output.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5767
2019-09-12 17:42:13 +02:00
f80018b5f7 Fix: missing atomic include 2019-09-12 17:03:03 +02:00
058d218254 BLI: new StringRef and StringRefNull data structures
These two data structures reference strings somewhere in memory.
They do not own the referenced string. The string is considered
const.

A string referenced by StringRefNull can be expected to be
null-terminated. That is not the case for StringRef.

This commit is a continuation of rB369d5e8ad2bb7c2.
2019-09-12 16:55:35 +02:00
Julian Eisel
914f4308fb Fix T69791: Fix crash reading old file browser in temporary window
When reading a old .blend file (from before the new file browser
design), we wouldn't create the execute region for existing file
editors. This usually wasn't an issue, but it could become one when a
file browser was opened in a temporary screen before, and that screen
was still visible. Then code spawning the new file browser would re-use
the old file browser data, assuming the execute region was there.

Handle this in versioning code and let rest of the code keep sane
assumtions (e.g. that there always is a execute region, even if
invisible).
2019-09-12 16:36:07 +02:00
52b32fde18 GPencil: Add Simplify panel to Workbench engine 2019-09-12 16:21:34 +02:00
78496331f5 GPencil: Fix missing Simplify panel in Cycles
Differential Revision: https://developer.blender.org/D5776
2019-09-12 16:21:34 +02:00
c40171c60d Themes: Update Blender Light theme.
Fixes T69531
2019-09-12 16:08:58 +02:00
2e10cb02fb UI: Two-column layout for User Interface theme settings.
Group related settings in columns:
* Align Inner, Inner Selected and Outline.
* Align Text, Text Selected and Item.

Place Shaded settings in its own sub-panel.
2019-09-12 16:08:58 +02:00
c168092014 Fix T69792: Auto-merge split faces creates faces with unrelated wire edges. 2019-09-12 10:58:18 -03:00
62c820cdaa UI: avoid using parenthesis
Convention is not to use parenthesis,
Details are included in tool-tip.
2019-09-12 22:53:29 +10:00
c6221f5ce4 BLI: fix unregistering timer with same id twice 2019-09-12 14:44:33 +02:00
369d5e8ad2 BLI: new C++ ArrayRef, Vector, Stack, ... data structures
Many generic C++ data structures have been developed in the
functions branch. This commit merges a first chunk of them into
master. The following new data structures are included:

Array: Owns a memory buffer with a fixed size. It is different
  from std::array in that the size is not part of the type.

ArrayRef: References an array owned by someone else. All elements
  in the referenced array are considered to be const. This should
  be the preferred parameter type for functions that take arrays
  as input.

MutableArrayRef: References an array owned by someone else. The
  elements in the referenced array can be changed.

IndexRange: Specifies a continuous range of integers with a start
  and end index.

IntrusiveListBaseWrapper: A utility class that allows iterating
  over ListBase instances where the prev and next pointer are
  stored in the objects directly.

Stack: A stack implemented on top of a vector.

Vector: An array that can grow dynamically.

Allocators: Three allocator types are included that can be used
  by the container types to support different use cases.

The Stack and Vector support small object optimization. So when
the amount of elements in them is below a certain threshold, no
memory allocation is performed.

Additionally, most methods have unit tests.

I'm merging this without normal code review, after I checked the
code roughly with Sergey, and after we talked about it with Brecht.
2019-09-12 14:23:21 +02:00
1954723635 Cycles: Fix Show Instanced Local View Objects
The local view check in the RNA didn't support instanced objects. Every
object has a copy of the local_view_bits from the base. This patch
changes the check to look at the local stored bits.

This patch removes the check if the object is part of the view_layer.
In the cases we are using it this check is not relevant. The `mesh_tissue`
add-on also uses it, and is not effected by this change.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5773
2019-09-12 13:33:46 +02:00
OmarSquircleArt
613b37bc2c Shading: Add More Features To The Voronoi Node.
This patch allows the Voronoi node to operate in 1D, 2D, and 4D space.
It also adds a Randomness input to control the randomness of the texture.
Additionally, it adds three new modes of operation:

- Smooth F1: A smooth version of F1 Voronoi with no discontinuities.
- Distance To Edge: Returns the distance to the edges of the cells.
- N-Sphere Radius: Returns the radius of the n-sphere inscribed in
the cells. In other words, it is half the distance between the
closest feature point and the feature point closest to it.

And it removes the following three modes of operation:

- F3.
- F4.
- Cracks.

The Distance metric is now called Euclidean, and it computes the actual
euclidean distance as opposed to the old method of computing the squared
euclidean distance.

This breaks backward compatibility in many ways, including the base case.

Reviewers: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D5743
2019-09-12 13:09:31 +02:00
0137509476 Fix T69789: Assert when create a new Full Copy scene base on 2D template.
Private ID data (nodetrees and scene collections...) need special care
and handling of their copy flags, and checks must be adapted too.

In that case, issue came from the fact that even though those IDs have
to be copied outside of bmain, we may still require usercount handling.

That commit also fixes a somewhat related issue - we cannot use the
non-id private data copying flag for private IDs copying, due to
difference in handling of usercount again.
2019-09-12 12:27:39 +02:00
4df75063e1 UI: Sub-type for Screen Grab Size.
Set to Pixel.
2019-09-12 12:23:51 +02:00
1885246015 UI: Wrong label in Screen Grab Size.
It was using "screen_grab_size" as label.
2019-09-12 12:23:51 +02:00
b6027b4efd UI: Labels capitalization.
Capitalize the first letter of a word, except articles and prepositions.
2019-09-12 12:23:51 +02:00
492a7998d5 Fix T69785: crash dragging in empty space in edit mode 2019-09-12 11:34:42 +02:00
9fa8614b32 Cleanup: compiler warnings 2019-09-12 11:34:42 +02:00
2cec4af124 Fix T69582: Empties no longer support Rigid Body Constraints
This is caused by rB1342d1879e12 and would also break the whole
"Connect" workflow [which relies on empties]

Reviewers: mont29, brecht

Maniphest Tasks: T69582

Differential Revision: https://developer.blender.org/D5772
2019-09-12 11:24:23 +02:00
bbae7874c0 Fix T69782: crash using gizmos in grease pencil edit mode 2019-09-12 11:14:44 +02:00
a22c2ceb0f Cleanup: line breaks with comments 2019-09-12 18:59:44 +10:00
1e2f2f27e9 Fix crash when doing cycles rendering
During F-12 Rendering the passed screen was Null, but decoded as a
number. In stead of a Null a 0 will be send to cycles python wrapper.
2019-09-12 10:25:39 +02:00
861697c9e5 Cycles: Initial Support For Local View
This diff will add support for local view to Cycles rendered preview mode.

Currently the implementation shows same results as EEVEE does. This entails
a difference with Blender 2.79, where lights were automatically added to the
local view. {T69780} describes this should be solved before the next release.

This patch also solves missing `owner_id` issues when using the RNA CPP Api
from Cycles. Cycles didn't provide the `owner_id` making some functionality
fail, what then was worked around in Blender. It also fixes an issue in
`makesrna` where incorrect CPP code was generated when only `PARM_RNAPTR`
was provided.

An optional `view_layer` parameter is added to the `Object.local_view_get`
method to reduce lookups.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5753
2019-09-12 09:08:22 +02:00
70a9347705 Fix T69737: Crash using the Elastic Deform brush and Compressibility
Also renamed "compressibility" to "volume preservation"

Reviewed By: brecht

Maniphest Tasks: T69737

Differential Revision: https://developer.blender.org/D5757
2019-09-12 03:55:53 +02:00
1e375ab5a1 3D View: only show origin axes when in object mode 2019-09-12 07:31:46 +10:00
32b49f9e9f Fix transforming armature origins
Using geometry update doesn't work on armatures.
2019-09-12 07:28:49 +10:00
62ffc0c2c9 DNA: use defaults for SceneEEVEE 2019-09-12 06:53:25 +10:00
ff085e85d3 DNA: move View3D, View3DOverlay into DNA_view3d_defaults.h 2019-09-12 06:48:13 +10:00
6db00065c5 Cleanup: remove redundant RNA defaults
These are now set from DNA defaults.
2019-09-12 06:25:32 +10:00
9a076dd95a DNA: defaults for ID types 2019-09-12 04:58:09 +10:00
2f08a25d83 Cleanup: Warning: 'sld': local variable is initialized but not referenced 2019-09-11 15:22:00 -03:00
3bd4f229be Transform: Edit Mesh: Support mirror on all axes
Part of T68930

Now two other mirror options that can be enabled simultaneously: Mirror Y and Z.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Subscribers: ThatAsherGuy

Differential Revision: https://developer.blender.org/D5720
2019-09-11 13:49:18 -03:00
OmarSquircleArt
003802db83 Cycles: Ignore links with unavailable sockets.
Ignore links with unavailable/disabled sockets during shader graph
generation.
2019-09-11 18:32:50 +02:00
6d85280ec3 Fix T69458: Edit Mesh selection bug from camera view 2019-09-11 13:06:28 -03:00
7e245e482c Fix T59143: Frame Selected Doesn't work in hair particle editmode
This is caused by rBeb521b22b2b1.

Looks like `PE_minmax` doesnt play nice with the evaluated view_layer.
If we look inside `PE_get_current`, then `BKE_ptcache_ids_from_object`
will actually return a list of `PTCacheID` for the evaluated object.
However, looking further, then `PTCacheEdit` / `psys->pointcache->edit`
is always NULL for the evaluated object.

Without a valid `PTCacheEdit`, `PE_minmax` will basically do nothing.
So now we are passing the non-evaluated view layer in the case of
particles.

Regarding to @sergey, in a longer term we should probably make it so
evaluated pointcache have pointer to edit.

Reviewers: sergey

Maniphest Tasks: T59143

Differential Revision: https://developer.blender.org/D5758
2019-09-11 18:01:45 +02:00
30aa67d5d5 Fix T69558: crash in BKE_scene_update_sound for a soundstrip without
linked sound

Crash could be triggered by just adding any object to the scene.

Reviewers: sergey

Maniphest Tasks: T69558

Differential Revision: https://developer.blender.org/D5764
2019-09-11 17:47:58 +02:00
d84d49280b Fix T69722: Pose brush crashes with multires modifier
Reviewed By: brecht

Maniphest Tasks: T69722

Differential Revision: https://developer.blender.org/D5759
2019-09-11 17:42:58 +02:00
ee734dcc73 Fix T69754: crash in sculpting after library overrides were enabled
The rest of this function uses G_MAIN, so do the same.
2019-09-11 17:32:44 +02:00
6283b5b817 UI: move transform settings from pivot to options panel
These weren't related to pivot, so add in a new options panel.
2019-09-12 00:52:46 +10:00
5f47adc0f7 UI: enable topbar by default
This lets us add settings to the options panel without them being
hidden from the user.
2019-09-12 00:52:46 +10:00
4665a08873 Python: Fix to support old-style handlers
Can not re-use single typle even if there is a single input pointer:
the all-arguments-typle consists of 2 elements.
2019-09-11 15:53:36 +02:00
fc16cf8d2d LibOverride: Enable them in UI by default.
This is minimal 'flip-switch' commit, proper cleanup and removal of the
option thing will happen later, once we are sure that we can release
2.81 with it enabled.

For now, we have a `--disable-library-override` now. ;)
2019-09-11 15:19:14 +02:00
e0ca19152f DNA: initialize defaults for output paths 2019-09-11 22:21:39 +10:00
0c2a314443 RNA: automatically initialize defaults from DNA
Use defaults from DNA_*_defaults.h headers, this avoids calling
RNA_def_property_*_default explicitly & having to repeat values.
2019-09-11 22:21:13 +10:00
a941e9de89 DNA: make DNA_elem_size_nr a public function
Needed for getting struct member offsets.
2019-09-11 22:20:36 +10:00
3f5c54575f RNA: separate internal allocation function 2019-09-11 22:16:36 +10:00
309cd047ef Sculpt: Transform tool
The sculpt mode transform tool applies the sculpt pivot transformation to all vertices, taking XYZ symmetry into account.
This commit also includes an operator to set the pivot point initial position.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5717
2019-09-11 13:07:19 +02:00
ef18b672f5 GPencil: New Brush postprocesing Simplify
This option allows to apply a simplify when the stroke is completed. The simplify use the Adaptive option to keep the shape.
2019-09-11 12:28:23 +02:00
7e61e59725 Cycles: Display RenderPass in Viewport
This change allows the user to select a renderpass in the 3d viewport.

Added support for external renderers to extend the `View3DShading` struct.
This way Blender doesn't need to know the features an external render engine wants to support.
Note that the View3DShading is also available in the scene->display.shading; although this is
supported, it does not make sense for render engines to put something here as it is really
scene/workbench related.

Currently cycles assumes that it always needs to calculate the combined pass; it ignores the
`pass_flag` in KernelFilm. We could optimize this but that was not in scope of this change

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5689
2019-09-11 12:19:44 +02:00
d4f8bc80a4 Armature: convert the length Python property of bones to a RNA property.
This allows accessing it from drivers and using it in UI, as
demonstrated by adding it to the transform panel of 3D View.

As an aside, properly mark transform-related properties of Bone
read-only, as they can only be changed correctly in edit mode.
2019-09-11 12:49:04 +03:00
Julian Eisel
69e0f485c9 Fix T69736: Flipping bookmarks region empties it 2019-09-11 11:39:58 +02:00
9bb6058489 Cleanup: typo/spelling 2019-09-11 11:29:45 +02:00
f7fce00297 Depsgraph: Allow non-keyed changes from frame_change_post handler
Makes it possible to do custom edits to animated properties from a
python handler.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5738
2019-09-11 10:43:27 +02:00
ea513a97f5 Render: Only run callbacks for non-preview renders
Those handlers are usually done to edit scene which is being rendered,
and this is not supported due to a fully localized nature of the preview
bmain.

There is still non-conditional callback in stats_background which is a
bit tricky to cover with check, but this code is not supposed to be run
for previews anyway.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5731
2019-09-11 10:43:27 +02:00
a650258158 Python handlers: Pass depsgraph to events where it makes sense
The goal is to make it possible to access evaluated datablocks at a
corresponding context. For example, be able to check evaluated state
if an object used for rendering.

Allows to write scripts in a safe manner for T63548 and T60094.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5726
2019-09-11 10:43:27 +02:00
022de797f1 Depsgraph: Introduce depsgraph registry
Allows to access dependency graphs created for render engines
to inform them about changes in .blend file structure from the
Python handlers.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5724
2019-09-11 10:43:27 +02:00
73a199e96a Depsgraph: Pass bmain to depsgraph object creation
Currently unused, but will allow to keep of an owner of the depsgraph.

Could also simplify other APIs in the future by avoiding to pass bmain
explicitly to relation update functions and things like that.
2019-09-11 10:43:27 +02:00
559df2fed9 Transform: Snap: Fix mixed snap without edge
Face snapping was disregarded when approaching an edge.
2019-09-10 22:09:05 -03:00
4ce3fbd52a UI: File Browser Friendly Volume Descriptions
File Browser Volumes list gets nicer friendly drive names with volume label or device description.

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

Reviewed by Brecht Van Lommel
2019-09-10 15:12:42 -07:00
fa12428ede Fix T69729: Missing Direction buttons in Draw Sharp brush
Reviewed By: brecht

Maniphest Tasks: T69729

Differential Revision: https://developer.blender.org/D5746
2019-09-10 22:05:12 +02:00
f1b52ef211 EEVEE: Volume: Fix error in fallback integration algo 2019-09-10 21:59:33 +02:00
caf494444c EEVEE: Volume: Speedup: Use Image load store extension
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5740
2019-09-10 21:59:16 +02:00
Julian Eisel
42c062c98a UI: File browser deselect on click on empty space
For the default and industry compatible keymap, clicking on empty space
in the file browser will deselect all files.

Also makes selection use same operator description we use for other
select operators.
2019-09-10 18:40:31 +02:00
01a3a9c818 Fix SDNA error expanding names not updating name array sizes
This doesn't cause problems at the moment,
it just makes using name sizes possible in the future.
2019-09-11 01:51:15 +10:00
2f4153396c Cleanup: no need to add Brush.flag2
Also use 'use_' prefix for RNA booleans.
2019-09-11 01:51:15 +10:00
5ba0726bc1 GPencil: Deduplicate function
The same code was duplicated and now it was moved to shared function.
2019-09-10 17:49:27 +02:00
841df2b98e Fix T69723: Crash with mask expand operator while in rendered or material view
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5745
2019-09-10 17:45:41 +02:00
0174185e2f GPencil: New Simplify Tint option
This is useful to disable all layers tint in one step and it will be used for future operators.
2019-09-10 17:41:23 +02:00
8f55794c0e UI: File Browser Custom Folder Color
Allows file browser folders to be shown in a theme-selectable color, default of manila.

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

Reviewed by Brecht Van Lommel
2019-09-10 08:07:39 -07:00
a3e7440cfd Sculpt: Grab Active Vertex and Dynamic Mesh Preview
Grab active vertex snaps the maximum strength of the grab brush to the highlighted active vertex, making it easier to manipulate low poly models or meshes with subdivision surfaces.
Dynamic Mesh Preview generates a list of connected vertices from the active vertex and draws them from the cursor code. This helps to visualize the real geometry the user is manipulating from sculpt mode when there are active modifiers.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5646
2019-09-10 16:24:09 +02:00
e0f7ada0d2 Fix warning and naming in mask expand
Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5742
2019-09-10 15:53:02 +02:00
a13b1b18de Fix T69702: crash using particles rendered as whole collection
This happened when the 'Whole Collection' option was enabled next to the
'Use Count' option. These two are exclusive but some code paths only
checked for 'Use Count'.

Reviewers: brecht

Maniphest Tasks: T69702

Differential Revision: https://developer.blender.org/D5741
2019-09-10 15:39:38 +02:00
cfb3011e52 Sculpt: Mask Extract operator
This operator extracts the paint mask to a new mesh object. It can extract the paint mask creating a boundary loop in the geometry, making it ready for adding a subdivision surface modifier.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5384
2019-09-10 15:19:48 +02:00
0083c96125 Sculpt: Mask Expand operator
This operator is a combined version of mask expand and mask by normal from the sculpt branch. It can be used to quickly isolate parts of a model based on topology or curvature.
- Shift + A starts the operator in topology mode from the active vertex
- Shift + Alt + A starts the operator in curvature mode from the active vertex

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5657
2019-09-10 15:13:37 +02:00
ef47c99fcb Fix T69651: Inpaint node distance parameter: Default value does not match minimum value
probably makes sense to allow for zero iterations...

Reviewers: jbakker

Maniphest Tasks: T69651

Differential Revision: https://developer.blender.org/D5728
2019-09-10 13:35:49 +02:00
b2b52c6c91 Fix T69432: Hair particle editmode: hiding not working
PTCacheEditPoint flag PEP_HIDE was not respected at all...

Reviewers: brecht

Maniphest Tasks: T69432

Differential Revision: https://developer.blender.org/D5739
2019-09-10 13:15:29 +02:00
df8341a486 Python: don't include distutils Windows installer executables for Linux/macOS
They were detected as (false positive) malware with ClamAV. It's unlikely
someone would need these files, and e.g. the Debian Python package also
excludes them with a custom patch.
2019-09-10 12:44:52 +02:00
bf6e05562c Fix assert hiding selected particles
was trying to get a boolean with RNA_enum_get (instead of
RNA_boolean_get)

Spotted while looking into T69680, T69432
2019-09-10 11:31:40 +02:00
3e81c1c1d5 Fix (unreported) crash after new mapping node commit.
Blatant obvious usage of freed memory in rBbaaa89a0bc54.

And also fix a memleak in same code/commit...
2019-09-09 22:20:32 +02:00
c8c3e7d284 Cleanup: trailing space, remove tabs, pep8 2019-09-10 06:17:59 +10:00
51334dd3a6 Fix T69686: Cycles OpenCL build error after recent changes 2019-09-09 22:11:23 +02:00
0426866eb0 Fix T67637: Selected edges hard to see with wireframe
Always show selected edges in wire/xray modes.
2019-09-10 05:59:50 +10:00
OmarSquircleArt
f2176b3ff3 Shading: Extend Musgrave node to other dimensions.
This patch extends Musgrave noise to operate in 1D, 2D, 3D, and 4D
space. The Color output was also removed because it was identical
to the Fac output.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5566
2019-09-09 21:06:55 +02:00
c2d37929b4 Fix T69633: weird behavior of operator_menu_enum tooltips.
For operators with dynamic tooltips the tooltip calculation is
deferred until the moment it is actually shown for performance
reasons, with the tooltip field left blank for the time being.
Enum menu code shouldn't jump in and assign a tooltip either.

The menu button itself can't show a dynamic tooltip because it
does not actually call the operator, and has no reference to it.

As a side change, allow returning None from the python callback
as the most natural way to fall back to the default tooltip.
2019-09-09 21:13:34 +03:00
ee9fb174f4 Added function to calculate the total area of a mesh. 2019-09-09 19:41:12 +02:00
9f859528e9 DNA: use defaults for Object, Mesh, Material 2019-09-10 03:27:27 +10:00
b24fdaed65 DNA: add theme & preferences to defaults
Use existing theme & preferences for defaults.
2019-09-10 03:27:27 +10:00
6be3348505 Cleanup: fix compiler warnings 2019-09-09 19:22:54 +02:00
828ef61cd1 Fix crashing mask brush after recent changes 2019-09-09 19:19:59 +02:00
8594cdb456 Fix build error after DNA defaults changing
dna_type_offsets.h must be generated before we use it in blenkernel,
similar to what we already do for blenloader.
2019-09-09 19:09:13 +02:00
bfbee87831 Sculpt: Pose Brush
This brush lets the user pose a model simulating an armature-like deformation. The pivot point for rotation is calculated automatically based on the radius of the brush and the topology of the model.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5647
2019-09-09 17:55:16 +02:00
55245ed6ad Fix (unreported) non-official X3D add-on enabled in factory startup.
Forgot to remove it from there when I moved it to community-supported
status last week.

Also raising subversion.
2019-09-09 17:42:44 +02:00
22d157d469 I18n: dirty workaround for PITA ghost classes remaining after unregister.
Spent again a whole day trying to understand what happens here, with no
luck. For some reasons, OperatorProperties children of unregistered
operator classes remain accessible, with their `bl_rna` member, although
that one is 100% invalid (freed memory, crashes with ASAN builds).

Funny thing is, I cannot reproduce that situation when disabling the
add-on from the py console of a Blender-with-UI.

Note: issue revealed by X3D add-on, which is still enabled in factory
settings, while not being officially supported any more, this has to be
fixed in a separate commit.
2019-09-09 17:42:44 +02:00
e781e9565d UI: Format Memory Strings in Binary
Show all memory-related byte size strings calculated with a base of 1024.

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

Reviewed by Brecht Van Lommel
2019-09-09 08:38:01 -07:00
6d4b311888 UI: File Browser Sizes in Binary for Windows
This adds per-platform change so Windows users will see file sizes calculated with a base of 1024.

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

Reviewed by Brecht Van Lommel
2019-09-09 08:29:21 -07:00
2b2739724e Sculpt: Topology automasking
The sculpt automasking feature assigns a factor to each vertex before starting the stroke. This can be used for isolating disconnected meshes, masking cavities, mesh boundary edges or creating topological falloffs.

This commit implements automasking in all brushes and topology automasking without topology falloff.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5645
2019-09-09 17:02:04 +02:00
5fe83ffb3a Cleanup: unused functions 2019-09-10 00:42:04 +10:00
Julian Eisel
2aa3e9c67c UI: Add superimposed + and - icons for file number
Brings back + and - icons to the file name button, but now as
superimposed icons.
2019-09-09 16:37:47 +02:00
Julian Eisel
828905190e UI: Refactor and improve buttton extra icons
Without this patch there could only be one superimposed icon
and the operators were hard coded for the button types.
This keeps the previous, sort of predefined extra icons working in a
rather generic way, but allows adding specific ones for specific case
through `UI_but_extra_operator_icon_set()`.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D5730
2019-09-09 16:37:47 +02:00
9b6233b27c Partial revert "Edit Mesh: Change color behavior"
Using a lighter color for faces than edges makes edges hard to see
in wire-frame display mode. See T67637.

This partially reverts commit 203f9a49e2.
2019-09-10 00:33:31 +10:00
2541d03917 Fix T69382: Crash - Regression - GPU Intel HD 4000
Workarounds were not being enabled for drivers like `10.18.10.5069`.
2019-09-09 11:32:32 -03:00
13206a6dc0 Sculpt: Mask Filter and Dirty Mask generator
The mask filter operator modifies the whole paint mask. In includes multiple operations like smooth, grow or contrast accessible from a pie menu.
The dirty mask generator is similar to Dirty Vertex Colors, but it generates a paint mask. It can be used to mask cavities in the sculpt.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5496
2019-09-09 16:30:12 +02:00
87c7135da5 Cleanup: GPencil small improvements in comparison
As the function `gpencil_onion_active()` has a loop, if some condition is false before we can avoid the loop.
2019-09-09 16:25:44 +02:00
bb8d859a68 GPencil: Fix unreported problem when main Onion switch is disabled
The main switch was not checked and the function was doing all calculations, but the data was not used. This makes all slower than expected because the user had the Onion Skinning disabled, but internally was running.
2019-09-09 16:20:40 +02:00
3d2b0c9b40 Cleanup: expand tabs 2019-09-10 00:04:02 +10:00
e22bae15aa Cleanup: missing break & shadowing warnings 2019-09-10 00:04:02 +10:00
6a4df70d41 Sculpt: Mesh Filter Tool
The mesh filter tool applies a deformation to all vertices in the mesh at the same time. It includes multiple deformation modes and the option to lock the deformation axis.
This commit also includes the FilterCache, which is needed in some new operators and tools.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5513
2019-09-09 15:50:17 +02:00
97a5f961c4 Fix compiler error in Windows introduced in 322c03f13c 2019-09-09 15:45:48 +02:00
74dcfaf172 GPencil: Fade layer using background color
Now the fade layer uses the same logic used to fade objects and also is available in all modes.

Reviewers: mendio, pepeland

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D5707
2019-09-09 15:41:11 +02:00
70c1aaf59b Sculpt: Elastic Deform Brush
This patch implements the paper "Regularized Kelvinlets: Sculpting Brushes based on Fundamental Solutions of Elasticity" https://graphics.pixar.com/library/Kelvinlets/paper.pdf

It includes grab, biscale grab, triscale grab, scale and twist.
All deformation modes are accessible under the same tool. This helps to keep the code organized and it should not make any difference to the user when a better brush management system is implemented.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5634
2019-09-09 15:34:25 +02:00
8127bbbe39 Cleanup: clang-format 2019-09-09 15:23:00 +02:00
5d9c01c53f Fix T69663: 2.81 Cant open/append/link a blend file but 2.8 can
Was a problem in the versioning code from rBbaaa89a0bc54, since the
TexMapping struct could already be freed and node->storage could already
be set to NULL (if a file with the new mapping node [saved from (2, 81,
8) or newer] is opened in a blender version prior to (2, 81, 8) and
saved from there again).

Reviewers: brecht

Maniphest Tasks: T69663

Differential Revision: https://developer.blender.org/D5723
2019-09-09 15:19:12 +02:00
f5e0dfe59c DNA: initial DNA defaults support
This provides an API to access structs
with their members set to default values:

- DNA_struct_default_get(name)
- DNA_struct_default_alloc(name)

Currently this is only used for scene & view shading initialization,
eventually it can be used for RNA defaults and initializing
DNA struct members on file reading.
2019-09-09 23:17:03 +10:00
e164afe9b5 GPencil: Change Arrange Strokes menu order
Before: Bring Forward, Send Backward, Bring to Front, Send to Back.

After: Bring to Front, Bring Forward, Send Backward,  Send to Back.
2019-09-09 15:15:29 +02:00
70991bfd94 Sculpt: Draw Sharp Brush
This brush is similar to the draw brush but it deforms the mesh from the original coordinates. When used with the sharper curve presets it has a much more pleasant crease/cut behavior than any of the other brushes. This is useful for creating cloth wrinkles, stylized hair or hard surface edges.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5530
2019-09-09 15:12:15 +02:00
056bb7721e Cleanup: remove unused scene struct members 2019-09-09 22:39:58 +10:00
322c03f13c Move callbacks API from BLI to BKE
Preparing for the bigger changes which will be related on passing
dependency graph to various callbacks which need it.

Differential Revision: https://developer.blender.org/D5725
2019-09-09 14:26:42 +02:00
103d29e2b2 Timer: Use explicit re-initialization on file load
Before this the timer API was relying on using a callback API to do
initialization when new file is loaded. This isn't how rest of Blender
works and it gets in a way because callbacks API is to be move to the
BKE level.

Use explicit call to timer API from where the file is loaded.
2019-09-09 14:26:29 +02:00
423435bd2e Cleanup: sort struct, file lists 2019-09-09 21:09:19 +10:00
98d3a16281 Fix (unreported) Freestyle modifiers element-wise multiplication error 2019-09-09 10:46:25 +02:00
d865ac8b1b Fix T69653: Freestyle modifiers "Distance from ..." python error
Was a wrong rename in rBaeb8e81f2741
2019-09-09 10:45:24 +02:00
f3a4f12ac0 Batch Rename: Rename Title Caps to Title Case 2019-09-08 17:40:46 -04:00
Julian Eisel
de12057365 UI: Allow context menu in all file browser regions 2019-09-08 21:27:58 +02:00
Julian Eisel
1601413b63 UI: Allow file number shortcuts ouside main region
Makes the numpad + and - type of shortcuts to increase/decrease the file
number suffix work in the upper and lower bar of the file browser.

Had to add keymap handlers to the execute region for this to work.
2019-09-08 20:35:56 +02:00
7ab936c5b9 Fix T69640: make update not working with Python older than 3.7 2019-09-08 18:45:08 +02:00
a9dbc2ef4a Edit Mesh: select interior faces now detects regions
The previous method only worked in simple cases where faces were
surrounded by non-manifold edges.

Now face regions surrounded by non-manifold edges are marked as interior.
Starting with regions most perpendicular to the surrounding geometry.

Resolves T68401
2019-09-09 01:48:25 +10:00
Julian Eisel
e7476b667e Fix T67756: File drag starts on file browser open
When the file browser was opened (from a temporary window since the file
browser redesign) using a button in the UI, under certain conditions
moving the mouse would trigger files to be dragged.

Note that this has been an issue before the new file browser design was
introduced, although under slightly different conditions.

Steps to reproduce:
* With factory settings, press F12
* Open a different image in the appearing Image Editor (not Render
  Result)
* Make sure the window is not maximized
* Press N to open the side bar, open Image tab
* Click the folder icon there to change the image
* Change to thumbnail display type in the appearing file browser
* Cancel, click the folder icon again
Moving the mouse now would start dragging files in most cases.

The same issue could be reproduced in a similar way when installing
lights/MatCaps or HDRIs through Preferences -> Lights -> Install...
2019-09-08 17:03:48 +02:00
5de51b46b6 Fix T69634: GPencil:Cutter Tool removes unexpected strokes on another layer
The function was not checking the locked flag.
2019-09-08 16:49:47 +02:00
c3be14e151 Cycles: add bump map shadow terminator softening term for diffuse BSDFs
This avoids artifacts for bump mapping and diffuse BSDFs, where the bump
normal deviates far from the actual normal.

Differential Revision: https://developer.blender.org/D5399
2019-09-08 15:32:08 +02:00
ad21a6c224 Fix script_load_modules test failure in power sequencer 2019-09-08 15:17:06 +02:00
b6114c3849 Build: skip Blender repository pull in "make update" when not possible
This prints a more informative message, and is convenient when working with
local changes or in a branch where you only need to update submodules or tests.
2019-09-08 14:52:33 +02:00
Julian Eisel
a566b71333 Fix crash closing stacked file browser window
Caused by ab823176d3.
Steps to reproduce were:
* Open Preferences
* Open file browser through Lights -> Install (doesn't matter which)
* Close browser through the window controlls

The window was freed earlier, but still referenced by new handler
context storage.
2019-09-08 14:37:12 +02:00
f5ad622009 Update RNA Manual References 2019-09-07 20:23:13 -04:00
4764362ebb Fix GTests failing on Windows buildbot
Run these tests from the install directory so they can find dlls.
2019-09-07 22:51:19 +02:00
fd05f01be6 Partially revert "Cleanup: use post increment/decrement"
This partially reverts commit 0b2d1badec

Post increment can deep-copy for C++ iterators, while in my own checks
GCC was able to optimize this to get the same output,
better follow C++ best practice and use pre-increment for iterators.
2019-09-08 04:08:10 +10:00
abeab4fcad Fix buildbot not reporting error when tests fail 2019-09-07 18:22:48 +02:00
2028302f44 Tests: run tests from install path
Blender can only be run correctly from the install path since it requires Python
scripts, dynamic libraries and other files to be present. By default the install
path is the same as the build path, so it works anyway. But on the buildbot it
isn't. There was a workaround but it failed on Windows and macOS.

Now tests run from the install path. Detecting that path for ctest is more
complicated than I would like, but I couldn't find a better solution.

Ref T69541.
2019-09-07 18:09:41 +02:00
708e81bdfa Fix buildbot error building release on macOS 2019-09-07 18:09:41 +02:00
ea6992d0e5 Fix missing LLVM include directories on macOS
These are not used in master yet, but they are needed for the functions branch.
2019-09-07 18:09:41 +02:00
d5642584cd Fix redo panel button alignment
Menu's in the redo panel left a space for decorators.
2019-09-08 01:18:51 +10:00
b380a98887 Fix two bugs in delaunay blenlib function.
Bugs were: (1) needed an epsilon test in CCW test in order to
handle new costraint edge that intersects an existing point
but only within epsilon; (2) the "valid bmesh" output mode
sometimes left a face that included outside frame point.
2019-09-07 20:31:24 +05:30
0b2d1badec Cleanup: use post increment/decrement
When the result isn't used, prefer post increment/decrement
(already used nearly everywhere in Blender).
2019-09-08 00:23:25 +10:00
Julian Eisel
ab823176d3 Fix saving images from temp Image Editor failing
Steps to reproduce were:
* Ensure //Render//->//Display Mode// is //New Window//
* F12
* In the opened Image Editor, Alt+S to save the image
* Save the image
The saving would fail silently.

Issue was that wm_handler_op_context() would fail to find the correct
area to activate, as the wrong window was active in context. So allow
overriding this window and do so when creating the file-select handler.
2019-09-07 16:08:56 +02:00
fa7ee622f0 Cleanup: includes in headers
Forward declare structs where possible.
2019-09-07 23:17:40 +10:00
1b0dd5a215 Cleanup: style, spelling 2019-09-07 21:28:05 +10:00
ed779333bb EEVEE: Shadows: Fix correlation issue between Shadows and Anti-Aliasing
To fix this, we just scramble the halton sequence by multiplying by a large
prime number.

It seems to work fine in practice.

We also tried Sobol sequence but it has a less uniform pattern for low
number of sample.

Fix T68594 Eevee: Soft shadows causing flickering in animation and temporal AA in scenes
2019-09-07 00:44:20 +02:00
963a266faf EEVEE: Fix tests crashing if file is in edit mode 2019-09-07 00:44:20 +02:00
44aaee573a EEVEE: Shadows: Fix incorrect shadowing near point lights source 2019-09-07 00:44:20 +02:00
Jean First
d288776cef Fix T68843: wireframe node in Eevee fails on macOS
Differential Revision: https://developer.blender.org/D5712
2019-09-07 00:01:48 +02:00
87d0033ea9 Fix node_shader_utils problems with new mapping node
Since rBbaaa89a0bc54 we have to access the mapping node differently.
This doesnt take actual linkage of the new sockets into account (but
this wasnt done for most sockets on the Principled BSDF node either)

Also the min/max of the mapping node was removed entirely.
It was decided upon removing this from node_shader_utils as well (and
replace this by existing access to the Extension parameter of the
Texture node).

Part of solving T69526.

Differential Revision: https://developer.blender.org/D5693
2019-09-06 23:39:19 +02:00
bbcb4be04f Fix T69597: Changing Grease Pencil Layer in Dopesheet unlocks all layers
The Dopesheet was unlocked all layers because it was using the same logic used in UI panel, but this was wrong.
2019-09-06 23:33:29 +02:00
9ecbd67dfb Python API: implement an Operator callback for dynamic description.
Blender UI Layout API allows supplying parameters to operators via
button definitions. If an operator behavior strongly depends on its
parameters, it may be difficult to write a tooltip that covers all
of its operation modes. Thus it is useful to provide a way for the
operator to produce different descriptions based on the input info.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D5709
2019-09-06 22:05:20 +03:00
b0b24b77ff Fix T68796: stereo side-by-side and pageflip not drawing correctly 2019-09-06 20:38:58 +02:00
7cec119c57 EEVEE: Fix Ambient Occlusion on backfaces
N is already the Facing normal! Dummy!
2019-09-06 19:15:15 +02:00
5289b16d77 UI: File Browser Preview Outlines
File Browser image thumbnails get just a contrasting outline and no shadow.

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

Reviewed by Brecht Van Lommel
2019-09-06 10:03:22 -07:00
d83734aa4b EEVEE: Fix bump mapping
Fix issue in latest patch and assure derivatives calculation is correct on
all GPU.
2019-09-06 19:02:15 +02:00
073624d4cc Eevee: Improve Test setup
- Remove use_screen_refraction as it conflict with SSR and SSS
- Increase GTAO distance
- Add a simple lightprobe setup that works well in most cases
- Enable soft shadows

Baking the lightprobes adds some overhead to the test time (+33%).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5507
2019-09-06 18:31:30 +02:00
a5a003ed55 GPencil: New option to fade not selected objects
Before, it was only possible to fade the active object. The new option allows to fade all non gpencil selected object. This is a common request by artists.

{F7719513}

Reviewers: mendio, pepeland

Reviewed By: mendio

Differential Revision: https://developer.blender.org/D5704
2019-09-06 17:23:00 +02:00
6d8a86c07d Fix T69548: Sculpt scene spacing breaks when object pivot not at origin
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5699
2019-09-06 17:20:32 +02:00
Huseyin Karakullukcu
6222cb575f Fix T68950: Adding lots of edge loops to cylinder produces a crash
Instead of fixed size, `IMM_BUFFER_SIZE` is adjustable now. The internal buffer can expand if there is a need a bigger buffer. All other behaviors are still the same.

Reviewed By: fclem, #gpu_viewport

Differential Revision: https://developer.blender.org/D5570
2019-09-06 17:03:15 +02:00
ffd5e1e6ac Eevee: Use manual derivatives for better quality bump.
We basically duplicate the height map branch plugged into the bump node,
and tag each node in each branch as dx/dy/ref using `branch_tag`.

Then we add a one pixel offset on the texture coordinates if the node is
tagged as dx or dy.

The dx/dy branches are plugged into (new) hidden sockets on the bump node.

This match cycles bump better but have a performance impact. Also, complex
nodetrees can now become instruction limited and not compile anymore.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5531
2019-09-06 16:59:15 +02:00
Julian Eisel
83a7d98a32 Fix: File browser report popups not showing up
Popup would be closed immediately after creating, because of incorrect
mouse coordinates stored in window (popup is set to close if mouse is
some distance away from it).

Completes fix for T69581.
2019-09-06 16:49:59 +02:00
24d05b5ff9 UI: File Browser Large Icon Update
Replaces the large icons used in the File Browser with updated versions by Andrzej Ambroz (jendrzych).

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

Reviewed by Brecht Van Lommel
2019-09-06 07:44:50 -07:00
OmarSquircleArt
61cc604da7 Fix: Rename the dimensions property in Noise nodes.
The `dimensions` property of the noise nodes has been renamed to
`noise_dimensions` because it conflicted with and overwrote the
`dimensions` property of the base node.

Reviewers: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D5705
2019-09-06 16:06:54 +02:00
d83f62e185 WM: batch rename support for regex groups
Optionally use regular expressions for the destination name,
allows re-ordering words while renaming.

Initial patch by @jmztn with error handling and UI changes.
2019-09-06 23:24:13 +10:00
a94bf0e134 GPencil: Guides: Refactor and add new ISO option
+ Simplify code, move into own function and run once rather than on every point
+ Improved snapping when a stroke is between increments
+ Added ISO grid option for lines specified by Angle under guide settings
+ Radial snapping mode uses Angle as an offset

Differential Revision: https://developer.blender.org/D5668
2019-09-06 14:07:26 +01:00
Julian Eisel
4c20c53b89 Fix: File browser errors not reported in the UI
This is a partial fix, in that it only brings back the banner reports in
the status bar. The popups still don't show up but I need to investigate
more.
It's really ugly that reports rely on wmWindowManager.winactive, but
that's how it is...

Partialy fixes T69581.
2019-09-06 12:48:23 +02:00
39f3474cf1 Fix T69536: Setting dimensions for parented objects fails
Parenting/constraints/delta-scaled all caused setting dimensions to fail.

Take the difference between the input scale and final scale into
account when applying the dimensions.
2019-09-06 20:04:09 +10:00
e858d21ae4 Transformation Constraint: implement a Mix Mode option.
Allow selecting how the new location/rotation/scale is combined with
the existing transformation. This is most useful for rotation, which
has multiple options, and scale, which previously could only replace.
2019-09-06 12:53:35 +03:00
a23ce7f3b7 Transformation Constraint: initialize scale range values to 1 instead of 0. 2019-09-06 12:53:35 +03:00
Julian Eisel
5fd46d27f5 Fix failing assert on directory auto-creation
The failing assert was there before the recent file browser design
overhaul. Might have been in there for quite a while in fact.

Auto-creation in this case means that the file path would be created if
a non-existent path was entered in the file browser path button.
2019-09-06 11:21:47 +02:00
Julian Eisel
e10f8c27a2 UI: Confirmation prompt for file path auto-create
This confirmation prompt was there earlier, we removed the prompts for
creating new directories all together, but in this case it's reasonable.
Without it, it's simply too easy to create new directories by accident.
2019-09-06 11:06:32 +02:00
f1659c5dd8 Cleanup: function grouping
Also rename widget color blending functions more clearly.

- color_blend_v3_v3, was widget_state_blend
- color_blend_v4_v4v4, was round_box_shade_col4_r
- color_ensure_contrast_v3, was rgb_ensure_contrast
2019-09-06 16:47:59 +10:00
ebb7096bb1 Cleanup: use doxy sections 2019-09-06 16:46:00 +10:00
1b287230a4 Viewport Shading: StudioLight Intensity
Add option to change the Intensity of the HDRI in the 3d viewport. This works for both EEVEE and Cycles

Reviewed By: brecht, fclem

Differential Revision: https://developer.blender.org/D5674
2019-09-06 08:35:14 +02:00
f8362836a5 Copy Transforms: add a mixing mode option.
Allow combining location, rotation and scale at the same time,
using one constraint. The mixing modes are based on matrix
multiplication, but handle scale in a way that avoids creating
shear.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5640
2019-09-06 07:58:13 +03:00
f4056e9ec3 Copy Rotation: implement new mixing modes that actually work.
Upon close inspection, the way the Offset mode works in the
Copy Rotation constraint makes no sense, and in fact, destroys
the rotation of its owner unless either it's single axis, or
the order is set specifically to `ZYX Euler`.

Since it can't simply be changed because of backward compatibility
concerns, replace the checkbox with a dropdown that provides a set
of new modes that actually make sense.

Specifically, add a mode that simply adds Euler components together,
and two options that use matrix multiplication in different order.

The Python use_offset property is replaced with compatibility stubs.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5640
2019-09-06 07:57:16 +03:00
Julian Eisel
9972d6c306 UI: Bring back features for file path button
Adds back auto-completion and auto-creation (inserting a non-existing
file-path would create it) for the file path button. The second feature
was left out knowingly, but seems there are reasonable use cases for it.

We can't add these features to the button in the Python script, we have
to call into C. So using a template to do that.
Note that this is based on the old file browser code, I've copied over
the TODO comment.
2019-09-06 01:31:45 +02:00
Julian Eisel
4c4a8bf588 Fix T69498: Crash on export UV Layout
Ensure there's a drawable context after the file browser window is
destroyed.
2019-09-06 00:13:24 +02:00
Julian Eisel
fbf6898f58 Fix T69495: Crash changing action in file browser
We need to ensure the file browser window doesn't manage the handlers
for itself.
The special file browser closing code that we used previously isn't
needed anymore, wm_window_open_temp() and the handling of
EVT_FILESELECT_FULL_OPEN  already manage it fine.
2019-09-05 23:38:45 +02:00
e77ecfa8cb UI: tweak 3D view space between navigation gizmo & buttons
Align the lower side of the navigation gizmo with the top of the icons.
2019-09-06 06:21:25 +10:00
524e000678 Revert "UI: Add Dimensions to Object Transform panel"
This reverts commit 82fc9d778e.

This doesn't use the workaround from v3d_object_dimension_buts
needed for dimensions properly update.

Doing this would require moving the panel to C.

Issues from T69536 should be resolved before adding this back.
2019-09-06 06:05:31 +10:00
051f98baf3 LibOverride: Initial attempt to ignore missing place-holders IDs.
Ideally, when a reference linked ID is missing (and replaced by linking
code with an empty place-holder), we should just keep the local
overriding datablocks as-is, until broken links are fixed.

Not really working yet though, needs more work here...
2019-09-05 21:31:01 +02:00
5f4caa8c4f LibOverride: add a generic macro to check whetehr an ID is overridable.
...and use it in code generating library overrides.
2019-09-05 21:31:01 +02:00
8622849beb LibOverride: give more remapping control to BKE_override_library_create_from_id() too.
Similar change to the one done for tagged IDs overriding some days ago.
We do not always want to remap all local usages of a linked data-block
to its new local overriding copy.
2019-09-05 21:31:00 +02:00
23d19c2b0d Fix T63653: Industry Compatible Keymap can't be saved & loaded
Replace keymap specific operator.
2019-09-06 04:44:12 +10:00
493fa59225 Fix keymap export of enum-flag properties 2019-09-06 04:44:12 +10:00
1efd857430 Object: Mode switching operator
Remove unused OBJECT_OT_mode_set_or_submode, add
OBJECT_OT_mode_set_with_submode which can switch to edit mode as well
as a sub-mode - currently only mesh select mode is supported
(others may be added later).
2019-09-06 04:44:12 +10:00
c25c3f73c4 Cleanup: reuse mesh select mode enum 2019-09-06 04:44:12 +10:00
3a15643b90 Cleanup: Cmake submodule checks
It is a pain if the subfile we are checking if it exists gets
renamed/removed.

Instead we can check if the directory is empty.

Reviewers: mont29

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D5653
2019-09-05 14:28:20 -04:00
08991c01f0 Fix unreported: snapping to 3d tracking markers sometimes fails 2019-09-05 14:48:18 -03:00
4e731ec97b Transform: Split transform_conversions into multiple files.
Part of T68836

`transform conversions.c` is a file that is getting too big (almost 10,000 lines).
So it's a good idea to split it into smaller files.

differential revision: https://developer.blender.org/D5677
2019-09-05 14:35:38 -03:00
c90b81172b Fix T69513: Grease Pencil Fade Layers Overlay only works in Material and Texture Shading
The overlay factor was not used in other modes.
2019-09-05 19:10:15 +02:00
Erik Abrahamsson
caaaac1365 Improve some textures UI properties click-drag precision
When click-dragging to change values in textures (for example Musgrave-
>Size to give an example) the step size is too big.

Reviewers: brecht, lichtwerk

Reviewed By: brecht, lichtwerk

Differential Revision: https://developer.blender.org/D5661
2019-09-05 17:55:37 +02:00
1bafa3139c Fix T68840: Metaballs update 'NEVER' method not working
Was always evaluating due to typo in rB34ab90f546f0.

Reviewers: brecht

Maniphest Tasks: T68840

Differential Revision: https://developer.blender.org/D5695
2019-09-05 17:45:42 +02:00
d8aaf25c23 Eevee: Shadow map refactor
Reviewed By: brecht

Differential Revision: http://developer.blender.org/D5659
2019-09-05 17:37:50 +02:00
ca58936f2f Cleanup: de-duplicate code 2019-09-06 00:59:25 +10:00
411adadf67 Depsgraph: Ensure it's fully evaluated after POST callbacks
It is possible that POST callbacks will modify objects or relations.
This change makes it so an extra update pass is done if needed.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D5690
2019-09-05 16:35:07 +02:00
7825697827 UI: use boolean for sequencer reverse frames
Revert part of 04b86c21bf

The option to reverse frames is used elsewhere as a boolean
which makes sense since reversing playback is a special case.
2019-09-05 21:47:06 +10:00
d0462dca90 GPencil: New Operator to set the active object material based on the selected stroke material
The operator set as active object material the material used in the selected stroke.

Access to the operator were added in the stroke menu and context stroke menu.

Reviewers: antoniov, pepeland

Tags: #bf_blender, #grease_pencil

Differential Revision: https://developer.blender.org/D5692
2019-09-05 13:29:13 +02:00
OmarSquircleArt
3a0b22b2da Fix T69532: Wave texture fails with a compile error.
`noise_turbulence` was renamed to `fractal_noise`.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5691
2019-09-05 13:25:13 +02:00
OmarSquircleArt
c060a4a714 Fix: Compile error due to undefined isinf function.
Some implementations of the standard c++ library doesn't define its
functions in the global namespace. So the `isinf` function might
fail in some systems. To fix this, we use the `ensure_finite`
function instead.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5687
2019-09-05 13:21:21 +02:00
b6e7e173ec Buildbot: enable tests to run again
These will not stop the build on failure yet, first step is to get them passing
more reliably.
2019-09-05 12:52:54 +02:00
Sebastian Koenig
83875e978d Tracking: Enable "Render Undistorted" only if there is actual distortion
Applies to "Setup Tracking Scene" operator which configures background
images for the viewport.

Solves unnecessary slowdown and higher memory usage when camera's model
does not have any effective distortion.

Differential Revision: https://developer.blender.org/D5520
2019-09-05 12:06:09 +02:00
31c2929496 Depsgraph: Free user code from worry about updates flush 2019-09-05 11:57:20 +02:00
ac060232aa Depsgraph: Pass bmain to evaluation function
Currently unused, makes code ready for an upcoming change.
2019-09-05 11:57:20 +02:00
f2400c1bb5 Industry Compat keymap: Add Batch Rename to Alt-Return 2019-09-05 10:51:02 +02:00
c2a0f5c3d4 File Browser UI: Use 'Install' instead of ''Install Add-on from File...' as the name of the execute button
The old name didn't fit inside the button, and this fits with simpler Open/Save labels too.
2019-09-05 10:21:24 +02:00
ab158cd00a Fix T69522: Render Region not refreshing Output Properties
setting/clearing render region uses ND_RENDER_OPTIONS notifier, but
listener was only refreshing RENDER and VIEWLAYER tabs in that case,
whereas the render region buttons are located in OUTPUT tab.

Reviewers: billreynish

Maniphest Tasks: T69522

Differential Revision: https://developer.blender.org/D5685
2019-09-05 10:14:28 +02:00
05721cd00a Mesh Batch Cache: Fix threading issue
I believed the crash I experienced happened because:
1. The `extract_pos_nor_init` function is called.
2. Tasks are added to the task pool for `extract_pos_nor`.
3. The tasks begin to be executed while more tasks are added.
4. In some rare cases, all existing tasks are finished, but not all have been added yet.
5. This let the task-counter go down to zero.
6. This triggered a call to `extract_pos_nor_finish`.
7. Then more tasks are added and in the end `extract_pos_nor_finish` is called again.

A solution is to use a task pool that is suspended when created.
Unfortunately, there was an outdated comment, that was probably the root cause of the issue.

Reviewers: fclem, sergey

Differential Revision: https://developer.blender.org/D5680
2019-09-05 09:57:30 +02:00
Sebastian Koenig
17baa43e59 MovieClip: Make name of Active Clip consistent in UI
Using the currently active movie clip had different names in the interface:
In scene context it was "Active Movie Clip", in Camera Background Images it was "Camera Clip", in Constraints it was "ActiveClip".
I made all those instances use "Active Clip", which is descriptive enough and also the shortest of the three.

Reviewed By: billreynish

Differential Revision: https://developer.blender.org/D5400
2019-09-05 09:32:13 +02:00
d813cc706d File Browser: Add Zip files as native recognised file type
Differential Revision: https://developer.blender.org/D5683

Reviewers: Brecht
2019-09-05 07:54:41 +02:00
6fc6f2504d Cleanup: use backslash for doxygen commands 2019-09-05 12:56:55 +10:00
adae93281c Cleanup: clang-format 2019-09-05 12:56:34 +10:00
410f3bc1d3 Fix 'make icons' on Linux
CRLF line ending caused shebang to fail.
2019-09-05 12:28:30 +10:00
OmarSquircleArt
baaa89a0bc Shading: Rewrite Mapping node with dynamic inputs.
This patch rewrites the Mapping node to support dynamic inputs. The
Max and Min options have been removed. They can be added as Min and
Max Vector Math nodes manually.

Texture nodes still use the old matrix-based mapping. A new SVM node
`NODE_TEXTURE_MAPPING` has been added to preserve this functionality.
Similarly, in GLSL, a `mapping_mat4` function has been added.

Reviewers: brecht, JacquesLucke
2019-09-04 23:17:13 +02:00
f098f6df76 UI: Remove 'Context.' string when hovering over Properties tabs
Differential Revision: https://developer.blender.org/D5679

Reviewers: Brecht
2019-09-04 22:33:32 +02:00
5d442440f8 File Browser UI: Add Select menu to File Browser
Adding this for consistency with other editors. Seems as if we never had this in the past.
2019-09-04 22:09:01 +02:00
fc0b51d516 UI: Icons update
New icons from Andrzej Ambroż (jendrzych)

  - Many tweaks to existing icons, such as folders and drives for the new file browser, as well as snapping
  - New icons for Checkmark, Transform Origins, Snap to Face Center, Zip Files (currently unused)
2019-09-04 21:42:25 +02:00
36e23c95e8 Python API: add methods for reordering constraints.
Order matters for constraints, but there was no way to change it.
The API follows other collections like idprops and node sockets.
2019-09-04 22:38:33 +03:00
e52ad1835a Fix hair collision instability with 'Quality Steps' > 1
This was removed in rB0666ece2e2f9 because it is handled differently for
"real" cloth in cloth_solve_collisions(), but hair still needs this
apparently [does its thing in cloth_continuum_step() instead].

And since we have a default 'Quality Steps' setting of 5, it made many
simulations unstable.

Fixes T65038, T59742 (possibly others)

Reviewers: brecht

Maniphest Tasks: T65038, T59742

Differential Revision: https://developer.blender.org/D5681
2019-09-04 21:05:54 +02:00
49ff9ca613 Missed from last commit 2019-09-05 03:28:45 +10:00
1715d09d7c Cleanup: userpref UI options into their own struct
Mixing options for showing preferences with other flags was confusing.
2019-09-05 03:25:55 +10:00
933725ab46 Cleanup: use doxy comments 2019-09-05 03:16:22 +10:00
c7b9ae310b Cleanup: correct UI_THEMESPACE_START/END macros 2019-09-05 03:16:09 +10:00
OmarSquircleArt
6f32f0ea27 Versioning: Bump subversion for the Noise node.
D5560 was missing a subversion bump.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5678
2019-09-04 19:02:40 +02:00
82fc9d778e UI: Add Dimensions to Object Transform panel
This makes the Transform panel complete, so you don't need to open the Sidebar for such a basic concept.

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

Reviewers: Brecht, Pablo Vazquez
2019-09-04 18:37:33 +02:00
OmarSquircleArt
23564583a4 Shading: Extend Noise node to other dimenstions.
This patch extends perlin noise to operate in 1D, 2D, 3D, and 4D
space. The noise code has also been refactored to be more readable.

The Color output and distortion patterns changed, so this patch
breaks backward compatibility. This is due to the fact that we
now use random offsets as noise seeds, as opposed to swizzling
and constants offsets.

Reviewers: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D5560
2019-09-04 17:54:32 +02:00
Julian Eisel
45d4c92579 Move file execute region back to C, fixing bugs
We moved this to Python too quickly, causing the following regressions:
* No auto completion for file names
* Additional handling not applied on changes, like automatic extension
  appending (see file_filename_enter_handle)
* Red highlight missing when the file name already exists

Note that earlier (before the file browser redesign), this didn't use
the panel and layout code at all. So even if it's still not in Python,
at least it's integrated into regular panel management now.
OS-specific ordering of the open and cancel button is kept.

Fixes T69457.
2019-09-04 16:30:09 +02:00
Julian Eisel
640c45dc3a Expose button UTF8 check in UI_interface.h
Used in following commit.
2019-09-04 16:30:09 +02:00
68d1f09158 Shading Modes: Material and Render Preview
This change implements the basics as described in {T68312} for the
shading modes.

* LookDev shading mode is renamed to Material Preview. It always uses Eevee as renderer, and is intended to provide a fast material preview suitable for texture painting, and texture and material setup.

* Rendered shading gains "Use Scene Lights" and "Use Scene World" options similar to current Material Preview. These will be enabled by default. When Use Scene World is turned off, HDRIs will be used for lighting instead. These options are available for EEVEE and Cycles.
* Renderers will be able to customize the shading settings panel and add additional settings.

Reviewed By: brecht, fclem

Differential Revision: https://developer.blender.org/D5612
2019-09-04 15:57:00 +02:00
d3ab930c88 Fix/cleanup error handling in paths generation for private ID data case.
When using new `rna_prepend_real_ID_path()`, caller have to handle the
NULL path case and decide whetehr this is a valid case or an error one.
2019-09-04 15:08:32 +02:00
e08dac5f06 UI: use vertical navigation buttons
This addresses crowding in the top right area of the view
with the existing header and tool header.

D5670 by @CandleComet
2019-09-04 23:05:20 +10:00
Yevgeny Makarov
0381727663 Fix T55745: Checker de-select, inconsistent selection
With these changes, successive selections result in an even pattern.
2019-09-04 22:51:48 +10:00
4d995527a9 UI: Rename Select tool to Tweak tool
'Tweak' better communicates what this tool is for

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

Reviewers: Brecht, Campbell Barton
2019-09-04 11:55:36 +02:00
Julian Eisel
718989d662 Fix T69469: Overrun in file action type RNA enum
Think it was harmless in practice since we didn't actually enumerate the
items, only count them and access the set value. Still...
2019-09-04 10:23:38 +02:00
fcf2a712ec Armature: add Inherit Scale options to remove shear or average the scale.
As an inherent property of matrix-based transformation math, non-
uniform scaling of a parent bone induces shear into the transform
matrix of any rotated child. Such matrices cannot be cleanly
decomposed into a combination of location/rotation/scale, which
causes issues for rigging and animation tools.

Blender bones have options to exclude rotation and/or scale from the
inherited transformation, but don't have any support for removing the
often undesired shear component. That goal requires replacing simple
parenting with a combination of multiple bones and constraints. The
same is true about the goal of inheriting some scale, but completely
avoiding shear.

This patch replaces the old Inherit Scale checkbox with a enum that
supports multiple options:

* Full: inherit all effects of scale, like with enabled Inherit Scale.

* Fix Shear: removes shear from the final inherited transformation.

  The cleanup math is specifically designed to preserve the main
  axis of the bone, its length and total volume, and minimally
  affect roll on average. It however will not prevent reappearance
  of shear due to local rotation of the child or its children.

* Average: inherit uniform scale that represents the parent volume.

  This is the simplest foolproof solution that will inherit some
  scale without ever causing shear.

* None: completely remove scale and shear.

* None (Legacy): old disabled Inherit Scale checkbox.

  This mode does not handle parent shear in any way, so the child
  is likely to end up having both scale and shear. It is retained
  for backward compatibility.

Since many rigging-related addons access the use_inherit_scale
property from Python, it is retained as a backward compatibility
stub that provides the old functionality.

As a side effect of reworking the code, this also fixes a matrix
multiplication order bug in the Inherit Rotation code, which caused
the parent local scale to be applied in world space. In rigger
opinion this option is useless in production rigs, so this fix
should not be a problem.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5588
2019-09-04 10:34:21 +03:00
64f8f7db7c Fix T63755: Area Stretching Overlay
Support for UV Stretching overlay during multi object editing. The
VBO now holds the ratios per fase. In the shader these ratios will
be compared against the global ratios. The global rations are created
from all selected objects.

The current implementation does not fit well with the draw module. The
plan is to move the drawing of other spaces towards the draw manager what
leads to a better fit. Currently the details on this solution is unclear
but this requirement will become an attentionpoint in the future design.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5665
2019-09-04 08:08:27 +02:00
0cb730146b Transform: remove X/Y shear tool option
Instead use vertical cursor motion for Y axis shear.

This removes the shear_axis option completely since we now have two
axis options used by shear it's not needed.
2019-09-04 15:33:07 +10:00
966c00060f Transform: Improve hierarchy in mixed snap edge detection. 2019-09-04 02:16:50 -03:00
55a6fc0be3 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-09-04 11:30:16 +08:00
Julian Eisel
da25aca267 Fix T69463: File Browser opens off-center on hiDPI
wmWindow.sizex/y doesn't have system's pixel size applied.
2019-09-04 02:01:44 +02:00
Julian Eisel
0c7bfdf9a5 Fix T69467: Temporary Info Editor window crashes
Code called editor creation twice, once for SPACE_INFO, once for
SPACE_EMPTY. Caused by a incorrectly solved merge conflict.
2019-09-04 01:47:16 +02:00
1886a2f3f5 Industry Compat keymap: Add support for tool hotkeys in paint modes
Use D for Draw, B for Blur.
2019-09-04 00:58:47 +02:00
c69130e9f9 Industry Compat keymap: Fix for opening folders in new File Browser 2019-09-04 00:51:43 +02:00
Julian Eisel
197653e087 Fix selecting multiple files ignoring first file
E.g. box selecting wouldn't allow selecting the first file.
Work selection and shift/ctrl selection had similar issues.

Code assumed that the first item was the '..' parent item and manually
removed it from the selection. I could just remove this special
handling, but instead I made the behavior more dynamic. So the file list
checks if the '..' item is there and only then applies special
treatment.
That way we can easily bring the '..' item back or make it optional if
wanted.
2019-09-03 23:15:31 +02:00
5ba0ce8544 UI: Minor fixes to Delta Transform panel
Removes some wrong gaps appearing
2019-09-03 22:34:55 +02:00
1af0f1fed9 File Browser: Fix Windows Execute/Cancel button order
Was using wrong check for Windows, causing this to fail
2019-09-03 21:45:39 +02:00
Julian Eisel
9e3cd98529 Fix T69451: Walk-select in empty directory asserts
Code assumed the '..' was there, which isn't the case any more. Just
early exiting for empty directories is fine.
2019-09-03 19:51:52 +02:00
0df6224d48 GPencil: Context menu update
Add missed 'Insert Blank keyframe in All Layers' to context menu

Reviewers: antoniov, pepeland

Tags: #bf_blender, #grease_pencil

Differential Revision: https://developer.blender.org/D5669
2019-09-03 19:04:36 +02:00
1abb1ba9a3 GPencil: Fix unreported autolock layers using Dopesheet
When select a layer in Dopesheet, the autolock layer was not working.

Now the Dopesheet code calls the function for autolock. Also some code cleanup to move the logic to new function.
2019-09-03 18:59:12 +02:00
e91ea20ebe Drivers: support decomposing rotation into swing followed by twist.
In order to correctly drive corrective shape keys from a freely
rotating organic joint it is very often found necessary to
decompose the rotation into separate bending and twisting
motions. This type of decomposition cannot be reproduced by
any Euler order or a single quaternion.

Instead this is done by using a helper bone with a Damped Track
constraint aimed at the tail of the control to pick up the bending,
and its helper child with Copy Transforms to separate the twist.

Requiring two additional bones to drive a shape key or a correction
bone seems inconvenient, so this implements the necessary math as new
options in the recently introduced Rotation Mode dropdown of the
Transform Channel driver variable type. The data is also accessible
as a Transformation constraint input.

The output is in the form of Quaternion-derived 'pseudo-angles',
which for `Swing and Y Twist` would represent the following:

* W: true bend angle, independent of bend direction.
* Y: true twist angle.
* X, Z: pseudo-angles representing the proportion of bending around X/Z.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5651
2019-09-03 19:35:36 +03:00
b3b59e3b56 Transform: support snap to children with 'Affect Parents'
Resolves T69398
2019-09-04 02:04:01 +10:00
e5c8f096f8 Cleanup: expand checks for selection when snapping
Adding extra checks here was getting unreadable,
expand to allow for easier to follow logic.
2019-09-04 02:04:01 +10:00
4f92725283 Fix buildbot unsuccessfully trying to update Blender repository for branches 2019-09-03 18:01:57 +02:00
bc1781cf6a EEVEE: Fix broken bump regression
Regression introduced by 7f4a2fc437
2019-09-03 17:45:58 +02:00
4c14a7484c Cleanup: unused flag, spelling 2019-09-04 00:53:05 +10:00
Julian Eisel
ee8f69c96c UI: File Browser Design Overhaul
This is a general redesign of the File Browser GUI and interaction
methods. For screenshots, check patch D5601.

Main changes in short:
* File Browser as floating window
* New layout of regions
* Popovers for view and filter options
* Vertical list view with interactive column header
* New and updated icons
* Keymap consistency fixes
* Many tweaks and fixes to the drawing of views

----

General:
* The file browser now opens as temporary floating window. It closes on
  Esc. The header is hidden then.
* When the file browser is opened as regular editor, the header remains
  visible.
* All file browser regions are now defined in Python (the button
  layout).
* Adjusted related operator UI names.

Keymap:
Keymap is now consistent with other list-based views in Blender, such as
the Outliner.
* Left click to select, double-click to open
* Right-click context menus
* Shift-click to fill selection
* Ctrl-click to extend selection

Operator options:
These previously overlapped with the source list, which caused numerous
issues with resizing and presenting many settings in a small panel area.
It was also generally inconsistent with Blender.
* Moved to new sidebar, which can easily be shown or hidden using a
  prominent Options toggle.
* IO operators have new layouts to match this new sidebar, using
  sub-panels. This will have to be committed separately (Add-on
  repository).
* If operators want to show the options by default, they have the option
  to do so (see `WM_FILESEL_SHOW_PROPS`, `hide_props_region`), otherwise
  they are hidden by default.

General Layout:
The layout has been changed to be simpler, more standard, and fits
better in with Blender 2.8.
* More conventional layout (file path at top, file name at the bottom,
  execute/cancel buttons in bottom right).
* Use of popovers to group controls, and allow for more descriptive
  naming.
* Search box is always live now, just like Outliner.

Views:
* Date Modified column combines both date and time, also uses user
  friendly strings for recent dates (i.e. "Yesterday", "Today").
* Details columns (file size, modification date/time) are now toggleable
  for all display types, they are not hardcoded per display type.
* File sizes now show as B, KB, MB, ... rather than B, KiB, MiB, … They
  are now also calculated using base 10 of course.
* Option to sort in inverse order.

Vertical List View:
* This view now used a much simpler single vertical list with columns
  for information.
* Users can click on the headers of these columns to order by that
  category, and click again to reverse the ordering.

Icons:
* Updated icons by Jendrzych, with better centering.
* Files and folders have new icons in Icon view.
* Both files and folders have reworked superimposed icons that show
  users the file/folder type.
* 3D file documents correctly use the 3d file icon, which was unused
  previously.
* Workspaces now show their icon on Link/Append - also when listed in
  the Outliner.

Minor Python-API breakage:
* `bpy.types.FileSelectParams.display_type`: `LIST_SHORT` and
  `LIST_LONG` are replaced by `LIST_VERTICAL` and `LIST_HORIZONTAL`.

Removes the feature where directories would automatically be created if
they are entered into the file path text button, but don't exist. We
were not sure if users use it enough to keep it. We can definitely bring
it back.

----

//Combined effort by @billreynish, @harley, @jendrzych, my university
colleague Brian Meisenheimer and myself.//

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

Reviewers: Brecht, Bastien
2019-09-03 16:10:40 +02:00
545f565426 Fix selection engine checks
- Don't use vertex selection in texture paint mode.
- Don't allow mixing vertex & face flags in vert/weight paint modes.
2019-09-03 23:43:15 +10:00
8be800dcdf Fix T69424: Weight paint sample doesn't work 2019-09-03 23:38:12 +10:00
51d8facbc3 Fix buildbot Python executable not found on Windows 2019-09-03 14:35:57 +02:00
fc99297411 Fix T66950: WeightPaint Bone Selection Overlay
In weightpaint it is possible to enable the bone selection mode. During
drawing the overlay was rendered, but during selection this was ignored.
Users needed to double click in order to select bones even when the overlay
was enabled.

This patch makes bone selection possible during weight painting using the pose mode bone
selection overlay with a single click.

Reviewed By: fclem, campbellbarton

Differential Revision: https://developer.blender.org/D5629
2019-09-03 14:09:44 +02:00
Lucas Boutrot
97f7f5fdbb Fix T69384: Noise Depth widgets steps set to 0
Reviewed By: brecht, lichtwerk

Maniphest Tasks: T69384

Differential Revision: https://developer.blender.org/D5652
2019-09-03 13:42:43 +02:00
21c099c5be Fix compiler warning after recent change to splash screen version 2019-09-03 13:05:55 +02:00
a620501acb Fix T62152: Shear X and Y are swapped 2019-09-03 20:36:31 +10:00
85b1506c6e Fix Credits link not working in About menu 2019-09-03 12:35:17 +02:00
81849e7c9d Buildbot: support building releases, make non-releases more consistent
* Auto detect rc and release version cycle in BKE_blender_version.h.
* On Windows, generate zip and installer if a release is detected.
* On macOS, always generate a dmg instead of zip.
* Use standard package names without hash if a release is detected.
* Buildbot package names now match platform names in releases.

Ref T67056

Differential Revision: https://developer.blender.org/D5643
2019-09-03 12:23:39 +02:00
ad5e91a107 Subsurf: Show error when Blender is built without OpenSubdiv 2019-09-03 11:45:52 +02:00
42478436ae Add OpenSubdiv information to bpy.app
Allows to customize interface and inform about lack of
subdivision surface support.
2019-09-03 11:45:52 +02:00
5ea6545ad5 Fix library link errors after building with install_deps.sh on Ubuntu
On some systems this would use the builtin echo command without support for
the -e option.

Thanks Alexander Gavrilov for helping find this.
2019-09-03 11:20:29 +02:00
9be138bf63 Fix empty image wire drawing with front/back depth
The vertex shaders depth offset was ignored in this case.
2019-09-03 19:16:37 +10:00
65db18fc56 Fix T68868: Assert in depsgraph debugging logs
Was happening when tagging for LEGACY_0 was used.
2019-09-03 11:06:41 +02:00
abfb8b6963 3D View: option only to show axis aligned image empties
Useful for using reference images that only make sense to see
in aligned axis-views.

This restores functionality possible with 2.7x background images.
See: T52668.
2019-09-03 19:01:27 +10:00
8a7a7af627 Fix T69326: Parent type ARMATURE doesn't work 2019-09-03 10:48:29 +02:00
841346df5d Depsgraph: Cleanup, more clear variable name 2019-09-03 10:43:40 +02:00
f45e55c9c8 Depsgraph: Cleanup comment 2019-09-03 10:43:05 +02:00
d74cc6c08c Drivers: add separators to the Transform Channel type enum menu.
It's hard to find things quickly in the wall of '...ation' without breaks.
2019-09-02 23:51:09 +03:00
d4a905fd85 UI: Fix Bug With Join Area Tolerance
Join area tolerance not properly checking all vertices on shared edge.

Differential Revision: https://developer.blender.org/D5662
2019-09-02 13:06:42 -07:00
47cde3292c Return proper RNA path in py console for 'private ID' data.
We can now generate a proper path here, make use of it.

Note: not sure how property pyrna path is supposed to be accessed? code is
similar to the struct pyrna path anyway...
2019-09-02 18:46:20 +02:00
6f1fa7aa25 Fix/enhance new RNA path from real ID helpers.
Main issue was that `rna_prepend_real_ID_path()` would return
nothing in case given path was NULL, when it should actually return the
`prefix` computed by `RNA_find_real_ID_and_path()` in that case...

Also make return `real_id` pointer optionnal, no reasons to make it
mandatory here. And some general naming fixes.
2019-09-02 18:43:43 +02:00
1fd5c90e63 DatablockManagement: Cleanup: get rid of BKE_collection_copy_master().
Now that we 'properly' support private ID data in lib management, there
is no reason anymore to have that custom func, badly named and
by-passing the whole generic ID management code.
2019-09-02 18:39:08 +02:00
99e8aeaa4a DatablockManagement: Fix/sanitize handling of flags for private ID data in copy functions.
Not sure exactly why that was working with nodetrees in depsgraph (could be some special
code in the despgraph), but we always want to allocate memory for the nodetrees here!
2019-09-02 18:39:08 +02:00
3850557073 Cleanup: get rid of BKE_collection_master() useless accessor.
In its current version that was a totally useless extra layer of crap
that we can totally avoid. Plus name was bad too.
2019-09-02 18:39:08 +02:00
0ebc76354f DatablockManagement: Cleanup logic of private IDs handling in BKE_libblock_copy_ex().
Now that we have the private ID data flag, we can be more simple *and*
generic here.
2019-09-02 18:39:08 +02:00
64efbbca8e Make Scene Master collection 'Private' ID data, like root nodetrees.
Same issue here as with root nodetrees, those are private ID data owned
by another ID, and not in Main DB. This requires special handling.

there are still quiet a few things to do here, like getting rid of
special code for master collection (regular ID copying should handle
that just as it already does for root nodetrees), cleanup in ID copying
code, etc.
2019-09-02 18:39:08 +02:00
283d96de11 Buildbot: refactor all build slave code
* Move common code into buildbot_utils.py
* Remove legacy code from removed builders
* Split code into smaller functions

Differential Revision: https://developer.blender.org/D5642
2019-09-02 17:37:22 +02:00
a565096109 GPencil: Add suport to Poly Curves to Convert to Strokes operator
The Poly curves were not supported when convert curves to grease pencil strokes, but now are supported.

Also, some code cleanup to make it more readable.
2019-09-02 17:24:05 +02:00
a3559a70dd Fix T69404: Merge by distance crash with Unselected
Error introduced when removing the automerge bmesh operator.
2019-09-03 00:35:22 +10:00
afac2afbfc Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-16 14:27:04 +08:00
b535223b29 LANPR: Smooth contour modifier file. 2019-08-11 11:07:11 +08:00
dadbf3f877 LANPR: Smooth contour modifier name change. 2019-08-11 11:04:51 +08:00
2df4e606e4 LANPR: Render status. 2019-08-11 11:00:29 +08:00
cc4fde3bc4 LANPR: Remove update button in GPencil LANPR tab. 2019-08-11 10:26:55 +08:00
aa86a72743 LANPR: Merge error fixes. 2019-08-11 10:17:50 +08:00
4cd9b51a96 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-11 10:17:31 +08:00
7cf46056ac LANPR: Fix background color. 2019-08-09 10:39:30 +08:00
b6cc0d0e1c LANPR: Rename Freestyle face/edge mark structures into LANPR. 2019-08-09 09:56:08 +08:00
b6fa99e219 Cleanup: Remove obsolete lanpr_access.h 2019-08-09 09:49:09 +08:00
d17fc35ae0 Cleanup: lanpr operator py script. 2019-08-09 09:41:00 +08:00
b120ee633e Cleanup: make format. 2019-08-09 09:39:15 +08:00
1908141ea0 Cleanup: Remove LANPR from editor CMakeLists. 2019-08-09 09:17:30 +08:00
57ebc7255d Cleanup: Remove random useless files. 2019-08-09 09:05:40 +08:00
5322c2069d Cleanup: Remove obsolete LANPR includes from CMakeLists 2019-08-09 09:01:24 +08:00
16f11d28ae Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-09 08:54:53 +08:00
7ad5f38725 LANPR: UI refactor: taper distance label. 2019-08-08 17:11:54 +08:00
d2c404f050 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-08 16:57:09 +08:00
d3b69c7959 LANPR: Fix type error for MSVC. 2019-08-08 15:38:14 +08:00
e47c6dad09 Cleanup: rna_lanpr.c format 2019-08-07 15:16:52 +08:00
f3b5476f46 LANPR: GPU memory leak fixed. 2019-08-07 10:00:56 +08:00
3f9668c54b LANPR: Batch discard for CPU mode with chaining. 2019-08-07 09:36:15 +08:00
c9a546ae31 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-07 09:03:23 +08:00
50358c563c LANPR: Removed "Including" panel. 2019-08-05 16:46:54 +08:00
c57c4e6d47 Cleanup: Make format. 2019-08-05 16:38:04 +08:00
295931d193 LANPR: Fixed ormal value error in chaining. 2019-08-05 16:32:43 +08:00
80e5ade006 LANPR: Fixed unlinked lines when splitting bounding area. 2019-08-05 16:23:13 +08:00
181b44d76a LANPR: Fixing chained line normal value errors. 2019-08-05 11:22:22 +08:00
5462908a29 LANPR: Add checkbox to normal controlled line weight. 2019-08-05 10:48:43 +08:00
8621c634a9 LANPR: Default values for normal style. 2019-08-05 10:17:08 +08:00
4ddc14c732 Cleanup: make format. 2019-08-05 08:48:21 +08:00
51cc9d8fdf Cleanup: comment format in two headers. 2019-08-05 08:47:20 +08:00
8708a96dde LANPR: UI refactor: naming fixes. 2019-08-05 08:29:05 +08:00
a49b749385 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-05 08:24:30 +08:00
3cc60bbbc1 LANPR: Fix GPU texture init errors. 2019-08-01 17:21:44 +08:00
c6587efffe LANPR: Fix shader assert error in deprecated NormalMatrix. 2019-08-01 17:16:03 +08:00
cb7e9d7978 LANPR: Remove image filter shader inits. 2019-08-01 16:45:18 +08:00
2787c36956 Cleanup: lanpr_chain_draw.c 2019-08-01 16:27:49 +08:00
6df67f026c LANPR: Remove edge detection mode file from compiling. 2019-08-01 16:23:48 +08:00
93ab22f308 Cleanup: Fix warnings in lanpr_util.c. 2019-08-01 16:20:24 +08:00
214978376e Cleanup: Fixed many warnings. 2019-08-01 16:08:26 +08:00
838ba72792 LANPR: Fix merge problems. 2019-08-01 15:32:22 +08:00
69a9eac2d6 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-08-01 15:14:27 +08:00
70ba6d3532 Cleanup: Fix compiler warnings. 2019-07-31 17:13:48 +08:00
69d20e8eed Cleanup: Fixed some warnings on function declares. 2019-07-31 16:53:50 +08:00
e5c1b74ec9 LANPR: use own operator registering function. 2019-07-31 16:23:32 +08:00
4fe067b854 Merge branch 'master' into soc-2019-npr 2019-07-31 15:55:04 +08:00
5cb3161486 Gpencil: Fix cmake list duplicates. 2019-07-31 15:35:46 +08:00
bd371a4f9f Test commit for investigating git problems. 2019-07-29 23:52:22 +08:00
6022c2fae2 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-29 09:06:33 +08:00
ff74822863 GPencil: Cleanup tarnsform rotation function 2019-07-28 17:29:47 +02:00
0473e4c50a Merge branch 'master' into greasepencil-object 2019-07-28 17:06:37 +02:00
a8037f4038 Merge branch 'master' into greasepencil-object 2019-07-27 11:44:21 +02:00
3eecb2806b GPencil: Add Edit support to Length modifier
Now the modifier is visible in edit mode.
2019-07-26 17:28:09 +02:00
9a7f7757f8 GPencil: Fix missing modifiers initialization
This was missing when the modifier was ported from NPR branch
2019-07-26 17:12:00 +02:00
0bbf47ce42 GPencil: Cleanup more compiler warnings 2019-07-26 16:48:22 +02:00
af7d3bb2db GPencil: Remove compiler warnings 2019-07-26 16:43:18 +02:00
4e017abc3d Cleanup: Fixed some warnings in editor/lanpr. 2019-07-26 17:29:43 +08:00
fbbbdf33f2 GPencil: two modifiers from LANPR branch. 2019-07-26 16:47:59 +08:00
bd26db98bc LANPR: UI refactor: line layer ui list use name. 2019-07-26 16:16:56 +08:00
56b29df5cb LANPR: UI refactor: collection usage panel. 2019-07-26 15:59:38 +08:00
a1e758801f LANPR: Object usage flag now in LANPR tab. 2019-07-26 15:54:12 +08:00
284f04a53d LANPR: UI refactor: modifier ui now put into separate tab. 2019-07-26 15:48:29 +08:00
05bf5dab1b GPencil: static and const flags for function/args. 2019-07-26 14:56:46 +08:00
02de8602c8 LANPR: Make flag marcos into enums. 2019-07-26 14:46:52 +08:00
dbd558d574 LANPR: Fixed drawing problems when chaining is enabled. 2019-07-26 12:20:52 +08:00
dd3f69a783 LANPR: Fixed "point" mode in normal control. 2019-07-26 11:33:36 +08:00
52db223bd6 LANPR: UI refactor: naming fixes in the main panel. 2019-07-26 11:09:11 +08:00
cbaab41450 LANPR: UI refactor: option sub panel fixes. 2019-07-26 11:04:58 +08:00
ee73885bd1 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-26 11:00:53 +08:00
a2fb1f367b Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-26 11:00:41 +08:00
80a6acd814 Cleanup: Remove . at the end of text 2019-07-25 14:03:02 +02:00
c6fbc1db41 Merge branch 'master' into greasepencil-object 2019-07-25 12:41:59 +02:00
9e4cc7c630 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-25 14:34:45 +08:00
caab047f9c LANPR: UI refactor: added script for object lanpr tab. 2019-07-24 17:10:44 +08:00
22e330b4b0 LANPR: Added a dedicated tab for feature line modifier options. 2019-07-24 16:59:13 +08:00
16a453dd9c LANPR: UI refactor: gpencil panel. 2019-07-24 16:11:40 +08:00
6e2f3ee26a LANPR: UI refactor: options panel. 2019-07-24 15:59:43 +08:00
6acc7d4015 LANPR: UI refactor: chaining panel. 2019-07-24 15:50:43 +08:00
86fa225164 LANPR: UI refactor: effects panel. 2019-07-24 15:44:46 +08:00
1616a6a57f LANPR: use LANPR_LineType for duplicated style storage. 2019-07-24 10:55:54 +08:00
b4f707424e LANPR: UI refactor: main panel. 2019-07-24 10:22:06 +08:00
349f7b8f32 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-24 09:03:51 +08:00
09a774c3c0 GPencil: Remove duplicate self overlap option
The option was duplicated for textured strokes.
2019-07-23 13:32:57 +02:00
8441fa98f7 Merge branch 'master' into greasepencil-object 2019-07-23 09:48:00 +02:00
0abf6d349c Cleanup: Rename poll function 2019-07-22 16:54:42 +02:00
2f1c33d87b LANPR: Fixed render alpha in LANPR engine. 2019-07-22 10:09:11 +08:00
37ca6d2947 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-22 09:55:46 +08:00
b5c3dbc359 Fix assert in some cases when using DataTransfer modifier for custom normals.
Reported by @sybren on IRC, thanks.

Should be safe for 2.80.
2019-07-22 08:54:00 +08:00
6fff1f2b6e Merge branch 'master' into greasepencil-object 2019-07-21 22:34:05 +02:00
f491355c43 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-20 16:41:35 +08:00
475aca05ab GPencil: Fix errors after merge and compiler warnings
The BKE_text_write function parameter list changed.

Added some UNUSED_VARS to functions in development.
2019-07-19 15:51:09 +02:00
c4b57de36e Merge branch 'master' into greasepencil-object 2019-07-19 15:29:45 +02:00
39341441f1 GPencil: Add frame parameter to deformStroke callback
This parameter can be necessary for some new modifiers in development. The parmeter was already there but it was removed, now we back again the parameter.
2019-07-19 15:26:29 +02:00
b07a0fe41d LANPR: Use GPU_BATCH_DISCARD_SAFE marco. 2019-07-19 17:05:13 +08:00
9b0c3c39a6 LANPR: Remove useless GPU_ATTACHMENT_LEAVE flags. 2019-07-19 17:03:06 +08:00
0c69893bd6 LANPR: Renamed freestyle edge mark constant into lanpr. 2019-07-19 16:26:08 +08:00
0a6dd063ef LANPR: Edge/face mark UI now forllows LANPR checkbox. 2019-07-19 16:26:08 +08:00
7dfb221aca LANPR: Remove freestyle #ifdef's. 2019-07-19 16:26:08 +08:00
a693068047 LANPR: Rename freestyle edge mark functions to LANPR. 2019-07-19 16:26:08 +08:00
3912e4439a Cleanup: Replace if else if, by Switch 2019-07-19 10:18:51 +02:00
69c8d314cf Merge branch 'master' into greasepencil-object 2019-07-18 22:24:14 +02:00
69218e4d9a GPencil: Remove old comments 2019-07-18 22:23:14 +02:00
b05570736c GPencil: Testing idea for changing weights when opacity factor is greater than 1.0 2019-07-18 20:50:03 +02:00
3f4e87e987 GPencil: Clamp weight in Opacity modifier for Material mode
If the value is not clamped, the opacity gets wild values.
2019-07-18 20:25:29 +02:00
092f9ead20 GPencil: Apply opacity only to vertex with weights 2019-07-18 20:22:54 +02:00
8fc1be0c2b GPencil: Fix unreported error in Brush option panel
The options of the material are from object material not pinned material.

If the brush is pinned, the material must be the brush material and not the object material.
2019-07-18 19:52:52 +02:00
2cef81ac4f GPencil: Modify opacity modifier to use weights inverted
It's more logic consider the no weight as opaque and the weight to transparent.

Also fixed some small issues.
2019-07-18 19:38:45 +02:00
71eda41ae9 GPencil: Fix error when apply material in Opacity/Hue and Tint 2019-07-18 18:07:56 +02:00
35af94cc86 GPencil: New Strength mode for Opacity modifier
Now it's possible to determine the opacity by Material (default) or by point Strength.

This new mode is required to get some effects using weight data.
2019-07-18 18:07:34 +02:00
8bfa7e1c72 GPencil: Fix error with evaluated colors after changing evaluation to depsgraph
The temporary colors were not copied when the derived frame was created.

The color must be copied in evaluation, not in draw manager because this replace any modifier change.
2019-07-18 18:03:14 +02:00
c6f6d6ef09 GPencil: Enable gradient factor for Line strokes
Now it's possible to use the same gradient used in Dots and Boxes with Line strokes. This was disabled, pending to solve the overlap glitches, but as this was fixed with stencil, we can enable it again.

Also, the gradient formula has been changed to use the same of Dots.
2019-07-18 16:50:43 +02:00
995c0f84a6 LANPR: Remove mode selector when not in LANPR engine. 2019-07-18 19:47:13 +08:00
ea4119b894 LANPR: Removed edge detection entry in the mode selector. 2019-07-18 19:29:48 +08:00
7c476569e5 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-18 15:55:48 +08:00
6e38a00d45 GPencil: Fix length modifier wrong callback. 2019-07-18 15:12:13 +08:00
c0bc74fb5e LANPR: Description of auto update write as "frame changes". 2019-07-18 14:36:44 +08:00
bf7727c976 Cleanup: Make format. 2019-07-18 14:34:32 +08:00
46b84938fa GPencil: Sample modifier accepts 3 points at least. 2019-07-18 14:33:34 +08:00
10ff3061dc GPencil: Relieable counter for sample function. 2019-07-18 14:23:12 +08:00
0507d41374 Merge branch 'master' into greasepencil-object 2019-07-17 23:02:30 +02:00
4759a0f0a6 Merge branch 'master' into greasepencil-object 2019-07-17 22:10:17 +02:00
fc40a09531 GPencil: Move initial curve control points apart
Based on feedback from @matiasmendio
2019-07-17 17:08:55 +01:00
80779629dc GPencil: Sample function new counter (not working properly). 2019-07-17 22:10:12 +08:00
2b17ee6cd4 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-17 20:03:31 +08:00
7f1acb3c51 Merge branch 'master' into greasepencil-object 2019-07-17 11:15:07 +02:00
e2a7fca986 GPencil: Make sample modifier a part of simplify modifier. 2019-07-17 14:40:00 +08:00
01e91a4215 LANPR: Feature line modifier UI consistensy with the rest. 2019-07-17 14:18:25 +08:00
957348116b GPencil: Renamed modifier "Length". 2019-07-17 14:12:18 +08:00
c7156dd30c GPencil: Renamed modifier into "MultiStroke". 2019-07-17 14:08:48 +08:00
93c4a93328 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-17 13:57:21 +08:00
1e0f4ba138 GPencil: Allow widng curve when normalize on in thickness modifier. 2019-07-17 11:20:15 +08:00
1ee17517f9 LANPR: Generate 100px wide original stroke for GPencil. 2019-07-17 11:06:33 +08:00
0d73e79966 Merge branch 'master' into greasepencil-object 2019-07-16 18:06:58 +02:00
c85f8ae5b2 Merge branch 'master' into greasepencil-object 2019-07-16 16:43:39 +02:00
665b57e0b9 Fix MSVC type error. 2019-07-16 22:42:30 +08:00
8a124f86c4 GPencil: Use alpha channel of curve material
Now the grease pencil stroke is using the alpha channel of the original curve material.
2019-07-16 16:30:55 +02:00
33596f237c LANPR: Stop splitting chains in CPU mode. 2019-07-16 20:50:53 +08:00
3afe60b2c4 LANPR: Auto update GPencil when in other engines. 2019-07-16 20:23:01 +08:00
0df10ebf3f GPencil: Use alpha component for converting splines
The alpha channel was not used before.

Note: This is a previous step before changing svg add-on to support alpha.
2019-07-16 13:45:33 +02:00
cb17dba738 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-16 19:36:44 +08:00
9a0c100e6c LANPR: GPU mode batch refresh method changes. 2019-07-16 19:35:15 +08:00
575fff2209 GPencil: Cleanup MSVSC warnings 2019-07-16 13:11:34 +02:00
157dc60dc8 Merge branch 'master' into greasepencil-object 2019-07-16 12:14:36 +02:00
43343509b9 GPencil: Improve curve conversion when end points are very near
When the distance between first and last point of the curve was very small, there was a glitch in the join. Now the points are moved slightly to get good result.
2019-07-16 12:13:45 +02:00
4cda368ef6 GPencil: Improve Close stroke function for very small gaps
When the gap is very small, don't need to add new points to the stroke, just cyclic.
2019-07-16 11:31:05 +02:00
a808ade3a2 GPencil: Create one stroke for each spline
For curves with several splines, must create a stroke for each of them or the shape would be wrong.
2019-07-16 11:00:19 +02:00
cfdd663679 Merge branch 'master' into greasepencil-object 2019-07-15 17:22:35 +02:00
5b31532ec3 LANPR: Moved GPU batches to lanpr_share. 2019-07-15 22:18:23 +08:00
bb4c9ae09b LANPR: Fixing memeory leaking in GPU mode. 2019-07-15 21:29:21 +08:00
ba07ebb4cf Cleanup: Make format 2019-07-15 17:10:39 +08:00
43a15ac599 Cleanup: ED Declareations move into ED_lanpr.h 2019-07-15 17:05:43 +08:00
7f9a4d521a Cleanup: Redundant defines. 2019-07-15 16:51:56 +08:00
a0d8953335 Math: Double version of interpolate functions. 2019-07-15 16:45:09 +08:00
4a8167e026 Cleanup: Removed utility files. 2019-07-15 16:02:23 +08:00
67d493f6f2 Cleanup: LANPR draw engine codes. 2019-07-15 16:00:47 +08:00
31a71467e4 LANPR: Fixing function prefixes. 2019-07-15 15:55:14 +08:00
42b8ba32c1 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-15 14:01:00 +08:00
648bd58595 GPencil: Change default value in python API
The gpencil_lines must be set to False by default.
2019-07-14 20:55:02 +02:00
7393ca434d GPencil: Set gpencil_lines parameter to False by default 2019-07-14 17:23:27 +02:00
58b7d61ebf GPencil: Fix problem when color is nofill in SVG
If the color in the SVG converted was nofill, the stroke had fill color in grease pencil and this creates glitches because the shape was not defined to be filled.

Now, the name of the color is checked to verify if the material is for stroke, and if only there is one material with this name, the fill is disabled.
2019-07-14 17:19:45 +02:00
e4c9f9d953 GPencil: Fix error generating strokes with curves with 2 points only
The number of segments must be 1 if the number of control points is 2. The problem was with the closed curves.

Also added tag of the databalock.
2019-07-14 14:33:23 +02:00
af6a5bc071 GPencil: Apply curve radius as pressure for stroke point
When convert the curve, the beziert point radius is used to generate the pressure of the grease pencil stroke point and this allows to generate different thickness.
2019-07-14 11:04:31 +02:00
f05a18f0fa GPencil: Rename python API function from convert_to_gpencil to generate_gpencil_strokes
The problem with old name was that it implied that original object was removed, but the function only creates the strokes, so the new name is better.
2019-07-14 10:46:22 +02:00
65bde9334d Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-14 14:23:03 +08:00
9546718f32 Merge branch 'master' into greasepencil-object 2019-07-13 11:35:27 +02:00
96339b8ea4 LANPR: Moved lanpr_util.c into ED. 2019-07-13 17:35:07 +08:00
141382d6f2 LANPR: Moved non-drawing related chaining code to ED. 2019-07-13 17:07:29 +08:00
ef16f19845 LANPR: Fixing local functions. 2019-07-13 16:28:22 +08:00
5b3ab68ae7 LANPR: Fixing local function and naming. 2019-07-13 16:19:55 +08:00
625fa7f276 LANPR: Moved CPU side calculations to ED. 2019-07-13 16:00:52 +08:00
f444749064 LANPR: Line layer operators now moved to ED 2019-07-13 15:23:55 +08:00
e6273ea3c7 LANPR: Changed to ED_ prefix. 2019-07-13 14:36:23 +08:00
897db2ba77 LANPR: Move GPencil operators into ED 2019-07-13 14:13:42 +08:00
8e8dac8160 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-13 10:44:24 +08:00
e1ce914c1e Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-12 09:13:44 +08:00
ae57188191 Merge branch 'master' into greasepencil-object 2019-07-11 17:21:22 +02:00
c6896fa780 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-11 07:56:04 +08:00
ff12988a49 GPencil: Cleanup commet 2019-07-10 22:53:44 +02:00
3ba6576a32 GPencil: Remove extra parameters to Convert API
Scene can be removed using context. Also bmain can be removed too.
2019-07-10 21:09:18 +02:00
3ed7b3b37c GPencil: Add notifier to update new created stroke 2019-07-10 17:45:06 +02:00
8e8673483d GPencil: Change default parameter use_collections to True 2019-07-10 17:37:58 +02:00
8b3afb178a GPencil: Fix double definition
The gpl was out of scope due double definition.
2019-07-10 17:37:33 +02:00
097ae32e2b Merge branch 'master' into greasepencil-object 2019-07-10 17:12:31 +02:00
c524490425 GPencil: Basic python api to convert curve to strokes 2019-07-10 17:12:05 +02:00
9ad5e8cacc LANPR: Fix return type error. 2019-07-10 21:28:19 +08:00
74ae87d1d4 LANPR: Fix missed library linking. 2019-07-10 21:13:40 +08:00
8fc5c61974 LANPR: Move data defs and the svg modifier into editor/lanpr. 2019-07-10 21:09:39 +08:00
6cbc913b00 Cleanup: make format. 2019-07-10 20:32:35 +08:00
16ddb6a6f7 LANPR: use ED_ functions for SVG export. 2019-07-10 20:28:26 +08:00
88c5c92b03 Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-10 20:14:44 +08:00
222deeee3d SVG: functions moved to editors/io for ease of external access. 2019-07-10 20:10:33 +08:00
905b70f9a4 LANPR: SVG export callbacks. 2019-07-10 13:43:35 +08:00
a412b5c7fb LANPR: Added operator for exporting svg. (Not functioning) 2019-07-10 11:08:40 +08:00
6a9c424b76 Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-10 10:49:31 +08:00
fc34653ce2 Gpencil: Basic SVG export callback is running OK. 2019-07-10 10:48:10 +08:00
f27629c593 Gpenci: Fix missing path end markings in writesvg.c 2019-07-10 09:55:50 +08:00
ef7587c4d5 Gpencil: Renamed GPencilSVGWriter into GPencilSVGIterator. 2019-07-10 09:45:59 +08:00
b4f39f5ee9 Merge remote-tracking branch 'origin/greasepencil-object' into soc-2019-npr 2019-07-10 09:31:56 +08:00
00b5bda6ae Merge branch 'master' into greasepencil-object
Conflicts:
	release/datafiles/locale
	release/scripts/addons
	release/scripts/addons_contrib
	source/tools
2019-07-09 23:23:26 +02:00
2e7dee3fb9 GPencil: Add "Self Overlap" parameter to materials to disable Stencil
This parameter was removed in 2.80 and we decided to back again, but now is inverted.
2019-07-09 23:11:36 +02:00
2708e25e4e GPencil: Use dynamic array size for SBuffer while drawing
This is to solve the fixed limit defined before.

Also some cleanup and renames.
2019-07-09 22:53:06 +02:00
8742dedaab GPencil: Fix possible memory leak in function
The function exit before the END_ITER
2019-07-09 22:44:26 +02:00
58888e7f87 GPencil: Undo clang reformat lines and keep old format
These lines were changed by clang and don't need to be changed.
2019-07-09 16:44:07 +02:00
b76eb572fc LANPR: don't use zero value in chaining. 2019-07-09 22:01:53 +08:00
0fecf69adb Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-09 15:42:30 +08:00
bf73c8bf39 Gpencil: svg export operator 2019-07-09 15:42:09 +08:00
11423f922b Gpencil: svg callbacks. 2019-07-09 14:47:58 +08:00
a4f499eb23 Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-09 12:01:40 +08:00
f4b4e77312 Gpencil: error fixes. 2019-07-09 11:54:22 +08:00
91d21adabd Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-09 11:42:32 +08:00
176ef101a0 Gpencil: Fixed include errors in writesvg.c 2019-07-09 11:41:46 +08:00
f3e08bbf50 Gpencil: fixed writesvg.c include errors. 2019-07-09 11:40:24 +08:00
37d111b30b Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-09 11:33:04 +08:00
cd931d48a6 Gpencil: Fix non-return error. 2019-07-09 11:32:22 +08:00
97d6c9bae9 Merge branch 'greasepencil-object' into soc-2019-npr 2019-07-09 11:24:46 +08:00
c2e46946a7 Gpencil: svg exporter initial. 2019-07-09 11:23:29 +08:00
3ecac8b2e5 Merge branch 'master' into soc-2019-npr 2019-07-09 09:14:58 +08:00
710eb7b3a9 Merge branch 'master' into greasepencil-object 2019-07-08 20:50:48 +02:00
3fb21e6010 LANPR: Fix CPU mode overlay display error. 2019-07-08 22:24:03 +08:00
b922253366 Merge branch 'master' into greasepencil-object 2019-07-08 16:04:41 +02:00
aa25207c44 Cleanup: make format 2019-07-08 21:34:32 +08:00
b3b40fca75 LANPR: CPU mode camera view pan/zoom aligned. 2019-07-08 21:26:26 +08:00
e410f352d6 GPencil: Fix Select material operator not refresh viewport
With the change to depsgraph evaluation, need tag the datablock to refresh screen.
2019-07-08 12:21:06 +02:00
3ad90ba731 GPencil: Use secondary material for stroke color 2019-07-08 11:55:12 +02:00
b5da6a9126 LANPR: Fixing CPU mode camera view scale. 2019-07-08 17:52:56 +08:00
a04dafceff LANPR: CPU mode shaders now follow viewport zoom/pan values. 2019-07-08 17:29:42 +08:00
5e6e550861 GPencil: Use collection names as layer names in conversion from curves 2019-07-08 11:03:45 +02:00
ebeb3b84c0 LANPR: Panels in object and collection page always display when engine is selected 2019-07-08 16:29:51 +08:00
2a15303a8f LANPR: GPU mode now supports all three usage flags in objects and collections. 2019-07-08 16:24:35 +08:00
1f875e60b7 LANPR: GPU mode follow object/collection usage flag. 2019-07-08 16:15:20 +08:00
3f1072d827 Merge branch 'master' into greasepencil-object 2019-07-08 10:08:28 +02:00
f96f91512c LANPR: UI and operator guard for null camera situations. 2019-07-08 15:28:28 +08:00
4aa84a312a Fix line layer init level errors. Default follow world color 2019-07-08 15:11:16 +08:00
85d36aebf4 LANPR: able to toggle two background colors. 2019-07-08 14:58:09 +08:00
2948779839 LANPR: option to use the world background. 2019-07-08 14:29:31 +08:00
6120e6ef06 GPU preview and render mode now follows background alpha correctly. 2019-07-08 13:56:06 +08:00
b0385f514f LANPR: Modifier ui now deactivates correctly. 2019-07-08 13:07:52 +08:00
f1bfe10c82 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-08 12:27:34 +08:00
85f13246ad Merge branch 'master' into greasepencil-object 2019-07-07 09:39:40 +02:00
ae8976b596 Cleanup: Use zero_v4 to init the default value. 2019-07-06 23:47:00 +08:00
3bd56a33d9 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_engine.h
2019-07-06 16:16:08 +02:00
fe31148d16 GPencil: Remove custom equals functions and reuse BLI_math compare
I have found the compare function when looking at BLI_math to add my functions, so these are duplicatd and can be removed.
2019-07-06 11:56:08 +02:00
e57d50d4d4 GPencil: Cleanup equals functions and add for floats and V2 2019-07-06 11:48:48 +02:00
6702da509a Merge remote-tracking branch 'origin/master' into soc-2019-npr
# Conflicts:
#	source/blender/draw/intern/draw_manager.c
2019-07-06 10:03:47 +08:00
9c0b207819 Merge branch 'master' into greasepencil-object 2019-07-05 22:15:31 +02:00
e125f3d3ae Merge branch 'master' into greasepencil-object 2019-07-05 17:10:33 +02:00
b8b88b7d52 GPencil: Improve management of curves without material
The SVG to Curves add-on gets some curves without material. Now these curves are set to a Pink material.
2019-07-05 17:09:54 +02:00
0f606437c3 Cleanup: Fix build error with MSVC
space after \ is not allowed
2019-07-05 07:12:45 -06:00
eebcad2813 LANPR: Minor display fixes. 2019-07-05 20:55:41 +08:00
8697062438 LANPR: Fix MSVC errors. 2019-07-05 20:49:49 +08:00
741c286e2b GPencil: Improves color handling for converted curves
Reduce the number of very similar colors.

Note: Maybe equals_v3v3_limit and equals_v4v4_limit could be added to BLI_math but with some cleanup and adding v2 version too
2019-07-05 10:41:12 +02:00
693cecab70 LANPR: Disable header checkbox when in LANPR engine. 2019-07-05 15:57:20 +08:00
e9bac3a23a LANPR: Modified default values for better initial experience. 2019-07-05 15:18:11 +08:00
38b68fa8fa LANPR: Enable Freestyle mark functions when LANPR is enabled. 2019-07-05 15:05:34 +08:00
ee1e72a316 Gpencil: make format 2019-07-05 14:52:04 +08:00
b28eb5e339 Gpencil: Fading in duplicate modifier. 2019-07-05 14:33:22 +08:00
61ccd2fa38 Gpencil: Duplicator stroke fading data structures. 2019-07-05 13:37:28 +08:00
f7c0fce061 Gpencil: Fix stroke duplication offset and UI slider. 2019-07-05 12:04:01 +08:00
bcb12f6a6c Gpencil: Fixed distance interpolation in multiply modifier. 2019-07-05 11:27:16 +08:00
e2cc428686 LANPR: Fixed GPU mode
bug: contour is always on.
2019-07-05 10:44:56 +08:00
de1994174b LANPR: Fixed always-on contour in UI. 2019-07-05 10:17:41 +08:00
80939ade23 LANPR: Improved line layer display in the list. 2019-07-05 10:11:27 +08:00
4052d68a00 LANPR: Discard source object stroke update functions. 2019-07-05 09:57:13 +08:00
fb96cbcf21 LANPR: Stroke update button for GP targets and mesh source objects. 2019-07-05 09:15:00 +08:00
e6421de53b LANPR: GPU mode empty layer list prompt. 2019-07-05 08:29:18 +08:00
4ff47d66b3 LANPR: GP target updater overwrite option. 2019-07-05 08:21:10 +08:00
1c2a22bb18 LANPR: Improvements of disable_edge_splits function. 2019-07-05 07:55:15 +08:00
3f7ed2261e Merge branch 'master' into soc-2019-npr 2019-07-05 07:37:58 +08:00
ae3116b49d GPencil: Fix error in Convert to Stroke with materials
The material color was checked in linear, but the gpencil material is sRGB.
2019-07-04 23:16:14 +02:00
fa39bdacf0 GPencil: New convert Curve to Stroke
New operator to convert any curve to grease pencil stroke.

The conversion works as a new option for Convert To operator.

Added a new parameter for selecting the color of the stroke.
2019-07-04 22:57:00 +02:00
c9d046c992 Merge branch 'master' into greasepencil-object 2019-07-04 22:48:45 +02:00
1455e56f28 Merge branch 'master' into greasepencil-object 2019-07-04 17:05:00 +02:00
7aed5dcad9 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-07-04 22:35:59 +08:00
10098812d3 LANPR: Intersection cache now updates before lanpr_cache_finish(). 2019-07-04 22:12:07 +08:00
0e19957ea1 LANPR: CPU mode chaining use deep bounding areas. 2019-07-04 16:18:55 +08:00
59da33fdb6 LANPR: fixed one coordinate bug in triangle culling function. 2019-07-04 15:10:48 +08:00
e2d3553343 LANPR: Fix GPU overflow prevention. 2019-07-04 14:56:11 +08:00
4530bb4f4d LANPR: use minimum occlusion level needed to speed up CPU mode. 2019-07-04 14:31:23 +08:00
28212da97f LANPR: new layer now increase occlusion level automatically. 2019-07-04 13:49:52 +08:00
321f92424e LANPR: Remove composition operators. 2019-07-04 13:25:09 +08:00
fe573ce914 LANPR: GPU mode prevent overflow. 2019-07-04 12:47:31 +08:00
ff78b59b7c LANPR: GPU mode follow cache size settings. 2019-07-04 12:33:30 +08:00
09df147f8d LANPR: GPU mode cache size option. 2019-07-04 12:05:25 +08:00
5ddcffa17c Merge branch 'master' into soc-2019-npr 2019-07-04 10:46:15 +08:00
adab7242d4 LANPR: Fixed _UL_ name warnings. 2019-07-03 21:56:32 +08:00
6b179c7f86 LANPR: Image chaining threshold set higher bound. 2019-07-03 17:06:04 +08:00
a44d39800b Gpencil: Duplication modifier is working now. 2019-07-03 16:49:23 +08:00
1aa8870b95 Gpencil: Length modifier now handles relative lengths 2019-07-03 15:08:44 +08:00
caa004c6bc LANPR: GP update will now delete data in the original frame. 2019-07-03 14:33:37 +08:00
95cf3a3234 LANPR: Automatically update cache before drawing. (by a switch) 2019-07-03 14:04:15 +08:00
d7174b1860 LANPR: Automatically update LANPR calculation in gp update button. 2019-07-03 13:44:41 +08:00
0a13fde96d Gpencil: Multiply modifier angle split functions 2019-07-03 11:59:29 +08:00
89e1c3ca68 Gpencil: int/float length fix 2019-07-03 11:30:04 +08:00
c2ec2affd1 Gpencil: Stroke split function. 2019-07-03 11:09:58 +08:00
7e0a7639be Gpencil: clean up length modifier callback 2019-07-03 10:45:33 +08:00
f194ab1950 Merge branch 'master' into soc-2019-npr 2019-07-03 10:20:33 +08:00
54919b2543 Merge branch 'master' into greasepencil-object 2019-07-02 20:37:37 +02:00
f449908451 LANPR: GP target reset button 2019-07-02 17:46:26 +08:00
dfb78e2ba0 Gpencil: Cleanup debug prints and comments. 2019-07-02 16:55:03 +08:00
577d049336 Gpencil: Shrink functions and modifier is working properly. 2019-07-02 16:50:03 +08:00
889919e707 Gpencil: Multiply modifier added. (not functioning) 2019-07-02 15:21:16 +08:00
a562e1fa81 Gpencil: Renamed "Backbone" into "Length" modifier. 2019-07-02 14:38:56 +08:00
2d01192c4d LANPR: intersection update button in GPU mode, small UI modifications. 2019-07-02 14:27:08 +08:00
858539520e LANPR: Only calculates intersection lines when not in software modes. 2019-07-02 14:16:01 +08:00
c216cb6a69 Merge branch 'master' into soc-2019-npr 2019-07-02 13:11:58 +08:00
98e744c549 Merge branch 'master' into greasepencil-object 2019-07-01 15:50:53 +02:00
8d8200c173 Gpencil: Stretch function now handles short segments and double points. 2019-07-01 20:22:52 +08:00
aa111b0b91 Gpencil: Stroke stretch function use copy instead of directly assign. 2019-07-01 19:51:58 +08:00
563b784f2b LANPR: make format 2019-07-01 17:33:00 +08:00
1074150f2a LANPR: defaults in new line layers. 2019-07-01 17:21:18 +08:00
a083fb84d4 LANPR: Fixed line level error in engine self rendering. 2019-07-01 17:16:03 +08:00
570f2814ac Merge branch 'master' into greasepencil-object 2019-07-01 11:13:22 +02:00
e3b9dfd357 LANPR: viewport auto update in LANPR line layer operators. 2019-07-01 17:02:31 +08:00
6f090b3e37 LANPR: Updating GPencil will now automatically redraw. 2019-07-01 16:30:14 +08:00
c2254194f8 LANPR: Chaining is force enabled for engines other than LANPR. 2019-07-01 16:06:43 +08:00
506dbb8cff LANPR: discard very short chains. 2019-07-01 15:50:56 +08:00
5ac143dbe8 Modifier: EdgeSplit modifier now follows LANPR "disable_edge_splits" as well. 2019-07-01 15:35:14 +08:00
94bee8fa25 Modifier: EdgeSplit modifier now has ignore_lanpr option. 2019-07-01 15:15:46 +08:00
b2ca257e63 LANPR: modified buttons and panels for non-LANPR engine display. 2019-07-01 14:50:34 +08:00
a620a2442f LANPR: Add LANPR to COMPACT_ENGINES in relevant panels. 2019-07-01 10:30:35 +08:00
d3dcb70f61 LANPR: remove unnecessary options when only generating GPencil strokes. 2019-07-01 10:10:12 +08:00
27ca5cdfee Merge branch 'master' into soc-2019-npr 2019-07-01 09:49:08 +08:00
bc3ef662d8 GPencil: Fix error in Thickness and Strength for closing strokes
The values were inverted.
2019-06-30 11:07:12 +02:00
541f66ffea GPencil: Add support for multiframe to Cyclic operator
This operator was working with active frame only.
2019-06-30 11:02:16 +02:00
ddc12efa21 GPencil: Remove Close operator and reuse Cyclic operator
Cyclic could do the same, so it's not logic to have duplicate code.
2019-06-30 11:01:51 +02:00
fad8b45df5 Merge branch 'master' into greasepencil-object 2019-06-30 11:00:41 +02:00
7130eee812 GPencil: Change poll method for Close stroke operator
Must be edit mode and 3D view.
2019-06-29 21:02:00 +02:00
e7b49aa84a GPencil: Add F key to close strokes 2019-06-29 21:01:54 +02:00
b5d4c081de GPencil: New parameter to create geometry when set stroke to cyclic
In grease pencil is not logic to join without geometry.
2019-06-29 21:01:48 +02:00
d5bebb33b2 GPencil: New Close Stroke operator
This operator allows to close a stoke generating geometry for the closing gap.

This is totally different of Cyclic, because this was only a visual closing, but as there wasn't new geometry, you could sculpt or edit and need manual subdivide.
2019-06-29 16:43:10 +02:00
5e8f7c439b Merge branch 'master' into greasepencil-object 2019-06-29 16:42:46 +02:00
7b725f55e1 Merge branch 'master' into greasepencil-object 2019-06-28 15:41:24 +02:00
37c3aa8eab LANPR: fix readfile pointer address. 2019-06-28 19:59:19 +08:00
9fc9ee742e LANPR: intersection strokes are now generated in the first collection. 2019-06-28 19:00:31 +08:00
d1ed9ddef2 Merge branch 'master' into greasepencil-object 2019-06-28 11:49:51 +02:00
d1d7dc4373 Gpencil: fixed "totweight" count in sample functions. 2019-06-28 15:00:20 +08:00
ec580226e8 Gpencil: make format 2019-06-28 14:51:38 +08:00
715458f413 Gpencil: New sample function which handles weights. 2019-06-28 14:49:59 +08:00
dd9579ccd4 LANPR: Added error message for failed DPIX shaders. 2019-06-28 14:05:11 +08:00
6d3e0a94f6 Merge branch 'master' into soc-2019-npr 2019-06-28 13:08:51 +08:00
56bc8e929a Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
2019-06-27 16:44:09 +02:00
605f492237 LANPR: make format. 2019-06-27 16:40:56 +08:00
0ce9471b49 LANPR: Fixed an accidental if() bracket error in lanpr_line_crosses_bounding_area(). 2019-06-27 16:03:56 +08:00
2d247cbda1 LANPR: GP stroke bake function. 2019-06-27 15:48:54 +08:00
a0c45cdaa4 LANPR: selective line type now working for objects and collections 2019-06-27 14:43:37 +08:00
3c185098c6 LANPR: ensure chain only contains one type of segments. 2019-06-27 14:35:02 +08:00
7be203b070 LANPR: collection line type selecot and default values. 2019-06-27 14:27:07 +08:00
a230ab1571 LANPR: first-time chain only includes the same type of lines. 2019-06-27 14:00:15 +08:00
0af490ede4 LANPR: enable switch now operative in software mode 2019-06-27 13:55:48 +08:00
1067924979 LANPR: modified modifier and main panel UI for clarity. 2019-06-27 13:05:20 +08:00
2712d082d3 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-06-27 12:03:21 +08:00
f0a225f524 LANPR: modified "item" into prev/next in lanpr_data_types.h 2019-06-26 21:50:13 +08:00
0751c14dd3 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
2019-06-26 13:41:24 +02:00
a400ce4a3d LANPR: collection GP target now working. 2019-06-26 17:02:18 +08:00
3fffd652f6 LANPR: collection and object usage flags now effective. object flags overrides modifier. 2019-06-26 16:28:21 +08:00
0d0f3801cd LANPR: Object usage flag is effective now. 2019-06-26 15:32:53 +08:00
a943a2edaa LANPR: move "usage" settings into struct ObjectLANPR. 2019-06-26 15:20:35 +08:00
fbbffc0420 LANPR: separate thresholds for image/geometry space chaining. 2019-06-26 14:29:28 +08:00
a4147edb3e LANPR: Fixed occlusion bugs in first-step chaining. 2019-06-26 14:02:20 +08:00
85aa8ab273 LANPR: shaders now support main color/thickness. 2019-06-26 13:28:02 +08:00
c6f58fc523 Merge branch 'master' into soc-2019-npr 2019-06-26 12:44:13 +08:00
d6eeb656ea LANPR: all the if() statements now use {} brackets. 2019-06-25 17:43:01 +08:00
52e35cd224 Merge branch 'master' into greasepencil-object 2019-06-25 11:26:17 +02:00
47d04c4af4 LANPR: Added collection target and related options. 2019-06-25 16:54:47 +08:00
5a4dd8f7b9 LANPR: make format 2019-06-25 16:21:03 +08:00
ce48510462 LANPR: Added collection tab and put collection specific LANPR settings in it. 2019-06-25 16:18:58 +08:00
c10f834b32 GPENCIL: Prevent sampling from crashing. Need a new implementation to calculate acturate segment count. 2019-06-25 14:33:07 +08:00
abecf82b6e GPENCIL: removed weights sample. Needs new implementaion. 2019-06-25 14:04:41 +08:00
be138d3380 LANPR: target GP material selection working 2019-06-25 13:44:44 +08:00
c0aae838ab LANPR: red-out modifier name when target is not set. 2019-06-25 13:25:36 +08:00
d0ea6e306c LANPR: filter GP targets only. 2019-06-25 13:24:35 +08:00
185d319ea3 LANPR: Comment changed into C style. 2019-06-25 12:39:39 +08:00
419837b680 Merge branch 'master' into soc-2019-npr 2019-06-25 12:15:12 +08:00
a0d1198a8d LANPR: Fix compiler issues
Yo need define the variable to copy and not the pointer array.

Also some clang format fixes done automatically by VS editor.
2019-06-24 15:51:47 +02:00
794da0fa14 GPENCIL: Sample function now handles weights as well. 2019-06-24 19:16:18 +08:00
5c7577f05b LANPR: fix error in GPencilModifierType. allocate for GPencil weights. 2019-06-24 17:15:35 +08:00
e3f606fa65 Merge remote-tracking branch 'origin/soc-2019-npr' into soc-2019-npr 2019-06-24 16:51:04 +08:00
6e1be5b09e LANPR: removed GP Stroke modifier, Object modifier now only create visible strokes and follow level values. 2019-06-24 16:49:04 +08:00
a86cbbfa51 LANPR: Apply clang format 2019-06-24 10:48:41 +02:00
f29cf28bab LANPR: Fix pointer mistakes. 2019-06-24 16:15:39 +08:00
45074ae36f LANPR: use "master style" instead of following contour style. 2019-06-24 09:23:50 +08:00
fd803aba5e GPENCIL: use copy_v3_v3 for gp points. 2019-06-24 08:35:30 +08:00
c2e7ef36d9 LANPR: make format 2019-06-23 18:01:07 +08:00
332423a7ca LANPR: two step chaining, need a toggle for switching 2d/3d space priority. 2019-06-23 18:00:03 +08:00
7799374520 LANPR: Fixed modifier read pointer error by providing foreachObjectLink() callback. 2019-06-23 16:11:21 +08:00
dc61580638 LANPR: modifier controlled stroke generation is working. (only manual) 2019-06-23 15:30:16 +08:00
1d532325bd LANPR: feature line modifier manual update 2019-06-23 14:28:29 +08:00
93f75be1ef GPencil: Remove Stencil for Background texture 2019-06-22 18:09:10 +02:00
e23ea999a6 Merge branch 'gp_stencil' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
	source/blender/draw/engines/gpencil/gpencil_engine.c
2019-06-22 17:55:05 +02:00
d1a5617c76 Merge branch 'master' into gp_stencil 2019-06-22 17:47:50 +02:00
31fb6c1d8f Merge branch 'master' into gp_stencil
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
	source/blender/draw/engines/gpencil/gpencil_engine.c
2019-06-22 16:56:25 +02:00
f30e4cd236 Merge branch 'master' into soc-2019-npr 2019-06-22 16:20:07 +08:00
b1bd4810b6 Merge branch 'master' into gp_stencil 2019-06-20 19:51:19 +02:00
2708515de7 Merge branch 'master' into gp_stencil 2019-06-20 16:32:29 +02:00
67e594ea7c Merge branch 'master' into gp_stencil 2019-06-20 13:44:21 +02:00
3af63f17c2 GPencil: Undo changes to use evaluated data in paint
There are problems when delete points and strokes and need a full redesign.
2019-06-20 13:37:49 +02:00
e8c17d9902 Merge branch 'master' into greasepencil-object 2019-06-20 09:36:12 +02:00
42e094bb3f Merge branch 'master' into gp_stencil 2019-06-20 09:35:36 +02:00
ec95642e6b Merge branch 'master' into GP_STENCIL 2019-06-19 20:04:02 +02:00
6e465c92da GPencil: Fix problem with several objects
The loop was not checking the end group of the object
2019-06-19 16:41:30 +02:00
ed00bc16a7 GPencil: Fix problem with several objects
The loop was not checking the end group of the object
2019-06-19 16:41:22 +02:00
0ac8ef1131 GPencil: Separate Stencils in groups of 255
Also some more changes to improve drawing.
2019-06-19 12:57:37 +02:00
15afcb6dd9 DRW: New functions for getting stencil_mask id
Workaround functions waiting for the clearing operation to be available inside the shgroups.

Required to check if the stencil was activated in the shading group to calculate batches of 255 stencil masks and reduce number of stencil clearing.
2019-06-19 12:57:31 +02:00
16279cbbba GPencil: Remove parameter and use Stencil for lines solid only
Also removed the parameter from UI
2019-06-19 12:57:16 +02:00
caa7c9a36f Merge branch 'master' into greasepencil-object 2019-06-19 12:56:55 +02:00
0738dac300 Merge branch 'master' into GP_STENCIL 2019-06-19 12:56:35 +02:00
1fe3139477 GPencil: Separate Stencils in groups of 255
Also some more changes to improve drawing.
2019-06-19 12:25:15 +02:00
08f6566dbf LANPR: Default values now in versioning_280.c 2019-06-19 18:17:20 +08:00
4be8461b88 LANPR: make format 2019-06-19 17:42:31 +08:00
ca0c24c9df LANPR: Manual stroke update functions. (Not working yet) 2019-06-19 17:41:02 +08:00
b5ea252ac3 LANPR: Chaining threshold parameter. Disabled LANPR composition operators. 2019-06-19 16:47:32 +08:00
e38a32e58a DRW: New functions for getting stencil_mask id
Workaround functions waiting for the clearing operation to be available inside the shgroups.

Required to check if the stencil was activated in the shading group to calculate batches of 255 stencil masks and reduce number of stencil clearing.
2019-06-19 09:30:50 +02:00
b165d0a414 LANPR: Removed "Tip Extend" data and properties. GP Modifiers will handle this. 2019-06-19 15:20:36 +08:00
dbb151c02b LANPR: modified default UI for more logical display. 2019-06-19 15:09:04 +08:00
e61479bcec Merge branch 'master' into GP_STENCIL 2019-06-19 08:56:17 +02:00
6e38e95b96 Merge branch 'master' into soc-2019-npr 2019-06-19 13:23:43 +08:00
6d88f8eaad GPencil: Remove parameter and use Stencil for lines solid only
Also removed the parameter from UI
2019-06-18 20:44:47 +02:00
7d15efec15 GPencil: Add a new parameter to material to disable Stencil
Sometimes is good to disable the stencil and get the overlap. With this parameter the artist has the option to disable it.
2019-06-18 19:31:18 +02:00
c2c6c62ea1 GPencil: Add a new parameter to material to disable Stencil
Sometimes is good to disable the stencil and get the overlap. With this parameter the artist has the option to disable it.
2019-06-18 19:24:36 +02:00
280135da56 GPencil: Disable Stencil for Fill while drawing 2019-06-18 18:05:22 +02:00
5be1adf12a GPencil: Disable Stencil for Fill while drawing 2019-06-18 18:05:06 +02:00
12b867cf66 GPencil: Disable Stencil for Dots while drawing 2019-06-18 18:01:47 +02:00
84666bdc3e GPencil: Disable Stencil for Dot while drawing 2019-06-18 18:00:19 +02:00
1ea17f5c9e GPencil: Disable Stencil for Dots and Fill shading groups
This types don't need stencil check because the stencil "kill" artistic effects.
2019-06-18 17:41:57 +02:00
2e15d015cd GPencil: Disable Stencil for Dots and Fill shading groups
This types don't need stencil check because the stencil "kill" artistic effects.
2019-06-18 17:41:25 +02:00
d4d92bff82 Basic Stencil working
Still not working the 255  layer separation
2019-06-18 17:31:25 +02:00
1243299bee LANPR: Added collection properties. 2019-06-18 18:28:36 +08:00
3f0c51c881 GPencil: Basic stroke stencil to avoid alpha glitches
Still not completed, but this commit fix the ugly artifacts in strokes with alpha when the stroke intersect itself. Now, the stroke only use the first pixel color and don't add blends.
2019-06-18 11:24:12 +02:00
4adfa653b5 Merge branch 'master' into greasepencil-object 2019-06-18 11:14:17 +02:00
a4287db20d LANPR: Fix smooth contour modifier merge errors. 2019-06-18 16:22:27 +08:00
1fb871e804 Merge remote-tracking branch 'DarkdefenderRepo/npr_tess' into soc-2019-npr 2019-06-18 16:09:44 +08:00
013c6d6c38 LANPR:Added option to use the same style for different line types 2019-06-18 15:53:21 +08:00
30b2db0be7 LANPR: Add enable and auto update switches 2019-06-18 15:00:28 +08:00
13cff0d524 LANPR: Move main panel to render tab 2019-06-18 13:36:49 +08:00
384d417f5f Merge branch 'master' into greasepencil-object 2019-06-17 10:22:49 +02:00
7cb674d521 LANPR: make format 2019-06-17 15:08:06 +08:00
915a928067 Merge branch 'master' into soc-2019-npr 2019-06-17 14:58:39 +08:00
fe71389950 LANPR: Object modifier for line selection (not functional yet) 2019-06-17 14:50:34 +08:00
c45cfec2fd Merge branch 'master' into greasepencil-object 2019-06-16 11:01:53 +02:00
f4ed032ad0 Merge branch 'master' into greasepencil-object 2019-06-15 09:11:00 +02:00
4f5f19c1a8 Merge branch 'master' into greasepencil-object 2019-06-14 20:10:38 +02:00
df385eb0a9 Merge branch 'master' into greasepencil-object 2019-06-14 10:12:35 +02:00
0d159bf74e LANPR: Removed duplicated code in stroke modifier. 2019-06-13 23:09:22 +08:00
40a12b4a38 LANPR: Fix pointer conversion for MSVC. 2019-06-13 22:33:04 +08:00
82c6ebee9a Merge branch 'master' into greasepencil-object 2019-06-13 13:51:58 +02:00
5d689428b3 Merge branch 'master' into greasepencil-object 2019-06-12 16:04:01 +02:00
e09dfe644b Merge remote-tracking branch 'origin/master' into soc-2019-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
2019-06-12 21:35:05 +08:00
6034edfb41 LANPR: Use root bounding area to allow longer chaining (need workarounds.) 2019-06-12 21:33:27 +08:00
bc1b7a7af1 LANPR: Chain connection is now working properly 2019-06-12 21:05:53 +08:00
c8ad50a4e3 LANPR: Chain connection working. 2019-06-12 19:33:25 +08:00
668c15d5bf LANPR: Chain image space connection (not working yet) 2019-06-12 17:55:57 +08:00
212351ad78 Merge branch 'master' into greasepencil-object 2019-06-12 08:46:38 +02:00
0dd47056eb Merge branch 'master' into greasepencil-object 2019-06-11 11:06:11 +02:00
d251aaeebe LANPR: Shader free. 2019-06-11 12:04:54 +08:00
1d68941e3b Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-06-10 19:57:59 +08:00
f59db22f51 LANPR: Software mode now allows camera lens shift. 2019-06-10 19:52:20 +08:00
5e2fab456d LANPR: sample and batch pool goes to lanpr_share. 2019-06-10 17:17:29 +08:00
5d534f947d LANPR: hide render_buffer from SceneLANPR, implemented copy and free functions. No memory leaks on software mode now. 2019-06-10 16:15:11 +08:00
d1c4790d61 Merge branch 'master' into greasepencil-object 2019-06-10 08:39:03 +02:00
d6456466e9 LANPR: Renoved workbench engine registeration. Now LANPR registers correctly. Memory free working. 2019-06-10 13:52:43 +08:00
7e5eeeeb9c LANPR: Fixed DPIX object position error. 2019-06-09 17:32:33 +08:00
1eb0994d38 LANPR: Fixed triangle culling algorithm errors. 2019-06-09 14:50:44 +08:00
a6678bc637 Merge branch 'master' into greasepencil-object 2019-06-07 13:01:49 +02:00
ee28432848 Merge branch 'master' into greasepencil-object 2019-06-07 10:40:53 +02:00
a391719afd Merge branch 'master' into greasepencil-object 2019-06-05 15:59:20 +02:00
a4b0a65909 GPencil: Backbone Stretcher modifier 2019-06-05 12:20:48 +08:00
f8f010887b Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-06-05 11:09:28 +08:00
1816e1f9ae GPencil: Sample modifier OK. 2019-06-04 21:43:16 +08:00
c536d7b778 LANPR: Added a placeholder for GPencil sample modifier. 2019-06-04 18:31:09 +08:00
c610ea5ad0 Merge branch 'master' into greasepencil-object 2019-06-04 11:15:51 +02:00
fd9c100e59 GPencil: Fix compiler error after merge 2019-06-04 11:14:41 +02:00
7f1a9480fc LANPR: Fixed last segment missing error on chain splitting. 2019-06-04 16:41:12 +08:00
b7067088fe Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
2019-06-04 10:40:35 +02:00
cbc0c4846b LANPR: Split chains based on occlusion value changes. 2019-06-04 16:24:40 +08:00
f23223ee26 LANPR: Fixed last point occlusion error on "this line" chaining. 2019-06-04 14:48:05 +08:00
181e4ba1cf LANPR: Fixing chaining occlusion values for GPencil to use. 2019-06-04 13:48:40 +08:00
00202210ca Make LANPR main panel show in all engines. Fixed "up" button bug. Crease value now in software mode as well. 2019-06-04 12:47:54 +08:00
902c358932 Merge branch 'master' into soc-2019-npr 2019-06-04 12:15:43 +08:00
2897c90597 LANPR: rollback no-depth composition for GP, use object in front. Fixing chaining artefacts. 2019-06-03 18:28:09 +08:00
acc075f33c LANPR: GP stroke now automatically updates LANPR cache. 2019-06-03 17:49:24 +08:00
4cc1426783 LANPR: Memory now all in RenderBuffer->pool. engine_free() not called. 2019-06-03 16:28:29 +08:00
90137bbfa4 Fix chaining occlusion error and formatted source files. 2019-06-03 15:24:15 +08:00
bb48fcac2f Render data distroy functions 2019-06-03 15:06:32 +08:00
461008a3e8 Image and viewport now both support GPencil stroke overlay 2019-06-03 14:20:52 +08:00
dfbd3e4d9e Grease pencil composition depth option added. 2019-06-03 13:57:52 +08:00
bff6b5330f Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-06-03 12:06:09 +08:00
be9ef613fc Fixed smooth contour modifier not showing up bug. 2019-05-31 10:47:57 +08:00
b3d98f3532 Grease pencil conversion now projects onto 3D space now. Need perspective correction fix for cut points. 2019-05-31 10:20:35 +08:00
4f2b6c95fa Merge branch 'master' into soc-2019-npr 2019-05-31 08:12:45 +08:00
ecfe74cf74 Fix remaining pointer conversion errors for MSVC 2019-05-30 09:48:21 -06:00
25987fef1d Fix pointer conversion error for MSVC 2019-05-30 22:33:56 +08:00
413b2256d9 Spell check 2019-05-30 21:10:16 +08:00
daf3610a95 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-05-30 19:22:46 +08:00
29f1a8f175 Added LANPR chain conversion funcitons. Now LANPR to GP is able to run. 2019-05-30 19:21:58 +08:00
1c2cda87b1 temporally add draw lib to gpencil modifier for lanpr 2019-05-30 16:11:46 +08:00
0d1bf0623b Adding lanpr to grease pencil strokes modifier. 2019-05-30 15:16:58 +08:00
200e5a77e2 Merge remote-tracking branch 'origin/master' into soc-2019-npr 2019-05-30 12:36:19 +08:00
5cfe6607d8 Remove obsolete memory pool 2019-05-30 12:35:16 +08:00
39ee04352d Merge branch 'master' into greasepencil-object 2019-05-29 16:54:15 +02:00
dac6485938 Merge remote-tracking branch 'origin/master' into soc-2019-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
2019-05-29 16:23:33 +08:00
66f09eef29 Clean up of lanpr_util stuff. 2019-05-29 16:21:28 +08:00
6b9eb806dd Merge branch 'master' into greasepencil-object 2019-05-29 09:50:15 +02:00
14ffd94628 Finished structure naming convention changes in lanpr_all.h 2019-05-28 21:54:04 +08:00
28944549d6 Clang format the code. 2019-05-28 21:15:20 +08:00
19d3c5f9a6 Continue renaming structure variables. 2019-05-28 21:09:32 +08:00
37cc7063c7 Fixing LANPR structure naming to blender's style 2019-05-28 20:52:17 +08:00
847192b3d6 Use DRW_view APIs. (Potentially not doing it correctly.) 2019-05-28 16:32:11 +08:00
f37533fc44 Merge branch 'master' into soc-2019-npr 2019-05-28 15:39:42 +08:00
aa966ebf64 Merge branch 'master' into greasepencil-object 2019-05-27 16:26:14 +02:00
b50c7d7861 Merge branch 'master' into greasepencil-object 2019-05-27 10:14:06 +02:00
f78e1dea64 Merge branch 'master' into greasepencil-object 2019-05-26 16:24:51 +02:00
ef22ff0f79 GPencil: Redesign Grab evaluation transform calculation
Still problems with single points strokes
2019-05-23 17:01:14 +02:00
7acb5b91d5 GPencil: More test to apply evaluated rotation in Sculpt
This is an experimental commit
2019-05-23 12:55:14 +02:00
28748bb85c GPencil: Prepare data to calc transformation in derived data
This commits only prepares the information.
2019-05-22 10:52:09 +02:00
22c36bd7b3 Merge branch 'master' into greasepencil-object 2019-05-22 10:10:20 +02:00
fc0659a24b Merge branch 'master' into greasepencil-object 2019-05-21 20:26:00 +02:00
7155130911 GPencil: New function to get derived array
This utility is used to get the difference between original point and derived point
2019-05-21 19:52:59 +02:00
d5a8fe2282 Merge branch 'master' into greasepencil-object 2019-05-21 16:40:27 +02:00
6661855767 GPencil: Fix grab error in Sculpt with evaluated data 2019-05-21 16:13:57 +02:00
22768c2eff GPencil: Prepare fileds to implement Sculpt with eval data 2019-05-21 13:26:58 +02:00
2f3af2cc93 GPencil: Use evaluated data for Eraser
Now it's possible to erase an stroke in the position after applying a modifier. Before, this was not supported.
2019-05-21 12:42:59 +02:00
2b17ed31e2 Merge branch 'master' into greasepencil-object 2019-05-21 10:30:00 +02:00
76675d2eb7 Merge branch 'master' into greasepencil-object 2019-05-20 16:53:18 +02:00
4272fbae72 GPencil: Add multiframe support to reproject surface operator
This change solves T64814
2019-05-20 16:52:28 +02:00
f0e9ecd26b GPencil: Fix error in Multiedit
This error was related to the change to use depsgraph
2019-05-20 16:05:18 +02:00
Lukas W
0b8d2ab88c GPencil: Improve reproject operator in surface mode
See D4878 by  Lukas W (@geloescht)
2019-05-20 11:17:33 +02:00
69d338e254 Merge branch 'master' into greasepencil-object 2019-05-20 10:13:34 +02:00
a640228d92 Added support structure for material controlled line style.
Also with a primitive UI.
2019-05-19 14:37:03 +08:00
5b6b741ec0 Disable rendering of the orginal scene in the script. 2019-05-18 21:01:29 +08:00
abf50bc1db Merge branch 'master' into soc-2018-npr 2019-05-18 19:41:40 +08:00
78a8b208b7 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_object_types.h
2019-05-17 10:45:23 +02:00
abe57249a5 GPencil: Fix crash adding new layer
The derived frame was not initializated to NULL.
2019-05-16 20:48:00 +02:00
818d2258b1 Merge branch 'master' into greasepencil-object 2019-05-16 20:13:31 +02:00
ba694d0e60 Merge branch 'master' into greasepencil-object 2019-05-16 16:17:51 +02:00
96caf9f4b7 Merge branch 'master' into greasepencil-object 2019-05-16 14:02:26 +02:00
e0dbedb708 GPencil: Apply Onion keyframe type to all modes 2019-05-16 13:43:40 +02:00
84f0aee3d7 GPencil: Change Onion key type filter to Range mode
The filter is more useful in this mode, not selected.
2019-05-16 13:38:23 +02:00
9faa0f7e6d GPencil: Remove animation for some properties 2019-05-16 12:15:25 +02:00
104c84a793 GPencil: New filter in Onion by keyframe type
This new filter allows to select only some type of keyframe (keyframe, breakdown, etc).

This was a request of artists that are used to work with other 2D softwares.
2019-05-16 12:03:56 +02:00
a0c890d3ef Merge branch 'master' into greasepencil-object 2019-05-16 12:03:28 +02:00
46866fb907 Solve merge errors in shader calls. 2019-05-16 10:03:21 +08:00
54804117e8 Merge branch 'master' into soc-2018-npr 2019-05-16 09:48:45 +08:00
f5e091095a Merge branch 'master' into greasepencil-object 2019-05-15 09:49:00 +02:00
21755dc610 Merge branch 'master' into greasepencil-object 2019-05-14 18:08:14 +02:00
c391f9daca Merge branch 'master' into greasepencil-object 2019-05-14 17:30:26 +02:00
977cfd62dc Merge branch 'master' into greasepencil-object 2019-05-14 16:32:33 +02:00
c15b10e227 Merge branch 'master' into greasepencil-object 2019-05-14 12:34:12 +02:00
6aa462128a Merge branch 'master' into greasepencil-object 2019-05-13 10:06:29 +02:00
5b2b1f053f Merge branch 'master' into greasepencil-object 2019-05-11 08:37:16 +02:00
cd82e3fcd4 Merge branch 'master' into greasepencil-object 2019-05-10 15:32:58 +02:00
c6acb31f70 Merge branch 'master' into greasepencil-object 2019-05-10 08:29:53 +02:00
fd9d4da257 GPencil: Fix errors after merge and minor cleanup 2019-05-09 13:36:21 +02:00
b914af26a2 Merge branch 'master' into greasepencil-object 2019-05-09 13:28:24 +02:00
ccd176046f GPencil: Move modifiers evaluation logic to Depsgraph (wip)
This commits is the first step to move all logic for evaluating modifiers to depsgraph evaluation and remove from the draw manager.  This was coded in the draw manager because when new grease pencil modules were written, the depsgraph was not ready.

Move all to depsgraph reduces the complexity of draw manager, and follows the standards for evaluated data.

This allows to use the evaluated data in edition modes.

Now, it's only working in selection operators, but in the future the different tools will work with the evaluated version and not with the original version as it was before.
2019-05-09 13:27:41 +02:00
767f1801fc Merge branch 'master' into greasepencil-object 2019-05-09 09:08:57 +02:00
bb0830816d Merge branch 'master' into greasepencil-object 2019-05-07 11:47:38 +02:00
2753611c4e Merge branch 'master' into soc-2018-npr 2019-05-06 10:09:12 +08:00
4a3fb26d34 GPencil: More code reorganization
Part of the reorganization to implement modifiers in Edit mode.
2019-05-04 10:59:35 +02:00
c6cf0b9999 GPencil: Move Runtime Cache data definition to BKE
This is the first step to prepare the code for using the modifiers data in Edit mode.
2019-05-04 10:52:37 +02:00
2c869e45c8 Merge branch 'master' into greasepencil-object 2019-05-03 18:44:05 +02:00
9a13815c49 Merge branch 'master' into greasepencil-object 2019-05-03 18:38:01 +02:00
3595919cba GPencil: Use default Brush material in Popover
For pinned materials, the stroke color must be the brush color, not selected slot.
2019-05-03 17:38:47 +02:00
8d6f4b75a7 GPencil: Change UI text 2019-05-03 10:29:24 +02:00
3928582d35 GPencil: Fix some errors in previous commit adding color to popover 2019-05-03 10:28:20 +02:00
3e7064f66e Merge branch 'master' into greasepencil-object 2019-05-03 10:16:50 +02:00
fc048122ce GPencil: Add Stroke Color to Popover panel 2019-05-03 10:16:19 +02:00
3d9bfd76b9 Merge branch 'master' into greasepencil-object 2019-05-03 09:49:27 +02:00
3947310ca8 Merge branch 'master' into greasepencil-object 2019-04-30 17:50:16 +02:00
f147becfd4 Merge branch 'master' into greasepencil-object 2019-04-29 16:25:16 +02:00
aafb17aeed Merge branch 'master' into greasepencil-object 2019-04-27 08:47:20 +02:00
abfd340bce Merge branch 'master' into greasepencil-object 2019-04-25 17:22:54 +02:00
eedb25087c Merge branch 'master' into greasepencil-object 2019-04-24 10:19:04 +02:00
fbb5edf974 Merge branch 'master' into soc-2018-npr
# Conflicts:
#	source/blender/blenloader/intern/readfile.c
2019-04-24 11:00:23 +08:00
cddccbc7b7 Merge branch 'master' into greasepencil-object 2019-04-22 17:30:18 +02:00
efcc83a07d Merge branch 'master' into soc-2018-npr 2019-04-22 09:46:20 +08:00
e630644fd4 Merge branch 'master' into greasepencil-object 2019-04-21 12:04:14 +02:00
2c5bce2300 Merge branch 'master' into soc-2018-npr Fix errors
# Conflicts:
#	intern/opensubdiv/internal/opensubdiv_evaluator.cc
#	intern/opensubdiv/internal/opensubdiv_evaluator_internal.cc
#	release/scripts/startup/bl_ui/properties_data_modifier.py
#	source/blender/CMakeLists.txt
#	source/blender/blenkernel/intern/scene.c
#	source/blender/blenloader/intern/readfile.c
#	source/blender/blenloader/intern/versioning_280.c
#	source/blender/blenloader/intern/writefile.c
#	source/blender/bmesh/intern/bmesh_polygon.c
#	source/blender/draw/CMakeLists.txt
#	source/blender/draw/intern/draw_manager.c
#	source/blender/draw/modes/object_mode.c
#	source/blender/editors/mesh/editmesh_tools.c
#	source/blender/editors/mesh/mesh_ops.c
#	source/blender/editors/render/render_intern.h
#	source/blender/editors/render/render_ops.c
#	source/blender/editors/space_outliner/outliner_draw.c
#	source/blender/editors/space_view3d/space_view3d.c
#	source/blender/makesdna/DNA_light_types.h
#	source/blender/makesdna/DNA_modifier_types.h
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/makesdna/intern/makesdna.c
#	source/blender/makesrna/intern/CMakeLists.txt
#	source/blender/makesrna/intern/makesrna.c
#	source/blender/makesrna/intern/rna_modifier.c
#	source/blender/makesrna/intern/rna_scene.c
#	source/blender/modifiers/CMakeLists.txt
#	source/blender/modifiers/intern/MOD_util.c
2019-04-20 14:10:24 +08:00
4d40187623 Merge branch 'master' into greasepencil-object 2019-04-19 10:30:11 +02:00
2a6abac705 Merge branch 'master' into greasepencil-object 2019-04-18 19:40:23 +02:00
fe9a87f879 Merge branch 'master' into greasepencil-object 2019-04-18 16:59:57 +02:00
4047ed1a9d GPencil: Add option to mix color with texture
This was already supported in Fill, but not in Strokes. This adds more artistic options when use textured strokes.
2019-04-18 14:29:19 +02:00
a656b6dacc Merge branch 'master' into greasepencil-object 2019-04-18 14:27:24 +02:00
0323111785 Merge branch 'master' into greasepencil-object 2019-04-18 09:47:43 +02:00
865bb3f948 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/draw/engines/gpencil/gpencil_engine.h
2019-04-17 18:09:12 +02:00
44acf0e331 Merge branch 'master' into greasepencil-object 2019-04-16 13:15:06 +02:00
24de946a4e GPencil: New Normalize All operator
This operator works similar to mesh operator but for Stroke and Points data.

Also minor cleanup in Normalize operator.
2019-04-16 12:12:35 +02:00
1fb43ba8c3 GPencil: Add lock icon to Vertex Groups list
Also check this flag in operators.

Note: This is required for the development of the new Normalize All operator.
2019-04-16 11:27:36 +02:00
565772bc70 GPencil: New Normalize Weights operator
This works similar to mesh operator, but using Stroke and Points data.
2019-04-16 10:47:30 +02:00
c85241bf32 Merge branch 'master' into greasepencil-object 2019-04-16 10:25:53 +02:00
2148ad3eb9 Merge branch 'master' into greasepencil-object 2019-04-15 16:45:08 +02:00
05db802421 Merge branch 'master' into greasepencil-object 2019-04-15 10:34:58 +02:00
2f36df9f37 Merge branch 'master' into greasepencil-object 2019-04-15 09:50:08 +02:00
ce90b6fb76 Merge branch 'master' into greasepencil-object 2019-04-13 13:33:51 +02:00
39ccfbc604 Merge branch 'master' into greasepencil-object 2019-04-13 11:21:37 +02:00
88928b6234 GPencil: Implement Opacity transform
Add Shift+F to transform points opacity in Edit mode
2019-04-13 10:48:53 +02:00
33a62c4277 GPencil: Add option to Follow Drawing Path
This option allows to enable or disable the automatic orientation of Dot and Box strokes.
2019-04-12 15:53:49 +02:00
8bfc689e83 Cleanup: Fix comment typo 2019-04-12 11:19:21 +02:00
d5b6f93523 Merge branch 'master' into greasepencil-object 2019-04-12 11:15:05 +02:00
dda2bdd819 GPencil: Improves Dot Texture rotation
Before when you use textures in a Dot stroke, the texture did not rotate with the stroke and always kept locked to North (0, 1).

Now, the rotation of the texture is calculated using the previous point to determine the direction of the stroke and rotate the texture following the drawing path.
2019-04-12 11:14:30 +02:00
11229c4d41 Merge branch 'master' into soc-2018-npr 2019-04-12 16:33:02 +08:00
e48795c20c GPencil: Cleanup unused shader variable 2019-04-11 18:31:00 +02:00
dfeb47e7ba GPencil: Cleanup unused vars 2019-04-11 18:06:16 +02:00
a27eb4dddb Merge branch 'master' into greasepencil-object 2019-04-11 16:37:07 +02:00
5740dc8f2a GPencil: Improve gradient stroke thickness
This change tries to improve the control of thickness when mix strength and gradient.
2019-04-10 20:01:25 +02:00
65d54f3023 GPencil: Replace gradient tooltip 2019-04-10 14:22:39 +02:00
30dea6af8d Merge branch 'master' into greasepencil-object 2019-04-10 10:42:52 +02:00
0c4144c472 GPencil: Improve Gradient in Dots mode
The old method was too complex and got weird results when mixed with brush strength. Now the result is far better.
2019-04-10 10:42:23 +02:00
39b32676d2 GPencil: Fix error with material context 2019-04-09 16:43:45 +02:00
ea90625acf GPencil: Active gradient only for DOTS 2019-04-09 16:25:04 +02:00
48bf837c8c GPencil: Disable gradient lines for Line strokes
Keep this disabled while the line glitch bug exists.
2019-04-09 16:01:14 +02:00
f415cbec5e Merge branch 'master' into greasepencil-object 2019-04-09 11:38:41 +02:00
c4fec789b2 GPencil: Remove Opacity parameter from Topbar 2019-04-09 11:30:15 +02:00
31066ef234 GPencil: Fix stroke opacity initialization 2019-04-08 17:22:48 +02:00
a016499d4a Merge branch 'master' into greasepencil-object 2019-04-08 16:32:00 +02:00
4f938d2cfe Merge branch 'master' into greasepencil-object 2019-04-07 17:05:26 +02:00
535899ae57 Merge blender2.8 into npr_tess 2019-04-05 23:38:45 +02:00
f1be941769 Merge branch 'master' into greasepencil-object 2019-04-05 18:29:11 +02:00
f1470a84f8 Fix modifier api 2019-04-04 21:57:00 +08:00
92a33e4599 Merge remote-tracking branch 'origin/master' into soc-2018-npr 2019-04-04 20:33:44 +08:00
47495f6f09 Fix errors 2019-04-04 20:33:16 +08:00
525c9034cd Merge remote-tracking branch 'origin/master' into soc-2018-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_scene.py
#	source/blender/draw/intern/draw_manager_texture.c
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2019-04-04 19:14:41 +08:00
23c262192c Merge branch 'master' into greasepencil-object 2019-04-02 16:51:32 +02:00
dab0af9b0d Merge branch 'master' into greasepencil-object 2019-04-02 11:40:23 +02:00
6cf1f68725 Merge branch 'master' into greasepencil-object 2019-04-01 11:27:20 +02:00
5407c3a8b0 Merge branch 'master' into greasepencil-object 2019-03-30 11:37:22 +01:00
623b08d210 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2019-03-27 16:03:19 +01:00
1dbece8080 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2019-03-24 12:12:26 +01:00
46d35d00f6 Merge branch 'master' into greasepencil-object 2019-03-22 09:05:29 +01:00
a30dfaab64 Merge branch 'master' into greasepencil-object 2019-03-20 17:17:50 +01:00
24bab81d08 Merge branch 'master' into greasepencil-object 2019-03-19 16:25:10 +01:00
67143dba0d GPencil: Add gradient opacity parameter to topbar 2019-03-19 14:07:26 +01:00
12655c3590 GPencil: Cleanup unused code 2019-03-19 13:51:40 +01:00
b513f29a87 GPencil: Change Text for Gradient parameter 2019-03-19 13:49:41 +01:00
530d81c240 GPencil: More changes in gradient calculation for points 2019-03-19 13:44:24 +01:00
2ba4164072 GPencil: More changes to gradient factors 2019-03-19 12:27:58 +01:00
781a282caa GPencil: Pass gradient basic data to point shader 2019-03-18 11:04:31 +01:00
7f6d3d8fc4 GPencil: Add default gradient values to gizmo 2019-03-18 10:56:01 +01:00
bdbb0b0bd6 GPencil: Fix problem with gradient for Stroke and Monkey primitives 2019-03-18 10:53:15 +01:00
4ca31474ef GPencil: Pass basic data to shaders for gradients (wip) 2019-03-18 10:50:07 +01:00
dda3e48303 GPencil: Copy Brusg gradient data to stroke in drawing operators. 2019-03-18 10:29:13 +01:00
323ab6fdd7 GPencil: Set default gradient in new brushes 2019-03-18 09:06:11 +01:00
ac1adbc3f1 GPencil: New parameter for gradient
Add new fields and initialize.
2019-03-18 09:03:29 +01:00
13c1e7ffb7 Merge branch 'master' into greasepencil-object 2019-03-17 19:49:19 +01:00
738c8482de Merge branch 'master' into greasepencil-object 2019-03-17 15:56:55 +01:00
cf30fc24a8 GPencil: Reproject strokes to 3D cursor
Add a new option to reproject the strokes using the 3D cursor orientation.
2019-03-17 12:54:31 +01:00
9d13f18cce Merge branch 'master' into greasepencil-object 2019-03-17 09:38:31 +01:00
8ea91b34d7 GPencil: Back Canvas Grid to Draw position
Undo the previous commit and keep the Canvas in the position used in Draw mode. Change the position by mode looks strange.
2019-03-16 19:33:18 +01:00
df04d1242d Merge branch 'master' into greasepencil-object 2019-03-16 19:22:01 +01:00
9b50448e0d GPencil: Test the option to move the grid depending of mode. 2019-03-16 17:40:08 +01:00
4ee23876b5 Revert "GPencil: Show Canvas Grid only in Draw Mode"
This reverts commit a6ca1b27fb.
2019-03-16 17:15:05 +01:00
a6ca1b27fb GPencil: Show Canvas Grid only in Draw Mode
The grid is not used in Edit mode and in Sculpt mode the position depends of point, so the visual help is not valid.
2019-03-16 16:53:04 +01:00
4d390c2af6 Merge branch 'master' into greasepencil-object 2019-03-16 12:01:56 +01:00
c2fa4d18a0 GPencil: Fix compiler warning 2019-03-15 19:44:41 +01:00
3632e925c2 GPencil: Use the cursor lock in Sculpt mode
The point is locked to a plane with the last point and the normal of the cursor orientation.

The moved point is projected over the cursor/point plane and the closet point is used as result of the sculpt operation.
2019-03-15 19:36:34 +01:00
d4982f1911 GPencil: Canvas grid must be invisible for Stroke and Surface modes
In these modes, the grid is not used, so it's not logic show somthing that is not used.
2019-03-15 17:24:49 +01:00
0402db47b1 GPencil: Change cursor orientation Tooltip 2019-03-15 17:08:14 +01:00
fec90e08f7 Merge branch 'master' into greasepencil-object 2019-03-15 16:49:02 +01:00
6e8ac50dde GPencil: Improve origin location of new strokes
Before there was a mix between cursor and object origin. Now the origin is defined with one parameter and the lock defines the orientation.
2019-03-15 16:48:30 +01:00
cf5b7f97de Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_primitive.c
2019-03-15 10:10:27 +01:00
25b6802aca GPencil: Drawing locked to 3D cursor (wip)
Now it's possible to draw strokes attached to a plane locked to 3D cursor.

Still pending the lock in Sculpt mode.
2019-03-15 08:43:39 +01:00
f63255412f Merge branch 'master' into greasepencil-object 2019-03-14 19:54:31 +01:00
2bbcae2779 Merge branch 'master' into greasepencil-object 2019-03-14 19:50:24 +01:00
07c8f472cd GPencil: Cleanup unused shader code
After last changes, some code is not required and only adds noise lines.
2019-03-14 09:48:08 +01:00
b95c52d151 GPencil: Text flip vertical to texture stroke 2019-03-13 19:48:16 +01:00
11f5d0e339 GPencil: More test for textured strokes
Now the texture is inverted in alternate segments.
2019-03-13 16:36:08 +01:00
f3ee171917 Merge branch 'master' into greasepencil-object 2019-03-13 10:05:49 +01:00
712e898f28 Merge branch 'master' into greasepencil-object 2019-03-11 17:43:32 +01:00
55ca1d7c0e GPencil: Display color names only in Edit mode 2019-03-10 17:14:01 +01:00
bd4e21591b Merge branch 'master' into greasepencil-object 2019-03-10 16:53:25 +01:00
236353e385 GPencil: Add support to color names for selected strokes
When enable names display in object panel, the color of each selected stroke is displayed in the viewport near to the first selected stroke.
2019-03-10 16:52:43 +01:00
c7ce7f6f83 Merge branch 'master' into greasepencil-object 2019-03-08 22:09:50 +01:00
71e55d7a9a Merge branch 'master' into greasepencil-object 2019-03-08 19:55:53 +01:00
4bfe2a1638 Merge branch 'master' into greasepencil-object 2019-03-08 16:15:41 +01:00
a08bf336f5 Type error 2019-03-08 19:58:41 +08:00
c46ce1bc81 Merge changes 2019-03-08 19:39:02 +08:00
26fc7ef55f Merge branch 'master' into soc-2018-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/draw/intern/DRW_render.h
#	source/blender/makesdna/DNA_light_types.h
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2019-03-08 19:12:37 +08:00
51db1be858 GPencil: More test to textured strokes
Now, the UV is inverted by section (a full texture width) and not by point.
2019-03-08 10:24:54 +01:00
5a2e6d1a2f GPencil: Fix error after merge
Missing field rename.
2019-03-08 10:04:01 +01:00
3ff6b1b79e Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2019-03-08 08:44:03 +01:00
afbe476aa7 Merge branch 'master' into greasepencil-object 2019-03-07 19:16:08 +01:00
5b627da8ad GPencil: Invert texture UV for textured strokes
More test with textures to invert the UV depending of the random rotation.
2019-03-07 10:05:37 +01:00
f1966fae33 GPencil: Try to add some randomness to textured strokes
This is a test to check the sclae of the random value for UV in strokes.
2019-03-06 19:47:17 +01:00
3d60d3eb22 Merge branch 'master' into greasepencil-object 2019-03-06 19:31:38 +01:00
fe436f279c Merge branch 'master' into greasepencil-object 2019-03-06 19:23:24 +01:00
995113925f Merge branch 'master' into greasepencil-object 2019-03-06 16:26:30 +01:00
9c14b2442e Merge branch 'master' into greasepencil-object 2019-03-05 12:13:40 +01:00
10c15f2778 Merge branch 'master' into greasepencil-object 2019-03-04 20:57:35 +01:00
341d5f4cff Annotations: Reduce smooth factor to 0.5
The previous value was too high and deform too much if write text.
2019-03-04 20:38:03 +01:00
e897ec1295 Merge branch 'master' into greasepencil-object 2019-03-04 19:41:20 +01:00
46b6c97737 GPencil: Add a comment to tag pending change in gizmo
This comment is to tag this line to be removed when OB_MODE_EDIT_GPENCIL will be merged into OB_MODE_EDIT.
2019-03-04 19:28:35 +01:00
1d903d490b GPencil: Move Extrude Toolbutton to bottom group 2019-03-04 19:24:42 +01:00
8f6ef7563a GPencil: Add multiframe support to Extrude operator 2019-03-04 17:43:49 +01:00
2028ca8426 Merge branch 'master' into greasepencil-object 2019-03-04 17:32:55 +01:00
d56f4f55b1 GPencil: New extrude operator
If the extrude points are the first or last of the stroke, the stroke is extended.

If the extrude points are in the middle of the stroke, a new stroke is created because the grease pencil strokes can be only with 2 extremes.

Still pending define a new icon and set by default XYZ axis in gizmo.
2019-03-03 16:35:54 +01:00
283b516d88 Merge branch 'master' into greasepencil-object 2019-03-03 16:33:17 +01:00
fb0f740f81 GPencil: Fix merge error 2019-03-01 20:58:03 +01:00
89bb36edc6 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_engine.c
2019-03-01 20:55:19 +01:00
a001cdb3ad GPencil: Fill: UI Tweaks 2019-03-01 15:44:24 +00:00
aac875421f GPencil: Fill changes
+ Replace Strokes with Adaptive
+ Remove dilate option, always on
+ UI changes
2019-03-01 13:29:04 +00:00
34b32fbd2c GPencil: Fix merge error 2019-02-28 16:16:51 +01:00
63ea3ffa26 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_engine.c
	source/blender/draw/engines/gpencil/gpencil_engine.h
	source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
2019-02-28 16:13:26 +01:00
07c6221925 GPencil: Rename variable name and add alpha to outline
The outline now has some alpha to be more consistent with other Blender areas.
2019-02-28 16:11:30 +01:00
a030e2fa15 GPencil: Disable Outline if Overlay is disabled
The main overlay switch and outline option must be checked.
2019-02-28 15:58:03 +01:00
8388f4b985 GPencil: Remove comment line added by error to header text
This line was added accidentally in the header text.
2019-02-28 12:23:58 +01:00
345ab3ab70 GPencil: Increase outline to 2 pixels
The selection outline of 1 pixel was too thin.
2019-02-28 12:12:52 +01:00
834942d121 GPencil: Hide selecction outline when play animation 2019-02-28 11:45:23 +01:00
770239fe61 GPencil: Draw Outline to Active and Selected objects
Now an outline is drawn when the grease pencil is selected.
2019-02-28 11:16:35 +01:00
ad9922516a GPencil: Remove dummy marker for Grease Pencil objects
After adding selecction using strokes, the dummy is not required because it was added as a provisional solution while we implement stroke selection.
2019-02-28 11:16:29 +01:00
db6fb2a719 GPencil: Add selection support for objects using strokes
Now it's possible to select a grease pencil object without using the dummy.
2019-02-28 11:16:24 +01:00
18c43863f4 GPencil: Draw Outline to Active and Selected objects
Now an outline is drawn when the grease pencil is selected.
2019-02-28 10:47:57 +01:00
370d6293dc GPencil: Remove dummy marker for Grease Pencil objects
After adding selecction using strokes, the dummy is not required because it was added as a provisional solution while we implement stroke selection.
2019-02-27 20:46:04 +01:00
0b0bda3860 GPencil: Add selection support for objects using strokes
Now it's possible to select a grease pencil object without using the dummy.
2019-02-27 19:50:58 +01:00
21bcc58c88 Merge branch 'master' into greasepencil-object 2019-02-27 19:50:10 +01:00
bb9422ec82 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/makesdna/DNA_brush_types.h
	source/blender/makesrna/intern/rna_brush.c
2019-02-27 16:32:47 +01:00
0425686754 Merge branch 'master' into greasepencil-object 2019-02-26 14:05:30 +00:00
7809ef8c57 Merge branch 'master' into greasepencil-object 2019-02-25 17:52:07 +01:00
6bebb39c1c Merge branch 'master' into greasepencil-object 2019-02-25 08:35:50 +01:00
c26ab6fe15 Merge branch 'master' into greasepencil-object 2019-02-23 11:49:48 +01:00
50293fd251 GP: Change Draw Mode Title 2019-02-22 14:35:20 +01:00
cd68ef4803 GP: Reorganize Draw Mode
Now, the parameter only works with 3D space depth ordering. The Back and Front depths are incompatible with 3D Space mode.

Options are:
- Back
- Front
- 3D Space->2D Layers (default)
-3D Space->3D Space (new mode)
2019-02-22 09:12:22 +01:00
70c511cecb GP: Cleanup style 2019-02-21 12:35:29 +01:00
2d7c903512 Merge branch 'master' into greasepencil-object 2019-02-21 12:28:39 +01:00
333f562cf7 GP: Define new Draw Mode
Add a new Draw Mode to display panel in order to define the z-.depth order of the strokes using the real 3D position and not the 2D layer position.

This change makes possible to use VR with grease pencil drawings because the depth of the strokes change with camera position.
2019-02-21 12:27:43 +01:00
14cd89149a Merge branch 'master' into greasepencil-object 2019-02-19 17:41:00 +01:00
5a3095ffb7 Merge branch 'master' into greasepencil-object 2019-02-17 12:22:20 +01:00
4f04859237 Merge branch 'master' into greasepencil-object 2019-02-14 23:04:15 +01:00
d1067b645d GP: Fill: Fix issue with textured strokes
Force textured strokes to use control lines for the fill boundary regardless of fill mode.
2019-02-14 11:10:39 +00:00
4311346e29 Merge branch 'master' into greasepencil-object 2019-02-14 10:03:28 +01:00
48355d7430 GP: Trim Strokes: UI Changes
+ Fix inner loop
2019-02-11 13:54:01 +00:00
3013afcc1e Merge branch 'master' into greasepencil-object 2019-02-09 19:09:52 +01:00
5f52ea5218 Merge branch 'master' into greasepencil-object 2019-02-07 16:32:47 +01:00
6535ce6e61 Merge branch 'master' into greasepencil-object 2019-02-07 15:37:53 +01:00
cee3b7b2d9 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_render.c
2019-02-06 10:02:51 +01:00
856ad07a71 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/makesrna/intern/rna_brush.c
2019-02-05 12:10:56 +01:00
41f2a8c861 GP: Cleanup blend render functions
This is the first step to try to fix the problems with colors.
2019-02-04 20:01:20 +01:00
7a6daa6b26 Merge branch 'master' into greasepencil-object 2019-02-02 09:34:05 +01:00
5aee6cbcbb Merge branch 'master' into greasepencil-object 2019-02-01 17:15:36 +01:00
53586f3fb2 Merge branch 'master' into greasepencil-object 2019-01-30 16:36:14 +01:00
d4eafa06a1 GP: Test for removing DEG_get_original_id()
Use depsgraph data and not original data in draw manager, except while drawing new strokes.
2019-01-29 17:19:02 +01:00
5bda55aec9 Merge branch 'master' into greasepencil-object 2019-01-29 16:34:20 +01:00
16eacc9196 Merge branch 'master' into greasepencil-object 2019-01-28 17:27:37 +01:00
eff62db361 Merge branch 'master' into greasepencil-object 2019-01-27 19:29:40 +01:00
685909272f Merge branch 'master' into greasepencil-object 2019-01-26 10:57:56 +01:00
e633707e0f Merge branch 'master' into greasepencil-object 2019-01-25 20:45:51 +01:00
b6fc2f1e12 Merge branch 'master' into greasepencil-object 2019-01-25 10:08:31 +01:00
67b31124e8 Merge branch 'master' into greasepencil-object 2019-01-24 18:36:05 +01:00
b0f8331b78 GP: Move trim to shared module and cleanup
- Moved trim function to shared BKE.
- Add support to multi frame edit.
- Cleanup debug code.
2019-01-24 18:12:05 +01:00
f6c25ed3ba GP: Draw: Stroke Trim
+ New 'Trim' edit mode operator and post-processing brush option.

Trim works on a single GP stroke. It removes trailing points before and after the first intersection (or loop) nearest to the start of the stroke.
2019-01-24 15:57:02 +00:00
1af7837e6d Merge branch 'master' into greasepencil-object 2019-01-23 13:40:28 +00:00
0d9e6c5acd Merge branch 'master' into greasepencil-object 2019-01-22 20:17:24 +01:00
bd5200f18f Merge branch 'master' into greasepencil-object 2019-01-22 17:56:00 +01:00
746d1904fe Merge branch 'master' into greasepencil-object 2019-01-21 19:14:14 +01:00
1651f53276 Merge branch 'master' into greasepencil-object 2019-01-21 15:03:19 +00:00
ca6b2bdc17 Merge branch 'master' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_paint_common.py
2019-01-21 11:05:58 +01:00
5cba4e1cb6 Merge branch 'master' into greasepencil-object 2019-01-20 20:41:25 +01:00
8c48e8d805 Merge branch 'master' into greasepencil-object 2019-01-19 14:34:40 +00:00
7625771e3e GP: Fill: Add end cap support to boundary strokes
+ Fill boundary stroke supports end caps
+ Fix pixfactor type
2019-01-19 02:24:43 +00:00
9e28e409bc Merge branch 'master' into greasepencil-object 2019-01-18 15:51:31 +00:00
022eca106e Merge branch 'master' into greasepencil-object 2019-01-18 10:56:44 +01:00
fedb278d31 GP: Fill: Temp fix for fill options in topbar
Topbar has a bug that means if there are too many items it won't display them.
This temp fix moves some of the Fill tool options to a popup panel.
2019-01-18 09:22:31 +00:00
5abe5050ed GP: Fix Fill Topbar
The column layout is not supported as expected.

Anyway, there is a bug in topbar when the size of the parameters is too big.
2019-01-17 20:34:39 +01:00
b4a172fe59 Merge branch 'master' into greasepencil-object 2019-01-17 19:34:19 +01:00
5f76b766d4 GP: Fill: Tweaks
+ Made Dilate an option for all fill modes for testing purposes
+ Pixel shift is enabled for all modes
2019-01-17 11:57:27 +00:00
171861eb5e Merge branch 'master' into greasepencil-object 2019-01-16 20:05:37 +01:00
c6467c3c4f Merge branch 'master' into greasepencil-object 2019-01-16 19:23:08 +01:00
9d5bae9d09 GP: Fill: Dilate into corner pixels
Dilate now fills corner pixels for more accuracy.

Devs: Not sure that the algorithm is the most efficient so if you have any tips let me know!!!
2019-01-16 17:44:27 +00:00
5cdd1d901b GP: Fill: Fix issue with dilate creep 2019-01-16 15:14:09 +00:00
4ca6d8e9d8 GP: Use multiframe falloff in Shear transform 2019-01-16 11:30:06 +01:00
efec93974e GP: Use multiframe falloff for Bend transformation 2019-01-16 11:25:12 +01:00
46f0093be3 GP: Fill: Adaptive mode
+ add naive dilate to filled area
+ shift points by half pixel
2019-01-15 21:40:43 +00:00
0fa111e74f Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_fill.c
2019-01-15 19:45:14 +01:00
1d2cb649f7 GP: Fill: New mode, adaptive
This is like both strokes and control mode but with narrower strokes.
2019-01-15 15:08:20 +00:00
6871f7bca2 GP: Fill: Reduce stroke thickness to minimum
Sets flag when using the fill tool to reduce strokes to minimum. This helps reduce white areas.
2019-01-14 23:03:16 +00:00
5e5496e6ea GP: Fill: Fix crasher when unable to create GPUOffScreen 2019-01-14 22:39:01 +00:00
fe570a2fea GP: Fill: Add Resolution multiplier
Default is 1, no change. Increasing this number improves accuracy at the expense of processing time and memory usage.

This value multiplies the resolution of the buffer image generated used to calculate the flood fill.
2019-01-14 19:03:47 +00:00
f49c07aaa7 Merge branch 'master' into greasepencil-object 2019-01-14 18:00:59 +00:00
76bcef3c98 Merge branch 'master' into greasepencil-object 2019-01-11 19:23:09 +01:00
e6cd8294d9 Merge branch 'master' into greasepencil-object 2019-01-11 18:56:47 +01:00
f7e1904f08 Merge branch 'master' into greasepencil-object 2019-01-11 16:59:25 +01:00
a5b1305cf2 GP: Guides: Set status back to idling after exiting cp mode 2019-01-11 15:31:38 +00:00
98542acb4f Merge branch 'master' into greasepencil-object 2019-01-11 11:01:07 +01:00
b6a09a0ff6 Merge branch 'master' into greasepencil-object 2019-01-11 10:26:46 +01:00
a99886d55c GP: Guides: Fix snapping distance
Use pre-existing code to determine the pixel scale.
2019-01-10 23:46:27 +00:00
cbc2c91356 Merge branch 'master' into greasepencil-object 2019-01-10 16:26:40 +01:00
89281f0dd8 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_geom.glsl
2019-01-10 13:17:31 +01:00
60cd64fe2e Merge branch 'master' into greasepencil-object 2019-01-09 16:44:38 +01:00
c863ad1a85 Merge branch 'master' into greasepencil-object 2019-01-08 16:55:32 +01:00
23aae7822b GP: If no collision restore selection of points
If no collision, the selection only selected the vertex as vertex mode and don't extend selection.
2019-01-08 11:26:22 +01:00
bdbc0f184f GP: Remove with Cutter strokes of 2 points
As thess strokes always generate an autocollision, it was impossible to delete them.
2019-01-08 11:16:59 +01:00
ee672ad4ea Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_paint.c
2019-01-08 09:28:08 +01:00
56a829145b GP: Guides: Change keys to release event 2019-01-08 00:41:02 +00:00
bc859fadad GP: Guides: Change units from px to blender
Based on GP team feedback

+ Tidy and also fix issue of not snapping to nearest guide
2019-01-08 00:26:26 +00:00
e6296a54f2 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_gpencil_types.h
	source/blender/makesdna/DNA_scene_types.h
2019-01-07 19:05:48 +01:00
6d6985ff84 GP: Support Cutter in same stroke
Before the cutter only worked with different strokes, but now can handle selfcollisions.

Also added code to avoid infinite loops.
2019-01-07 18:43:49 +01:00
b21bb283b5 GP: Guides: UI Cleanup
Remove enable option from menu
Remove cursor location
2019-01-07 15:17:24 +00:00
3331c73564 GP: Cleanup compiler warnings 2019-01-07 16:12:28 +01:00
74f39165fd GP: Cleanup - Remove commented UI code 2019-01-07 10:08:30 +00:00
607e542087 Merge branch 'master' into greasepencil-object 2019-01-07 10:43:53 +01:00
bddb1c0f4d GP: Cleanup typo error 2019-01-07 10:42:47 +01:00
1d3d48fa4d GP: Cleanup - Move Guides RNA to separated function 2019-01-07 10:34:31 +01:00
431e7349e7 GP: Guides: Speedline drawing guides
Initial commit for final testing
2019-01-06 23:07:43 +00:00
014c2d5e03 GP: Rename Solo Mode property 2019-01-06 17:26:43 +01:00
38f844c078 Merge branch 'master' into greasepencil-object 2019-01-06 17:22:59 +01:00
c78fbccee8 GP: Set Cap mode as Enums
Now the Cap mode is an enum ready for future modes.

Add the cap mode to material is not logic because the stroke start and end depends on the drawing direction. Maybe in the future we could add to material, but will need more work at stroke level.

The Toggle operator keeps equal in a circular switch mode. We can improve it also in the future.
2019-01-06 16:41:02 +01:00
f51c34ec59 GP: Move Solo Mode to Layer level
WIP: Still pending the final UI location and name.
2019-01-06 16:12:39 +01:00
8e62b8907d GP: New Solo Mode to display keyframes only
When paint mode, now is possible display only layers with keyframes in the current frame.

This is very useful to fill strokes.
2019-01-05 19:44:40 +01:00
3c8cc073ad Merge branch 'master' into greasepencil-object 2019-01-05 19:03:17 +01:00
13fedec4ab GP: Allow different cap shape in each extrem of the stroke 2019-01-05 16:38:04 +01:00
ef57bc2d5f GP: New option to toggle Caps mode
Now it's possible to have flat or rounded (default) stroke caps.

The operator is accessible in edit mode.
2019-01-05 12:22:00 +01:00
d0da9054c6 Merge branch 'master' into greasepencil-object 2019-01-05 11:10:53 +01:00
0ed55524f1 Merge remote-tracking branch 'origin/master' into soc-2018-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2019-01-05 17:29:09 +08:00
516019bc72 GP: Rename isect property 2019-01-05 09:06:30 +01:00
e6a9af4427 GP: Add Keymap for segment mode 2019-01-05 09:06:17 +01:00
6d92338179 GP: Remove hardcode factor for cutter point
This made the intersection to be over original point.
2019-01-04 22:19:13 +01:00
87ca0afe81 GP: Initialize intersection threshold 2019-01-04 20:18:13 +01:00
d2d2d2416b Merge branch 'master' into greasepencil-object 2019-01-04 18:16:34 +01:00
682ba1d001 GP: Minor threshold tweaks 2019-01-04 18:15:57 +01:00
eba3cb75b0 GP: Improve intersections and add Threshold parameter
Now the threshold can be defined using a UI parameter.

The parameter is available in Edit selecction and in Cutter tool.

Also improved the use of this threshold.
2019-01-04 17:52:29 +01:00
b2df4c5d5b GP: Cleanup code 2019-01-04 10:43:35 +01:00
ebf98b4c05 Revert "GP: Draw: Speedline guides"
This reverts commit e83bfeab81.
2019-01-04 10:31:58 +01:00
e48c4638f8 Merge branch 'master' into greasepencil-object 2019-01-04 10:29:45 +01:00
d337a3993b Merge branch 'master' into greasepencil-object 2019-01-03 20:14:33 +01:00
5c14270fd8 GP: Add small offset to collision point 2019-01-03 20:09:21 +01:00
c3f971fc10 GP: Fix segment fault whith Cutter
The problem was when the new intersection point was inside the lasso.

Also improved when select all stroke points.
2019-01-03 19:50:21 +01:00
6bc549d40d Merge branch 'master' into greasepencil-object 2019-01-03 16:49:26 +01:00
ba5a8d5992 GP: Improve collision detection
Now the stroke extremes are scaled for improving the collision detection.
2019-01-03 16:41:22 +01:00
fd552a77d7 Revert "GP: Remove correction factor in Cutter"
This reverts commit c05ac7bc58.
2019-01-03 13:58:33 +01:00
78994637ca GP: Fix problem when select same stroke several times 2019-01-03 13:47:27 +01:00
2648ef562b GP: Hide topbar options for Cutter 2019-01-03 12:12:56 +01:00
c808e33461 GP: Add Lasso Eraser to Cutter tool 2019-01-03 12:03:46 +01:00
b02d985ce3 Merge branch 'master' into greasepencil-object 2019-01-03 11:30:35 +01:00
950dc276a7 Merge branch 'master' into greasepencil-object 2019-01-03 10:52:12 +01:00
1d3aedfb2e GP: Fix segment fault using cutter
The layer can be empty without frames.
2019-01-03 10:50:50 +01:00
d99b647015 Merge branch 'master' into greasepencil-object 2019-01-02 19:56:27 +01:00
dc8eb55390 GP: Basic Lasso Cutter support 2019-01-02 19:40:30 +01:00
c05ac7bc58 GP: Remove correction factor in Cutter
This factor makes better cuts, but breaks other cuts, so the next operation is not working.

Maybe in the future we can add this as a parameter.
2019-01-02 19:40:30 +01:00
e83bfeab81 GP: Draw: Speedline guides
Initial commit for artist feedback.
Provides drawing guides or constraints for drawing lines.

Notes:
UI Panel in 3D view. Some settings only have keyboard access at the moment.
Alt-C: Screen space position of circular guide
C: Circular guide
L: Parallel line guide
M: Flip direction 90° degrees
V: Freehand mode (turn off)
J/K: For line guide, rotate guide (alt 45°, shift 15°)
Alt-L: Set angle to that of the last stroke (useful to align to freehand strokes)
Ctrl-L: Set angle to 0°

Todo:
On screen guidelines
2019-01-02 17:57:07 +00:00
0ab64a9297 Merge branch 'master' into greasepencil-object 2019-01-02 17:44:38 +01:00
63e34ee641 Merge branch 'master' into greasepencil-object 2019-01-02 10:19:22 +01:00
e5b7ebf71f GP: Fix possible NULL error 2019-01-02 10:05:38 +01:00
8d78a25ef4 Fixed clipping distance calculation, but clip plane triangle cutting still have problems. 2019-01-02 16:09:01 +08:00
27eb5c231e Merge branch 'master' into greasepencil-object 2019-01-01 17:42:23 +01:00
960455b232 GP: New Cutter tool
This tool is used to cut the extremes.
2019-01-01 17:41:09 +01:00
cd07dd2a1c GP: New Segment selection mode
New option to select points between stroke collision. This is useful to select the segment between two strokes to make merges.
2018-12-30 22:10:50 +01:00
fc23d501d3 Merge branch 'master' into greasepencil-object 2018-12-30 13:09:17 +01:00
13df6fb776 Merge branch 'master' into greasepencil-object 2018-12-30 12:49:05 +01:00
907ea48a52 Fixed intersection missings when bounding area separation occurs. 2018-12-30 11:28:36 +08:00
fd49ce1d7b Fixed hidden multi-thread error. 2018-12-29 21:31:32 +08:00
5ded8bc95f Fix triangle-point test function for a stupid condition. See comment. 2018-12-29 15:05:41 +08:00
628ff9b3d6 make rendering into a loop to avoid callback stack overflow. 2018-12-29 13:04:22 +08:00
a531f8528b remove INVOKE_DEFAULT for rendering, otherwise still cause trouble on windows. 2018-12-29 12:28:10 +08:00
a3b17a6c71 Fix scripts from external editings. 2018-12-28 21:49:50 +08:00
7d60b14676 Added one click composition to LANPR. 2018-12-28 21:20:19 +08:00
8ac8cb9ce1 GP: fix error after merge 2018-12-28 10:48:45 +01:00
e1aaeaf27e Merge branch 'master' into greasepencil-object 2018-12-28 10:42:48 +01:00
736bb18666 GP: Fix error when merge 1 stroke only 2018-12-28 10:41:27 +01:00
be0628b743 Merge branch 'master' into soc-2018-npr 2018-12-28 10:59:36 +08:00
28e2e688d9 GP: More cleanup and renames 2018-12-27 22:29:36 +01:00
b60e45164d GP: Remove unused variable 2018-12-27 22:22:06 +01:00
a5d66391ab GP: Mew Merge Strokes operator
This operator allows to create a new stroke joining several stroke selected points of different strokes.

The new stroke will use the current material.

To use, first select the points to be merged. Optionally can remove the old points and strokes.

The operator is available in Edit mode in the Specials menu and Stroke menu.
2018-12-27 17:48:28 +01:00
c68996c75a Merge branch 'master' into greasepencil-object 2018-12-27 17:07:22 +01:00
039af4f45c Merge branch 'master' into greasepencil-object 2018-12-25 11:11:09 +01:00
acb1f24178 GP: Remove temporarily chord primitive
As this primitive is not defined completely, we remove it now and we can add later. Keep this primitive in the source code can produce errors when move more stable options to master.
2018-12-25 10:47:02 +01:00
537b6681d8 Merge branch 'master' into greasepencil-object 2018-12-25 10:28:10 +01:00
be72963cc8 Merge branch 'master' into greasepencil-object 2018-12-24 11:18:15 +01:00
d28d0e4416 Merge branch 'master' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_intern.h
	source/blender/editors/gpencil/gpencil_primitive.c
2018-12-23 16:58:25 +01:00
Nick Wu
61d3c1261c Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-12-23 19:09:42 +08:00
4e84dd7106 Merge branch 'master' into greasepencil-object 2018-12-21 18:55:55 +01:00
22f1cb2121 Merge branch 'master' into greasepencil-object 2018-12-21 16:27:31 +01:00
9c91e6c857 GP: Primitive: Fix randomness bias 2018-12-21 12:19:41 +00:00
56873ae4fd GP: Primitive: Fix merge errors 2018-12-21 09:29:16 +00:00
c8f72541b6 Merge branch 'blender2.8' into greasepencil-object 2018-12-21 08:47:53 +01:00
93a341526c Merge branch 'blender2.8' into greasepencil-object 2018-12-20 17:39:35 +01:00
0a795fa99c GP: Fix merge conflict 2018-12-20 15:53:36 +01:00
2cc269fe8f GP: Fix merge error 2018-12-20 14:00:28 +01:00
f9a8662938 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_primitive.c
2018-12-20 13:36:41 +01:00
ef757a2ef8 GP: Primitive: Fkey to size brush 2018-12-20 11:45:51 +00:00
8d599e1e67 GP: Primitive: Add MMB to confirm 2018-12-19 15:33:24 +00:00
761c937a8e GP: Primitive: RMB does not cancel previous strokes
Based on GP team feedback.
2018-12-18 16:17:38 +00:00
05cb3fe584 GP: Primitive: Fix flickering when using a noise brush
Previously, the random values were generated every draw, now they are generated once.
2018-12-18 14:26:53 +00:00
90875f7d94 Merge remote-tracking branch 'origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesdna/DNA_lamp_types.h
#	source/blender/makesdna/DNA_scene_types.h
2018-12-18 11:56:01 +08:00
6dfc7969f5 Merge branch 'blender2.8' into greasepencil-object 2018-12-17 19:14:30 +01:00
b4d0795be5 Merge branch 'blender2.8' into greasepencil-object 2018-12-17 18:35:43 +01:00
77b9002fa0 GP: Primitive: Chord shape
Similar to Arc but based on a chord. Can create bulbous curves.
2018-12-17 17:02:33 +00:00
ecfcb3948a Merge branch 'blender2.8' into greasepencil-object 2018-12-17 11:45:27 +01:00
b5c754ba11 Merge branch 'blender2.8' into greasepencil-object 2018-12-16 12:24:07 +01:00
e54e69764e Merge branch 'blender2.8' into greasepencil-object 2018-12-16 11:41:46 +01:00
e66165e0a3 Merge branch 'blender2.8' into greasepencil-object 2018-12-15 17:22:42 +01:00
ba9faca2a6 GP: M key only must works for Arcs 2018-12-15 16:57:38 +01:00
c29cb2a88a GP: Remove L keymap
Change the Tool using a keymap is not the best solution. The right way is use a different tool.
2018-12-15 16:37:02 +01:00
f6ecefa675 GP: Make C key works only with curves
If we enable this key in Arc it looks the curve and Arc and the same tool, but they are different, so to change the tool use toolbar not a keymap.
2018-12-15 16:35:02 +01:00
21df096161 GP: Change F keymap to M keymap
F means fill, M for mirror is better.
2018-12-15 16:27:56 +01:00
d1da89f73e GP: Replace A keymap by E keymap to be consistent. 2018-12-15 16:22:59 +01:00
50668ae249 GP: Remove C key for Line primitive
It's weird to have this option in lines because mix with arcs. For Arcs and Curves the C key is very useful.

Some changes in bottom text too.
2018-12-15 12:19:43 +01:00
8695adddb4 GP: More control points more transparent
This helps to see the extremes of the stroke.
2018-12-15 12:02:40 +01:00
6d0cec5e0b Merge branch 'blender2.8' into greasepencil-object 2018-12-15 11:52:45 +01:00
1a44501f57 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/presets/keyconfig/keymap_data/blender_default.py
2018-12-14 19:17:08 +01:00
b0df9b51b4 Merge branch 'blender2.8' into greasepencil-object 2018-12-14 16:53:17 +01:00
eea081cd5f GP: Primitive: Revert adding new cursor and use nsew instead 2018-12-14 15:28:21 +00:00
ca17bf014b GP: Primitive, fix move bug 2018-12-14 15:05:09 +00:00
081a964db5 GP: Cleanup code and comments 2018-12-14 10:55:55 +01:00
92398166b0 Merge branch 'blender2.8' into greasepencil-object 2018-12-14 10:29:48 +01:00
1d4ea9d881 Fix smooth contour modifier for API changes 2018-12-14 14:57:51 +08:00
39f22cc857 Merge remote-tracking branch 'origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesrna/intern/rna_scene.c
2018-12-14 14:47:39 +08:00
feb24c13b9 Fix accidental merge error 2018-12-14 14:46:43 +08:00
41b580619b GP: Primitive: Enable manipulators for Line/Box/Circle
Based on GP team feedback, all primitive tools have consistent behaviour.

Additionally:
AKEY extends Line, Arc and Curve.
CKEY changes type to Curve/Arc (toggle).
LKEY changes type to Line.
GKEY moves shape.
2018-12-14 01:25:18 +00:00
a6c0ec0cec Merge branch 'blender2.8' into greasepencil-object 2018-12-13 23:38:10 +01:00
f9bffb5b70 GP: Add Subdivide Smooth option 2018-12-13 23:30:29 +01:00
2719824a2e GP: Add missing Main Overlay switch to previous commit 2018-12-13 23:17:25 +01:00
6bc7180ca9 GP: Hide Primitive Gizmos with Overrlay switches
If disable Gizmo or Tool Gizmo the manipulators are not displayed.
2018-12-13 23:07:22 +01:00
84b7624b80 GP: Primitive: Add support for brush jitter and random strength
Also fix extra point bug.
2018-12-13 18:57:27 +00:00
3ef40443d4 Merge branch 'blender2.8' into greasepencil-object 2018-12-13 19:50:32 +01:00
9f4e8108fd GP: Remove redundant text 2018-12-13 19:38:25 +01:00
b79feba4c1 GP: New Smooth Operator in Specials menu
This Smooth works as in Meshes when you are in Edit mode.
2018-12-13 18:34:34 +01:00
5fb4f472da GP: Cleanup inverse loops
Why use inverse loops when we can use normal loops.
2018-12-13 14:12:40 +01:00
6fbf02f2a7 GP: Check if z-depth has valid values
If the values are too high, disable because not surface to project.
2018-12-13 13:56:42 +01:00
8042e5405e GP: Fix bug when start new file and select Arc primitive 2018-12-13 13:20:38 +01:00
42fe035cd2 Merge branch 'Blender2.8' into greasepencil-object 2018-12-13 12:45:11 +01:00
fa9c7f41d7 GP: Primitives, fix add curve behaviour
Reported by @_pepeland_

Also, add TAB key to exit edit mode.
2018-12-13 11:34:31 +00:00
c191f8d35f Merge branch 'blender2.8' into greasepencil-object 2018-12-13 11:52:29 +01:00
671748d877 Merge branch 'blender2.8' into greasepencil-object 2018-12-13 10:53:17 +01:00
bc8384d8a3 GP: Fix missing control points after merge 2.8 2018-12-12 22:42:02 +01:00
c07ba23896 GP: Refactor reproject in primitives 2018-12-12 21:50:09 +01:00
76d5500298 Merge branch 'blender2.8' into greasepencil-object 2018-12-12 19:49:52 +01:00
0ac991611a GP: Primitive: Change defaults
Based on User feedback from @mmendio.

The Arc tool now starts as a perfect arc in all directions.
The two control points for the Curve tool can be constrained to a single point using Shift.
Add Thickness profile to Box and Circle tools.
2018-12-12 17:56:33 +00:00
0cb674cd87 GP: Primitive: Avoid duplicate point when adding new curves 2018-12-12 15:11:01 +00:00
4ce6dfcd85 GP: Primitive: Arc tool changes
Added back constraint option to draw perfect arcs
Added back flip option
2018-12-12 14:13:03 +00:00
0fe997ae05 Merge branch 'blender2.8' into greasepencil-object 2018-12-12 14:44:21 +01:00
f1222d6115 Resume default contour detection method. 2018-12-12 21:22:51 +08:00
a33a3dfd74 Merge remote-tracking branch 'origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesdna/DNA_scene_types.h
2018-12-12 19:02:58 +08:00
18301bf2cc GP: Print number of edges for Curves
This information was missing in bottom text  but you could change it.
2018-12-12 10:30:57 +01:00
46cdecbd0f GP: Reduce default edges for Box and Lines
Also avoid saving of edge number to reset for each new shape.
2018-12-12 10:26:59 +01:00
42767c180c Merge branch 'blender2.8' into greasepencil-object 2018-12-12 08:44:10 +01:00
63360df98f GP: Primitives: Adjust control point styles 2018-12-12 01:19:01 +00:00
1569196cf2 GP: Change Circle primitive control points
Changed to small red style.
2018-12-12 01:08:19 +00:00
351cd57aa0 GP: Editable Arc tool
Arc tool is now editable like the Curve tool.
Unlike the curve (bezier) tool this uses an elliptical function.
Remove flip option as it is no longer needed.
2018-12-12 00:54:08 +00:00
03d84f2b22 Merge branch 'blender2.8' into greasepencil-object 2018-12-11 18:47:55 +01:00
5734e0c2f8 GP: Fix box and circle cyclic on preview stroke 2018-12-11 17:43:25 +00:00
8e2f213746 GP: Remove "Close" from Bottom text
This was missing in previous commit.
2018-12-11 18:42:14 +01:00
0c4be6546c Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_primitive.c
2018-12-11 18:08:06 +01:00
fcb0e8c75f GP: Cleanup. Rename Beziers to Curve
Beziers name can be misunderstood for users. Curve is more generic.
2018-12-11 18:05:29 +01:00
7567700b15 GP: Remove cyclic option
Not compatible with new brush drawing.
2018-12-11 16:48:45 +00:00
2475d76dd9 GP: Remove Radius control point in Circles
This only adds complexity and don't communicate the information of the radius in a easy way, so it's better keep UI as clean as possible.
2018-12-11 17:40:49 +01:00
4886ab72ef GP: Test moving origin point to start control point for Arcs and Curves 2018-12-11 17:37:28 +01:00
0ed319cb0c GP: Add number of divisions in bottom message for Boxes
It was impossible to see the number of divisions used.
2018-12-11 17:29:24 +01:00
5e8cd30db1 GP: Restore origin point for Lines
Maybe is good tohave where is the origin of the line
2018-12-11 17:21:01 +01:00
ca7fd606da GP: Merge errors 2018-12-11 15:47:32 +00:00
9615d6f44a GP: Primitive, add noise to box and circle 2018-12-11 15:43:54 +00:00
522fab74a4 GP: Change control points size and remove in line 2018-12-11 16:34:57 +01:00
7a5080de0b GP: Fix memory leak 2018-12-11 16:24:07 +01:00
4370bc0c6e GP: Change constants by define for Ctrl points size
This makes changes easier and can be replace by variables or parameters easily.
2018-12-11 16:18:53 +01:00
85e253a934 Merge branch 'blender2.8' into greasepencil-object 2018-12-11 15:51:26 +01:00
3e169f0220 GP: Fix wrong end cap when finish stroke 2018-12-11 15:37:55 +01:00
c438ca96ba GP: Fix control points size when change zoom
Also replaced the shader used.
2018-12-11 15:22:42 +01:00
13e7eaee22 GP: Primitive, add brush noise 2018-12-11 13:44:06 +00:00
1d3756d4f7 GP: Remove orange line in primitives
After adding the preview of real stroke, this does not make sense.
2018-12-11 13:15:01 +01:00
0a2d9c58ee GP: Undo change for Buffer z-depth
This breaks the previous fix of orange line, but it's needed for projected strokes.
2018-12-11 13:08:23 +01:00
608504351d GP: Move drawing of control points to Draw Manager 2018-12-11 13:02:55 +01:00
2b888f8d21 GP: Line primitive, add support for thickness profile
This means that by default lines are drawn with multiple points rather than two.
2018-12-11 11:01:59 +00:00
cc1af80116 GP: Move Control Points data to Runtime
As we maybe will use these control points in more operators is not logic keep  them in operator temp data. This makes also possible move drawing to Draw Manager.
2018-12-11 11:25:33 +01:00
90d1665738 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2018-12-11 10:32:10 +01:00
49bf43e63a GP: Fix orange lines in primitives
The orange lines must be on top of the stroke. Before, the current stroke was drawn in Front, but since we have speed painting functions, we can draw on back.
2018-12-11 10:18:37 +01:00
252460b50a GP: Change Thickness Profile panel 2018-12-10 22:21:59 +01:00
944f1d4ae8 Merge branch 'blender2.8' into greasepencil-object 2018-12-10 20:30:43 +01:00
63537e77c3 GP: Use a fixed UV data for buffer end cap 2018-12-10 20:09:39 +01:00
2e488107ad GP: Fix problems with stroke Caps
Now the start cap is done and during drawing the end cap is not set because needs to have a UV calculated and this is not done while drawing.
2018-12-10 20:04:17 +01:00
f9dbee0cac Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2018-12-10 19:16:07 +01:00
b17c8dfe28 GP: Tidy 2018-12-10 16:45:06 +00:00
6073037ad8 GP: Primitives: tidy up control point code
The display of control points is temporary as this is still wip.
2018-12-10 16:42:59 +00:00
ac7618d0dc GP: Primitives: tidy up control point code
The display of control points is temporary as this is still wip.
2018-12-10 16:23:19 +00:00
41e059d344 GP: Add missing depsgraph update 2018-12-10 17:15:47 +01:00
fdff9ce59e GP: Set Brush default material when add new GP Object
Before the brush color was not set equal to object active color.
2018-12-10 16:54:49 +01:00
811cf683f1 GP: Remove Object Onion Skin switch
It was confusing to have two switches.
2018-12-10 16:42:40 +01:00
0c0f355ae3 GP: Replace Clamp icon 2018-12-10 16:21:34 +01:00
64c64d21e5 GP: Use floats for primitive coords 2018-12-10 14:28:07 +00:00
208ff2eb86 GP: Make Onion Skin ON as default RNA value 2018-12-10 14:33:10 +01:00
cdd2bba0fc Merge branch 'blender2.8' into greasepencil-object 2018-12-10 10:45:46 +01:00
19b066c41b GP: Enable Object Onion Skin by default
Now, the main switchis on, and the layer onion skin is off.
2018-12-10 10:43:29 +01:00
a6eb1bbf57 GP: Add offset over surface 2018-12-09 09:41:23 +01:00
6acfdbb6e1 GP: Add missing initialization for surface projection 2018-12-09 09:36:54 +01:00
8582a432a5 GP: Add support for drawing control points [wip]
Also renamed variables top, bottom -> start, end
2018-12-09 00:59:17 +00:00
e08c70d11c GP: Experimental test for Stroke project 2018-12-08 23:35:44 +01:00
e1d0312d8c GP: Cleanup typo 2018-12-08 23:35:02 +01:00
a3e3e2f2f1 Merge branch 'blender2.8' into greasepencil-object 2018-12-08 17:19:22 +01:00
Nick Wu
54443b6d90 Fix merge errors. 2018-12-08 22:55:29 +08:00
71f8d998c4 GP: Allocate stroke memory only when required 2018-12-08 11:17:57 +00:00
d778b0cc00 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-12-07 22:11:32 +00:00
9b429d721c GP: Changes to bezier curve tool
When extending line with AKEY, prevent editing of joining point.
Update curve on initial draw, fixes pressure curve issue.
Change RMB to save and quite when editing.
2018-12-07 22:10:59 +00:00
d77446a681 Merge branch 'blender2.8' into greasepencil-object 2018-12-07 23:09:41 +01:00
4b3a48901a GP: Reorder Sculpt brushes in Tool bar 2018-12-07 22:59:40 +01:00
0be4c38125 GP: Fix primitive memory leak 2018-12-07 20:05:32 +01:00
205bfe524d Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/depsgraph_tag.cc
	source/blender/editors/gpencil/gpencil_primitive.c
	source/blender/makesdna/DNA_ID.h
	source/blender/modifiers/intern/MOD_meshdeform.c
	source/blender/modifiers/intern/MOD_surfacedeform.c
2018-12-07 19:24:31 +01:00
4685cb6885 GP: Fix merge errors 2018-12-07 16:12:46 +00:00
7690ab09ad add 'Control Points' and 'Segments' editmode menus for Surfaces
Fixes T58922

Reviewers: brecht, billreynish

Maniphest Tasks: T58922

Differential Revision: https://developer.blender.org/D4046
2018-12-07 16:00:41 +00:00
Dalai Felinto
a01ccd09a8 Update BVHTree.FromObject API, remove render argument
This information should come from the depsgraph.
2018-12-07 16:00:41 +00:00
e03fd3c446 Cycles: Do more user-friendly indication that GPU devices are not found 2018-12-07 16:00:41 +00:00
fbeae89071 Cycles: Disable OpenCL on macOS
This is unfortunate, but the number of bugs in this configuration
keeps growing, and almost all of them are caused by bug in OpenCL
compiler.

The compiler is not likely to be fixed, since Apple declared OpenCL
deprecated.

This evil commit is aimed to keep officially supported features
of Blender in a good working and stable state.
2018-12-07 16:00:41 +00:00
a17abec24b Fix T58902: error getting tools for Image Editor (modes Paint and Mask)
Maniphest Tasks: T58902

Differential Revision: https://developer.blender.org/D4044
2018-12-07 16:00:41 +00:00
9c509d6b51 Fix T57640: UV unwrap packing not working without sync selection. 2018-12-07 16:00:40 +00:00
Dalai Felinto
4c41f8e9ad Partial fix to T58917 - No valid cage
The fix itself simply is to store the cage object as a pointer instead
of a string/name.

That said baking with or without cage is yielding very different results
than in 2.7.
2018-12-07 16:00:40 +00:00
1b1b28f4bd GP: Refactor coordinates to float
See: D4030

Differential Revision: https://developer.blender.org/D4036
2018-12-07 16:00:40 +00:00
e7b9d49e91 Fix/workaround crash opening almost any Spring file
The issue was caused mpoly array urequired by the cache filling,
but the pointer was never set when preparing render data.

Seems this change is safe enough, in terms it shouldn't be
causing slowdown, since the assignment of mpoly is cheap, but
hard to tell if there is anything else affected by thing underneath.
2018-12-07 15:59:47 +00:00
f6a0a8b89e Depsgraph: Make data allocation dependency more robust
This fix aims to fix crash/assert failure related on wrong
evaluation order which happens when there is a cyclic
dependency involved.

The rationality of this change is that we can allow use
of uninitialized scalar value, but memory is better be
allocated.

This might not be ideal still, but worth a try.
2018-12-07 15:59:47 +00:00
6646d1a8c6 Depsgraph: Use shorter relation name
It is clear enough already that it goes From to To.
2018-12-07 15:59:47 +00:00
5ee8111f15 Depsgraph: Cleanup, line length 2018-12-07 15:59:47 +00:00
c11cfa8072 Depsgraph: Remove duplicated sets of recalc/update flags
There were at least three copies of those:

- OB_RECALC* family of flags, which are rudiment of an old
  dependency graph system.
- PSYS_RECALC* which were used by old dependency graph system
  as a separate set since the graph itself did not handle
  particle systems.
- DEG_TAG_* which was used to tag IDs.

Now there is a single set, which defines what can be tagged
and queried for an update. It also has some aggregate flags
to make queries simpler.

Lets once and for all solve the madness of those flags, stick
to a single set, which will not overlap with anything or require
any extra conversion.

Technically, shouldn't be measurable user difference, but some
of the agregate flags for few dependency graph components did
change.

Fixes T58632: Particle don't update rotation settings
2018-12-07 15:59:47 +00:00
0e90627861 Cleanup/refactor binding code for MeshDeform modifier.
We had two different ways of doing it, SurfaceDeform and LaplacianDeform
would do it through a special modifier stack evaluation triggered from
binding operator, while MeshDeform would do it through a regular
depsgraph update/eval (also triggered from its binding op).

This enforces the later to search back for orig modifier data inside
modifier code (to apply binding on that one, and not on useless CoW
one).

Besides the question of safety about modifying orig data from threaded
despgraph (that was *probably* OK, but think it's bad idea in general),
it's much better to have a common way of doing that kind of things.

For now it remains rather dodgy, but at least it's reasonably consistent
and safe now.

This commit also fixes a potential memleak from binding process of
MeshDeform, and does some general cleanup a bit.
2018-12-07 15:57:47 +00:00
3323693ea0 Fix T58046: Crash when changing Particle type, when Hair has dynamics
thx @sergey for checking
2018-12-07 15:57:46 +00:00
4ff30177ad Cleanup: split mixed_bones_object_selectbuffer
Split basic object picking logic out into it's own function.
2018-12-07 15:57:46 +00:00
16ae5375fd Cleanup: style 2018-12-07 15:57:46 +00:00
a2201c870e Fix T58913 Won't focus on Grease Pencil
When the datablock was empty, the center was not calculated. Now it uses the object location.
2018-12-07 15:57:46 +00:00
df10669321 Fix T58911: Picking objects fails in pose mode 2018-12-07 15:57:46 +00:00
cc41bfb65c Fix T58811: Scale bezier handle uses tip as origin 2018-12-07 15:57:46 +00:00
9fc81d8cea Merge remote-tracking branch 'origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_data_camera.py
#	release/scripts/startup/bl_ui/properties_material.py
#	release/scripts/startup/bl_ui/properties_particle.py
#	release/scripts/startup/bl_ui/properties_physics_common.py
#	release/scripts/startup/bl_ui/properties_physics_rigidbody.py
#	release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
#	release/scripts/startup/bl_ui/properties_physics_softbody.py
#	release/scripts/startup/bl_ui/properties_scene.py
#	release/scripts/startup/bl_ui/properties_view_layer.py
#	release/scripts/startup/bl_ui/properties_world.py
#	source/blender/draw/intern/draw_manager.c
#	source/blender/makesrna/intern/rna_scene.c
2018-12-07 22:53:30 +08:00
0eabdabfae GP: Clear selected flag for new primitives 2018-12-07 15:46:40 +01:00
d22455089c GP: Fix wrong extreme in primitive 2018-12-07 15:23:09 +01:00
8cfc8e6347 GP: Fix multi-segment curve
Currently, only last segment is editable.
2018-12-07 14:17:17 +00:00
a62728abea GP: Remove curve for Lines
Lines only have 2 points, so it's not logic.
2018-12-07 13:27:55 +01:00
f23bd736de GP: Curve edit mode is now default after initial line
No need to hold shift.
2018-12-07 12:27:21 +00:00
70297337e0 GP: Enable curve only for Arcs and Beziers 2018-12-07 13:25:56 +01:00
45fe039c14 GP: Change default primitive curve 2018-12-07 13:17:32 +01:00
70a2eeba9e GP: Fix segment fault with primitive curve 2018-12-07 12:53:42 +01:00
fc97baf73a GP: Fix problems with primitive curve and add to Topbar 2018-12-07 12:49:12 +01:00
d690a1e32c GP: Evaluate curve for thickness in primitives 2018-12-07 11:34:36 +01:00
60d953ae30 GP: New curve to define thickness in primitives 2018-12-07 11:16:09 +01:00
5a4166b9b8 Merge branch 'blender2.8' into greasepencil-object 2018-12-07 08:22:21 +01:00
8aa0188de5 GP: Use brush strength when draw primitves 2018-12-06 19:21:45 +01:00
fec794bd3e GP: Bezier tidy
Remove unused defines and prevent num input while editing
2018-12-06 18:18:32 +00:00
454563ffac GP: Add bezier tool [wip]
Shift drag to move curve.
Ctrl-shift to move both cps.
2018-12-06 17:10:54 +00:00
0013bfdf25 GP: Fix gap drawing Circle, Rectangle and Arc primitives 2018-12-06 17:02:20 +01:00
2bcc5f8bde Draw real stroke while using a primitive 2018-12-06 13:13:47 +01:00
51e39ce568 Copy drawing data to stroke buffer
Still the draw manager is not calling to draw this datablock.
2018-12-06 12:32:14 +01:00
5d7474ae01 Prepare buffer stroke to save points 2018-12-06 12:18:11 +01:00
5bed2a23c5 Fix merge errors 2018-12-06 11:57:18 +01:00
2e0ef10670 Merge branch 'blender2.8' into greasepencil-object 2018-12-06 10:49:48 +01:00
231355fd09 Merge branch 'blender2.8' into greasepencil-object 2018-11-28 19:23:17 +01:00
f2fdfbb735 Change default annotation onion colors 2018-11-28 18:08:18 +01:00
8a0ed1214e Cleanup: Fix comment typo 2018-11-28 17:21:57 +01:00
5dadb95909 Enable Onion Skin for Annotations
Back port and adapt to 2.8 the onion skin for annotations in View 3D and Sequencer.

Added only basic features. For onion skin advanced features use grease pencil object.
2018-11-28 17:19:41 +01:00
f2161312f2 Merge branch 'blender2.8' into greasepencil-object 2018-11-28 16:54:32 +01:00
2614f21412 Add vtx boundry setting 2018-11-27 17:25:15 +01:00
63c0427b55 Merge branch 'blender2.8' of https://git.blender.org/blender into npr_tess 2018-11-27 16:22:03 +01:00
54cf0461fc Merge branch 'blender2.8' into greasepencil-object 2018-11-26 17:47:37 +01:00
4b8d091c90 Reorganize Mask button and rename to Clamp
Now the Clamp is valid in Normal layers and the value is OFF by default.
2018-11-26 17:34:40 +01:00
a14da4a859 Use Stroke Alpha when mix Normal Layers 2018-11-26 16:17:58 +01:00
Nick Wu
a1a526e557 added example functions for accessing LANPR occlusion data 2018-11-26 21:47:11 +08:00
Nick Wu
e4d987d7fb Added temporary contour bypass for smooth contour modifier build. 2018-11-26 20:27:36 +08:00
Nick Wu
c94b494f20 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/makesrna/intern/rna_scene.c
#	source/tools
2018-11-26 20:15:13 +08:00
0669f08437 Rename Bled Layers to Layers Blending 2018-11-26 11:15:37 +01:00
ec07eeba1c Merge branch 'blender2.8' into greasepencil-object 2018-11-26 08:54:11 +01:00
1f9119a059 Fix multiply error when blend layer do not cover below layer 2018-11-25 20:12:04 +01:00
2104b22dad Merge branch 'blender2.8' into greasepencil-object 2018-11-25 19:35:53 +01:00
018d7039c4 Fix opacity problems when value is 0 2018-11-25 19:28:17 +01:00
6ce9e29296 Fix noise in blend layers
The antialiasing is generating noise in intermediate layers.
2018-11-25 19:04:24 +01:00
03d125b881 Fix problems with Mask button 2018-11-25 18:14:51 +01:00
f63633cc9d Fix ALT key for boundary fill strokes 2018-11-25 17:39:14 +01:00
dac044d03c Add Simplify Blend Layers option 2018-11-25 17:23:03 +01:00
5b7780920b Merge branch 'blender2.8' into greasepencil-object 2018-11-25 16:27:39 +01:00
fdb51ac280 Enable layer opacity in blend layers 2018-11-25 16:26:01 +01:00
3884d76645 Adjust Blend mode y Opacity to column 2018-11-25 16:12:14 +01:00
72cc5c291f Use multisample for nomal blend
The layers are multisampled before blend
2018-11-25 16:02:40 +01:00
c5acc7ae36 Hide Mask Icon in Layer list
By default is off and it's something that is using too much space
2018-11-25 14:17:04 +01:00
01d27d0b2b Use Box blur for Edges 2018-11-25 14:13:41 +01:00
6f66bcff3f Change tooltip 2018-11-25 14:13:31 +01:00
78c8a26322 Invert Mask flag to be ON by default 2018-11-25 09:44:25 +01:00
07d68ff0dc Fix problem when several objects 2018-11-24 13:39:55 +01:00
0d1e36cd18 Only show Mask icon for Blend layers 2018-11-24 13:15:45 +01:00
c4f5477dec Fix error when blend layers are consecutive 2018-11-24 12:44:40 +01:00
01a1b977dc GP: Reorganize Mask icons 2018-11-24 12:25:40 +01:00
3aa787a23a GP: New option to enable masking
Now the blend masking can be enabled or disabled
2018-11-24 12:02:37 +01:00
43237796a6 Merge branch 'blender2.8' into greasepencil-object 2018-11-24 10:12:38 +01:00
f2806a3b04 GP: Apply alpha to mix color 2018-11-23 20:18:04 +01:00
06c7d3ab28 Merge branch 'blender2.8' into greasepencil-object 2018-11-23 19:45:43 +01:00
1991bd5c65 GP: Exchange opacity and blend parameters in Panel 2018-11-23 19:22:49 +01:00
46567d982f GP: Disable opacity of Blend layers
The opacity parameter is not logic for blend layers because the opacity is determined by underlying layers.
2018-11-23 19:20:38 +01:00
fac51e039d Avoid error adding layer 2018-11-23 17:47:56 +01:00
d121071a0f GP: Cleanup unused variable 2018-11-23 17:01:38 +01:00
a8bcfe4c31 WIP: Support Blend layer
This new option for Layers allow to define the blend mode between layers to create effects and help with the painting of the frames.

Note: If use substract to open holes, you can get the transparent problem we already know and that it's pending to solve using OIT.
2018-11-23 16:53:41 +01:00
5ec6e95a75 Merge branch 'blender2.8' into greasepencil-object 2018-11-23 16:24:41 +01:00
e7d2f0e880 Add GP modifer to extract strokes 2018-11-23 00:16:07 +01:00
60d541c728 Add option to select contour verts 2018-11-22 23:05:26 +01:00
1c1ec90486 Merge branch 'blender2.8' into greasepencil-object 2018-11-20 20:17:01 +01:00
e39461d83b Merge branch 'blender2.8' into greasepencil-object 2018-11-20 19:12:53 +01:00
6083edbeea Merge branch 'blender2.8' into greasepencil-object 2018-11-20 16:35:13 +01:00
f32368591c Merge branch 'blender2.8' into greasepencil-object 2018-11-20 09:28:01 +01:00
ac197f50d5 Fix problem with onion in multiwindow mode 2018-11-19 20:09:18 +01:00
3798303749 Fix problem with storage index
The storage index was not updated and the object scale and other data were wrong
2018-11-19 19:47:27 +01:00
f1255ba320 Use Time Offset modifier to calc VBOs size
The active frame can be different if there is a time offset modifier.
2018-11-19 17:15:47 +01:00
ee58b97b44 GP: Small cleanup 2018-11-19 16:55:22 +01:00
9e38c89684 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
2018-11-19 16:30:04 +01:00
bdbbadab75 GP: Recalc VBOs size with modifiers
Some modifiers can change the total number of points.
2018-11-19 16:26:34 +01:00
461387051d GP: Alloc maximum size
The resize of the VBOs is very heavy for the CPU, so now the maximum size is allocated.
2018-11-19 11:37:30 +01:00
Nick Wu
3c7da86849 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/makesdna/DNA_lamp_types.h
2018-11-19 12:51:52 +08:00
cb0934477e Change default VBO size for FILL 2018-11-18 20:36:34 +01:00
6357ac5409 Merge branch 'blender2.8' into greasepencil-object 2018-11-18 19:49:00 +01:00
371f53bd73 GP: Some fixes after merge 2018-11-18 17:06:41 +01:00
ca89a6b3a0 Merge branch 'blender2.8' into greasepencil-object 2018-11-18 16:39:31 +01:00
680f8039eb GP: Drawing Engine use only one batch
This is part of T57829.

Reduce the number of used batches to only one by shader type.  This reduces GPU overhead and increase a lot the FPS. As the number of batches is small, the time to allocate and free memory was reduced in 90% or more.

Also the code has been simplified and all batch management has been removed because this is not necessary. Now, all shading groups are created after all vertex buffer data for all strokes has been created using DRW_shgroup_call_range_add().

All batch cache data has been moved to the Object runtime struct and not as before where some parts (derived data) were saved inside GPD datablock.

For particles, now the code is faster and cleaner and gets better FPS.

Thanks to Clément Foucault for his help and advices to improve speed.
2018-11-17 17:52:19 +01:00
aef6f7d75e Merge branch 'blender2.8' into greasepencil-object 2018-11-17 09:58:15 +01:00
Nick Wu
13a654d0f3 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-11-14 11:34:27 +08:00
Nick Wu
821aa86d98 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/startup/bl_ui/properties_scene.py
2018-11-14 11:32:17 +08:00
3f1f1931e7 Update to new API changes 2018-11-12 14:57:52 +01:00
a2b31ed120 Merge branch 'blender2.8' into npr_tess 2018-11-12 13:20:58 +01:00
0277819b18 Fixed corner case with mult_face_search and shifted border verts 2018-11-09 19:17:08 +01:00
896dbf836b Fix strack smash for deg edges, move opti flip to own function 2018-11-08 00:45:59 +01:00
Nick Wu
fc650ae86a Make ui work under new api. 2018-11-07 22:37:14 +08:00
Nick Wu
b77c6a859e Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/makesdna/DNA_scene_types.h
#	source/tools
2018-10-31 13:45:08 +08:00
4a90ddad76 Fix mixed indent 2018-10-29 20:25:29 +01:00
d18fa37cad Fix FB split face logic 2018-10-29 20:02:06 +01:00
Nick Wu
fc94e46f36 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-10-25 17:54:30 +08:00
Nick Wu
7a34d16d7a Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-10-21 14:16:32 +08:00
1c14aee5b1 Merge branch 'blender2.8' into greasepencil-object 2018-10-20 09:18:02 +02:00
Nick Wu
6a638e9555 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr, also fix errors in modifier code.
# Conflicts:
#	release/scripts/startup/bl_ui/properties_data_camera.py
#	release/scripts/startup/bl_ui/properties_data_speaker.py
#	release/scripts/startup/bl_ui/properties_render.py
#	release/scripts/startup/bl_ui/properties_scene.py
#	source/blender/makesrna/intern/rna_scene.c
2018-10-20 13:05:21 +08:00
270cd09afa Merge branch 'blender2.8' into greasepencil-object 2018-10-19 15:03:02 +02:00
8eff6c4223 GP: Fix problem with Onion Skin after last commit 2018-10-19 12:13:38 +02:00
c2aefb8ea4 GP: Redesign drawing cache to support particles
Full redesign of the cache system used for drawing strokes and handle derived frame data.

Before, the cache was saved in bGPdata and a hash was used to manage several objects with the same datablock.

Old design made the use of particles very inefficient and prone to bugs and segment faults, and especially when this was mixed with onion skinning and multiple objects using same datablock. Also, there were some conflicts with the depsgrah logic (the old design was done before despgraph was in place) that made the use of hash not working.

The new design saves the data in the object runtime struct and avoid the use of any hash to find the right data. This improves the speed and reduce a lot the complexity of the code, memory allocation, hash overload and adds full support for particles and reused datablocks.

The particles can reuse the modifiers and shader effects of the original grease pencil object.
2018-10-19 11:35:58 +02:00
e96f7ab0ed Merge branch 'blender2.8' into greasepencil-object 2018-10-19 11:11:31 +02:00
12d345af03 Made opti edge flip use actual face normals and fiddled a bit with cusps again 2018-10-16 17:04:38 +02:00
f8d633f3e7 Fix FB split uv bug and treat cusps more like in the paper 2018-10-08 19:50:43 +02:00
Nick Wu
0bc6e431cc Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesrna/intern/rna_scene.c
2018-10-03 18:30:02 +08:00
Nick Wu
8ae40f4fcb Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
2018-09-19 22:24:36 +08:00
Nick Wu
74294b8686 Fix interface lock situation reported by DarkDefender. 2018-09-17 21:49:08 +08:00
Nick Wu
923f59a984 DPIX normal controlled line width 2018-09-16 15:35:41 +08:00
Nick Wu
843a57e3a5 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
2018-09-16 15:02:02 +08:00
Nick Wu
bef1fb79ee Vertical line hack: tip point threshod fix and a condition branch. 2018-09-16 15:00:57 +08:00
3a9e7bf92d Merge branch 'blender2.8' into greasepencil-object 2018-09-15 12:09:20 +02:00
Nick Wu
1bd6f3605d Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_physics_cloth.py
#	source/tools
2018-09-15 11:03:29 +08:00
Nick Wu
85f6277e6c Possibly fixed shader errors, but don't know exactly what caused it. 2018-09-12 23:03:34 +08:00
Nick Wu
b3ed2a8751 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/tools
2018-09-12 22:27:01 +08:00
29cb9e057d Increased the amount of faces the inco check will search 2018-09-10 12:19:21 +02:00
c9961e4d0b Fix memleak when creating eval 2018-09-08 23:00:41 +02:00
d574014a91 Remove opti vert dissolve 2018-09-08 15:42:28 +02:00
cf3f8c46fd Merge branch 'blender2.8' into greasepencil-object 2018-09-08 11:14:47 +02:00
Nick Wu
4498126016 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/draw/CMakeLists.txt
#	source/blender/makesrna/intern/rna_scene.c
2018-09-07 23:13:23 +08:00
Nick Wu
c44e716f9c Fixed still frame render cache out of date error. 2018-09-07 22:16:21 +08:00
9a51f1567b Merge branch 'blender2.8' into greasepencil-object 2018-09-07 09:21:29 +02:00
Nick Wu
dacceb573f Fixed vertical line missed calculations. 2018-09-06 13:39:55 +08:00
Nick Wu
fceb384ad1 Partly fixed "Absolute horizontal/vertical" situations. 2018-09-06 12:01:26 +08:00
Nick Wu
b6b0d986bb Fixed contour priority. Fixed software mode line type shader. 2018-09-06 10:49:22 +08:00
Nick Wu
3ab0ae97cd Merge branch 'soc-2018-npr' of git.blender.org:blender into soc-2018-npr 2018-09-06 09:54:20 +08:00
Nick Wu
7f4daea0c0 Fixed line width incorrect variations under different aspect ratios. commented weird code in culling. 2018-09-06 09:53:10 +08:00
Nick Wu
cdad75303a Fixed line width incorrect variations under different aspect ratios. 2018-09-06 09:48:04 +08:00
Nick Wu
eeeee3b10a Fixed software mode ortho condition errors in culling. Now working. 2018-09-06 09:25:22 +08:00
Nick Wu
592b2bd5e4 Fixed DPIX ortho view. 2018-09-06 09:01:50 +08:00
Nick Wu
4df5506b22 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesdna/DNA_scene_types.h
2018-09-06 08:30:31 +08:00
57cf101dbd Merge branch 'blender2.8' into greasepencil-object 2018-09-04 17:35:12 +02:00
Nick Wu
de2c47cbf1 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/makesdna/DNA_scene_types.h
2018-09-04 21:52:48 +08:00
Nick Wu
f0eca87df6 Fixed collection header name 2018-09-04 12:56:46 +08:00
b216e9e81b Merge branch 'blender2.8' into greasepencil-object 2018-09-03 08:29:24 +02:00
Nick Wu
3fc578d7cb Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	source/blender/CMakeLists.txt
2018-09-01 11:03:10 +08:00
Nick Wu
ef234a2e61 Software crease threshold follow DPIX's 2018-08-31 21:48:19 +08:00
ed9a4cb95f Merge branch 'blender2.8' into greasepencil-object 2018-08-31 10:11:54 +02:00
290d366b61 Merge branch 'blender2.8' into greasepencil-object 2018-08-30 15:57:34 +02:00
5d168135e8 Merge branch 'blender2.8' into greasepencil-object 2018-08-30 12:26:25 +02:00
ed47fc02e1 Merge branch 'blender2.8' into greasepencil-object 2018-08-30 11:22:23 +02:00
01823ea736 Merge branch 'blender2.8' into greasepencil-object 2018-08-30 10:21:15 +02:00
f558b43373 Merge branch 'blender2.8' into greasepencil-object 2018-08-29 20:29:21 +02:00
Nick Wu
552d256cfd Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr 2018-08-29 19:08:14 +08:00
4ab09aad67 Update tess mod UI split code to upstream changes 2018-08-29 13:07:31 +02:00
f4b65dd63c Merge branch 'blender2.8' into npr_tess 2018-08-29 12:58:16 +02:00
Nick Wu
e9d3c2e8fb Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr 2018-08-29 18:42:08 +08:00
7ef8404f4e Always use get_facing function when possible 2018-08-29 12:29:09 +02:00
b1d1ea8f8b Only check for FF/BB split on edges that are somewhat close to a zero crossing 2018-08-29 12:06:25 +02:00
7b32c913c1 Change how opti marks inco faces initially 2018-08-29 11:02:16 +02:00
2f1f4b5115 Cleanup code 2018-08-29 10:54:15 +02:00
dce768b263 Rename all armature modifiers
Now it's possible add several armature modifiers, so need rename all of them, not only first one.
2018-08-29 10:39:48 +02:00
6bf998a893 Merge branch 'blender2.8' into greasepencil-object 2018-08-29 10:18:47 +02:00
eb5efaa558 Merge branch 'blender2.8' into greasepencil-object 2018-08-28 21:57:16 +02:00
c16126246b Fix some errors in Simplify and Subdivide 2018-08-28 21:51:46 +02:00
2098adf2ea Fix several things 2018-08-28 17:03:47 +02:00
f8bd98194f Merge branch 'blender2.8' into greasepencil-object 2018-08-28 16:29:13 +02:00
7790545475 Cleanup: fix merge small mistake 2018-08-28 13:29:55 +02:00
792f92e983 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_paint.c
2018-08-28 13:18:34 +02:00
Nick Wu
1e70595e05 Fixed file data blocks linking error. 2018-08-28 18:52:40 +08:00
73de6c2725 Use default armature of Modifier
By default try to use the armature of first modifier, but allows to select different armatures.

This is required for special configurations with several armature modifiers.
2018-08-28 12:35:26 +02:00
Nick Wu
bcc3003cb4 Fixed chained line type display control 2018-08-28 18:23:58 +08:00
c3f2a5e0fc New parameter to select armature in Automatic Weights op.
Before, the operator always used the armature of the modifier, but now it's possible to have several modifiers, so it needs a parameter to select the armature.
2018-08-28 12:15:36 +02:00
Nick Wu
775df5a1d5 Fix directional object matrix error 2018-08-28 18:10:18 +08:00
Nick Wu
8072b68387 Directional light control object ok, fixing file rw 2018-08-28 17:34:12 +08:00
Nick Wu
f33c3d157c Fixed dropdown list reference lost issue. 2018-08-28 16:07:17 +08:00
Nick Wu
6b005517db Normal controlled normal thickness for software is ok. No direction and position variation. 2018-08-28 15:48:36 +08:00
613c920275 Merge branch 'blender2.8' into greasepencil-object 2018-08-28 09:31:03 +02:00
Nick Wu
0b758fd994 Software normal control thickness for non-chain situation 2018-08-28 14:13:57 +08:00
Nick Wu
db66c3a9a2 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/tools
2018-08-28 12:46:50 +08:00
c5924b3a64 Merge branch 'blender2.8' into greasepencil-object 2018-08-27 22:32:30 +02:00
6f4d709ad2 Fix vertex group functions after merge
The custom api has been replaced by standard functions.
2018-08-27 16:51:37 +02:00
9cdbe5b129 Merge branch 'blender2.8' into greasepencil-object 2018-08-27 16:32:54 +02:00
ccda31aa48 Redo Armature modifier using standard modules
Now the armature modifier is using the same functions used in Mesh and Lattice armatures and share the same parameters.

This makes the code easy to maintain.
2018-08-26 19:39:56 +02:00
714a133083 Merge branch 'blender2.8' into greasepencil-object 2018-08-26 17:27:13 +02:00
45edce5fa9 More fixes after merge 2018-08-26 17:12:32 +02:00
f94384afc6 Changes after merge and some cleanup
Added some initialization code and fixed some isues after merge.
2018-08-26 17:06:43 +02:00
e52b914782 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/gpencil_modifier.c
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_fill.c
	source/blender/editors/gpencil/gpencil_paint.c
2018-08-26 16:49:26 +02:00
Nick Wu
fba6d68915 Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr 2018-08-26 20:13:30 +08:00
Nick Wu
5d21c3089d Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-08-26 10:28:55 +08:00
8ecb34982e Allow wiggling of radial verts 2018-08-25 21:04:21 +02:00
80b44aaa26 Change name of 'is_C_vert' func to something more descriptive 2018-08-24 21:05:29 +02:00
925333e51d Merge branch 'blender2.8' into greasepencil-object 2018-08-24 10:18:44 +02:00
f79e734ff3 Merge branch 'blender2.8' into greasepencil-object 2018-08-23 16:15:23 +02:00
Nick Wu
8e58b88ea4 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/tools
2018-08-23 18:55:32 +08:00
Nick Wu
4b763f4cb2 Fixing perpective flag 2018-08-23 18:53:37 +08:00
b4f9b25107 Merge branch 'blender2.8' into greasepencil-object 2018-08-23 10:18:19 +02:00
462c69d288 Rename function and fix wrong pointer increment
The change done in previous cleanup broken the function.
2018-08-23 10:15:19 +02:00
5262e21c6c Cleanup style 2018-08-23 10:15:13 +02:00
7fc1d6cf96 Cleanup: Unused variable 2018-08-23 10:15:08 +02:00
39344493e3 Add Force Fill Data parameter
Add a general parameter to force the recalc of the triangulation data because some modifiers could change the geometry and the filling triangles would not be right.

Now, the parameter is visible in UI panel because this option reduces FPS, but maybe in the future we can keep always ON and remove the parameter.
2018-08-23 10:15:02 +02:00
ee212fd204 UI: Change text of force recalc 2018-08-23 10:14:56 +02:00
b91deea4dc Change calculation of automatic weights
There were several mistakes and now is using standard routines.
2018-08-23 10:14:48 +02:00
62f67b8bef Implement Parent with Empty and Automatic weights
This is an alternative way of define weights.
2018-08-23 10:14:43 +02:00
f92e13a4eb Enable Fade geometry in Pose mode
Now the grease pencil geometry is fade when the alpha value is enabled.
2018-08-23 10:14:38 +02:00
948e1de325 Rename parent layer when change bone name 2018-08-23 10:14:32 +02:00
7088c211a5 Rename bone if Armature modifier 2018-08-23 10:14:27 +02:00
b425c0a302 Add weight data when drawing 2018-08-23 10:14:21 +02:00
cdad9b4960 Keep weight when simplify with RDP 2018-08-23 10:14:15 +02:00
fbc2a8a604 Interpolate weights when subdivide 2018-08-23 10:14:10 +02:00
ec58cb0429 Manage weights in simplify operator and modifier 2018-08-23 10:14:04 +02:00
c91aaf5891 More changes to subdivide modifier 2018-08-23 10:13:58 +02:00
8ddbcd67f4 Add weights to subdivide points 2018-08-23 10:13:51 +02:00
9d3cea5e54 Improvements in automatic weight calculation 2018-08-20 11:22:25 +02:00
ad5dc176a7 New parameter to force Fill cache recalc
This is needed for extreme deformations
2018-08-19 20:50:32 +02:00
dfdf4514a5 New operator to generate automatic weights 2018-08-19 17:22:35 +02:00
643afc347b WIP: Operator to create vertex groups
Only works with the Empty mode.
2018-08-19 13:04:21 +02:00
89e8ccaacf Cleanup unused function 2018-08-19 11:41:14 +02:00
d634916624 Cleanup code and comments 2018-08-18 22:47:27 +02:00
b5301a185c Limit Armature modifier to only one instance 2018-08-18 22:32:00 +02:00
e9e1e8f6dc More cleanup 2018-08-18 20:17:26 +02:00
9d937032b9 Code cleanup: remove unused code 2018-08-18 19:22:17 +02:00
e4082db577 Put text to review 2018-08-18 18:43:03 +02:00
c3ba8910a1 WIP: Add basic functions to deform 2018-08-18 18:08:22 +02:00
31a1135829 Merge branch 'blender2.8' into greasepencil-experimental 2018-08-18 17:37:26 +02:00
96d9b20aa2 Put in place all pieces for Armature modifier
The modifier doesn't do anything yet.
2018-08-18 17:36:54 +02:00
Nick Wu
4594287191 Fixed some matrix fuction naming format 2018-08-18 17:51:13 +08:00
Nick Wu
4af59419fc Software mode FOV adapted. 2018-08-18 17:39:09 +08:00
Nick Wu
1f5b23318b Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_physics_field.py
#	source/blender/makesdna/DNA_scene_types.h
#	source/tools
2018-08-18 14:04:38 +08:00
Dalai Felinto
57b5a4e805 Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object
Hard-core resetting the files to origin/blender2.8
2018-08-17 12:54:18 -03:00
Nick Wu
d40a1bc3cc Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/editors/space_outliner/outliner_draw.c
#	source/blender/makesdna/DNA_scene_types.h
#	source/blender/modifiers/intern/MOD_mybmesh.c
#	source/tools
2018-08-16 15:37:02 +08:00
51ead449f7 Add sanity check in mult_face_search 2018-08-15 19:03:28 +02:00
ae4185f96f Merge with upstream changes 2018-08-15 18:09:17 +02:00
4c77b378a5 More opti step tweaks 2018-08-15 17:17:11 +02:00
c9831644e6 Make shift fold check and radial insert check more robust 2018-08-14 21:16:21 +02:00
e49f7e6b64 Add sanity check for radial insert face selection 2018-08-14 19:40:44 +02:00
d8a9fd7810 Do not shift cusp edges as they might lead to CCC triangles 2018-08-14 19:23:03 +02:00
3607e52a6b Remove fold check from opti wigg/split and fix new vert idx bug 2018-08-14 17:48:10 +02:00
Nick Wu
7aa1c544f7 Fix opensubdiv error when not enabled WITH_OPENSUBDIV 2018-08-14 16:20:19 +08:00
Nick Wu
dc03876c7b Fixed engine compatible panel for camera and speaker data. 2018-08-14 13:44:04 +08:00
Nick Wu
0b75e68500 Fixed lanpr field always NULL error. (caused by depsgraph scene copy) 2018-08-14 13:39:44 +08:00
dee286cdb9 Update new vert data if they are shifted 2018-08-13 17:30:07 +02:00
5ef6bcd645 Convert to opti wigg and edge slit to use st coords 2018-08-13 16:11:21 +02:00
b0489b96f7 Convert mult_face_search to use st space for better accuracy 2018-08-13 15:31:04 +02:00
7b1875b442 Make radial insert and exten work in 2d space (better accuracy) 2018-08-13 14:27:27 +02:00
1ef4dc3265 Fix broken normal calculation of flipped faces 2018-08-12 15:34:05 +02:00
23501383bb Add new heuristic in opti step 2018-08-11 18:58:28 +02:00
1a59bc7ecf Modify opti edge split and vertex wigg so they can move new verts 2018-08-11 17:19:53 +02:00
Nick Wu
cefcf402cb Fixed taper on software side 2018-08-10 17:13:57 +08:00
Nick Wu
18cc07076d Fixed taper on software side, merged tess modifier's osd adapter. 2018-08-10 17:13:09 +08:00
6d9f748e5a Merge branch 'blender2.8' into npr_tess and update to new blender OSD API 2018-08-10 10:43:59 +02:00
Nick Wu
251dbabdf1 Fixed enum in modifier IDs (npr tess modifier and a merged new one) 2018-08-10 16:18:31 +08:00
Nick Wu
2d01210ea7 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons_contrib
#	source/blender/editors/mesh/editmesh_tools.c
#	source/blender/editors/space_outliner/outliner_draw.c
#	source/blender/makesdna/DNA_modifier_types.h
#	source/blender/makesrna/intern/rna_modifier.c
#	source/blender/modifiers/MOD_modifiertypes.h
#	source/blender/modifiers/intern/MOD_util.c
#	source/tools
2018-08-10 15:56:46 +08:00
Nick Wu
83c85c9c98 Fixed shader variable naming style issue. 2018-08-10 15:51:08 +08:00
Nick Wu
89e9c1405c Python panel engine adaptations 2018-08-10 15:36:02 +08:00
874b1a38af Tweak how potential folds are detected in opti wigg 2018-08-09 23:24:39 +02:00
2c61729764 More work on radi insertion 2018-08-09 22:38:21 +02:00
0b8e41098c Rewrite mult_radi 2018-08-09 20:51:46 +02:00
Nick Wu
4d7d0b60d1 Modified UI for background color display and line layer on DPIX. Added console warning for software rendering. 2018-08-09 15:41:30 +08:00
80ff0dd03c Change cusp edge shift criteria 2018-08-08 17:23:43 +02:00
7b038b6a06 Added check if radial insertion flip will create a fold 2018-08-08 16:10:25 +02:00
Nick Wu
ca07177f5b Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr 2018-08-08 21:55:54 +08:00
bfae9afeb3 Fix faulty opti radi extend logic 2018-08-08 10:17:23 +02:00
0717bdea66 Fix some gcc warnings 2018-08-07 20:48:09 +02:00
189de98ac1 Added a very basic cache system 2018-08-07 19:30:07 +02:00
Nick Wu
d9b0c6711e Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-08-07 19:57:07 +08:00
cb1d57f0f7 Added a multithreaded variant of split ff bb 2018-08-06 23:57:43 +02:00
ba0a4372ca Comment spammy debug prints 2018-08-05 23:12:35 +02:00
33abe49d38 Fixed opti edge flip not nulling corrected face and add sanity opti checks 2018-08-05 22:20:09 +02:00
Nick Wu
80e3a97744 Adapted shader APIs to DRW_ 2018-08-04 09:53:03 +08:00
Nick Wu
356dc7892b Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-08-04 09:34:15 +08:00
71fbf963af Simplyified mutl_face_search (should now be more robust too) 2018-08-03 20:26:59 +02:00
3daac4d4cc More work on opti edge split 2018-08-02 18:53:12 +02:00
Nick Wu
44f0f14232 Fixed software triangle and render line culling bug. (crappy, but works correctly) 2018-08-01 23:21:20 +08:00
Nick Wu
d2f77ce653 Uncrustify processed. 2018-08-01 20:29:17 +08:00
Nick Wu
7866c2fb05 potentially fixed drawing command conflict error in F12 2018-08-01 18:50:08 +08:00
Nick Wu
64c2578228 Fixed software rendering intersection cache update 2018-08-01 16:19:34 +08:00
Nick Wu
9b06c78676 Adapted multisample functions. 2018-08-01 12:08:05 +08:00
Nick Wu
3b36c698cd Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_scene.py
#	source/blender/draw/CMakeLists.txt
#	source/blender/editors/space_outliner/outliner_draw.c
2018-08-01 10:15:47 +08:00
48c96f6f01 Merge branch 'blender2.8' into greasepencil-object 2018-07-31 09:54:05 +02:00
be27284b76 Only align to view by default Monkey GP object
The blank grease pencil object must be aligned to axis by default.
2018-07-31 08:57:55 +02:00
2e4527f3ca Add a warning in annotations if active object is GP
Now the annotations is not working with grease pencil object selected and we need inform the user.

We need find a better solution for this, but at least we have a notification and not something that looks a bug, but a not supported function.
2018-07-30 22:21:13 +02:00
64fff35c2e Merge branch 'blender2.8' into greasepencil-object 2018-07-30 20:18:06 +02:00
ae2e2386ac New grease pencil transform icons
Designed by Matias Mendiola
2018-07-30 20:16:23 +02:00
Nick Wu
002712d04c Merge branch 'soc-2018-npr' of git.blender.org:blender into soc-2018-npr
# Conflicts:
#	release/scripts/startup/bl_ui/properties_scene.py
2018-07-30 23:20:28 +08:00
Nick Wu
927c7aae0d Added init code for default LANPR values. Fixed render and scene panels to accept LANPR engine. 2018-07-30 23:19:17 +08:00
1e45155e7a Change icon names to define custom grease pencil icons
The standard icons for these operators don't fit in the grease pencil use and it's better to have icons more designed for grease pencil strokes.
2018-07-30 16:30:43 +02:00
480abbe839 Fix: Ensure that LANPR panel is only enabled when that engine is enabled
- Fixed incorrect COMPAT_ENGINES define

- Removed poll() callback that was preventing the COMPAT_ENGINES
  set from working

- Have panel opened by default (since it doesn't need to stay collapsed
  when other engines are active anymore)
2018-07-31 02:05:13 +12:00
91a4d28a1c Example commit for fixing panel visibility when LANPR is enabled
Following the examples here (for the Scene/KeyingSet settings),
all general non-engine-specific panels should include "BLENDER_LANPR"
in the COMPAT_ENGINES set.
2018-07-31 02:03:47 +12:00
277a7a527f Automatically refresh viewport when changing LANPR settings
Use the messagebus struct-subscription methods here (as used for EEVEE settings)
so that changing rendering methods or other settings immediately refreshes
the viewport instead of requiring the user to click on the viewport to force
a redraw.
2018-07-31 01:51:31 +12:00
4c088075f0 Fix compiler warnings (use 0 in enums for no icon, not NULL) + whitespace (mixed tabs/spaces) 2018-07-31 01:44:54 +12:00
ff471c95fc Compile Fix: Branch now compiles when WITH_OPENSUBDIV is disabled 2018-07-31 00:54:51 +12:00
9ce69d83d1 Adjusted vertex wig and edge flip opti 2018-07-30 14:39:58 +02:00
1c04f26efd Fix missing parameter after merge 2018-07-30 14:39:23 +02:00
8303df3b4e Merge branch 'blender2.8' into greasepencil-object 2018-07-30 14:25:44 +02:00
28c08117ef UI: Hide Opacity and Thickness in Annotations panel
We hide these parameters while we decide if they are required or not, but now it's better keep hidden.
2018-07-30 13:48:34 +02:00
0ad8b25cca Merge branch 'blender2.8' into greasepencil-object 2018-07-30 12:55:18 +02:00
Nick Wu
67d1949c5b Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
2018-07-30 18:27:46 +08:00
Nick Wu
63921c65e9 changed most of the list API into BLI_'s. Removed many unused functions 2018-07-30 18:26:39 +08:00
56f3473b85 Cleanup: remove unused code 2018-07-30 10:51:21 +02:00
76c3335c9d Cleanup: use __func__ for mallocN identifier 2018-07-30 18:47:16 +10:00
8aa1af5bc2 Cleanup: unused warnings, right shift 2018-07-30 18:31:13 +10:00
4e09b80fb0 UI: Changes in some text in Overlay panel 2018-07-29 20:48:28 +02:00
c00ec472ef Cleanup: Fix typo error 2018-07-29 17:33:27 +02:00
e0ae593a7c Set default values for Grid and Fade 2018-07-29 17:30:10 +02:00
9399ae1697 Change Grid to work as 3D Grid
Now the scale is the size and the subdivisions the number of cuts inside this "bounding box"
2018-07-29 17:21:38 +02:00
5ec0745e49 Fix first edit mode change with TAB key
The operator assumed the object editable was using always OB_MODE_EDIT, but for grease pencil the mode must be OB_MODE_GPENCIL_EDIT
2018-07-29 16:13:19 +02:00
aa503b5913 UI: Use slider type for grid opacity and fade factor 2018-07-29 15:51:50 +02:00
bfd27bfcc7 Fix TAB key to toggle Edit mode
This key was removed by error in the past.
2018-07-29 12:43:04 +02:00
5ef8b72d15 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/addons
2018-07-29 12:24:34 +02:00
a4023605dc Change number of subdivision to avoid int division problem in Grid
Before, if you selected 5 subdivisions, the number of boxes in the grid was 5/2= 2, so the odds values were not working.

Now, the subdivisions means the number of boxes in each side of the symmetry line 5= (5 Right side + 5 Left side) = 5 * 2 = 10 Boxes.
2018-07-29 12:22:43 +02:00
44bb85b919 UI: Reorder Grid parameters 2018-07-29 12:02:17 +02:00
1545203d86 Update Grid when change lock axis 2018-07-29 11:48:59 +02:00
94c459147e Enable grid when play animation 2018-07-28 20:42:07 +02:00
2198cd5067 Cleanup: Move view settings to overlay struct 2018-07-28 20:41:04 +02:00
bdeceba5f6 Add Lock to axis and opacity control to grid
Now, the grid axis can be automatically set to the current lock axis
2018-07-28 17:58:27 +02:00
e33a16317d Minor changes to grid
- Use half number of lines in loop to be equal UI parameter
- Cleanup typo errors
- Change default number of lines
2018-07-28 16:43:49 +02:00
d157584f59 Enable grid in different axis
Before only Y axis was supported.
2018-07-28 16:29:49 +02:00
ff683fc86b Merge branch 'blender2.8' into greasepencil-object 2018-07-28 12:08:06 +02:00
e920e1335d Full refactor of Grease Pencil grid
After testing the old grid locked to view, the artist found that old system was not usable and they requested a grid locked to grease pencil object.

Also fixed some problems with fade object
2018-07-28 12:02:29 +02:00
d977db77cd UI: Change old Grease Pencil Paper and remove color
Now, the color is always white. We still keep internally the color field because maybe we reuse it in the future.
2018-07-27 21:13:48 +02:00
3dbbaf15be Initial work on edge wiggle rewrite 2018-07-27 17:27:44 +02:00
eacc4ae316 Separate Paper and Grid and rename 2018-07-27 16:58:51 +02:00
6c68bea576 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_view3d_types.h
2018-07-27 16:39:36 +02:00
d9e7a9ad5f Fix snap operator
There was a problem updating the scene due depsgraph missing tags
2018-07-27 16:27:55 +02:00
e4da722dd7 UI: Move draw on back button after lock options 2018-07-27 16:13:33 +02:00
5d060c3fb9 UI: Remove menu icons 2018-07-27 16:06:39 +02:00
65bc541f5d Implement Presets for Brush options
This is the first step to create a set of predefined settings.
2018-07-27 16:04:57 +02:00
6c8485ceec UI: Add additive drawing option to top header
This option was a menu option and must be a switch.
2018-07-27 13:13:42 +02:00
Nick Wu
9218730b2b DPIX and Snake's F12 is working now. 2018-07-27 18:17:18 +08:00
a6263a3c02 Merge branch 'blender2.8' into greasepencil-object 2018-07-27 12:16:07 +02:00
5d3082aa61 UI: Move lock options to Left Top Header
These options were not tool parameters but a general option, so we move to the same UI location used in mesh sculpt.
2018-07-27 12:15:21 +02:00
d7c410971f UI: More changes in menus 2018-07-27 12:03:22 +02:00
bb69ff8943 UI: Replace Weight Paint menus
Also some preparation for other modes
2018-07-27 12:03:22 +02:00
12ed26444e Fix: Forgot to rename a few properties in earlier RNA/DNA commit 2018-07-27 21:24:08 +12:00
Nick Wu
e941813e3c Debugging small problem in threads, in lanpr_triangle_line_imagespace_intersection_v2() 2018-07-27 15:53:13 +08:00
81b971b154 Fix: Refresh issues in Topbar with Grease Pencil and Annotations 2018-07-27 16:44:38 +12:00
a2dcac0a02 Cleanup: Remove unused code 2018-07-27 16:29:11 +12:00
aa8b7f4368 RNA/DNA changes to further decouple Grease Pencil and Annotation settings where clashes occurred
* Decouple stroke placement settings for 3D view
* Ensure that proper thickness controls are used in the topbar
2018-07-27 16:29:11 +12:00
f4f5c1152c Fix: Don't show GP Object's layer data in the Annotation topbar settings 2018-07-27 16:29:10 +12:00
Nick Wu
4ef26d98d3 Fixed intersection calculation memory leak, fixed snake UI error, added F12 supporting functions. 2018-07-27 11:41:16 +08:00
0300f6ee03 Merge branch 'blender2.8' into greasepencil-object 2018-07-26 22:28:38 +02:00
c581207556 Merge branch 'blender2.8' into greasepencil-object 2018-07-26 08:26:41 +02:00
Nick Wu
68374d3838 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-26 10:09:40 +08:00
7e0de88ce2 Merge branch 'blender2.8' into greasepencil-object 2018-07-25 20:39:12 +02:00
Nick Wu
d250cd950b Typo fix finalColor 2018-07-25 22:49:14 +08:00
Nick Wu
dd5fcd4d0f Fix camera access error, added report to no camera situation. 2018-07-25 22:25:18 +08:00
Nick Wu
3353221166 Fix code for strict compile. 2018-07-25 22:15:18 +08:00
0383854870 UI: Remove transform orientation options in Sculpt mode 2018-07-25 16:01:18 +02:00
ddd32b09ec UI: Hide snap options in Paint, Sculpt and Weight mode 2018-07-25 15:57:06 +02:00
0eb95d6ebc UI: Remove duplicated menu items
Some options were duplicated by error in previous commit.
2018-07-25 15:34:25 +02:00
b2d0bdf878 Merge branch 'blender2.8' into greasepencil-object 2018-07-25 13:21:39 +02:00
5417c39564 UI: Move Shapes panel to Header 2018-07-25 13:20:44 +02:00
6ef94c6407 UI: Remove more old Toolbar panels
The options has been moved to header or menu
2018-07-25 12:47:57 +02:00
bdf4967db7 UI: First changes in Edit Toolbar
- Add transform tools
- Move Bend, Mirror, Shear and ToSphere as Tools
2018-07-25 11:53:58 +02:00
Nick Wu
ea8f7878f6 Added debug shaders to find problems in f12 2018-07-25 16:43:30 +08:00
Nick Wu
88448dba15 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-25 13:43:14 +08:00
9afed02356 Annotation Eraser: Only erase the point within the cursor, not the whole segment 2018-07-25 16:46:43 +12:00
171e231a8a Fix: Crash in non-3d editors when using Annotations
The wrong shader was being used after removing the per-point
varying colors.
2018-07-25 16:39:56 +12:00
f806dd9bfc Merge branch 'blender2.8' into greasepencil-object 2018-07-24 22:16:26 +02:00
f0eaacc343 Change order of modes to reorder Pie menu
The Draw now is on N option and not in NW. In this way is easier change the most common modes (N, S, E, W)
2018-07-24 18:17:32 +02:00
d5c7fd54fd T55445: Add custom properties panel to materials 2018-07-24 16:45:54 +02:00
705b0631b3 UI: Harmonize Toolbar parameters
Some parameters have been moved to toolbar and removed from header.
2018-07-24 12:54:01 +02:00
bb66837116 Back opacity to annotations
This parameter is usefull to reduce visibility of annotations and was removed by error in a previous commit.
2018-07-24 11:30:26 +02:00
Nick Wu
7fa715cfb7 Modified UI for chaining. 2018-07-24 16:57:29 +08:00
2439ca1529 Merge branch 'blender2.8' into greasepencil-object 2018-07-24 10:57:16 +02:00
bd3f7816f9 UI: Improve Toolbar icons (group)
Now it's possible group new brushes
2018-07-24 10:53:53 +02:00
Nick Wu
483d5d7c93 Fixed c function and glsl file names. 2018-07-24 15:30:06 +08:00
a54c30da76 Hacky fix for Mode Switch Pie Menu overflowing to a submenu on GP Objects
With the introduction of the GP editing modes to the object/workspace
modes enum, this introduced a number of issues for the Ctrl-Tab mode
switching pie menu, e.g.
 * To access any of the GP Editing modes, you had to first navigate to
   the "More" sub-pie, before being able to see these values. In practice,
   this was tricky to use, and not ideal.
 * Particle Editing mode was also moved into a sub-pie by itself

This was due to the following reasons:
 1) Pie Menus for Enums use the "static" enum define to determine
    where items should go.  This was done to ensure spatial consistency
    of items (e.g. Edit is always in the "east" position).
 2) Each pie menu layout is only allowed to contain 8 items.
    (i.e. so that movements can be less precise, corresponding to the
    main compass directions only)
 3) The nature of the modes menu means that there is never any situation
    where all menu items need to be visible at the same time. Usually,
    there are only between 2-5 items in that menu at a time, and at least
    6 of the items are only valid for a single object type each.

Several other solutions were tried, but this hack is the simplest fix.
2018-07-24 17:47:28 +12:00
c8cf0e10e0 Annotations: Show "Stroke Placement" options in the topbar again
We may have to introduce a dedicated setting here for use with the
annotation tools, since the GP Object version is quite different now.
2018-07-24 17:25:54 +12:00
dc215a5851 Annotation Tools: Use different cursors to indicate that the tools are running 2018-07-24 17:25:54 +12:00
091db5fb96 Assorted Cleanup/Fixes 2018-07-24 17:25:53 +12:00
846f5d8f74 Annotations: Dynamically updating layer-color preview icons + "Active Note" enum
This adds a new enum with dynamically-generated icons to show previews
for the icons associated with each GP layer used for annotations. This
enum is used as part of the UI for annotations (specifically, in the
topbar settings for the active  tool), making it easier for users to
see what color strokes drawn using the active note/layer will look like.

I ended up needing to create a new icon type in BKE_icons.h so that
we can store references to the layer/color used.

Known issues:
* The icon seems a bit too big, and would look a bit nicer with
  rounded corners. But there are too many issues with the UI roundbox
  functions (e.g. _aa() makes colors too dark, and non-aa versions look
  too rough).

* Changing layer colors doesn't redraw the icons. A manual refresh
  (by mousing over the widget) is needed.
2018-07-24 17:25:53 +12:00
1b47790111 Cleanup: Whitespace 2018-07-24 17:25:51 +12:00
d62a48411d Cleanup: Remove need to set colors on each and every annotation point when drawing 2018-07-24 17:25:51 +12:00
Nick Wu
3f7d07ac97 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-24 10:12:03 +08:00
d3c463b6f5 Fix duplicate Brush in tool bar 2018-07-23 21:17:50 +02:00
8ad523b885 Merge branch 'blender2.8' into greasepencil-object 2018-07-23 20:28:04 +02:00
0050fc1cb5 UI: Improve brush toolbar
This is a temp solution to show all brushes and sort by use, not alphabetical.

This will be replace when new tool bar system is in place.
2018-07-23 20:27:20 +02:00
0b99dc1b25 Fix duplication error for Brushes
This produced an error when create a new brush and a memory leak when closed Blender.
2018-07-23 17:06:54 +02:00
Nick Wu
e406c67842 Provide a switch to enable chaining or not. 2018-07-23 22:33:59 +08:00
c013752625 Merge branch 'blender2.8' into greasepencil-object 2018-07-23 15:47:50 +02:00
Nick Wu
1ddd3d60bf Chain support line types and levels.
Still bugs in chaining, hard to find, but results good enough in most of the conditions.
2018-07-23 17:57:34 +08:00
610013da70 Clenup: Remove old unused code 2018-07-23 10:13:41 +02:00
5927e4cba4 Merge branch 'blender2.8' into greasepencil-object 2018-07-23 09:53:01 +02:00
Nick Wu
9f344c6b88 Merge and changed GWN APIs into GPU ones. 2018-07-23 11:34:30 +08:00
Nick Wu
aa6563d3a9 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	release/scripts/startup/bl_ui/space_view3d.py
#	source/blender/draw/intern/draw_manager.c
2018-07-23 10:55:48 +08:00
353c5a1c79 Merge branch 'blender2.8' into greasepencil-object 2018-07-22 12:15:31 +02:00
7201126e84 Merge branch 'blender2.8' into greasepencil-object 2018-07-21 14:21:17 +02:00
e0fc790da2 Merge branch 'blender2.8' into greasepencil-object 2018-07-21 14:14:05 +02:00
2d3a3d2241 Revert temp fix for materials preview 2018-07-20 22:30:22 +02:00
a7765d3511 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/render/render_preview.c
2018-07-20 22:19:59 +02:00
e2204f3fc5 Merge branch 'blender2.8' into greasepencil-object 2018-07-20 19:44:05 +02:00
768cb61181 Fix segment fault with material previews
This fix solves the issue with multiple previews at the same time. Maybe there wll be a more general solutions in render preview module, but we need keep the system running.
2018-07-20 19:43:15 +02:00
Nick Wu
67fa286f11 Fix render triangle size increment error. 2018-07-20 23:27:28 +08:00
Nick Wu
227c259873 Fix fileread error again. 2018-07-20 22:41:39 +08:00
Nick Wu
b3cea139a8 Fix taper on segment_count==1 situation 2018-07-20 22:26:32 +08:00
Nick Wu
efe7257a20 Fix detail reducing bugs 2018-07-20 22:14:02 +08:00
Nick Wu
b421eaa36d Chain first level preview ok. Simplification have bugs. 2018-07-20 21:06:36 +08:00
b7d2a47c06 Merge branch 'blender2.8' into greasepencil-object 2018-07-20 13:33:52 +02:00
ea0668e387 Remove unedeed flag in notifier 2018-07-20 11:53:52 +02:00
46f79f3f75 New version of Toolbar Icons 2018-07-20 09:09:22 +02:00
4eb3b3ce90 Fix Paint mode icons 2018-07-19 21:21:00 +02:00
c656a6dd6a Merge branch 'blender2.8' into greasepencil-object 2018-07-19 20:54:39 +02:00
9bacd9e3c9 Fisrt try of new Toolbar icons (WIP)
Designed by Matias Mendiola

Still problems with Paint Toolbar
2018-07-19 20:53:42 +02:00
Nick Wu
aceecd1749 Intersection chain now ok. (occlude level debug wait until tomorrow) 2018-07-19 23:44:30 +08:00
371b127043 Merge branch 'blender2.8' into greasepencil-object 2018-07-19 10:09:33 +02:00
Nick Wu
8bb97b6318 Fixed not updating normal error. now all lines properly calculated. 2018-07-19 15:50:50 +08:00
Nick Wu
4719b8f561 Fix occlusion error 2018-07-19 13:51:01 +08:00
1dbfd266a1 Tons of changes to fix GPU_* functions rename 2018-07-18 20:47:52 +02:00
b98e6d7742 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/draw_cache.c
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/gpencil/gpencil_brush.c
2018-07-18 20:18:09 +02:00
1334f3639c Cleanup: Reorder modifier list 2018-07-18 20:13:13 +02:00
3260ab8a7f New Mirror modifier
Still some functions not implemented, but the basic functionality is in place.
2018-07-18 19:42:18 +02:00
Nick Wu
3b52d6c72c Chain works, but occlusion is broken. (memory not cleaned up, drawing function is still the old one) 2018-07-18 23:49:14 +08:00
Nick Wu
ac74aa8d7f Fix typo, added to cmake, compile ok. 2018-07-18 16:42:05 +08:00
Nick Wu
7431839712 Chain now accept line segments (multiple occlusion level on one line is possible) 2018-07-18 16:20:21 +08:00
7a2617a6a8 Fix soft/hard limit warning 2018-07-18 10:00:31 +02:00
3537020110 Merge branch 'blender2.8' into greasepencil-object 2018-07-18 09:05:04 +02:00
Nick Wu
4b67aa4848 Implementing Chaining. Have problems for half-occluded line. Still thinking for solution. 2018-07-18 14:54:24 +08:00
8ce5bdffca Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2018-07-17 20:27:37 +02:00
Nick Wu
1313409e67 Merge branch 'soc-2018-npr' of git.blender.org:blender into soc-2018-npr
# Conflicts:
#	source/blender/draw/engines/lanpr/lanpr_chain.c
2018-07-17 23:23:23 +08:00
Nick Wu
4069c15759 Implementing software result chaining. Do NOT compile! 2018-07-17 23:21:28 +08:00
1892434c47 Merge branch 'blender2.8' into greasepencil-object 2018-07-17 15:37:00 +02:00
cca1d1038f Fix problem with preview for not visible materials
The preview must be generated with the color enabled and not checking the current scene settings. If we don't do this, the preview is empty for these materials.
2018-07-17 15:08:19 +02:00
Nick Wu
07cb51e074 Implementing software result chaining. Do NOT compile! 2018-07-17 17:26:30 +08:00
369816e531 Change RNA update to avoid unnecessary preview updates 2018-07-17 11:21:53 +02:00
a633737d93 Merge branch 'blender2.8' into greasepencil-object 2018-07-17 11:12:00 +02:00
Nick Wu
67ac0da53c Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-17 15:34:14 +08:00
Nick Wu
78277fe3f8 Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr
# Conflicts:
#	intern/opensubdiv/opensubdiv_capi.h
#	intern/opensubdiv/opensubdiv_evaluator_capi.cc
#	source/blender/modifiers/intern/MOD_mybmesh.c
2018-07-17 15:33:54 +08:00
c617cb11ce Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/modes/object_mode.c
2018-07-16 22:25:26 +02:00
5b5d80e864 Invert thumbnail switch to make UI more consistent
Also changed icon.
2018-07-16 18:21:22 +02:00
ef49c6368a Visual Studio compile fixes 2018-07-16 17:19:27 +02:00
917ea324d0 Add delete button to Color Preview list
This makes the control more consistent and avoid flickering when change list mode.
2018-07-16 16:31:00 +02:00
Nick Wu
1ce41b9726 File RW OK 2018-07-16 22:25:06 +08:00
751c8dfce3 UI: Replace color by material previews in list
To make more consistent the UI, the list of colors must shows the preview, not the old color boxes.

Besides, the new materials are more complex that a simple color box and the image was not representative.
2018-07-16 16:22:19 +02:00
f895b3e6ea Merge branch 'blender2.8' into greasepencil-object 2018-07-16 16:03:30 +02:00
915e414c86 Use live icons to template_ID for graese pencil materials 2018-07-16 13:54:22 +02:00
5cd39ced65 Add new parameter to template_ID to use live icon in button
By default, the button uses a predefined fixed icon, but in some situations it's better to show the preview (materials)
2018-07-16 13:51:40 +02:00
260ee7a770 update to new OSD API again 2018-07-16 13:10:59 +02:00
1ab1b4c1d8 Update to new OSD blender API 2018-07-16 12:01:40 +02:00
56d0fcbb66 Fixed camera object tranformation matrix 2018-07-16 12:01:40 +02:00
4268554f12 Make vertex wig sampling reflect the method in the paper 2018-07-16 12:01:40 +02:00
937b491943 Added time reporting and optimized osd_eval creation 2018-07-16 12:01:40 +02:00
09d0db2654 Initial port to 2.8 2018-07-16 12:01:21 +02:00
daeb641d42 Remove console warnings for tool bar
This will chanage in the future, but we can keep running without warnings with the current implementation.
2018-07-16 11:45:31 +02:00
7d22f617dd Update Icon for materials when change something
Need update icon for compact list. becaus ethe thumbnail is not used.
2018-07-16 11:11:30 +02:00
f1d0c41dcf Add missing weight data management in RNA function
This code was missing in the initial fix.
2018-07-16 10:01:28 +02:00
e386d627f6 Cleanup: Remove duplicate code 2018-07-16 09:33:19 +02:00
4faa243dd6 Cleanup: Make RNA callback names more consistent with the general naming scheme used 2018-07-16 18:41:04 +12:00
d94a9f5fbb RNA: Material filtering for GP Brush Settings 2018-07-16 18:41:04 +12:00
3c1c626916 Merge branch 'blender2.8' into greasepencil-object 2018-07-16 08:37:46 +02:00
Nick Wu
84c0f57d35 Code style fixes. Uncrustify processed. 2018-07-16 14:35:01 +08:00
39886fbb92 RNA: Filter "normal" materials vs "GP Object" ones 2018-07-16 17:57:57 +12:00
3a82de14d1 RNA: Add pointer poll callbacks so that Annotation datablocks don't get used for GP Objects and vice versa 2018-07-16 17:05:31 +12:00
Nick Wu
6af71e8176 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
# Conflicts:
#	intern/opensubdiv/opensubdiv_evaluator_capi.cc
#	release/scripts/startup/bl_ui/properties_scene.py
2018-07-16 10:44:49 +08:00
Nick Wu
8bb1a5396e Fixed OpenSubdiv_FVarLinearInterpolation type error. 2018-07-16 10:05:30 +08:00
5249e4bb11 Add switch to chnage betwen thumbnails and list
Now it's possible to change between a compact list of colors or the default thumbnail mode.
2018-07-15 21:34:23 +02:00
86965e51e9 Fix function names after merge
The functions have a new name now.
2018-07-15 17:19:52 +02:00
a5a0bc33a5 Merge branch 'blender2.8' into greasepencil-object 2018-07-15 16:59:04 +02:00
96831600bb UI: Change default previews to 80% 2018-07-15 16:23:03 +02:00
c846fa132d Add new Scale parameter to template_greasepencil_color
Now it's possible to define the size of the previews.
2018-07-15 14:12:38 +02:00
6f4849c22b UI: Fix some error in previous commit
Also rearrange some buttons.
2018-07-15 11:53:55 +02:00
14f5c40b80 UI: Use icon for Material Link
Follow the same UI design used in commitd2b28a8bf1b4d5abd9507e02702c6dc511ccf2c6
2018-07-15 11:46:14 +02:00
8664f667b2 Merge branch 'blender2.8' into greasepencil-object 2018-07-15 11:37:35 +02:00
84567336a5 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	build_files/cmake/macros.cmake
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/makesrna/intern/rna_scene.c
	source/blender/makesrna/intern/rna_space.c
2018-07-15 09:14:14 +02:00
d9526e5cb6 UI: Change preview row number to 3 2018-07-14 20:55:58 +02:00
f932d7863d Fix overlay panel missing in Edit/Sculpt/Weight Paint 2018-07-14 20:49:31 +02:00
57e0ebdba1 New preview file for grease pencil
Designed by Matias Mendiola
2018-07-14 20:48:40 +02:00
4eafa4f26a New property to verify if the material is grease pencil type 2018-07-14 17:14:39 +02:00
2b0a83bc78 UI: Make list of colors preview more compact 2018-07-14 16:15:26 +02:00
27ba739fb7 Merge branch 'blender2.8' into greasepencil-object 2018-07-14 13:44:14 +02:00
231e894a7e Update preview panel for grease pencil materials
Also some test changes to preview_grease_pencil.blend file
2018-07-14 13:41:17 +02:00
96cdb57d6f Clenup: PeP8 2018-07-14 13:07:05 +02:00
965c723eb4 UI: Add previeww materials panel to grease pencil 2018-07-14 13:06:27 +02:00
998a9a0322 Remove Grease Pencil Color Picker
This operator has been replaced by the new preview system.
2018-07-14 12:46:21 +02:00
cb01afc0b1 Update previews when change material
Also split rna update for grease pencil parameters
2018-07-14 12:17:42 +02:00
abab0398a0 Fix grease pencil cache update problems when change material properties
Since commit f84956738b 6/07/2018 12:33, the update of the materials was not working because depsgraph only update the current ID and not all related.

This fix the issue but need a review.

@aligorith Could you take a look and check if this is the best solution, I'm not sure about the fix, maybe we could add a relationship between material and datablock when create a new material.
2018-07-14 11:13:33 +02:00
2d90ef872a Fix merge error and remove old code
This file was wrong from a previous merge and still had code about grease pencil modifiers that was not deleted when the GP modifiers were splitted.
2018-07-14 10:05:31 +02:00
122c375d6e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/object/object_modifier.c
2018-07-14 09:42:03 +02:00
915b63c95f WIP: Define a new preview blend file for grease pencil
The blend file is only a copy of old file. Put only as placeholder.
2018-07-13 20:12:32 +02:00
Nick Wu
27628fa68c Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr-tess-modifier 2018-07-13 23:05:34 +08:00
Nick Wu
8dbc12864e Modify code to standard api and style 2018-07-13 23:05:16 +08:00
ad60c90c9a Merge branch 'blender2.8' into greasepencil-object 2018-07-13 15:51:47 +02:00
1471c5a2ec Merge branch 'blender2.8' into greasepencil-object 2018-07-13 12:29:06 +02:00
46453b13e8 Merge branch 'blender2.8' into greasepencil-object 2018-07-13 10:33:52 +02:00
5432109170 Move depsgraph tag after brush creation
If the brush was created, the tag was not working because it was done before the brush was available.
2018-07-13 10:33:07 +02:00
3808776a86 Move Overlay options to View3DOverlay
It's better to keep all overlays in the same RNA.
2018-07-13 10:28:02 +02:00
fff4676feb Replace "Notes" by "Annotations" to keep UI consistency
We can not use the word "Notes" in the UI for annotations because it creates confusion for the user.
2018-07-13 10:14:56 +02:00
d6eccc1361 Change some old grease pencil code to annotation
Fixed the error in annotation panel for other editors.

The main Notes switch for 3D View has been removed of the Notes panel because must be in the overlays.
2018-07-12 19:50:33 +02:00
6780be066f Move annotations switch to Overlay struct 2018-07-12 19:27:13 +02:00
edfcaea299 UI: Add again show annotation overlay switch
This was removed by error in a previous merge.
2018-07-12 19:20:32 +02:00
78ddb3c5f1 Update to new OSD blender API 2018-07-12 17:45:51 +02:00
c775facfd8 Update depsgraph to active brush from toolbar
There is a problem with the synchronization of the brush if it's selected from toolbar.

This change maybe can be removed when new toolbar system will be ready, but we need it now to keep drawing brushes working.
2018-07-12 17:35:29 +02:00
f2852b4c14 Revert "Revert "OpenSubdiv: Make more flexible C-API to specify FVar interpolation""
This reverts commit 14c72f943a.
2018-07-12 17:31:45 +02:00
3caae7707f Revert "Revert "OpenSubdiv: Fix wrong topology refiner cast""
This reverts commit 551f181742.
2018-07-12 17:29:38 +02:00
bbe59591d0 Revert "DO NOT MERGE - revert opensubdiv commit 9a0634a253421c02dbb6d2864db49e4d382ea2a3"
This reverts commit 87ed11f0a7.
2018-07-12 17:29:11 +02:00
23a870a0a9 Merge branch 'blender2.8' into greasepencil-object 2018-07-12 16:23:21 +02:00
c9026b8802 Merge branch 'blender2.8' into greasepencil-object 2018-07-12 09:09:00 +02:00
ac46f45e5c UI: Hide old Tools panels: Animation and Shapes
Pending to decide where put these operators.
2018-07-11 21:36:18 +02:00
28ed04b367 Merge branch 'blender2.8' into greasepencil-object 2018-07-11 19:18:31 +02:00
3bab9673ae UI: Hide color picker operator in Top bar
This operator will be replaced by material preview selector.

We keep the code internally now, but it will be removed when the preview works fine.
2018-07-11 19:18:02 +02:00
Nick Wu
6e3726439b Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr-tess-modifier 2018-07-11 23:14:48 +08:00
Nick Wu
93113d9b77 modify the code to adapt VC and some API changes. 2018-07-11 22:51:36 +08:00
a51b0fd81c Fixed camera object tranformation matrix 2018-07-11 16:43:59 +02:00
86b53f79d3 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_scene.py
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/editors/space_view3d/space_view3d.c
2018-07-11 16:28:59 +02:00
a74a8dfede New template for grease pencil material previews
This is the initial step to prepare the use of material previews in the topbar as color selector.

We need a new template to hide some elements of the default template.

Still the preview of the material is not available.
2018-07-11 16:21:13 +02:00
b24fec55a4 UI: Add different parameter to TopBar for each type of brush 2018-07-11 15:48:29 +02:00
b662ff5cae UI: Make Tool text shorter and less repetitive 2018-07-11 15:41:51 +02:00
652826dc77 Fix broken Tools group by previous commit.
The commit f468302660 broke the groups for mesh tools.

This is a temp hack to make the tools work, but need a better solution.
2018-07-11 15:30:52 +02:00
d4b7d488ff Fix error in toolbar for mesh modes
The category array must be shared.
2018-07-11 13:26:20 +02:00
25b95b2736 Replace text for Show/Hide panel
Before the name was too long, but with new design is ok.
2018-07-11 13:21:43 +02:00
Nick Wu
51df987a06 Merge branch 'npr_tess' of https://github.com/DarkDefender/blender into soc-2018-npr-tess-modifier 2018-07-11 17:14:02 +08:00
0dfc34d2b5 Make vertex wig sampling reflect the method in the paper 2018-07-11 10:42:10 +02:00
8cc727b6c6 Added time reporting and optimized osd_eval creation 2018-07-11 10:42:10 +02:00
87ed11f0a7 DO NOT MERGE - revert opensubdiv commit 9a0634a253 2018-07-11 10:42:10 +02:00
893633527d Initial port to 2.8 2018-07-11 10:42:10 +02:00
14c72f943a Revert "OpenSubdiv: Make more flexible C-API to specify FVar interpolation"
This reverts commit c17cb50ae2.
2018-07-11 10:41:20 +02:00
551f181742 Revert "OpenSubdiv: Fix wrong topology refiner cast"
This reverts commit d0920fba16.
2018-07-11 10:41:08 +02:00
8dc7c6bc47 Fix problem with Eraser cursor
The blend modes were using the GPU functions but the parameters were the old GL mode.
2018-07-11 10:25:21 +02:00
e93a1db8ec GPU replace missing in previous commit 2018-07-11 10:03:28 +02:00
457934c247 Replace gl* functions by GPU* 2018-07-11 10:01:11 +02:00
Nick Wu
ee788360cc Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-11 15:03:52 +08:00
1b32fa0ef5 Merge branch 'blender2.8' into greasepencil-object 2018-07-11 08:34:35 +02:00
f468302660 Fix: All GP Paint brushes were getting added to the same group in the toolbar 2018-07-11 17:13:23 +12:00
20bdf114a5 WIP: Add Brush drawing settings to topbar 2018-07-10 19:36:58 +02:00
e03a04dec7 WIP: Set Paint toolbar
Still the bushes are inside same category
2018-07-10 19:25:03 +02:00
a3e7590bb8 Merge branch 'blender2.8' into greasepencil-object 2018-07-10 18:05:02 +02:00
09078d12c3 WIP: More changes to try to get Draw tools
Still not working
2018-07-10 17:00:56 +02:00
2bff2a33b4 Do not include object type in name for Brush enums 2018-07-10 16:35:51 +02:00
ffa21e7417 WIP: Changes to make Sculpt and Weight paint tools work
This is a temp solution while we get the new toolsystem in place
2018-07-10 16:02:44 +02:00
db6d0ca6e9 Undo context changes
This can be needed by pending areas.
2018-07-10 13:29:14 +02:00
bf6c5e935e WIP: More work in toolbars (still not working) 2018-07-10 12:04:11 +02:00
3583c3f8dd Move GPENCIL_PAINT context inside tools switch 2018-07-10 11:59:57 +02:00
4ca18ac8cd Set icon for Brush enum 2018-07-10 11:53:34 +02:00
659254c2d0 Create Enum with all Grease Pencil Drawing Brushes 2018-07-10 11:50:16 +02:00
ae6036e371 Add property to check brush type
This is required by Tool system.
2018-07-10 11:11:04 +02:00
4d67d4bfc9 Remove annotation tool in Sculpt
This tool is not logic here
2018-07-10 10:36:01 +02:00
73a191d0cb WIP: Initial steps to implement Sculpt brushes in Toolbar
This is not working yet and can produce segment faults.
2018-07-10 10:11:47 +02:00
b6b6ee3134 UI: Remove obsolete function 2018-07-10 10:11:47 +02:00
7a40a8c0ef Cleanup/Fixes
* Remove hack that's no longer needed

* Don't change the GP Eraser Size userpref property from GP Object
  drawing operator, as it doesn't use that anymore. Instead, the
  eraser brush's size gets adjusted instead.
2018-07-10 19:52:23 +12:00
0e967bfb76 Toolbar: Move Ruler into same group with Annotations (but as separate buttons)
This way, the items group up nicer when you have the 2 column
icon groupings.
2018-07-10 19:13:10 +12:00
a77c3d5cb3 Fix: Pinning GP Object data in Properties Editor wasn't showing the GP Data tab 2018-07-10 18:52:21 +12:00
a2d7cb8c75 Merge branch 'blender2.8' into greasepencil-object 2018-07-10 08:05:18 +02:00
e9f21519fe Fix building & linking on Linux 2018-07-10 08:04:47 +02:00
fe98aed876 Cleanup: Remove GPENCIL_OT_color_choose
This isn't used anywhere, and should really even need to be
used for any purpose.
2018-07-10 17:25:40 +12:00
76c80cf124 Annotations: Don't display Annotations properties panel when GP data in context is for GP Object 2018-07-10 17:21:59 +12:00
2c609f6175 Fix: Don't allow Annotation tool to paint on GP Objects and vice versa 2018-07-10 15:44:30 +12:00
e7dc57438a Merge branch 'blender2.8' into greasepencil-object 2018-07-10 14:49:22 +12:00
0c830cf90e Merge branch 'blender2.8' into greasepencil-object 2018-07-09 20:35:36 +02:00
d3afa14647 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2018-07-09 17:17:05 +02:00
cd12b15756 Make Ruler works with Annotations not Grease Pencil object
Now, the ruler is using the annotation datablock (scene) and not a object with materials
2018-07-09 15:45:13 +02:00
117d304a90 Tweaks to GPENCIL_OT_new operator
* Correctly tag Annotation datablocks as such when adding them
* Add new layer by default. It saves users from having to manually
  add one after adding the datablock anyway.
2018-07-10 00:20:19 +12:00
c56e3bcb6f Fix: "New Note" didn't tag newly-created GP datablock for annotations when creating a new datablock 2018-07-09 23:47:33 +12:00
60d2ff134e Cleanup: Use GPU_* calls instead of gl* in annotate_draw.c 2018-07-09 23:28:02 +12:00
d884d41d17 Annotations: Change "New Layer" label to "New Note" 2018-07-09 23:15:51 +12:00
85f7f0fddf Make Annotations toggleable with main overlay switch 2018-07-09 10:47:56 +02:00
c8943925e5 Rename Grease Pencil to Annotation
Some properties and flags are more clear if the name is annotation.

Also changed some text and tooltips.
2018-07-09 10:37:44 +02:00
ff20577420 Merge branch 'blender2.8' into greasepencil-object 2018-07-09 09:49:19 +02:00
995a573d30 User Prefs: Make it clearer which properties affect Annotations only vs GP + Annotations 2018-07-09 19:45:21 +12:00
9cfd0c1720 Annotations: Change default color for new annotation layers
Although we've had a default color for new Grease Pencil layers for
years, hardly anyone ever changed the default color from the old
default of black. This commit changes this default to match the
color used in the annotation pencil icons, giving it a stronger
connection to the tool, and giving users a better default color
that will make the new strokes actually visible with the default
theme.
2018-07-09 19:42:37 +12:00
4a09bb1e8a Annotations: WIP access to tool settings in topbar
Lots of stuff to fix still - Not final UI at all
(in terms of widgets + properties exposed)

What works now:
* Exposed access to the setting controlling the default color to use
  when adding new layers
* Exposed access to change which color (layer) and thickness new strokes
  get drawn with (as per the current implementation). Now all annotation
  tools have tool settings exposed.

Big Todo's:
* Find a way to display color previews of GP Layers as icons
  (e.g. how to register all the necessary icon_id's, etc.)
* Replace the prop_search() with an enum prop
* Separate annotation RNA type defines? Context issues? etc.
2018-07-09 19:26:22 +12:00
6e05dc608c Annotation Eraser: Only operate on the active layer
Since we aren't exposing per-layer locks here (as we want to avoid
having lots of work enabling/disabling locks), the eraser now only
erases strokes on the active layer
2018-07-09 16:05:29 +12:00
3a53b24043 Cleanup: Assorted little tweaks/moving code around 2018-07-09 15:54:36 +12:00
2d2c03b8e4 Annotation Eraser Tweaks
* Remove the "soft" modes from the annotation eraser. Now, erasing
  strokes will immediately remove the stroke points. This works better
  for annotation use cases, as when erasing strokes, you usually just
  want to get rid of the notes quickly.

* Show eraser brush size setting in the topbar/tool settings when the
  eraser tool is active.  (Note: This setting still uses the userpref
  setting, which we should move to the scene toolsettings instead
  so that it doesn't get reset with each session)
2018-07-09 15:34:22 +12:00
7e6beb70ad Cleanup: Deduplicate stroke freeing code 2018-07-09 14:55:34 +12:00
85d61dfbd6 Merge branch 'blender2.8' into greasepencil-object 2018-07-09 14:32:40 +12:00
129c8fd684 Fix error when render
The v3d pointer is null when renders, so need to be checked before use it.
2018-07-08 20:43:09 +02:00
8fde165929 Fix errors and changes after merge 2018-07-08 16:45:16 +02:00
534c715bf5 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/gpencil/gpencil_brush.c
2018-07-08 16:17:35 +02:00
90a8ecc5ad Merge branch 'blender2.8' into greasepencil-object 2018-07-08 12:37:22 +02:00
646e90dee2 Move Vertex Opacity from Tolsettings to View3D
The vertex opacity is a parameter of the view and not of toolsettings as it was defined before.

With this commit we moved the last parameter to control the view look to the right place.
2018-07-08 12:36:39 +02:00
082b36934e Verify View3D is vailable before using it
This variable is not loaded when render.
2018-07-08 12:08:19 +02:00
4b84a25da9 Merge branch 'blender2.8' into greasepencil-object 2018-07-07 19:33:35 +02:00
82afe5c324 New Main switch at view level for Onion Skin
The switch is on top of GP datablock onion switch and allows to show/hide all datablocks in the view.
2018-07-07 19:17:27 +02:00
62526308ac Move Edit LInes and Multi Edit LInes switch at View level
This overlay must be by view, not by object.

Also changed the name to "gpencil_*" to some grease pencil paper to keep name consistency.
2018-07-07 18:30:07 +02:00
a8b63c3675 UI: Define a Header Text for Overlay Panel 2018-07-07 17:37:29 +02:00
9e7e926ed3 Try to fix the rim problem when the image ends outside view
The rim is disabled if the image to rim extends beyond the borders.
2018-07-07 11:13:01 +02:00
7ba438099b Improve Blur qualitty when the zoom factor changes
Now the number of pixels to blur depend of the pixel size and not as fix values as before.
2018-07-07 11:04:13 +02:00
fe68d0767f Fix animation path typo error
This error made impossible animate modifiers.
2018-07-07 10:51:21 +02:00
73cfbbcea9 UI: Reorganize Overlay panel
The separated panel for Paper and Options has been replaced by an unique panel, because two panels display too much empty space between them and make easier the maintenance.

Following how works other Blender panels, the paper options are hiddden when the paper is disabled, only required parameters are displayed.

We keep Onion switch here because is still pending the decission to use a general switch (mesh and GP) or keep separated switches.
2018-07-07 10:40:16 +02:00
5be3134ca0 Merge branch 'blender2.8' into greasepencil-object 2018-07-07 10:21:57 +02:00
158d55c2e6 UI: Move Vertex Opacity to Overlay 2018-07-07 10:21:26 +02:00
955a48384a UI: Small tweaks 2018-07-07 10:04:41 +02:00
924ff86814 Add Grease Pencil object to new View/Hide topbar control
Note: Used "GPencil" instead of "Grease Pencil" for Popup menu because full name is too long.
2018-07-06 22:55:47 +02:00
d809346eda Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/__init__.py
	source/blender/editors/object/object_add.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/editors/space_buttons/space_buttons.c
	source/blender/makesrna/intern/rna_internal.h
2018-07-06 22:31:03 +02:00
82a2bb2750 Enable Onion with Overlay button
The grease pencil onion skin need to set the cache as dirty to recalculate geometry, so a depsgraph recalc must be done when change Overlay switch.
2018-07-06 22:22:51 +02:00
55f01739c4 Undo hide Onion with overlay
There is a problem with the cache update and need a refactor. Remove the code while found a solution.
2018-07-06 20:54:48 +02:00
64abbdc192 UI: remove Edit Lines color from Overlay panel 2018-07-06 16:59:54 +02:00
2af322f3ba UI: Back Selected Mask options to Topbar
These options aren't overlays.
2018-07-06 16:55:16 +02:00
375dcdd5c4 UI: Add Edit LIne Color to Overlay 2018-07-06 16:41:00 +02:00
be13808886 Disable Onion y Edit lines with Overlay flag 2018-07-06 16:40:07 +02:00
8565fb5bce UI: Move some options to overlay (Edit lines, Onion) 2018-07-06 16:36:26 +02:00
ed5c6da73c Disable Grease Pencil Paper when disable overlays 2018-07-06 15:57:09 +02:00
974f2b6cfd U: Show grease pencil paper options in any GP mode 2018-07-06 15:37:43 +02:00
cf2a929bfe UI: Recover Pivot Point selector
After a merge, the pivot point disappear en Edit and Sculpt mode
2018-07-06 13:59:28 +02:00
4953892acf Check Weight data is available before duplicate or use
This is needed for using the functions in annotations where the weight data is not created
2018-07-06 11:06:32 +02:00
86f0549056 Merge branch 'blender2.8' into greasepencil-object 2018-07-06 10:23:54 +02:00
b5dfb62a2c Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/makesrna/intern/rna_gpencil.c
2018-07-06 09:30:22 +02:00
ca3cd8f916 New Shader FX implementation
This is the new implementation of the old VFX modifiers.

- All the BKE functions have been separated in new module and a new listbase was added to Object struct. Now the modifiers and the new shader FX are totally separated.

- Added a new section in properties panel for FX. ToDo: New Icon.

- Drawing methods improved aand new Rim and Colorize FX created.

Some functions and code (glsl and DRW_*) could be shared by other modules in the future, but as today only grease pencil is using it and the logic depend of the drawing engine, we decided to keep inside the GPencil drawing engine.
2018-07-06 08:46:00 +02:00
efc08aa600 Merge branch 'blender2.8' into greasepencil-object 2018-07-05 19:39:42 +02:00
2c19f296ce Fix: Icons for annotation tools now show in toolbar 2018-07-06 03:54:07 +12:00
4eefe33f77 Icons for Grease Pencil/Annotation tools
These were in the icon_geom.blend file in SVN (lib/resources),
but needed to be manually added to the Export group for this to
work.

They are needed for use for use with the annotation tools.

NOTE: There are currently problems running the icon generation
scripts in the gp-object branch due to some file loading pointer
remapping problems there causing segfaults when running the script.
Thus, I generated these icons using the 2.8 branch, then cherry-picked
that commit over to this branch.
2018-07-06 03:44:43 +12:00
b643f32354 Fixes for incorrect version patching code introduced in b6776304e7
* newlibadr() shouldn't be called from direct_link_* functions
  Besides, the pointers in question get corrected in
  lib_link_material() already

* Added expand_doit() calls for the sima and ima pointers.
  Following what's done for tex->ima, these also get expand_doit() calls,
  since they increase the usercount of images when used.
2018-07-06 00:38:33 +12:00
4b64b7e21c Cleanup: Remove the obsolete "ts->gp_brushes" field
This isn't used or accessed from anywhere anymore, so time to remove it
2018-07-06 00:38:32 +12:00
Nick Wu
68b0b7810e fix gcc warnings 2018-07-05 17:55:01 +08:00
41418be00d Merge branch 'blender2.8' into greasepencil-object 2018-07-05 09:49:23 +02:00
Nick Wu
ca4144a11a Provide a switch to turn on/off intersection line calculation to save time when intersection is not needed. 2018-07-05 15:25:07 +08:00
Nick Wu
ec2ccc7d60 software method preview now in correct aspect ratio 2018-07-05 14:53:01 +08:00
Nick Wu
9d71b50678 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-05 11:28:28 +08:00
Nick Wu
a75059cd44 fixed VC-specific warnings. 2018-07-05 11:17:36 +08:00
08b9036e3a Enable Grease Pencil paper in edit mode 2018-07-04 15:44:19 +02:00
8c45d279c9 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/object.c
2018-07-04 12:53:14 +02:00
b6776304e7 Fix missed materials after append GP object 2018-07-04 12:51:07 +02:00
Nick Wu
508a06e581 Merge branch 'soc-2018-npr' of git.blender.org:blender into soc-2018-npr
Conflicts:
	source/blender/draw/engines/lanpr/lanpr_engine.c
2018-07-04 17:38:13 +08:00
Nick Wu
42ddafedf5 debugging f12 weird behavior 2018-07-04 17:33:19 +08:00
Nick Wu
d5a1c5a4a0 debugging f12 2018-07-04 15:52:20 +08:00
ecb4a65460 Merge branch 'blender2.8' into greasepencil-object 2018-07-04 09:11:20 +02:00
Nick Wu
59d878aa5c Fixed multithread RenderTriangle size error 2018-07-04 13:32:40 +08:00
03082dd1dd Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2018-07-03 19:46:29 +02:00
9d96302f47 Fix typo 2018-07-04 03:57:28 +12:00
891a944dfd Fix: Crash when erasing annotation strokes
The code was assuming that dvert data always exists on strokes
(it shouldn't, if we're doing everything correctly!), which
caused crashes when erasing annotation strokes (which definitely
don't have this data).

TODO:
Check that the rest of the code doesn't make similar assumptions!
2018-07-04 03:43:30 +12:00
cc7bbda849 Annotations: WIP first steps towards toolbar support
This adds a toolbar entry for activating the annotations tools
as active tools. Many things are WIP still (e.g. tool settings
are yet to come, as the necessary props aren't defined in DNA/RNA yet).

Todo's:
* Icons are missing.  The necessary icons *do* exist right now
  in the icon_geom.blend file, but I can't get them to export/generate
  .dat files that we can use in the UI here.  That said, the placeholder
  names (from that file) are now used.

* Key mappings need work/testing. They seem to work well enough as-is
  already though

* Tool settings (in topbar) are not implemented yet. Coming soon
  (aka tomorrow, after I get some sleep)

* Non-3D view toolbar support
2018-07-04 03:43:29 +12:00
179dfd0729 Cleanup: Remove 2D Editor support from gpencil_paint.c
The "GPENCIL_OT_draw" operator pretty much didn't support non-3D
views already (at least not without crashing). Now that we've got
a separate/dedicated operator for Annotation support (GPENCIL_OT_annotate),
we can remove the old 2D Editor support here.
2018-07-04 03:43:29 +12:00
c3f5c1dd20 Cleanup: Remove "Scene->gp_object"
This was from an earlier design for supporting Annotations,
where in the 3D view, we would have only had GP Objects.
Now that we've moved away from that idea, and are back to
having a separate "Annotations" system, this concept can
be removed from the code again.
2018-07-04 03:43:29 +12:00
6cb0327f17 Cleanup: Remove deprecated toolsettings->gpencil_src field
This was used to determine whether Grease Pencil data was stored
on the Scene level or per Object. It isn't actually used anywhere
in 2.8 now, with the GP Objects / Annotations. Removing now
to make space for storing the toolsettings for the annotation tools.
2018-07-04 03:43:28 +12:00
Nick Wu
74e029dcb6 Multithread OK. 2018-07-03 20:42:32 +08:00
Nick Wu
34db087c38 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-03 17:48:17 +08:00
Nick Wu
118cadf1ce move line layer and delete line layer component ok. 2018-07-03 17:43:35 +08:00
Nick Wu
54172dcab5 Line selection from object and collection is ok, material pending. 2018-07-03 16:28:39 +08:00
d86b7f53a8 Merge branch 'blender2.8' into greasepencil-object 2018-07-03 09:59:11 +02:00
339708d3eb GP UI: Make the "Grease Pencil Paper" panel/options part of the Overlays popover
This is a special feature only used during Draw Mode, and functionally
acts like an overlay. Some cleanups/tweaks to this are needed still,
but it's good to get it out of the way.
2018-07-03 17:15:37 +12:00
df1cf4af94 Cleanup: Variable Naming 2018-07-03 17:11:43 +12:00
ebbc047dfe Merge branch 'blender2.8' into greasepencil-object
# Conflicts:
#	release/scripts/startup/bl_ui/space_view3d.py
2018-07-03 13:20:38 +12:00
5abee2392f Fix for py errors in console, caused by bad poll callback for the "Animation" panel 2018-07-03 01:42:04 +12:00
9521de5583 Fix: Ensure correct names when using the "New Layer" operator for GP Object and Annotations
This replaces what 7931a1357a
tried to do.  We may still need to make these separate operators
to simplify things even further.
2018-07-03 01:42:03 +12:00
87a308ed33 GP Object: Don't show Add/Unlink datablock buttons for GP datablock ID selector
These buttons are not shown for any other object type,
so these shouldn't be shown for Grease Pencil objects.
2018-07-03 01:42:03 +12:00
105c0d178a Revert "Add annotation layer with the right name"
This reverts commit 7931a1357a.
2018-07-03 01:42:03 +12:00
bd53e9f2c5 Remove Animdata update for Palettes
This datablock is not animatable.
2018-07-02 13:24:16 +02:00
cb32dd9604 Fix parameter type after merge 2018-07-02 13:03:20 +02:00
fa73cd1854 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_data.c
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_intern.h
	source/blender/editors/gpencil/gpencil_utils.c
	source/blender/makesrna/intern/rna_internal.h
2018-07-02 12:48:37 +02:00
Nick Wu
07b7fae45d Updated ui, more easy to be used. (take advantage of new grouping api) 2018-07-02 17:11:00 +08:00
Nick Wu
f5b133fc2a Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-07-02 11:46:00 +08:00
6728b4a9b0 Cleanup: trailing space 2018-07-01 19:12:52 +02:00
31fee9b670 Merge branch '28' into greasepencil-object 2018-07-01 19:10:19 +02:00
531f833491 Cleanup: unused vars & comment block that doesn't run 2018-07-01 19:09:21 +02:00
014395cb53 Rename variable after merge 2018-07-01 11:09:59 +02:00
a1f0aed7d8 Merge branch 'blender2.8' into greasepencil-object 2018-07-01 11:01:04 +02:00
7931a1357a Add annotation layer with the right name
When adding layers, the name of the layer is different for grease pencil object and annotation.
2018-07-01 11:00:29 +02:00
552b954d30 Merge branch 'blender2.8' into greasepencil-object 2018-06-30 19:38:35 +02:00
02f4a180d9 Merge branch 'blender2.8' into greasepencil-object 2018-06-30 09:00:21 +02:00
cb144fe5ce Merge branch 'blender2.8' into greasepencil-object 2018-06-29 20:41:57 +02:00
1b13fdaf80 Annotations: Restore 3D View support for annotations (WIP)
Initial support for getting annotations to show up in the 3D
viewport again.  WIP and slightly hacky, but it restores basic
working functionality so we can focus on polishing the "new" parts.

Ultimately, the way these callbacks are integrated into the
drawing loop will probably need to change. For example,
* Perhaps we might need a full overlay engine for this one case
  (as for motionpaths), though that may also be overkill, and would
  further split the code in different places.
* The draw order (relative to manipulators) needs review. It probably
  should be below both sets of manipulators, not sandwiched between them.

Other notes:
* For this to work, we currently need to use the original (non-evaluated)
  scene data, or else we don't get the newly drawn strokes, as the
  scene->gpd stuff isn't copied by COW yet.
2018-06-30 02:52:20 +12:00
e2626831dc Annotations Keymap: Restore D-RMB for eraser 2018-06-30 02:52:20 +12:00
8308a051b4 Cleanup: Remove redundant code + note some code issues to fix 2018-06-30 02:52:19 +12:00
bc0f489619 Set annotions drawing mode always on top
The annotations must be visible on top of any other object in the scene.
2018-06-29 12:51:07 +02:00
Nick Wu
d4c5c2d76b Offline, DPIX, Snake working. no F12. DPIX draw intersection if cached. 2018-06-29 17:53:45 +08:00
ebadf391e3 Fix render type name error 2018-06-29 11:04:43 +02:00
0dbbedbf0f Cleanup code 2018-06-29 10:58:17 +02:00
0c1c619681 Fix draw back error due z-depth precission
The value 1.0 makes the image disappear.
2018-06-29 10:13:50 +02:00
f88f2b73c0 Merge branch 'blender2.8' into greasepencil-object 2018-06-29 09:55:11 +02:00
3587e5ca1e Fix problem when increase viewport qualitty
The reason of the problem was the precission of the background buffer. The original value was not enough when viewport qualitty was > 0.1
2018-06-29 09:52:30 +02:00
2784f1b6fc Cleanup unused extern definition
This was part of old VFX modifiers.
2018-06-29 09:43:34 +02:00
6ece125739 Fix again the pointer name for textures 2018-06-29 09:42:43 +02:00
Nick Wu
3ea9277205 removed line styles from SceneLANPR 2018-06-29 14:18:11 +08:00
Nick Wu
02b3e81793 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-29 12:03:27 +08:00
Nick Wu
141c2cf150 Multisample implementing, f 12 won't work either. 2018-06-29 12:01:12 +08:00
f19b34b43b UI: Rename Grease Pencil Simplify Panel 2018-06-28 17:45:56 +02:00
824ef929f6 Fix merge errors 2018-06-28 17:44:59 +02:00
823bb18425 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/datafiles/userdef/userdef_default_theme.c
	release/scripts/startup/bl_ui/properties_scene.py
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/gpencil/gpencil_brush.c
	source/blender/editors/gpencil/gpencil_paint.c
2018-06-28 17:33:55 +02:00
23ffb562b6 Move GPD runtime fields to runtime struct 2018-06-28 17:25:30 +02:00
Nick Wu
0065c907c4 remove linear depth conversion. now clipping finally works as expected. 2018-06-28 22:55:39 +08:00
e97f357b19 Annotations: Set better default name for new annotation layers
Note: Many of the add layer operators still need tweaks,
but this is a good start for the main ones.
2018-06-29 02:48:27 +12:00
8869939d58 Annotations: Restore color selector per layer
This shows up in the layer list, making it possible to quickly change it
inline, and to see what color the strokes in the layer are using.
2018-06-29 02:29:41 +12:00
630d1ac6fc GP/Annotations: Provide usage hints about the "Poly" tool 2018-06-28 21:32:51 +12:00
bfae260928 Annotations: Don't respect the "on back" option
This is too complicated for an annotation tool
2018-06-28 21:27:41 +12:00
91f7ba14f2 Remove "Continuous Drawing" flag/mode
* GP Object doesn't need this as it has a proper "Draw Mode"

* For Annotations, it just got in the way and was a confusing
  modal+blocking nuissance that randomly activates when you just
  want to draw a quick line
2018-06-28 21:25:49 +12:00
bec3a00e59 Annotations Fix: "Freehand" mode now works
Was over-zealous when removing code from the drawing operator
to remove all the non-essential additions here.

Now annotations work in some of the 2D views:
* Nodes/Image Editor are confirmed to work
* Sequencer Preview needs further work
* Movie Clip editor works
2018-06-28 21:15:31 +12:00
3de40395da Fix stabilizer cursor after annotations
The cursor was drawn to wrong position after use annotations.
2018-06-28 10:19:26 +02:00
894b3b1f4e Annotations: Put in place basic building blocks for Annoations UI (WIP)
This is still a rough draft, just restoring all the essential bits and
pieces to have a workable system.
2018-06-28 19:13:20 +12:00
398ce6d987 Cleanup: Change "Drawing Tools" panel to use the annotation tools, not old GP drawing operator
This panel is going away soon, to be replaced by the active tools system.
But in the meantime, we need to stop using this old panel as it will
cause crashes when used.
2018-06-28 19:13:20 +12:00
76f914d36c Fix: Errors in console when using annotations in viewport
Was caused by a missing poll callback for a GP object panel
2018-06-28 19:13:20 +12:00
f1470f8a20 Cleanup: Move GP-Object specific UI panels to the appropriate file 2018-06-28 19:13:20 +12:00
979a881e23 Cleanup: Remove unused stuff 2018-06-28 19:13:20 +12:00
6b42183120 3D Annotations: Restore ability to access annotations from the 3D view
For now, the "gpencil" context properties work as follows:
* If the active object is a GP Object, the GP data associated with
  that is returned
* Otherwise, the Scene's GP data (i.e. annotations) are used

We may need to revise this later. But in the meantime, I'm restoring
this so that we have a quick way of figuring out what parts of the
annotation tool workflow are currently broken.
2018-06-28 19:13:18 +12:00
f855bb52fb Annotations: Properly initialise annotation datablocks 2018-06-28 19:13:17 +12:00
560950776e TODO: Note some struct members that should be moved to runtime data struct 2018-06-28 19:13:17 +12:00
4726aa3d5e Annotations: Repurpose an ancient/rarely-used flag to indicate that a GP datablock is used for annotations 2018-06-28 19:13:16 +12:00
6df2bed1e9 Annotations: First steps towards having working annotations again
Copy-back (from 2.8) and split out "Annotations" drawing operator/rendering
code from the "GP Object" versions of the same code.

Notes:
* All "annotation" related things are now in the annotate_*.c files,
  while "drawgpencil.c" and "gpencil_paint.c" are for the GP Object only
  now. This will simplify maintenance of the two different usecases,
  as the GP Object versions are significantly more complicated and filled
  with extra cruft.

* The general "Grease Pencil" keymap (i.e. the one that allows DKEY+LMB-drag
  to draw) is now for annotation usage only. For GP Objects, you can add a
  blank GP Object, enter Draw Mode, and start drawing.

Code Changes:
* Removed all 2D drawing-code entrypoints from drawgpencil.c

* Cleaned up most of the annotate_paint.c and annotate_draw.c code
  to remove stuff that annotations won't use (e.g. brushes, palettes,
  fancy line effects, etc.)  As much as possible, these have been restored
  back to a pre 2.77 state - with the notable exception of per-layer
  Onion Skinning, for which the settings were removed already.
2018-06-28 19:13:16 +12:00
f3c42200d3 Cleanup: Remove all mention of annotations from GP drawing operator 2018-06-28 19:13:16 +12:00
57ef71c555 Cleanup: Move comments to sit above the right structs 2018-06-28 19:13:16 +12:00
b41d293a96 Set again mix pass to DEPTH_LESS
Using ALWAYS for this pass is wrong because when using several objects, only the less z-depth object is drawn.
2018-06-28 09:12:35 +02:00
Nick Wu
b6129384d7 Modified triangulator function 2018-06-28 13:46:07 +08:00
Nick Wu
a63777b879 Fixed normal matrix error. obmat needs double to produce better result. 2018-06-28 12:30:58 +08:00
Nick Wu
40b2263284 Fixed save/reading error on line style thing... 2018-06-28 09:31:18 +08:00
Nick Wu
84877dc53f Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Conflicts:
	release/scripts/startup/bl_ui/properties_scene.py
2018-06-28 08:46:30 +08:00
b3ec99f176 Revert "Fix wrong engine name"
This reverts commit 7c3c256170.
2018-06-27 22:44:13 +02:00
8b1315facd Temp fix to compile
There is a problem with the generator for themes, and this is a temp fix while Campbell fix the generator,
2018-06-27 20:15:49 +02:00
b0ba7341bd Merge branch 'blender2.8' into greasepencil-object 2018-06-27 16:51:39 +02:00
411a8d13e9 Increase multisample texture precission
When use FX get glitches.
2018-06-27 16:45:04 +02:00
7c3c256170 Fix wrong engine name 2018-06-27 16:44:23 +02:00
01d9f8131e Merge branch 'blender2.8' into greasepencil-object 2018-06-27 11:43:20 +02:00
c11748475a Fix struct typo name errors 2018-06-27 11:33:48 +02:00
08a2176558 Fix FXAA problem when drawing
The internal passes never must check z-depth values, only in the final pass.
2018-06-27 11:28:11 +02:00
c6b1a931a3 Compile fixes after merge 2018-06-27 18:40:11 +12:00
3b34bc96ca Merge branch 'blender2.8' into greasepencil-object
# Conflicts:
#	source/blender/editors/gpencil/gpencil_interpolate.c
#	source/blender/editors/gpencil/gpencil_paint.c
2018-06-27 18:25:38 +12:00
Nick Wu
3a4515add9 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-27 11:12:43 +08:00
3bbf08cc15 Cleanup: Remove some obsolete defines 2018-06-27 00:03:15 +12:00
Nick Wu
4970b003ed Offline render running and display is ok. Don't render more than 1 time. 2018-06-26 18:31:10 +08:00
7caccf4bf2 Merge branch 'blender2.8' into greasepencil-object 2018-06-26 21:48:41 +12:00
Nick Wu
fd2036333b redo-ing draw code for offline rendering 2018-06-26 14:03:52 +08:00
Nick Wu
309f06c4ef rename LANPR_LineStyle into LANPR_LineLayer. 2018-06-26 09:29:40 +08:00
66b1de59b5 Merge branch 'blender2.8' into greasepencil-object 2018-06-25 22:30:25 +02:00
Nick Wu
e6821d3d27 Drawing code moved in, but most parts need redo. 2018-06-25 21:37:17 +08:00
f99830961a Merge branch 'blender2.8' into greasepencil-object 2018-06-25 11:04:48 +02:00
53447101f6 Merge branch 'blender2.8' into greasepencil-object 2018-06-25 09:21:00 +02:00
Nick Wu
1a8652192e Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-25 13:48:30 +08:00
b8cb4b5e01 UI: Hide layer panel if not GP object 2018-06-23 22:29:05 +02:00
af5f4f5d74 Merge branch 'blender2.8' into greasepencil-object 2018-06-23 22:02:25 +02:00
7d954885ff Fix z-depth error drawing new strokes
The new strokes must be on top of any other stroke.
2018-06-23 18:42:58 +02:00
4c58ab8754 Merge branch 'blender2.8' into greasepencil-object 2018-06-23 16:44:07 +02:00
67faa2d34d Fix missing thickness when scale or mirror
The line was reset to minimum thickness when it was scale with -1 or the mirror transform was used.
2018-06-23 16:28:41 +02:00
5eb25b1856 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_scene_types.h
	source/blender/makesrna/intern/rna_scene.c
2018-06-22 22:54:07 +02:00
a10266310b UI: Changes in Specials and Deleet menus 2018-06-22 18:14:20 +02:00
b7bdae5304 Adapt code after merge 2018-06-22 16:53:50 +02:00
85674e73b0 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesdna/DNA_object_types.h
2018-06-22 16:42:41 +02:00
018f2724f8 Fix segment fault in Noise Modifier
The random init seed was not done in the right function.
2018-06-22 16:09:33 +02:00
Nick Wu
0fb1e8fb03 Uncrustify processed. 2018-06-22 17:34:09 +08:00
Nick Wu
45a2126cc1 Offline intersection and occlusion test code complete. 2018-06-22 16:55:05 +08:00
Dalai Felinto
2ec28dd28f Fix reading modifier object pointers
Kudos to Bastien Montagne to help figure out the special modifier read code.
2018-06-22 10:15:09 +02:00
Dalai Felinto
71e2a5a56f Remove unused variable
(instead of poorly silencing it with UNSED =))
2018-06-22 09:08:54 +02:00
Dalai Felinto
161c67de14 Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2018-06-22 09:05:39 +02:00
Dalai Felinto
727f6d70fa Silence warning + cleanup 2018-06-22 09:05:27 +02:00
Nick Wu
d234d87295 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-22 13:31:25 +08:00
009f33b588 Fix name typo error 2018-06-21 17:23:29 +02:00
82ecee0a7b Small UI Fixes
* Fixed comment about the "Surface" panel. It's used after all
  (as a parent for two others). Adjusted comment to make that
  more obvious.

* Don't show decorators on the Parent Relations panel.
  None of those settings should be driven/animated.
  Maybe we put it back for overrides later though?
2018-06-22 02:18:47 +12:00
6d85d0f08a Cleanup: Delete unused code 2018-06-22 02:18:47 +12:00
8e4b87e9a5 Cleanup: Move some GP Object specific types to their respective files 2018-06-22 02:18:47 +12:00
788a6d078e Merge branch 'blender2.8' into greasepencil-object 2018-06-21 16:14:26 +02:00
36ce57f306 Merge branch 'blender2.8' into greasepencil-object 2018-06-21 15:50:31 +02:00
Nick Wu
801d037802 Render process ok. spin lock ok. DON'T COMPILE 2018-06-21 21:27:36 +08:00
7f6ec8c7fe Cleanup: Remove a few more references missed earlier 2018-06-21 23:25:34 +12:00
c719299bf2 Cleanup: Remove all old panels that Annotations will not be using 2018-06-21 23:14:21 +12:00
3012ea067f Remove various checks used in the general GP layers/data panel for isolation the GP Object 2018-06-21 22:57:59 +12:00
6e9b328a39 UI Tweak: Disable property split for GP Layers panel
There's just a single property here (opacity) under a
list widget that spans the full width of the panel.
It's not really worth having the half-size widget here.
2018-06-21 22:53:02 +12:00
71dd90c5c9 Decouple GP Object's "Layers" panel from that used for "Annotations" 2018-06-21 22:44:28 +12:00
208bf89fd2 UI: Simplify Panel default closed 2018-06-21 11:09:27 +02:00
d757771d27 Add depsgraph support for gpencil_modifiers_foreachTexLink 2018-06-21 10:58:45 +02:00
e584443af7 More depsgraph missing: modifiers_foreachIDLink 2018-06-21 10:39:39 +02:00
Nick Wu
de60a9646a Continue modifying files. Don't compile! 2018-06-21 16:36:01 +08:00
382db124d1 Changes to integrate depsgraph evaluation for modifiers
Still pending:

- void DepsgraphNodeBuilder::build_object
- void DepsgraphRelationBuilder::build_object
2018-06-21 10:33:50 +02:00
35d823c3e4 Merge branch 'blender2.8' into greasepencil-object 2018-06-21 10:07:08 +02:00
853da3babc New functions for ID Linking 2018-06-21 10:04:55 +02:00
Nick Wu
57d52826f6 Added almost all offline render code. adaptation pending, don't compile! 2018-06-21 15:56:49 +08:00
Nick Wu
7d062aabac turn off freestyle. preserve edge mark ops to to edit older files. 2018-06-21 11:12:21 +08:00
Nick Wu
c20e6ee66f UI fixed. active_layer is working now 2018-06-21 10:44:21 +08:00
ae8620b3ae Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2018-06-20 19:26:07 +02:00
f23e999720 Cleanup: Rename shader to keep name consistency 2018-06-20 19:12:41 +02:00
67c7b58313 UI: Second round to fix panel
I made stupids errors in previous commit
2018-06-20 18:54:48 +02:00
06cff7dd8e Cleanup: Stupid duplicated line 2018-06-20 18:50:51 +02:00
b4284a99bf UI: Back proportional editing for Sculpt mode 2018-06-20 18:48:13 +02:00
Dalai Felinto
39c9d9035f Rename greasepencil callbacks since we are already in GP namespace 2018-06-20 18:40:18 +02:00
Dalai Felinto
a624e1b5ff Silence warning 2018-06-20 18:38:46 +02:00
Dalai Felinto
8703dafb51 Fix crash on tweaking greasepencil modifier
We were missing a proper copy of modifiers.

Note: there was a warning for the function not being declared in any header
it should be enough to find the error by following the warning.
2018-06-20 18:34:03 +02:00
6d4ee22da2 WIP: Free modifiers memory
This was missing, but this lines get a segment fault

Still memory leak present
2018-06-20 17:42:03 +02:00
b5247238bb Split Grease Pencil Stack modifiers
Now all modifiers logic is totally separated of mesh modifiers.

Thanks Dalai Felinto for his help and support doing this change.
2018-06-20 17:20:08 +02:00
6b1e6b2061 Cleanup: Rename fields 2018-06-20 17:08:46 +02:00
Nick Wu
5f08c4e819 implemented set() for active_layer but still. 2018-06-20 22:37:10 +08:00
83f5606b69 Fix random number functions after merge 2018-06-20 16:00:14 +02:00
Nick Wu
eaf9f696f5 lanpr.layers.active_layer always return None. weird. 2018-06-20 21:48:22 +08:00
7f1eddb5ab Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenlib/BLI_rand.h
	source/blender/blenlib/intern/rand.c
	source/blender/makesrna/intern/rna_gpencil.c
2018-06-20 14:30:08 +02:00
2f9b8c7bc6 Fix multisample textures were using default not local copies
The multisamples used were not the custom textures for GP.
2018-06-20 11:05:18 +02:00
Dalai Felinto
e9b91d5803 Fix lanpr DNA not compiled 2018-06-20 10:24:23 +02:00
Nick Wu
ae2d58f443 Adding LANPR structures. makesrna fails, very weird. 2018-06-20 15:59:26 +08:00
b281b0fb6c Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
2018-06-20 09:43:55 +02:00
747c2814b0 Clenaup: Rename pass 2018-06-20 08:26:31 +02:00
eb3d80e6b8 Update depsgraph after adding Monkey 2018-06-19 17:19:21 +02:00
f0749f9f17 Merge branch 'blender2.8' into greasepencil-object 2018-06-19 17:07:14 +02:00
86dd04d540 UI: More panel adjustments 2018-06-19 17:06:04 +02:00
fe9e3ff97f Fix memory leak for RNG
After last changes in random number generation, there was a memory leak.
2018-06-19 16:58:11 +02:00
f195fc73b0 UI: Fix align in weight paint panel 2018-06-19 16:19:13 +02:00
e631871461 UI: Hide decorator icons
This icons break the design of the panel
2018-06-19 16:16:16 +02:00
b6fabaa83f UI: Set opacity parameter to single column layout 2018-06-19 15:52:29 +02:00
94c94e7a63 Merge branch 'blender2.8' into greasepencil-object 2018-06-19 11:21:50 +02:00
Nick Wu
2a7b4a84af Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-19 11:32:44 +08:00
Nick Wu
48e17cea96 Adding software render functions. don't compile! 2018-06-19 11:27:53 +08:00
967718b206 Merge branch 'blender2.8' into greasepencil-object 2018-06-18 17:45:22 +02:00
865f5ac173 Fix whitespace error breaking UI 2018-06-19 01:14:23 +12:00
556f23ab50 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_userpref.py
2018-06-18 11:08:16 +02:00
f0efa634b2 Git submodules
This commit was generated by Visual Studio
2018-06-18 10:50:53 +02:00
6782bdcc11 Hide internal properties in the viewport 2018-06-18 09:57:19 +02:00
15a58ebc31 UI: Expand direction buttons
This was disabled due layout bug
2018-06-18 08:35:17 +02:00
2a89323947 Merge branch 'blender2.8' into greasepencil-object 2018-06-18 08:24:07 +02:00
Nick Wu
c561923617 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Conflicts:
	source/tools
2018-06-18 10:22:20 +08:00
a0c8cf8f36 Make properties not animatable
These properties must not use the icon to animate property.
2018-06-17 20:14:25 +02:00
8eeb857cab Fix merge error in Topbar
This errors broke the topbar
2018-06-17 19:43:57 +02:00
f1daff28a0 Merge branch 'blender2.8' into greasepencil-object 2018-06-17 17:12:26 +02:00
67747dc2c3 Merge branch 'blender2.8' into greasepencil-object 2018-06-17 16:57:51 +02:00
687d248486 UI: Changes in sculpt brush panel
* The direction is not expanded because enabling Expand=True rises an Assert.
2018-06-17 16:24:01 +02:00
0883e0c51d Add default icons for direction 2018-06-17 16:18:24 +02:00
1cf1ff17e0 Merge branch 'blender2.8' into greasepencil-object 2018-06-17 12:55:55 +02:00
1902d38ec9 Fix changes after merge 2018-06-16 19:51:56 +02:00
747d1a8989 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_brush.c
        source/blender/editors/gpencil/gpencil_intern.h
	source/blender/editors/gpencil/gpencil_paint.c
	source/blender/editors/gpencil/gpencil_utils.c
2018-06-16 19:39:59 +02:00
08a2bde685 Modify copy function after merge 2018-06-16 10:17:02 +02:00
9ad04b85ef Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/gpencil.c
2018-06-16 10:01:21 +02:00
Nick Wu
0944c31451 render_to_image implemented, but not working correctly. 2018-06-15 22:03:19 +08:00
64599aff4c UI: Move Draw on Back to Topbar 2018-06-15 10:31:08 +02:00
205cd86516 UI: Chnages in Sculpt Brush panel 2018-06-15 10:18:01 +02:00
c98b4ee52d UI: Cleanup Appearance panel 2018-06-15 09:52:54 +02:00
cabd84f4a2 UI: Move more Brush option panels as Subpanels 2018-06-15 09:48:36 +02:00
240a78377a UI: Move Brush Stabilizer to Subpanel 2018-06-15 09:35:48 +02:00
0e2e8381b8 Merge branch 'blender2.8' into greasepencil-object 2018-06-15 09:23:38 +02:00
10d948469c UI: Some cleanup of properties panels (WIP) 2018-06-14 20:14:33 +02:00
4bad42176b Check the context outside tool system
for grease pencil we don't use tool system yet, so we need check outside  workspace->tools_space_type because this value is not available.

Thanks Campbell Barton for his help fixing this bug.
2018-06-14 19:50:56 +02:00
d7439790d3 Cleanup: unused vars 2018-06-14 19:44:34 +02:00
39b0ac43cc UI: MOve topbar panels to Properties
WIP: Still some issues pending.
2018-06-14 19:30:46 +02:00
b468f18e86 Cleanup: Missing in previous commit 2018-06-14 18:46:55 +02:00
35c7876606 Cleanup: Remove unused parameter 2018-06-14 18:45:42 +02:00
484d44ccc4 Add missing context to buttons_main_region_layout_too() 2018-06-14 18:41:57 +02:00
Dalai Felinto
22ed3aa70b Fix building error, silence warning, stop double promotion 2018-06-14 18:28:53 +02:00
1f80f84d17 Cleanup: Remove excessive space 2018-06-14 17:36:16 +02:00
82edf15fd3 Merge branch 'blender2.8' into greasepencil-object 2018-06-14 16:16:35 +02:00
decc0f661a UI: Get back Pivot point origin
This control was removed by error in previous merges.

This change is temporary while the topbar is redesigned.
2018-06-14 16:13:48 +02:00
38aadd9a71 Merge branch 'blender2.8' into greasepencil-object 2018-06-14 09:52:06 +02:00
Nick Wu
62e4fb9113 Added DPIX crease fading. 2018-06-14 11:57:27 +08:00
Nick Wu
74ca16c418 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-14 09:50:06 +08:00
bebe6ce3ef Merge branch 'blender2.8' into greasepencil-object 2018-06-13 19:54:54 +02:00
9556e434b6 Fix errors after merge 2018-06-13 16:38:23 +02:00
401cdb36f8 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/blenkernel/intern/gpencil.c
	source/blender/editors/gpencil/gpencil_data.c
	source/blender/editors/gpencil/gpencil_paint.c
	source/blender/editors/space_view3d/view3d_manipulator_ruler.c
	source/blender/editors/space_view3d/view3d_ruler.c
	source/blender/makesrna/intern/rna_main_api.c
2018-06-13 16:27:34 +02:00
29bf8d456e Cleanup: More style changes 2018-06-13 16:18:12 +02:00
7053b00083 Cleanup: Remove unused struct
These lines were used by old palette system.
2018-06-13 16:07:15 +02:00
1ba5910098 Cleanup: Create macros for duplicate code 2018-06-13 16:04:13 +02:00
d1260a0820 Cleanup: Rename variables and comments 2018-06-13 15:49:02 +02:00
Nick Wu
813aea9b23 Now with seperate line thickness factor. 2018-06-13 21:18:37 +08:00
Nick Wu
9bc49a7c88 Seperate color demonstration. 2018-06-13 20:39:03 +08:00
Nick Wu
727104839d Added support for Freestyle edge mark. 2018-06-13 17:54:04 +08:00
Nick Wu
2076721e71 Seam and Material lines can be ena/disabled in dpix. Also added UI. 2018-06-13 17:27:17 +08:00
fa4100950d UI: Hack topbar to keep all running while found final design
These changes are only to keep running grease pencil with the last merge.

All these UI elements must be relocated to the right place, but if we don't show them in the UI while we get the final place, the grease pencil is unusable.
2018-06-13 10:35:32 +02:00
84d2d4e75e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_topbar.py
2018-06-13 08:40:46 +02:00
Nick Wu
625de6ef81 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-13 14:25:14 +08:00
7b2c840314 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenlib/intern/rand.c
2018-06-12 18:43:26 +02:00
1e611c1ce0 Remove Draw at Stroke Location
This option at layer level was only for very limited situations and added complexity not needed.
2018-06-12 17:11:08 +02:00
37ffbb292d Rename field gradient_boxsize to pattern_gridsize 2018-06-12 16:24:05 +02:00
bebc6bfee6 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/datafiles/CMakeLists.txt
	source/blender/makesdna/DNA_material_types.h
2018-06-12 15:46:08 +02:00
dc422dcdbf PEP8 Style 2018-06-13 01:40:28 +12:00
795a266697 Added missing "Custom Properties" panel for GP Objects 2018-06-13 01:40:28 +12:00
7d0ad0d441 UI: Check if the material has gpencil data to show panel 2018-06-12 15:38:45 +02:00
ce5ecd19b3 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/include/ED_object.h
	source/blender/editors/object/object_modifier.c
2018-06-12 13:56:46 +02:00
3721b857c6 GP Branch: Update gpl->actframe in depsgraph callbacks (fixes COW-related issues)
This commit fixes various problems across the codebase
caused by the fact that the gpl->actframe pointers no longer
get updated on redraw, meaning that various editing tools
were not working.

Applying a similar solution to 59a516913e
here: On the exit node for GP data evaluation, we flush the changed
actframe pointers back to main database, so that the main db
is consistent with the displayed time.

Notes:
- For now, we just reuse the BKE_gpencil_eval_geometry() callback,
  since it's the only one there and nothing else was happening there.
  In future, when we do convert the GP modifier stack evaluation away
  from its drawing-engine based approach, we should split this out into
  its own function.

- We also do the actframe update in the COW domain here. While it's
  not strictly needed for anything right now, this is something that
  should really have been happening, so let's do it the proper way now.

- The alternative approach would've been to modify all GP related
  context functions to set this whenever they were called. But that
  carries performance penalties, and isn't such a nice solution,
  as context getters should really not have side-effects.
2018-06-12 23:39:25 +12:00
d69ac37f85 Fixes after merge
Some parameter list change.

Also disabled some functions that will not be used in annotations. Keep the function as reference to be removed when annotation will be back.
2018-06-12 12:49:15 +02:00
e9964ed175 Merge branch 'blender2.8' into greasepencil-object 2018-06-12 12:40:39 +02:00
d3f35b58da Add comments to review context creation in render 2018-06-11 17:55:15 +02:00
3bacfa08f9 Add missing parameter after merge 2018-06-11 17:54:32 +02:00
d296a846c6 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2018-06-11 17:41:11 +02:00
e00948e9e8 Fix errors after merge 2018-06-11 16:00:58 +02:00
7dbdd96912 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/object_update.c
2018-06-11 15:51:02 +02:00
Nick Wu
d3ba4b3535 depth behave weird, fixed multisample on snake result. 2018-06-11 18:22:39 +08:00
3faa0e6c54 Fix segment fault in weight paint for 2.8 old files
This code would be moved to versioning code after merge, but now it's required to manage files created with previous versions of 2.8 (not 2.7x)
2018-06-11 11:38:27 +02:00
e98b9d3c9c Remove mode switching custom code
This code is not required because the mode switching is not done with keys 1..9
2018-06-11 11:27:14 +02:00
Nick Wu
4a63d0c9f0 added depth-alpha line style control (pre multiply) 2018-06-11 15:02:27 +08:00
67cfa736b4 Merge branch 'blender2.8' into greasepencil-object 2018-06-11 08:55:55 +02:00
Nick Wu
d64862f778 Add: depth controlled line width. 2018-06-11 14:02:36 +08:00
Nick Wu
711c3f504e Added multisampe support functions in DRW. transform_to_screen later. 2018-06-11 10:38:23 +08:00
Nick Wu
28823638f1 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Conflicts:
	source/tools
2018-06-11 09:54:18 +08:00
98021bd7d1 Move multisample textures to texture list
If the texture is in e_data is shared for all viewports and fails.
2018-06-10 20:56:56 +02:00
63dcb04a71 Cleanup GP multisample code 2018-06-10 20:18:53 +02:00
952d9559d2 Merge branch 'blender2.8' into greasepencil-object 2018-06-10 16:47:02 +02:00
e6995bb77f Merge branch 'blender2.8' into greasepencil-object 2018-06-10 10:47:42 +02:00
3b94a96fa1 Merge branch 'blender2.8' into greasepencil-object 2018-06-09 19:49:47 +02:00
e51e9bda6f Merge branch 'blender2.8' into greasepencil-object 2018-06-09 16:07:52 +02:00
ea7740addc Cleanup: Remove unused line 2018-06-09 13:37:13 +02:00
827b7de9d6 Add a new User Prefs parameter to control GP multisample AA
For general use of Viewport the multisample AA is not required and can produce errors in selection, but for grease pencil the AA is required all the time to get smooth lines, so a new parameter has been added to User Prefs screen to define this value.

If we use the same value for both AA (grease pencil and Viewport), the viewport would be intefered by grease pencil settings.

The new value is below Viewport Samples.

By default the value was set to 4 samples.

This changes was done as result of requirement of grease pencil development team artists.
2018-06-09 13:30:36 +02:00
1c85a74c44 WIP: Add parameter to multisample 2018-06-09 13:30:36 +02:00
6816582b5a Merge branch 'blender2.8' into greasepencil-object 2018-06-09 09:29:06 +02:00
71dc55e3bb Fix errors after merge 2018-06-08 18:02:51 +02:00
1beeff419e Merge branch 'blender2.8' into greasepencil-object
source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_paint.c
	source/blender/editors/gpencil/gpencil_utils.c
	source/blender/editors/space_view3d/view3d_ruler.c
2018-06-08 17:50:59 +02:00
b76343410b Changes in Fill tool
There were some problems with the mouse position and the new TopBar.

Some changes done in order to avoid get_pixel error, but I could not reproduce the crash in Windows.
2018-06-08 16:45:15 +02:00
42e6b9217f Merge branch 'blender2.8' into greasepencil-object 2018-06-08 10:58:21 +02:00
ad5196b075 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/editors/object/object_ops.c
2018-06-08 09:55:29 +02:00
7afa353d5e Redo stats calculation
Now the stat info is saved in the datablock to avoid recalculations and the stats are calculated in one function.

Still pending move the update of the stats to a better place to calculate only when the object change, maybe in depsgraph evaluation.
2018-06-08 09:44:19 +02:00
7b4fc58a2a Fix macro argument use 2018-06-08 08:23:46 +02:00
4846f644a9 Merge branch 'blender2.8' into greasepencil-object 2018-06-07 19:24:26 +02:00
3b5d9ce441 Move Info panel to Bottom Bar Statistics
Now the info appears in the same place that other object types.
2018-06-07 19:15:12 +02:00
9e1bdca3ba Merge branch 'blender2.8' into greasepencil-object 2018-06-07 18:00:21 +02:00
2882430d37 Reorganize Mix Color with Texture
Now, the mis is only with texture to avoid duplicate texture parameters that made the panel difficult to understand.
2018-06-07 17:51:12 +02:00
e5615c7835 UI: Include Stroke and Fill as subpanels of Surface Panel. 2018-06-07 17:39:21 +02:00
1f388a2188 UI: Move Pass Index to separate Panel 2018-06-07 17:23:03 +02:00
816d9beec2 UI: More changes in Viewport Display Panel 2018-06-07 16:47:03 +02:00
68a9bb0268 UI: Replace label to "Stroke Thickness" 2018-06-07 16:43:49 +02:00
aafeefe927 UI: Rename label "Use in Render" to "View In Render" 2018-06-07 16:42:13 +02:00
61b69af84f Remove unused Layer Onion Skinning fields
These fileds are not used because the Layer override was removed in a previous commit.
2018-06-07 16:39:59 +02:00
bd2c4ba698 Disable Onion Skinning for old Drawing methods
This code will be used for annotations and is not requiered.
2018-06-07 16:25:35 +02:00
dbc0ea9aff Disable debug lines to avoid compiler error 2018-06-07 16:20:51 +02:00
Nick Wu
42990349c6 Fixed include file error (caused by merge?) 2018-06-07 21:11:05 +08:00
89a843b7dc Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
2018-06-07 14:39:29 +02:00
Nick Wu
38cb2515df Fix snake mode reload. 2018-06-07 19:49:39 +08:00
Nick Wu
30947f2208 Now use one-time scene loading. Line/Polygon smooth added. 2018-06-07 18:56:17 +08:00
c5fbf68d68 Cleanup: Fix comment 2018-06-07 09:35:19 +02:00
212477f6ee Fix uniform name
The uniform variable name was wrong.
2018-06-07 09:24:01 +02:00
5d2f63c090 UI: More changes in Fill panel
Fix some issues with pattern type.
2018-06-07 09:22:09 +02:00
b40df071d8 Remove Onion Skinning override by Layer
This option is not required and only add complexity.

The UI panel was removed in a previous commit.
2018-06-07 09:10:45 +02:00
Nick Wu
79407c7b6e Uniform assign error fixed 2018-06-07 14:56:43 +08:00
Nick Wu
ee7e4a7d95 Fixed snake line taper error induced by combined batch. 2018-06-07 14:45:47 +08:00
3763f61104 UI: Remove duplicate "Layer" Header text
Now these panels are subpanels of Layer, so it's better don't duplicate name.
2018-06-07 08:08:03 +02:00
Nick Wu
54670f2722 Seperated different algorithms into 3 files. Init code minor changes. 2018-06-07 11:42:58 +08:00
Nick Wu
054e889a93 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Conflicts:
	release/scripts/addons
	release/scripts/addons_contrib
	source/tools
2018-06-07 10:30:18 +08:00
5b17fa3388 Merge branch 'blender2.8' into greasepencil-object 2018-06-06 21:43:02 +02:00
ebaccc96a5 Cleanup: Fix comment typo 2018-06-06 20:18:10 +02:00
84eae294ae WIP: More changes in Fill Panel 2018-06-06 20:17:18 +02:00
5ed5c45e20 WIP: Redesign Fill Material Panel and options
- Change the Pattern style as an option inside Texture.
- Define only a gradient type with Linear or Radial modes.

Still the panels are not working with the right options by mode.
2018-06-06 19:57:42 +02:00
484acb2b61 Remove Opacity parameter for Colors
In order to keep consistency with Blender UI, the color has included the alpha factor in the same property and not as separated value.

This improves the material slots too, because now you can set the alpha directly.
2018-06-06 18:53:04 +02:00
9ae27c2d24 UI: Move Panel Adjustments and Relations as Subpanels of Layers 2018-06-06 18:46:59 +02:00
97fbe76b7b UI: Small changes to Fill Panel 2018-06-06 18:16:04 +02:00
3a08a3aff2 UI: Changes in Stroke Panel 2018-06-06 18:03:02 +02:00
b119607691 UI: Changes in Viewport Display Panel 2018-06-06 17:57:49 +02:00
9256f8d306 UI: Remove Apply Layer thickness 2018-06-06 17:47:16 +02:00
6316a6753e UI: More changes in Onion Panel 2018-06-06 17:42:44 +02:00
0e9a0f21c9 UI: Remove Panel Onion skinning by Layer 2018-06-06 17:35:43 +02:00
1e0ecd6d6f UI: Remove Lock and Delete frame
This is available in Dopesheet and Timeline
2018-06-06 17:27:01 +02:00
17d035db09 UI: Change Onion and Parent panels 2018-06-06 17:22:45 +02:00
9394609d4e UI: Change panel Layer Adjustments 2018-06-06 17:04:18 +02:00
0b4ef212b4 UI: Remove Debug option
This options must not be in the panel
2018-06-06 16:54:06 +02:00
9093ffdfa6 Fix errors after merge
There were brackets missing.
2018-06-06 16:24:46 +02:00
973e9e925e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_topbar.py
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
2018-06-06 16:23:23 +02:00
570c7280ff Fix errors after merge (main->bmain) 2018-06-06 10:39:45 +02:00
d82685f57e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/blenloader/intern/versioning_280.c
2018-06-06 10:37:25 +02:00
6a7deb0bd5 UI: Remove debug option (show points)
This option is not needed in the panel.
2018-06-06 10:21:04 +02:00
900fd5ea62 UI: Rename Panel Display to Viewport Display 2018-06-06 09:19:55 +02:00
6bfd7c600e Fix error after merge 2018-06-05 17:10:16 +02:00
28e107f510 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
	release/scripts/startup/bl_ui/space_view3d.py
	release/scripts/startup/bl_ui/space_view3d_toolbar.py
2018-06-05 17:04:51 +02:00
6619fcc22d Merge branch 'blender2.8' into greasepencil-object 2018-06-05 14:01:03 +02:00
Nick Wu
3664b38618 Fixed depth occlusion stupid error. 2018-06-05 15:22:41 +08:00
Nick Wu
094e25752a Merge branch 'soc-2018-npr' of git.blender.org:blender into soc-2018-npr 2018-06-05 14:47:42 +08:00
Nick Wu
6a5cde3b74 Fixed complier-specific errors. Use force reload. 2018-06-05 14:39:34 +08:00
Nick Wu
3991d0805c Fixed complier-specific errors. 2018-06-05 13:34:01 +08:00
Nick Wu
9f8fbefc15 Added DPIX/Snake switch function. SceneLANPR out of sync with RNA, wierd 2018-06-05 11:36:22 +08:00
1609740341 Update submodule references
This change has been created by merge, but really does not change anything.
2018-06-04 20:12:06 +02:00
f2d856f3c6 Disable all modes after convert file 2018-06-04 20:11:12 +02:00
45c5d7a659 Disable missing flag
The WEIGHT flag must be disable too.
2018-06-04 20:08:56 +02:00
b9e62248ff Merge branch 'blender2.8' into greasepencil-object 2018-06-04 19:35:06 +02:00
Nick Wu
8d647a8f7d Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-06-04 23:43:47 +08:00
Nick Wu
4db17993a7 Removed debug Fragdata outputs 2018-06-04 23:42:27 +08:00
8ddf68b6a7 Fix rename missing in previous commit
These fields were not renamed in previous commit.
2018-06-04 17:25:17 +02:00
Nick Wu
1fe9a56112 DPIX implemented and running. 2018-06-04 23:18:00 +08:00
6f76154cf2 Remove deprecated data and move to new file conversion tools
These tools are included inside a file with DNA_DEPRECATED_ALLOW
2018-06-04 17:07:12 +02:00
e4f03e2304 Merge branch 'blender2.8' into greasepencil-object 2018-06-04 15:34:07 +02:00
3c03e24376 Merge branch '28' into greasepencil-object 2018-06-04 11:28:38 +02:00
604b673945 Merge branch '28' into greasepencil-object 2018-06-04 11:26:40 +02:00
71d300573a Merge branch 'blender2.8' into greasepencil-object 2018-06-04 09:06:15 +02:00
Nick Wu
6e44f612b0 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
Conflicts:
	release/scripts/addons
	release/scripts/addons_contrib
2018-06-04 10:14:22 +08:00
Nick Wu
cffef6cee5 Included DPIX Code, prevent compile. 2018-06-04 10:11:27 +08:00
fc2e0b6c6d Merge branch 'blender2.8' into greasepencil-object 2018-06-03 16:20:20 +02:00
47f4ca032b Merge branch 'blender2.8' into greasepencil-object 2018-06-03 09:41:32 +02:00
374e08db00 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/object.c
2018-06-01 19:38:27 +02:00
99cc3f81f3 Remap mode keymaps and solve merge issue
The keymap has been changed and there was a merge error.
2018-06-01 15:35:03 +02:00
ebd273db72 Merge branch 'blender2.8' into greasepencil-object 2018-06-01 15:20:37 +02:00
71d4bbf8da Merge branch 'blender2.8' into greasepencil-object
Conflicts:
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/makesrna/intern/rna_material.c
2018-06-01 13:21:20 +02:00
9911106534 More fixes after merge 2018-06-01 10:02:31 +02:00
d4eac6f998 Fix parameter values after merge
This python function needs different settings after merge.
2018-06-01 09:19:39 +02:00
4a9b3a76b5 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
release/scripts/startup/bl_ui/space_topbar.py
2018-06-01 09:13:08 +02:00
034c2c800e UI: Hide weight tools for non GP Objects
This poll method was missing in previous commit
2018-05-31 23:09:21 +02:00
93a61f4ab6 Merge branch 'blender2.8' into greasepencil-object 2018-05-31 19:26:06 +02:00
9e9453f1c6 Merge branch 'blender2.8' into greasepencil-object 2018-05-31 18:19:32 +02:00
6b53fc7b79 Fix color picker panel position
This is ahack to avoid the panel is shifted to the right. It looks the function to calculate the visible rect is using the toolbar size, but the view is full width.
2018-05-31 17:03:30 +02:00
1bc6089230 Merge branch 'blender2.8' into greasepencil-object 2018-05-31 16:50:13 +02:00
c3f08234aa UI: Back edit line button to previous place 2018-05-31 16:46:28 +02:00
bd7ccd4e95 UI: Remove redundanrt options moved to Top Bar 2018-05-31 16:11:33 +02:00
3a6328f389 UI: Replace icon 2018-05-31 16:06:45 +02:00
2e47506f8c UI: Move Multiframe ON/OFF to Topbar
Before it was inside the panel.

Thanks Pablo Vazquez for his help.
2018-05-31 16:02:49 +02:00
6e8a388e14 Do not hide grease pencil when disable Overlays
After adding the new grease pencil context modes, the draw must be done always.
2018-05-31 15:22:51 +02:00
7d294eade0 Merge branch 'blender2.8' into greasepencil-object 2018-05-31 13:29:57 +02:00
6c791e47ca UI: Fix multiframe ON/OFF option 2018-05-31 12:13:14 +02:00
76f84efcda Merge branch 'blender2.8' into greasepencil-object 2018-05-31 11:58:49 +02:00
9fc36300de UI: Fix curve controls
The template_curve_mapping is not working inside a box layout..
2018-05-31 11:58:08 +02:00
97f867f9f5 UI: Undo move to Top Bar for some panels with operators
The Top Bar must be used for settings only and never for operators.
2018-05-31 11:49:55 +02:00
2335390a3c Undo previous context change
These operators cannot be used in Top Bar, so this context is not required.
2018-05-31 11:47:37 +02:00
3e1fa48d39 UI: Move panels to Top Bar
Still some problems with operators using context data.
2018-05-31 11:07:18 +02:00
fc256d3233 Add TOPBAR context to poll functions 2018-05-31 11:06:41 +02:00
a155470363 Fix typo error in Stroke Panel 2018-05-31 09:52:55 +02:00
Nick Wu
e69e3553ed Implementing DPIX algorithm. (in progress, do not compile!) 2018-05-31 10:35:28 +08:00
9d47e56e47 UI: Move some panels to toolbar 2018-05-30 20:33:12 +02:00
2d65b34f16 Add new context modes for grease pencil
These modes were missing.
2018-05-30 20:15:53 +02:00
15b1acc6b5 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_scene.py
        source/blender/makesrna/intern/rna_object.c
2018-05-30 19:28:24 +02:00
b44e74cd77 Cleanup inactive code 2018-05-30 17:47:30 +02:00
73b91e0d05 Merge branch 'blender2.8' into greasepencil-object 2018-05-30 16:57:19 +02:00
21e2cdce54 Rework in modifers apply parameters
Instead to pass the Context variable that it was used to get bmain pointer,now bmain is passed as parameter to reduce data and avoid any use of Context.
2018-05-30 16:52:37 +02:00
9af8923d82 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-05-30 16:34:54 +02:00
eb66c19a5c Remove context parameter
This parameter is removed because Context must be avoided.
2018-05-30 16:33:18 +02:00
30ccca03d4 Redo mode settings after merge
This code section was changed in the last merge
2018-05-30 16:28:42 +02:00
5560722e34 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/include/ED_object.h
	source/blender/editors/object/object_edit.c
	source/blender/editors/object/object_ops.c
2018-05-30 16:25:09 +02:00
0894fb5749 Cleanup: shadowed var 2018-05-30 16:01:49 +02:00
bdd290cb81 Modify mode set routine to enable grease pencil modes
Now, when you press the numeric key to change mode, if the object is grease pencil, the grease pencil mode is enabled.
2018-05-30 16:00:04 +02:00
d038c07e4c Remove keymap for changing brush using numbers
This brush selection wil be replaced with spacebar and a menu.
2018-05-30 15:46:31 +02:00
aa722e8193 Remove old mode switching Keymaps
These keymaps are conflicted with new mode switching keymaps.
2018-05-30 10:27:53 +02:00
6d8bc03252 Disable old mode switching code 2018-05-30 10:27:14 +02:00
ba064952cb Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/addons
	release/scripts/addons_contrib
	source/blender/editors/object/object_edit.c
2018-05-30 08:47:44 +02:00
5edc1d475d Fix parameter list for some functions after merge 2018-05-29 17:59:45 +02:00
22a14f8d5c Merge branch 'blender2.8' into greasepencil-object 2018-05-29 17:38:28 +02:00
958a509c37 Filter dopesheet channel to OB_GPENCIL only
This filter using ob->data is evaluated for any object type and this can produce problems.

In the future, when grease pencil dopesheet will be merge with "normal" dopesheet, this section must be recoded.
2018-05-29 17:34:43 +02:00
Nick Wu
8b2722b200 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-29 22:16:35 +08:00
Nick Wu
c4583135e7 line drawing in one batch, greatly improve performance. modified UI. 2018-05-29 22:04:19 +08:00
f71cd9fb1a Cleanup: Rename depsgraph variable 2018-05-29 12:49:40 +02:00
762a08399b Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/gpencil/gpencil_paint.c
2018-05-29 12:38:38 +02:00
9fad3cc35c Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-05-29 10:08:22 +02:00
6b238fd4ae Fix missing renames in previous commit 2018-05-29 08:51:53 +02:00
92a69a383f Cleanup: some missing renames from last commit
Also whitespace edits
2018-05-29 08:51:41 +02:00
ead47fa2a2 Merge branch 'blender2.8' into greasepencil-object 2018-05-29 08:40:22 +02:00
663e918b09 Cleanup: rename color members in gpencil style
It reads like a bug to store alpha in variables named 'rgb'

Also remove some redundant casts.
2018-05-28 20:19:36 +02:00
8e54aaf41f Cleanup: remove gp_ prefix from variable names
These are already in a grease pencil struct.
2018-05-28 19:28:16 +02:00
b1097f17c6 Merge branch 'blender2.8' into greasepencil-object 2018-05-28 17:39:52 +02:00
Nick Wu
a51a683993 Merge remote-tracking branch 'remotes/origin/soc-2018-npr' into soc-2018-npr
Conflicts:
	intern/cycles/blender/blender_python.cpp
2018-05-28 21:55:49 +08:00
Nick Wu
07a132f695 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr
f32a7.
2018-05-28 21:49:20 +08:00
e0f33eb662 Merge branch 'blender2.8' into greasepencil-object 2018-05-28 15:28:21 +02:00
Nick Wu
9bf620392f fixed weird problem in blender/blender_python.cpp 2018-05-28 21:26:19 +08:00
Nick Wu
eb90e6944b Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-28 12:38:05 +08:00
Nick Wu
afbda949cf Snake works. Added color options. Performance need optimization. 2018-05-28 12:36:29 +08:00
34592648b7 Merge branch 'blender2.8' into greasepencil-object 2018-05-27 22:06:34 +02:00
f03895b9c6 Merge branch 'blender2.8' into greasepencil-object 2018-05-27 09:02:12 +02:00
490a342555 Merge branch 'blender2.8' into greasepencil-object 2018-05-26 09:02:27 +02:00
46db0fe3c8 Merge branch 'blender2.8' into greasepencil-object 2018-05-25 19:28:36 +02:00
1c6a39c924 Merge branch 'blender2.8' into greasepencil-object 2018-05-25 15:53:00 +02:00
9de639b0d5 Cleanup: Remove unused flag GP_STROKE_RECALC_COLOR
This flag was used when the color name was the link to the palette color, but now with materials this flag is not required.
2018-05-25 12:08:21 +02:00
a8fc8a5f7d Merge branch 'blender2.8' into greasepencil-object 2018-05-25 10:14:34 +02:00
Nick Wu
fe815dc4da Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-25 14:35:02 +08:00
Nick Wu
788f35a4d5 Vector okay, CEASH EXPECTED! 2018-05-25 14:33:03 +08:00
5bc9b73944 Tag COW after select to update strokes 2018-05-24 19:17:22 +02:00
ab5ba0cef8 Merge branch 'blender2.8' into greasepencil-object 2018-05-24 19:05:49 +02:00
710b0b6e8e Merge branch 'blender2.8' into greasepencil-object 2018-05-24 16:49:13 +02:00
44ded54154 Fix error converting old 2.7 files
The color name was deleted before conversion and the memory allocation was wrong.
2018-05-24 16:42:10 +02:00
e3f221a844 Cleanup: unused variable 2018-05-24 14:01:39 +02:00
6e37800070 Merge branch 'blender2.8' into greasepencil-object 2018-05-24 13:54:44 +02:00
Nick Wu
cde785e986 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-24 15:38:04 +08:00
Nick Wu
21045172ac what... 2018-05-24 15:35:37 +08:00
Nick Wu
80ec390d07 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-24 15:11:43 +08:00
Nick Wu
e37ff11312 changed a bit of argument uniform to match the API.(not working properly) 2018-05-24 15:10:29 +08:00
ae0de604e4 Merge branch 'blender2.8' into greasepencil-object 2018-05-24 08:31:25 +02:00
Nick Wu
241873023e Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-24 09:51:07 +08:00
Nick Wu
ad228f8e46 Edge thinning shader ok 2018-05-24 09:49:17 +08:00
09924fcdd1 Merge branch 'blender2.8' into greasepencil-object 2018-05-23 19:35:33 +02:00
91b7ee2ca3 WIP: Fix errors converting old 2.7 files
The brushes were not created and the palette must be removed.

The operator only works if Eevee engine is enabled. Cycles engine selected always fails.
2018-05-23 19:35:13 +02:00
Nick Wu
5cef17a439 Merge remote-tracking branch 'remotes/origin/blender2.8' into soc-2018-npr 2018-05-23 23:39:40 +08:00
Nick Wu
c7ef4704f9 Image filters ok, added ui adjustment(stub), prepared for vectorization. 2018-05-23 22:50:18 +08:00
852b5c58ab Merge branch 'blender2.8' into greasepencil-object 2018-05-23 16:38:09 +02:00
572b147d5b WIP: New operator to convert 2.7 grease pencil files
The operator convert the old 2.7x files to the new materials of 2.8.

This code is not defined in versioning code to avoid conversion of annotations.

Still pending some issues.
2018-05-23 16:37:32 +02:00
fe22793515 Merge branch 'blender2.8' into greasepencil-object 2018-05-23 10:37:10 +02:00
478c1ebb23 Cleanup: Reformat code 2018-05-22 19:35:15 +02:00
938a6c972a Cleanup: Fix comment 2018-05-22 19:29:04 +02:00
3502953167 Merge branch 'blender2.8' into greasepencil-object 2018-05-22 19:21:56 +02:00
350b660b65 Cleanup typo error 2018-05-22 19:20:11 +02:00
b9256d122f Move simplify options to Scene->RenderData struct
Before these change, the settings were defined in ToolSettings struct, but must be in the same struct that other scene simplify options.
2018-05-22 19:18:37 +02:00
67960e8d79 Cleanup: unused warnings 2018-05-22 16:52:41 +02:00
00907964d9 Merge branch 'blender2.8' into greasepencil-object 2018-05-22 16:42:22 +02:00
Nick Wu
7d1224406c Made a switch under Scene, and added files for LANPR adoptation. 2018-05-22 15:01:16 +08:00
0464a65ac3 Merge branch 'blender2.8' into greasepencil-object 2018-05-21 16:13:20 +02:00
26d507fbc0 Merge branch 'blender2.8' into greasepencil-object 2018-05-21 10:29:40 +02:00
5713dc558b Merge branch 'blender2.8' into greasepencil-object 2018-05-20 19:30:35 +02:00
60c4e20d9f Merge branch 'blender2.8' into greasepencil-object 2018-05-20 11:19:52 +02:00
b5dfa1108d Move random array function to BLI_rand
This function fills an array of random numbers
2018-05-20 11:17:43 +02:00
1b1baeeb0f Merge branch 'blender2.8' into greasepencil-object 2018-05-19 18:21:42 +02:00
c0ed6a6bea Remove scene->gpd deprecated 2018-05-19 18:20:56 +02:00
a1be8ef68e Fix merge problems and parameter list changes 2018-05-19 13:24:56 +02:00
f46e914448 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/CMakeLists.txt
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_query.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_280.c
	source/blender/collada/SceneExporter.cpp
	source/blender/editors/gpencil/gpencil_convert.c
	source/blender/editors/object/object_add.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_outliner/outliner_select.c
2018-05-19 13:05:23 +02:00
2406b8b8d0 Verify pointer before assign material 2018-05-18 18:41:52 +02:00
ca69d50031 Cleanup: Check pointer before link 2018-05-18 18:39:25 +02:00
8b76fb8c28 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-05-18 18:35:38 +02:00
8fc732d419 Refactor Brush Setting to new struct
This change moves the settings of grease pencil brush to a new sub struct.

WIP: Still not working the brush curves in the UI. The curves are working but don't appear in the UI panel.
2018-05-18 18:35:26 +02:00
577f93c399 Replace CFRA with DEG_get_ctime()
The CFRA value is not updated using COW.
2018-05-18 16:40:39 +02:00
3eab7fa512 Merge branch 'blender2.8' into greasepencil-object 2018-05-18 12:19:37 +02:00
bf375544cc Cleanup: use function to free weights 2018-05-18 12:16:49 +02:00
630f4a07d2 Replace CFRA with Depsgraph time to fix animation
The animation was not working because the number of current frame was not evaluated from depsgraph.
2018-05-18 10:38:43 +02:00
fb5e3fe050 Merge branch 'blender2.8' into greasepencil-object 2018-05-18 09:54:23 +02:00
c038ac8cad Modify rotate around cursor to use Trans Object
Now the object pointer is saved in the transformation data struct instead to use the viewlayer active object.
2018-05-17 19:28:16 +02:00
77ea4174d5 Merge branch 'blender2.8' into greasepencil-object 2018-05-17 18:57:14 +02:00
768fa47cf6 Add fix for rotation around cursor
NOTICE: This fix solves the problem rotating around 3D cursor, but it will need a review to use with multiedit.
2018-05-17 18:55:02 +02:00
19f7e2e674 Merge branch 'blender2.8' into greasepencil-object 2018-05-17 16:19:59 +02:00
0b4450124b Merge branch 'blender2.8' into greasepencil-object 2018-05-17 14:13:32 +02:00
0da4f410fb Merge branch 'blender2.8' into greasepencil-object 2018-05-17 10:05:56 +02:00
e6e46425aa Merge branch 'blender2.8' into greasepencil-object 2018-05-16 19:09:41 +02:00
895f4415f8 Fix error after merge: Parameter list change 2018-05-16 17:47:16 +02:00
1919eb7c9b Merge branch 'blender2.8' into greasepencil-object 2018-05-16 17:38:05 +02:00
5739e30fcb Add missing realloc for weights in RNA api
Fixed wrong weight field name too.
2018-05-16 17:22:52 +02:00
7532d611be Fix ruler weights array allocation 2018-05-16 17:18:50 +02:00
ff709b3784 Add missing weights array memory copy 2018-05-16 17:14:16 +02:00
ef4a169b94 Missing allocN line in previous commit 2018-05-16 16:47:56 +02:00
2ffbbfd67e Fix add primitive operator
The weight array was not reallocated.
2018-05-16 16:45:59 +02:00
304cb33533 Add initialization code for weights array
Cleanup unused code too.

Warning: This code is disabled, but add the fix for future use.
2018-05-16 16:40:26 +02:00
fceaa5f5f4 Define RNA properties for stroke weights 2018-05-16 16:34:57 +02:00
5c260a779c Cleanup: Remove old weights code 2018-05-16 16:10:37 +02:00
bd79c02c4b Fix error loading saved files
The weight array was not initializated.
2018-05-16 16:07:48 +02:00
5304756e2d Cleanup: Remove old unused functions
These functions were used by old drawing methods, but now they have been replaced with draw manager.
2018-05-16 16:00:13 +02:00
a7625df93e Cleanup: Remove unused parameter 2018-05-16 15:33:29 +02:00
82bffc68d8 Fix dissolve operator
The indices were wrong
2018-05-16 11:02:24 +02:00
f29b8c7fa8 Cleanup: Remove unused parameter 2018-05-16 10:51:17 +02:00
3e218ed6f5 ix simplify stroke segment fault
The index of the weights array was wrong.

WIP: Still there is a problem with  simplify adaptative.
2018-05-16 10:49:20 +02:00
03bb81f08d Fix field name error 2018-05-16 10:34:41 +02:00
619cc12b57 Add missing main weight array duplication 2018-05-16 10:16:31 +02:00
8f9e7de138 Fix segment fault when draw strokes
The subdivide was not reallocating the weights array.
2018-05-16 10:04:26 +02:00
9750e5c6f3 Cleanup: Remove duplicate and unused code 2018-05-16 09:48:34 +02:00
54be35123d Merge branch 'greasepencil-object' into experimental_gp_weight 2018-05-16 09:17:35 +02:00
cf53e1ca00 Merge branch 'blender2.8' into greasepencil-object 2018-05-16 09:16:54 +02:00
cffa00cbba Cleanup redundant code 2018-05-15 20:16:23 +02:00
13d411ccba Cleanup free code 2018-05-15 20:12:41 +02:00
c1c7df1c9c Move dupalloc outside duplicate function 2018-05-15 18:34:11 +02:00
3fe4232223 WIP: First compilation after change weights
This code is not tested, but as this is the first compilation without error, save this point as backup.
2018-05-15 17:55:49 +02:00
30beb53b78 WIP: Initial change of weight struct
This commit is not completed. Saved to get a backup point.
2018-05-15 14:04:15 +02:00
c5b72fd70e Rename field factor to weight
This is a previous step to move weights to MDeformVert
2018-05-15 12:52:45 +02:00
16ded67d80 Rename weight index field
This commit is a previous step to move the weights to MDeformVert and MDeformWeight
2018-05-15 12:45:38 +02:00
e6daa661bc Remove some deprecated scene->gpd
Still some pending.
2018-05-15 11:30:44 +02:00
f2f3bf48f8 Merge branch 'blender2.8' into greasepencil-object 2018-05-15 10:41:56 +02:00
2521a18dd7 Cleanup code 2018-05-15 10:17:17 +02:00
c5971d1f80 Cleanup: Define alpha field. 2018-05-15 10:17:17 +02:00
b5e1b13fe8 Fix inconsistent usercount handling of MaterialGPencilStyle.ima/.sima
Readfile was treating them as refcounted, RNA as user-one, and libquery
as not refcounted at all!

Full usercount makes more sense here, those images are used as 'real'
data for GP materials, not as temp setting of a brush!
2018-05-15 10:13:00 +02:00
6b5a67a0ae Cleanup: Fix unused parameter warning. 2018-05-15 10:12:33 +02:00
98bc64731f Cleanup: fix error w/ const arg 2018-05-15 09:37:41 +02:00
dfa87d3729 Cleanup: Remove duplicate parameter (cont.) 2018-05-15 09:31:32 +02:00
fcc41fafeb Cleanup: Remove duplicate parameter 2018-05-15 09:27:20 +02:00
5b12f86c84 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/transform/transform_snap_object.c
2018-05-15 09:09:53 +02:00
8839d96395 Merge Object cache allocate and add functions
As both functions are called always together, it's better to have in one only.
2018-05-14 20:26:31 +02:00
64e8d0eaa6 RNA: Replace material api 2018-05-14 19:54:57 +02:00
69bc2cb538 Remove DNADEPRECATED Scene->gpd from library_query.c
Deprecated DNA shall only be used in readfile?versionning code...
2018-05-14 18:32:56 +02:00
35e8acfe79 Add missing Object parent pointer from bGPLayer to library_query. 2018-05-14 18:32:56 +02:00
bff285a01a Merge branch 'blender2.8' into greasepencil-object 2018-05-14 18:27:18 +02:00
73b0aaacb8 Cleanup: Modify comments 2018-05-14 18:18:20 +02:00
05ab5b98c7 Cleanup: Add Comments 2018-05-14 18:07:07 +02:00
478cb94161 Fix merge error 2018-05-14 16:15:02 +02:00
e121fb7bfe Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2018-05-14 16:02:14 +02:00
7a6fa7eab9 Merge branch 'blender2.8' into greasepencil-object 2018-05-14 09:33:46 +02:00
40eda4f69c Cleanup: Remove unused header file 2018-05-13 17:56:26 +02:00
3cc2165ec5 Merge branch 'blender2.8' into greasepencil-object 2018-05-13 17:23:48 +02:00
4735ea927b Add Depsgraph parameter to calculate evaluate object matrix
The matrix for object and parent object need to be evaluated using depsgraph to get the right value.
2018-05-13 17:21:53 +02:00
f492e4a96b Fix error with parent matrix using COW
The obmat must be the evaluated object, not the object itself.
2018-05-13 14:07:56 +02:00
7cd3a98417 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/transform/transform.c
	source/blender/editors/transform/transform_conversions.c
2018-05-13 13:08:24 +02:00
83df53ccc8 Cleanup: Rename eGP_BrushIcons items 2018-05-13 13:00:19 +02:00
7c2db4036d Remove duplicate colors properties
These properties were to allow to change alpha in list of colors, but it can produe errors with animation.
2018-05-13 12:06:38 +02:00
51c9497d19 Merge branch 'blender2.8' into greasepencil-object 2018-05-12 21:06:39 +02:00
930a7a7b76 Cleanup: Rename function 2018-05-12 21:06:00 +02:00
e8f5844b58 Cleanup: Rename inverse_xxx to invert_xxx and GP_xxx_INVERSE_xxx to GP_xxx-INVERT_xxx 2018-05-12 20:08:29 +02:00
93114b508a Cleanup: Rename gpencil_fill_simplyfy_lvl to gpencil_fill_simplyfy_level 2018-05-12 19:56:22 +02:00
8f1224688e Cleanup: Rename keep_stroke_thickness to show_constant_thickness 2018-05-12 19:53:50 +02:00
16037ceff0 Rename field cur_thickness to curve_thickness 2018-05-12 19:46:07 +02:00
7c78f66926 Cleanup: Remove unused declaration 2018-05-12 19:45:41 +02:00
8bfb6dbdae Add DNA_DEPRECATED to old scene gpd field 2018-05-12 19:45:21 +02:00
ad4e9ef956 Move bGPdata runtime data to bGPdata_runtime struct 2018-05-12 19:11:06 +02:00
e442206701 Add DNA_DEPRECATED to old Palettes 2018-05-12 19:05:59 +02:00
98f8f324d0 Move bGPDlayer runtime data to bGPDlayer_runtime struct 2018-05-12 19:03:49 +02:00
879a77b08b Remove view_layer option for render (F12)
This option allowed to filter a grease pencil layer by view layer, but after merge review it was decided to remove.
2018-05-12 18:57:51 +02:00
b038e849a7 Move bGPDframe runtime data to bGPDframe_runtime struct 2018-05-12 18:47:38 +02:00
e471663da6 Move bGPDstroke runtime data to bGPDstroke_runtime struct 2018-05-12 18:43:26 +02:00
ad9ed38594 Cleanup: Rename field falloff to multi_frame_falloff 2018-05-12 18:29:35 +02:00
7d9043511c Cleanup: Remove unused code 2018-05-12 17:36:16 +02:00
7507432ccf Cleanup: Remove unused total shaders fields
These fields were added to debug the nuber of shading groups created and to be sure all was removed.
2018-05-12 17:28:23 +02:00
607d2e807e Cleanup: Rename gpencil_geom.c to gpencil_draw_cache_impl.c 2018-05-12 17:15:36 +02:00
5c1c9a814e Cleanup: Rename gpencil_draw_cache_impl to gpencil_draw_utils.c 2018-05-12 17:12:34 +02:00
fcd6727f0e Cleanup: Reorganize functions 2018-05-12 17:08:04 +02:00
94130eff34 Fix stabilizer cursor line drawing
The cursor line was not correct because it was not using the Region visible rectangle and the line to last stroke point was adjusted as the stroke.
2018-05-12 16:49:59 +02:00
0aa2238205 Merge branch 'blender2.8' into greasepencil-object 2018-05-12 16:09:55 +02:00
a17123f670 Cleanup: modifier arg wrapping 2018-05-12 08:28:58 +02:00
986f895989 Merge branch 'blender2.8' into greasepencil-object 2018-05-12 08:28:11 +02:00
18b891111a Cleanup: warning 2018-05-12 08:27:35 +02:00
8f5bd85f39 Merge branch 'blender2.8' into greasepencil-object 2018-05-12 08:27:23 +02:00
1d0245b396 Move Render code to separate file 2018-05-11 20:02:20 +02:00
f5f64794c5 Fix cache_used error in previous commit 2018-05-11 19:44:22 +02:00
c3a9e6ad90 Reuse fullscreen quads instead to create new ones 2018-05-11 19:36:03 +02:00
f7f55485ba Cleanup: Remove debug lines 2018-05-11 19:33:19 +02:00
af0ba709f8 Remove DRW_gpencil_create_blank_texture function
This function is not needed and the same can be done with less lines.
2018-05-11 19:30:57 +02:00
c127e6cf83 Don't pass cache_used as pointer
The value is not changes and don't need the pointer.
2018-05-11 19:24:22 +02:00
bdc5b35c74 Move matrix initialization to stl initialization block 2018-05-11 19:16:28 +02:00
97507ba563 Cleanup: Remove unused code 2018-05-11 19:15:51 +02:00
65862c549e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
2018-05-11 18:29:25 +02:00
aa2dfe1b02 Rename grease pencil modifier callbacks
Add the prefix gp_
2018-05-11 18:27:00 +02:00
3001ce368b Fix operator to change brush size
The field was wrong after last rename
2018-05-11 18:17:48 +02:00
534a713dbf WIP: Remove duplicate fields gp_lazy_radius and gp_lazy_factor
These fields have been moved to existing smooth_stroke_radius and smooth_stroke_factor.
2018-05-11 18:09:32 +02:00
2f29a45986 Resuse Brush size field instead to use separated thickness field
Pending to reorganize Brush struct to remove unused pad bytes.
2018-05-11 17:54:35 +02:00
d2b6195bad Rename brush cur_xxxx to curve_xxx 2018-05-11 17:35:23 +02:00
a62cc866b1 Cleanup: More renames 2018-05-11 17:30:25 +02:00
9771c008da Rename gradient and texture fields 2018-05-11 17:13:55 +02:00
287703cc4f Rename functions to use "material" instead of "color" 2018-05-11 16:59:13 +02:00
60a99fbff6 Rename GPC_xxx to GP_STYLE_xxx 2018-05-11 16:56:50 +02:00
26f6036242 Rename struct GpencilColorData to MaterialGPencilStyle 2018-05-11 16:49:53 +02:00
ca20817c7c Rename field gpcolor to gp_style 2018-05-11 16:43:38 +02:00
2e9a10c9a3 Remove unused ADS_FILTER_NOPALETTE 2018-05-11 16:31:57 +02:00
6ddb176e7a Cleanup: More function rename 2018-05-11 16:25:09 +02:00
2079edea93 Rename BKE_gp_smooth_stroke to BKE_gpencil_smooth_stroke 2018-05-11 16:23:12 +02:00
cffb84d8b2 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-05-11 16:20:11 +02:00
41957200b9 Rename BKE_gpencil_free_frame_temp_data to BKE_gpencil_free_frame_runtime_data 2018-05-11 16:19:53 +02:00
3a2935983c Cleanup: make LatticeDeformData private again
Matches master/2.8 branch.
2018-05-11 16:17:35 +02:00
c0e1771421 Cleanup: quiet warnings 2018-05-11 16:17:35 +02:00
b5f8c9d33e Cleanup: Replace () with {} 2018-05-11 16:16:42 +02:00
745ce35f8c Add missing break statement 2018-05-11 13:55:31 +02:00
6cb893f932 Merge branch 'blender2.8' into greasepencil-object 2018-05-11 13:53:34 +02:00
af88ef8336 Merge branch 'blender2.8' into greasepencil-object 2018-05-11 11:02:12 +02:00
ee11d4d556 Merge branch 'blender2.8' into greasepencil-object 2018-05-11 08:50:55 +02:00
6dd4622102 Merge branch 'blender2.8' into greasepencil-object 2018-05-10 17:53:28 +02:00
d0946b8420 Rename Gpencil<ModName>ModifierData to <ModName>GPencilModifierData 2018-05-10 17:52:49 +02:00
43993d7a55 Rename eModifierType_Gpencil<ModName> to eModifierType_GPencil_<ModName> 2018-05-10 17:00:43 +02:00
11cfa9eeda Merge branch 'blender2.8' into greasepencil-object 2018-05-10 08:41:40 +02:00
d2fc17fde3 Enable AA disabled by error in previous commit
This line was disabled by a temp commit to compile and must be enabled again.
2018-05-09 22:06:27 +02:00
77b58ec582 Merge branch 'blender2.8' into greasepencil-object 2018-05-09 19:00:24 +02:00
affd736c32 Cleanup: Style 2018-05-09 16:36:03 +02:00
00591fc2a7 Cleanup: Removing stuff that was added earlier but is no longer needed 2018-05-09 16:36:03 +02:00
05e5a72af5 Fix segment fault for modifiers with COW enabled
The curves in copyData was freed, but the pointer was not set to NULL.
2018-05-09 16:23:35 +02:00
8e4604949c Merge branch 'blender2.8' into greasepencil-object 2018-05-09 15:23:15 +02:00
52cf83d5a4 UI: Move "Move to Color" and "Select Strokes" operators from popup menu into the UI proper
This brings the GP materials UI more into line with the standard object materials UI
2018-05-09 15:10:35 +02:00
641eac4eab Cleanup: Remove unused code (was from when we still used palette colors) 2018-05-09 14:43:56 +02:00
5f6ade530b Fix: Don't show panels/complain if material doesn't have GP material settings 2018-05-09 14:24:46 +02:00
6674a754e6 Cleanup: Remove old cruft 2018-05-09 14:24:46 +02:00
5feb8317d8 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_scene.py
2018-05-09 14:07:57 +02:00
96e759dd31 Merge branch 'blender2.8' into greasepencil-object 2018-05-09 10:04:57 +02:00
5484a03b2f Merge branch 'blender2.8' into greasepencil-object 2018-05-09 09:21:31 +02:00
ed5c95f2cd Cleanup: Remove "colorname" from GPStroke.new()
This isn't used now, so remove it to silence the compiler warnings here
2018-05-08 19:36:10 +02:00
ca8b80c321 Fix compiler warnings after API changes in 2.8 2018-05-08 19:12:28 +02:00
4d506e981e Merge branch 'blender2.8' into greasepencil-object
# Conflicts:
#	source/blender/blenloader/intern/versioning_280.c
#	source/blender/editors/gpencil/gpencil_edit.c
#	source/blender/editors/gpencil/gpencil_paint.c
#	source/blender/editors/gpencil/gpencil_utils.c
#	source/blender/editors/object/object_transform.c
2018-05-08 19:07:23 +02:00
74119ec5b0 Remove VFX simplify option 2018-05-08 18:15:07 +02:00
f010d2ef27 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object
Conflicts:
	source/blender/draw/engines/gpencil/gpencil_engine.c
2018-05-08 18:08:42 +02:00
6537ab8812 WIP: Temporary/placeholder commit to get compiling working
Commented out all lines referring to vfx-related passes/buffers.
(Antonio: Please revert this commit, then commit proper fixes for each of these lines)
2018-05-08 17:56:38 +02:00
0b7cc1198b Remove VFX (more cleanup)
More changes to remove VFX modifiers and DOF.

Removed some unused code not removed in previous commit.

The temp texture A reused by general drawing has been enabled again (removed by error in previous commit) and renamed.

Fixed some lines removed by error in previous commit.

The modifer number in DNA_modifiers_types.h has been realigned to avoid any gap. This could produce some problems importing Hero files. Need check.
2018-05-08 17:55:14 +02:00
904e16f746 More build fixes - Removing more lingering modifier/dof defines 2018-05-08 17:55:04 +02:00
da246ccc50 More build fixes for VFX removal
Still not building, but these should also be safe
2018-05-08 17:33:01 +02:00
3e158b0a46 Remove VFX Modifiers + Defunct "DOF" Code
* As per code reviews (see T54721 and T54769), it was decided that the "VFX Modifiers"
  should not be in the modifiers stack, as they are not really modifiers. Instead, they
  are more like placeholders for shader effects on the object. For now, we simply remove
  these from the code, with a view towards designing a more general solution for all
  object types in 2.8 in future (e.g. as a "Viewport Effects" tab or similar in the Properties
  Editor)

* Also removed the "DOF" code. This was trying to copy what was done for Eevee, but the
  results were low quality, and the relevant code paths were already commented out.
  This code is also removed in this commit, as it depended a lot on many of the things
  put in place for the VFX modifiers, making removal of the VFX buffers complicated.
  Since it's not used now, it's not a big loss. Besides, with version control, we can
  bring this back in future.

NOTE: Blender still doesn't compile - there are still too many extra buffers hanging around
that need to be removed
2018-05-08 16:28:34 +02:00
44a4ed99ea Cleanup: Fix tabulation 2018-05-08 16:00:34 +02:00
3d60d221e4 Fix warning when select a object not GP
The onion skin panel needs a grease pencil layer.
2018-05-08 15:32:58 +02:00
8b9bd8a557 Cleanup: Operator properties for "GPENCIL_OT_multiedit_toggle"
* RNA_int -> RNA_boolean
* Rename "lines" to "toggle_visibility", as the previous name was ambiguous
2018-05-08 12:43:47 +02:00
d5ba36ecc1 Cleanup: Change the "back" parameter on GP editmode toggle operators from int to bool
It should have been a bool all along. However, it's debatable whether we should
even have this property to begin with, or a bunch of operators...
2018-05-08 12:38:35 +02:00
a6f9c29370 Fix: Re-enable toolshelf panels for GP tools
We will convert the UI later, so it can stay like this for now.
2018-05-08 11:48:00 +02:00
b4a4cbe7bb Cleanup: Simplify logic 2018-05-08 11:39:36 +02:00
cae3d19a8d Cleanup: Remove the old "total palettes" entry from the "Information" panel 2018-05-08 11:19:40 +02:00
46a58185ef Reshuffle order of panels in Propertes Editor -> Data, so that Datablock vs Layer settings aren't as mixed up 2018-05-08 11:18:25 +02:00
2eb0699272 Fix compiler warning - comment within comment 2018-05-08 11:05:06 +02:00
de00a05ade Merge branch 'blender2.8' into greasepencil-object 2018-05-08 10:49:37 +02:00
5bf9aca612 Merge branch 'blender2.8' into greasepencil-object 2018-05-07 17:28:05 +02:00
af11366d40 Fix AA error after draw manager changes
The AA was not working and the stroke was not visible while drawing due some changes in the draw manager.
2018-05-07 16:36:23 +02:00
b1accfaa19 Merge branch 'blender2.8' into greasepencil-object 2018-05-07 15:42:04 +02:00
74b338e57e Merge branch 'blender2.8' into greasepencil-object 2018-05-07 09:48:22 +02:00
a334ba5940 Merge branch 'blender2.8' into greasepencil-object 2018-05-06 17:41:38 +02:00
b9d8534161 Merge branch 'blender2.8' into greasepencil-object 2018-05-06 15:13:29 +02:00
a78341fe16 Cleanup: Remove unused and change comments 2018-05-06 15:12:17 +02:00
47402dd560 Color PIcker use list of materials not object materials
Now, the list shows all grease pencil materials and not only the materials of the active object.

If the material selected is not in the active object material slots, the material is added automatically when draw.
2018-05-06 13:37:48 +02:00
d10688dcee Cleanup: Rename function 2018-05-06 12:02:11 +02:00
a1b159d2f0 Cleanup: Remove unused parameter 2018-05-06 12:00:46 +02:00
8411afa034 Cleanup: Remove unused variable 2018-05-06 11:27:28 +02:00
2eb8779094 Use Brush material for Fill brush
Now the color used is the assigned to the brush and not the active color in material slots.
2018-05-06 11:25:22 +02:00
31a371f795 Fix compiler errors after merge 2018-05-06 10:51:19 +02:00
9b4931fdb7 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_scene_types.h
2018-05-06 10:35:55 +02:00
c061daac12 Use as Brush Material default slot 1
Use always the first material as default if the brush hasn't assigned a material.

Before, the current slot was used as default, but this could create a misunderstanding and make the artist believe he could select the color in properties.
2018-05-05 17:17:32 +02:00
e4c6dee1d0 Merge branch 'blender2.8' into greasepencil-object 2018-05-05 12:06:45 +02:00
8c6a4a6512 Cleanup: Remove redundant function (and cleanup compiler warnings in the process)
BKE_gpencil_frame_color_duplicate() is no longer needed to perform Grease Pencil's
in-house "COW" operations. It was previously used to create a copy of the palette
datablock being used, and to then reassign all the color pointers. Now that that's
no longer needed, we can just use the standard one.

Note: BKE_gpencil_stroke_duplicate() has now been modified to NOT clear the triangles
array anymore. Instead, since most places that use this will clear/reallocate it
themselves, it's easier to just keep it there, making the COW stuff easier.
2018-05-04 18:53:18 +02:00
7726e46fe6 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
2018-05-04 18:43:27 +02:00
e455c54eae Cleanup: Fix code format broken by previous commit 2018-05-04 17:34:56 +02:00
ba770b0160 Make color picker panel set Brush Material
When select  a color in the panel, the color is assigned to the current Brush as its default material.
2018-05-04 17:19:51 +02:00
9dab54562b Use Brush material for drawing instead of Active slot
Instead to use the active material in the list of materials, now always use the material assigned to Brush.

If the brush hasn't a material assigned, then the current slot is assigned as the brush material and it will be used in the next drawings of this brush.
2018-05-04 16:53:49 +02:00
6075b7d362 Fix: Only show GP add shapes panel when GP object is active 2018-05-04 16:27:17 +02:00
3a605ed044 Fix print about removed properties
* show_only_render has been removed. Instead, this is now handled through the
  overlays popovers. Therefore, we no longer need (or should have) a dedicated
  button for this.

* Removed also the lock camera button. This shouldn't be here in the first place,
  as it was a dedicated workflow-specific hack added for the Hero production workflow
  only.
2018-05-04 16:13:10 +02:00
8d3684c8b9 Cleanup: Remove the now unnecessary modifier_index parameter from Modifier->generateStrokes() 2018-05-04 16:03:17 +02:00
38718a6b6a Merge branch 'blender2.8' into greasepencil-object 2018-05-04 15:48:58 +02:00
0a28eb6dbe Fix compiler warnings after merge
* Adapted various DRW_* identifiers that got cleaned up in 2.8

* BKE_gpencil_frame_color_duplicate() - should be removed

* File versioning code for GP annotation datablocks - knock this out for now
  (since it's causing compiling problems due to the view layer stuff being
  deprecated). We need to review whether we do this type of patching automatically,
  since we don't really want GP annotations to show up on Cycles renders for example.
2018-05-04 15:48:22 +02:00
68b8ea0d06 Fix GP modifiers after merge (formatting/extra fields added to modifiers) 2018-05-04 12:41:21 +02:00
d6a38803e1 Merge branch 'blender2.8' into greasepencil-object
# Todo's / Need Further Review:
# - material.c - "man->gpcolor = NULL" (commented out for now)
# - rna_material.c - "rna_Material_update()" - Should GP material settings use their own update?
# - GP Modifiers typedefines need updating for the new struct layout
# - Merge conflicts in properties_gp_common.py - Mostly due to panels being removed in GP branch
# - GP Panels in 3D View (toolbar/topbar fixes postponed till after branch merge)
# - GP "Paper" Option/Settings (should become overlay? Design work needed)

# Conflicts:
#	release/scripts/addons
#	release/scripts/addons_contrib
#	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
#	release/scripts/startup/bl_ui/space_view3d.py
#	release/scripts/startup/bl_ui/space_view3d_toolbar.py
#	source/blender/blenkernel/BKE_modifier.h
#	source/blender/blenkernel/intern/material.c
#	source/blender/editors/object/object_transform.c
#	source/blender/editors/space_outliner/outliner_select.c
#	source/blender/gpu/intern/gpu_shader.c
#	source/blender/makesrna/intern/rna_material.c
#	source/blender/modifiers/intern/MOD_armature.c
#	source/blender/modifiers/intern/MOD_array.c
#	source/blender/modifiers/intern/MOD_bevel.c
#	source/blender/modifiers/intern/MOD_boolean.c
#	source/blender/modifiers/intern/MOD_build.c
#	source/blender/modifiers/intern/MOD_cast.c
#	source/blender/modifiers/intern/MOD_cloth.c
#	source/blender/modifiers/intern/MOD_collision.c
#	source/blender/modifiers/intern/MOD_correctivesmooth.c
#	source/blender/modifiers/intern/MOD_curve.c
#	source/blender/modifiers/intern/MOD_datatransfer.c
#	source/blender/modifiers/intern/MOD_decimate.c
#	source/blender/modifiers/intern/MOD_displace.c
#	source/blender/modifiers/intern/MOD_dynamicpaint.c
#	source/blender/modifiers/intern/MOD_edgesplit.c
#	source/blender/modifiers/intern/MOD_explode.c
#	source/blender/modifiers/intern/MOD_fluidsim.c
#	source/blender/modifiers/intern/MOD_hook.c
#	source/blender/modifiers/intern/MOD_laplaciandeform.c
#	source/blender/modifiers/intern/MOD_laplaciansmooth.c
#	source/blender/modifiers/intern/MOD_lattice.c
#	source/blender/modifiers/intern/MOD_mask.c
#	source/blender/modifiers/intern/MOD_meshcache.c
#	source/blender/modifiers/intern/MOD_meshdeform.c
#	source/blender/modifiers/intern/MOD_meshsequencecache.c
#	source/blender/modifiers/intern/MOD_mirror.c
#	source/blender/modifiers/intern/MOD_multires.c
#	source/blender/modifiers/intern/MOD_none.c
#	source/blender/modifiers/intern/MOD_normal_edit.c
#	source/blender/modifiers/intern/MOD_ocean.c
#	source/blender/modifiers/intern/MOD_particleinstance.c
#	source/blender/modifiers/intern/MOD_particlesystem.c
#	source/blender/modifiers/intern/MOD_remesh.c
#	source/blender/modifiers/intern/MOD_screw.c
#	source/blender/modifiers/intern/MOD_shapekey.c
#	source/blender/modifiers/intern/MOD_shrinkwrap.c
#	source/blender/modifiers/intern/MOD_simpledeform.c
#	source/blender/modifiers/intern/MOD_skin.c
#	source/blender/modifiers/intern/MOD_smoke.c
#	source/blender/modifiers/intern/MOD_smooth.c
#	source/blender/modifiers/intern/MOD_softbody.c
#	source/blender/modifiers/intern/MOD_solidify.c
#	source/blender/modifiers/intern/MOD_subsurf.c
#	source/blender/modifiers/intern/MOD_surface.c
#	source/blender/modifiers/intern/MOD_surfacedeform.c
#	source/blender/modifiers/intern/MOD_triangulate.c
#	source/blender/modifiers/intern/MOD_uvproject.c
#	source/blender/modifiers/intern/MOD_uvwarp.c
#	source/blender/modifiers/intern/MOD_warp.c
#	source/blender/modifiers/intern/MOD_wave.c
#	source/blender/modifiers/intern/MOD_weightvgedit.c
#	source/blender/modifiers/intern/MOD_weightvgmix.c
#	source/blender/modifiers/intern/MOD_weightvgproximity.c
#	source/blender/modifiers/intern/MOD_wireframe.c
2018-05-04 12:21:12 +02:00
c52f6b11c0 GP Properties: Separate onion skinning for datablock + per-layer override into separate panels
The panel layouts are still a mess, but at least there's less code duplication
and weirdness now, with everything taking advantage of more conventions here.
2018-05-01 19:12:58 +02:00
00c54fb23a Cleanup: Material Buttons for GP
* Don't collapse panels by default
* Cleanup old code/names/etc.
2018-05-01 19:12:58 +02:00
60549a6680 Remove dirty cache calls from kernel
The function BKE_gpencil_batch_cache_dirty() must be called only from operators or RNA.

Besides, the calls removed were redundant.
2018-05-01 17:36:24 +02:00
dca23ccc4e Cleanup: Fix some more warnings
NOTE: For rna_GPencil_stroke_new(), the problems aren't entirely eliminated yet.
Specifically, the colorname arg is now unused - it was used in the past to
specify what color the new strokes should have.
2018-05-01 16:27:07 +02:00
69c042b7c9 Code Cleanup: Clearly label which parameters are used for input/output 2018-05-01 16:27:07 +02:00
356ce71a5f GPencil Editors API: Added utility function to be called to get Copy-on-Write evaluated copies of data
* Use ED_gpencil_get_active() for writing settings back to the original datablock
  (existing callback used in most operators now)

* Use ED_gpencil_get_active_evaluated() for getting the COW-evaluated geometry
  (i.e. with modifiers, etc.) applied. i.e.,
  ``` const bGPdata *gpd_eval = ED_gpencil_get_active_evaluated(C); ```
2018-05-01 16:27:07 +02:00
ed29a6fcbb Cleanup: Remove unused var 2018-05-01 16:27:07 +02:00
c70de3abab Cleanup: Fix indentation 2018-05-01 16:27:07 +02:00
4cb2d6d58c Revert to use again BKE_gpencil_batch_cache_dirty()
These functions were changed by error when replace dirty management by depsgraph.

The depsgraph is only valid for operators and the files included in this commit must call the function directly and don't use depsgraph tag.
2018-05-01 15:59:26 +02:00
7c5a146243 Back BKE_gpencil_batch_cache_dirty function
This function was removed by error in previous commit.
2018-05-01 15:50:15 +02:00
82150ed577 Cleanup: Add new line at EOF 2018-05-01 13:51:09 +02:00
63c91f2bbd Remove BKE_gpencil_batch_cache_dirty()
This remove the function because is not used.
2018-05-01 13:48:09 +02:00
8098dc3d10 Replace DRW_gpencil_batch_cache_dirty() with DEG_id_tag_update 2018-05-01 13:44:17 +02:00
a597e21dbd Cleanup. Rename material variable to "ma"
The old name "mat" could be confused with matrix.
2018-04-30 19:41:51 +02:00
50e91b6a61 WIP depsgraph fixes for GP and depsgraph
Still not working yet - somehow the updates aren't getting flushed yet
(perhaps COW related)
2018-04-30 17:41:56 +02:00
d45f1e93a8 Cleanup: Indentation 2018-04-30 17:41:56 +02:00
e6d4465f7f Add default brush material to object materials
When draw using a brush that uses a default material, the material must be added to the object material slots if this material was not before.
2018-04-30 17:22:21 +02:00
7a5747d559 Rename Grease Pencil Array Modifier to Instance Modifier
The new name is more clear and does not create confusion with 3D objects array modifier.
2018-04-30 17:09:42 +02:00
09c900b1bf Fix error drawing with no object active 2018-04-30 16:18:34 +02:00
f5608c3655 Cleanup: Remove redundant parameter 2018-04-30 14:07:54 +02:00
3397007cb6 Fix wrong Material name
The name was using the ID type.
2018-04-30 11:27:12 +02:00
Nick Wu
644cd00d1a Merge branch 'blender2.8' of git://git.blender.org/blender 2018-04-30 08:58:47 +08:00
77e79bea56 Fix error in Join objects
The index of the material must be stroke value + 1.
2018-04-29 16:59:02 +02:00
95fa3ab416 Cleanup: Remove old unused code for bGPDpalettes
This commit removes some functions not used from old bGPDpalette and bGPDpalettecolor.

These structs were used in version 2.78 and 2.79 and only keep the minimum number of functions to convert old files.
2018-04-29 16:01:49 +02:00
0b476cd44e Cleanup: Remove unused function 2018-04-29 15:48:03 +02:00
bab586e254 Cleanup: Reduce calls to get GpencilColorData
This avoids some duplicate calls.
2018-04-29 15:37:24 +02:00
e2893dad4f Fix separate operator using Materials 2018-04-29 12:42:42 +02:00
14ec05f561 Cleanup: Fix old comments 2018-04-29 11:36:42 +02:00
21a530e76d Enable again select by color using Materials 2018-04-29 11:33:52 +02:00
7dc60eac13 Cleanup: Comments 2018-04-29 11:24:26 +02:00
1115a3eef5 Enable default material by brush
This is an essential feature for pipeline.
2018-04-29 11:02:55 +02:00
e693329ea6 Fix comment typo error 2018-04-29 11:02:10 +02:00
27a41b45af WIP: Add Material to GP datablock relation node
This is only the first step to prepare the node
2018-04-28 19:54:49 +02:00
913693839c Fix memory leak when paste 2018-04-28 16:49:51 +02:00
1ecb9b6cc6 WIP: Fix more operators for copy
Still a memory segment fault when copy several strokes.
2018-04-27 19:33:08 +02:00
5512f02c51 Create hash of material colors for copy buffer 2018-04-27 18:34:07 +02:00
d6b0d2ae9b Fix operators to use Materials instead of Palettes 2018-04-27 17:58:11 +02:00
0cb40164f8 Convert old 2.7x files from Palettes to Materials 2018-04-27 17:29:22 +02:00
e19f017800 Clear deprecated colorname field when write data
This field must be cleared because the string is not used (deprecated).
2018-04-27 16:44:46 +02:00
a4642040df Fix mermory leak for materials
The materials array must be duplicated and free in every undo step.
2018-04-27 16:39:12 +02:00
7ce63dcf97 Add comment to make annotation for ToDo 2018-04-27 11:09:12 +02:00
da8ef484a5 Remove Palette animation Depsgraph node
As the Palette animation has been removed, these modules must  be removed.
2018-04-27 10:51:58 +02:00
8df4d2de02 Add notifier flag to update viewport
Whitout this flag, the viewport is not updated when change something in the material.
2018-04-27 10:27:50 +02:00
a042d30745 Fix error of missing slots
The problem was in the creation of material slot all the time. By default, the material is created when we have a slot already created.
2018-04-27 09:07:20 +02:00
98b58db9cb WIP: Fix error when drawing using a material
Still a problem adding slots
2018-04-27 08:56:01 +02:00
1e30188d68 Add GpencilColorData path for animation 2018-04-26 18:28:14 +02:00
5c9312afee Improve default Material use
If the default material has not the Grease pencil settings, add it instead to create a new material.
2018-04-26 17:42:07 +02:00
4141fd6be6 Undo previous commit for newlibadr_us
I added this by error.
2018-04-26 16:54:15 +02:00
57f83110da Create Grease Pencil Materials Settings for GP Objects only
If the material is created for a grease pencil object, a new GpencilColorData settings is initializated
2018-04-26 16:52:29 +02:00
473b95bb0b Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2018-04-26 16:23:20 +02:00
69383f6b5d Use newlibadr_us for layer parent object 2018-04-26 16:22:54 +02:00
4b469806fb Code Cleanup / Fix ASAN Crash
With ASAN enabled, Blender crashed when deleting the default cube
(why GP engine is even running at that point is a bit of a mystery to me).
Checking on this, I discovered that the code here had multiple pointers with
different names to the active object and the GP datablock it uses... time to
clean this mess up!
2018-04-26 16:16:03 +02:00
38f1aa8d66 Replace allowed types from Palettes to Materials 2018-04-26 16:15:11 +02:00
87c38a2ed7 Remove newdataadr and use newlibadr_us for images 2018-04-26 16:08:51 +02:00
5b633d7abe Fix several compiler warnings 2018-04-26 15:31:38 +02:00
ad36cee68b Fix recalc of UV using materials instead of Palettes 2018-04-26 12:54:05 +02:00
83a1498cea Change Default Brush material after refactor 2018-04-26 12:35:28 +02:00
1df04cb661 Fix missing palette reference 2018-04-26 11:50:12 +02:00
ee94211eb3 Merge branch 'experimental_gp_material' into greasepencil-object 2018-04-26 11:38:50 +02:00
792bd2a9f1 WIP: More work in the huge material refactor
The Monkey primitive, colorpicker and basic color handle operators working.

Still a big problem with save/load that produces a segment fault with any undo operation.
2018-04-26 11:33:37 +02:00
e20cbe29f9 WIP: Convert old palette operators
These operators are used to manage the strokes lock and hide.
2018-04-26 10:31:28 +02:00
55c2e89222 WIP: Mega Refactor to replace Palettes with Materials - 1 2018-04-25 20:19:49 +02:00
15bb1b4b45 WIP: Rename settings function in Draw Manager 2018-04-25 09:54:29 +02:00
1e126fb8a4 WIP: Replace field name for palettecolor 2018-04-24 19:31:06 +02:00
5396e284f7 WIP: First step to remove Palettes from Draw Manager
Still is not working.
2018-04-24 19:14:07 +02:00
da49c11d5d Cleanup: Rename material index field
Now the name is equal to other Blender areas.
2018-04-24 18:08:39 +02:00
0639de4ceb WIP: Start the working in operators
- Delete Material->Strokes
- Move material in the list->Reasign Strokes
2018-04-24 17:38:15 +02:00
b1e4f1a832 Remove Palette panels and fix write/read bugs
Now the panels works with materials but still the drawing engine and operators is using the old palettes.
2018-04-24 16:59:43 +02:00
9c1a5b0641 Fix error reading materials
The link materials section was missing.
2018-04-24 15:46:44 +02:00
1746aaa86f WIP: More work converting to materials
There is a problem with the loading of converted files.

The conversion of Hero data is correct, but something is still missing.
2018-04-24 13:48:45 +02:00
5f49b21c5e More work to prepare material conversion
Doing RNA stuff and preparing for convert Hero files
2018-04-24 11:19:31 +02:00
d5b6419878 Create new fields in material for moving palettecolor 2018-04-23 19:55:48 +02:00
d036fa0d6a Fix: ASAN-related crash when scaling points in editmode 2018-04-23 15:45:18 +02:00
43f95cd616 Merge branch 'blender2.8' into greasepencil-object 2018-04-23 15:42:45 +02:00
6b33e71843 Fix merge error 2018-04-23 10:09:13 +02:00
09b41b9ef1 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/addons
	release/scripts/addons_contrib
	source/blender/blenloader/intern/versioning_280.c
2018-04-23 10:08:20 +02:00
8e939dedfe Merge branch 'blender2.8' into greasepencil-object 2018-04-22 19:34:52 +02:00
8cd6f60695 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_material.py
	release/scripts/startup/bl_ui/space_dopesheet.py
	source/blender/draw/modes/draw_mode_engines.h
	source/blender/editors/space_buttons/buttons_context.c
	source/blender/editors/space_time/space_time.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_draw_legacy.c
2018-04-22 16:54:08 +02:00
1c53becdf7 Fix Tint and Hue/Saturation modifiers
Now the modifiers don't use the palettecolor pointer
2018-04-20 11:01:36 +02:00
63fcb0e749 WIP: Remove palettecolor pointer
Still Hue/Saturation and Tint pending.

Now both are disabled while found a solution.
2018-04-19 19:19:10 +02:00
036c95a655 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/editors/space_view3d/view3d_header.c
2018-04-19 17:13:17 +02:00
527d9c7295 Fix missing library Palette relink
The palette pointer was not relink as expected for Brushes and GP strokes.
2018-04-19 17:02:39 +02:00
378969bb25 Merge branch 'blender2.8' into greasepencil-object 2018-04-18 16:33:52 +02:00
51b282f404 Fix various compiler warnings/errors 2018-04-18 10:57:09 +02:00
46422a3517 Merge branch 'blender2.8' into greasepencil-object
# Conflicts:
#	source/blender/blenloader/intern/versioning_280.c
#	source/blender/makesrna/intern/rna_scene.c
2018-04-18 10:52:24 +02:00
8e9b1e3e80 Cleanup: Whitespace + Code Redundancy 2018-04-17 18:37:56 +02:00
3d3cc30df4 Merge branch 'blender2.8' into greasepencil-object
Tempting fate by merging in the Game Engine removal in here too...
We might as well do this now though, since it'll have to happen at
some time anyway!

# Conflicts:
#	release/scripts/startup/bl_ui/properties_scene.py
#	source/blender/blenkernel/intern/object.c
#	source/blender/blenloader/intern/versioning_280.c
#	source/blender/gpu/CMakeLists.txt
#	source/blenderplayer/bad_level_call_stubs/stubs.c
2018-04-17 18:28:08 +02:00
6d0795628d Fix: Putting back bakeModifierGP() for Lattice and Hook
Ideally, we'd run this on a depsgraph-copy, on a background thread. But, that's
that's something that we'd be passing through to the modifier bake callbacks.
2018-04-17 18:16:28 +02:00
19716326f4 MOAR compile fixes for GP branch after merge
Lots more fixes for various little things that broke after the merge and the
fixes required for that.

Unfortunately, I've had to disable a few things to get Blender compiling
again - those will require a bit more attention to fix.

Things currently broken/disabled:
* Apply/Bake for Hook and Lattice modifiers - disabled as we need to rethink how
  this works after EvaluationContext removal. Probably should go to a new depsgraph
  copy (instead of working in main depsgraph).

* Helplines for GP point edit - 1c9690e760 has been
  temporarily reverted due to conflicts with multiedit changes
2018-04-17 17:04:39 +02:00
261d64922b Merge branch 'blender2.8' into greasepencil-object
Note:
There were some additional changes needed due to the EvaluationContext -> Depsgraph
cleanups + MultiObject edit that happened in 2.8 since the last merge of 2.8 into
this branch.


# Conflicts:
#	release/datafiles/locale
#	release/scripts/addons
#	release/scripts/addons_contrib
#	source/blender/blenkernel/BKE_modifier.h
#	source/blender/editors/gpencil/gpencil_paint.c
#	source/blender/editors/include/ED_object.h
#	source/blender/editors/object/object_modifier.c
#	source/blender/editors/screen/screen_context.c
#	source/blender/editors/space_view3d/view3d_draw_legacy.c
#	source/blender/editors/transform/transform.c
#	source/blender/editors/transform/transform_conversions.c
#	source/blender/editors/transform/transform_generics.c
#	source/blender/editors/undo/ed_undo.c
#	source/tools
2018-04-17 16:05:37 +02:00
5626738541 Cleanup: Various code/style tweaks to GP code 2018-04-17 12:57:09 +02:00
00636eb618 Compiler warning fixes on GCC
* gpencil_add_*_shgroup() - Removed unused parameters (gpd)

* Fix warning about rgba being uninitialised in gpencil_fill.c::get_pixel()
  - The non-float case here looks like it shouldn't ever happen, but for good measure,
    I've added an assert + set a value here to keep compiler happy.

* Fix uninitialised var in gp_brush_drawcursor() - paintbrush

* GPencilOffsetModifier defined an RNA vertex group name set function, but didn't use it
2018-04-17 12:20:36 +02:00
a27a206902 Cleanup: various warnings
Now compiles w/o warnings for GCC
2018-04-16 21:20:51 +02:00
30575f9eaf Fix invalid brush assignments 2018-04-16 21:08:21 +02:00
c2517ae75a Cleanup: unused variables & args 2018-04-16 21:07:33 +02:00
6f0408f79d Cleanup: -Wparentheses & line length 2018-04-16 20:52:59 +02:00
a7c7d23542 UI Tweak: Rename "Grease Pencil" menu in 3D View to "Strokes"
Menu names in general should be a single word. Having two separate words makes it
visually confusing (i.e. it looked like there were 4 menu items, when in fact there
were only 3). Since the operators here operate on the GP strokes, it's reasonable
to use this term instead.

(Discussed with William as part of an informal UI review of GP branch)
2018-04-16 19:01:01 +02:00
8f22682a1a Fix compile error: Was missing 'const' qualifier 2018-04-16 18:57:48 +02:00
b2b02c6522 Merge branch 'blender2.8' into greasepencil-object 2018-04-16 09:58:44 +02:00
ba477d9ccf Merge branch 'blender2.8' into greasepencil-object 2018-04-15 16:18:33 +02:00
507113543a Fix compiler error in Windows 2018-04-14 16:24:06 +02:00
39ac621c2a Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/object.c
2018-04-14 16:11:12 +02:00
7281d36a20 Fix parameter list errors after merge 2018-04-13 16:05:33 +02:00
67801591f6 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/readfile.c
2018-04-13 15:54:39 +02:00
025615fe78 Fix compiler warning 2018-04-12 17:33:07 +02:00
3b203b738e Merge branch 'blender2.8' into greasepencil-object 2018-04-12 17:08:51 +02:00
e601228e01 Fix wrong color pointers for old files
Some files created for Hero during development had wrong color pointers. This fix this error and avoid a segment fault.
2018-04-12 17:03:35 +02:00
b95cd2f97d Fix compiler error after merge 2018-04-12 16:20:14 +02:00
c8f56d6613 Merge branch 'blender2.8' into greasepencil-object 2018-04-12 10:04:28 +02:00
02e60d6ffa Merge branch 'blender2.8' into greasepencil-object 2018-04-11 09:01:59 +02:00
8a6a173435 Merge branch 'blender2.8' into greasepencil-object 2018-04-10 13:47:04 +02:00
1c9690e760 Fix transform center after merge
This code fix the error of rotation center calculation, but need a review to check if this is the best way to do it.

I commit the change while we check other solutions  to be sure we have a correct rotation function.
2018-04-10 10:54:53 +02:00
17c8b2e4a8 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/transform/transform.c
2018-04-10 09:39:06 +02:00
07b304bc03 Merge branch 'blender2.8' into greasepencil-object 2018-04-09 10:17:09 +02:00
6635886df4 Fix error drawing in 2D editors
The UV calculation is only valid for 3D view.
2018-04-09 10:16:33 +02:00
2abd5fd8f9 Merge branch 'blender2.8' into greasepencil-object 2018-04-08 16:52:43 +02:00
073efa89cb Merge branch 'blender2.8' into greasepencil-object 2018-04-08 12:02:35 +02:00
68eeb56104 Refactor to reduce number of textures and framebuffers used 2018-04-08 11:21:04 +02:00
b2a549b010 Fix memory error for duplicated objects when exit
When duplicate an object, the batch cache was pointing to the original address and when close Blender, the pointer was invalid.
2018-04-07 16:10:49 +02:00
86f7bd43b6 Merge branch 'blender2.8' into greasepencil-object 2018-04-07 11:38:48 +02:00
d13a685d1c Revert antialiasing commit
The antialiasing was not working because the final image in default framebuffer is not used to calculate the AA pixels, so this double antialiasing was only adding drawing time.

We need to find a way to mix the grease pencil with the current default framebuffer with antialiasing.
2018-04-07 11:37:45 +02:00
25a3c3f11f Cleanup: Remove unused code 2018-04-06 16:17:44 +02:00
47051a44a0 Merge branch 'blender2.8' into greasepencil-object 2018-04-06 16:07:19 +02:00
034207497e Set cursor when change object mode
Cleanup workspace code and replace by change cursor function.
2018-04-06 15:52:59 +02:00
309b6378d3 UI: Fix object mode after merge 2018-04-06 14:25:36 +02:00
642bf42040 Add bContext to function
This parameter is required for grease pencil modifiers

Maybe need more work to remove the bContext, but we need it now to compile.
2018-04-06 14:20:13 +02:00
2d93fa6231 Try to fix the merge problems.
Warning: Now this source code does not compile
2018-04-06 10:37:21 +02:00
987b60100a Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/object/object_edit.c
	source/blender/editors/object/object_modes.c
	source/blender/makesrna/intern/rna_brush.c
2018-04-06 10:14:12 +02:00
23c5eee284 New Line Primitive
The straight lines could be done using Alt key while drawing, but it's better to have a simple primitive.

This has been requested by artists.
2018-04-06 10:11:04 +02:00
9920155e31 Add antialiasing when mix with default buffer on viewport
Still pending antialiasing if there are objects when render.
2018-04-05 19:05:12 +02:00
11bacaa705 Merge branch 'blender2.8' into greasepencil-object 2018-04-05 17:12:51 +02:00
38cdaa97fb Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/gpu/GPU_shader.h
2018-04-05 16:14:18 +02:00
8f366d494e Fix render after merge 2018-04-05 11:55:41 +02:00
64b778f666 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/render/intern/source/external_engine.c
2018-04-05 11:44:18 +02:00
159358e4ee Remove aspect ratio from VFX Blur on y-axis
The aspect ratio was not required here because deform the image.
2018-04-05 11:38:07 +02:00
659c5dcffb Improve render image blending
The blend of the Eevee/Cycles render and grease pencil render was not working as expected when grease pencil used transparency.

Now the blend is using blend equation with GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
2018-04-05 11:34:07 +02:00
f18d8d84d1 Cleanup: Style 2018-04-04 17:41:50 +02:00
72204e2163 Cleanup: Add comments 2018-04-04 17:14:41 +02:00
9e46bbd305 Cleanup: Move cache functions to own module 2018-04-04 17:02:41 +02:00
162711fee2 Cleanup: Move vfx code and solve VFX order
All the code moved to vfx module and now the VFX modifiers are evaluated in the same order defined in the interface. Before, the order was always the same and did not use the interface order.
2018-04-04 16:37:28 +02:00
f536d5f821 Cleanup: Define variable using #define 2018-04-04 16:23:15 +02:00
dcd049321f Cleanup: Remove redundant object parameter for VFX 2018-04-04 16:17:07 +02:00
b756456929 Cleanup: Remove object index parameter for vfx 2018-04-04 16:10:55 +02:00
0a5c958275 Cleanup: More work to structure code 2018-04-04 16:07:22 +02:00
e286b359bb Cleanup. Create framebuffers in separate function 2018-04-04 16:00:18 +02:00
637b0154ad Cleanup: Create shaders in a separate function 2018-04-04 15:54:29 +02:00
96f4c3438e Merge branch 'blender2.8' into greasepencil-object 2018-04-04 15:44:58 +02:00
b8d9ff2989 Merge branch 'blender2.8' into greasepencil-object 2018-04-04 10:02:50 +02:00
e32c22d3a4 Add Lock to Focal Plane to Blur VFX
This optn works only in camera view and defines the blur factor depending of location of the object in depth of field. If the object is on a location inside near and far  depth of filed values, the blur is disabled.
2018-04-03 19:31:13 +02:00
3bfeb28b1e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_data.c
	source/blender/editors/gpencil/gpencil_paint.c
2018-04-03 18:40:11 +02:00
5ed07515f5 Refactor VFX code
Make code more consistent and clear to understand.
2018-04-03 18:28:14 +02:00
d983eb44bc Allow zero samples for VFX Blur
When the number of samples is set to zero, the blur is dissabled, but this can be used to get effects animating the samples parameter.

If the zero is not a valid value, it is impossible to disable the blur with only this parameter.
2018-04-02 17:23:42 +02:00
ff0d4c7f1a Fix reproject error drawing lines
The reproject was done two times and must be done only once.
2018-04-02 16:40:54 +02:00
2f46b16b0e Cleanup redundant variable 2018-04-02 16:33:45 +02:00
b6d63d5a97 Fix errors after merge 2018-04-02 16:18:52 +02:00
f01b8bcd0b Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_select.c
2018-04-02 15:58:34 +02:00
70d7939778 Cleanup: Make code more compact 2018-04-01 16:23:50 +02:00
0890922dbd Recover line deleted by mistake in previous commit
Still there is a problem when the undo change to a non GP object.
2018-04-01 16:03:44 +02:00
627a27dc69 Fix error after merge 2018-04-01 12:45:21 +02:00
7e4d6bcb88 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_data.c
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/util/undo.c
2018-04-01 12:25:58 +02:00
b9c5863fb6 Fix color names for monkey
The colors were missing after save and load again.
2018-03-31 18:56:01 +02:00
b1e3bb9eb4 Cleanup: Move all Shader creation to engine_init 2018-03-31 18:55:49 +02:00
7d27a537b9 Merge branch 'blender2.8' into greasepencil-object 2018-03-31 09:01:45 +02:00
4d45ea99e0 Fix blur shift when add more samples
The image was moved to top when increase the sample number. This was due the shader was bluring both axis at the same time.
2018-03-30 16:38:50 +02:00
3a8a749212 Cleanup: Use always even numbers for samples 2018-03-30 16:29:17 +02:00
e2100a698b Cleanup: Simplify shader parameters 2018-03-30 16:16:41 +02:00
984d5da990 Restructure VFX Blur, add Samples and cleanup
Now, the number of defined passes is low and there is a new parameter to define number of samples.
2018-03-30 13:47:34 +02:00
1e163414da Merge branch 'blender2.8' into greasepencil-object 2018-03-30 12:17:43 +02:00
ee1931e306 Cleanup unused variable 2018-03-29 19:58:12 +02:00
a954837eae Replace constant bokeh value by parameter 2018-03-29 19:38:43 +02:00
68aff2fb88 Fix compilation error after merge 2018-03-29 17:58:09 +02:00
d1130c5f4e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/gpu/GPU_shader.h
2018-03-29 17:40:51 +02:00
c80bb336d6 Fix DOF render segment fault and use Eevee UI options
To activate the DOF for grease pencil, the Eevee option is used as main flag.
2018-03-29 16:56:47 +02:00
67638e3136 Merge branch 'greasepencil-object' into GP-DepthOfField 2018-03-29 10:27:21 +02:00
bbde146ebc Merge branch 'blender2.8' into greasepencil-object 2018-03-29 10:26:47 +02:00
71bac9a99f WIP: Fix alpha channel and replace by weights
Still there is a problem with the external border.

Thanks Clément for the help.
2018-03-29 10:23:25 +02:00
e4c6746c31 WIP: More work on shaders and framebuffers for DOF
Still there are problems with the alpha factor and all the scene is empty because alpha is always 0.
2018-03-28 19:59:08 +02:00
fbc1b12aa8 Remove texture Free for DOF
These textures are freed by draw manager and don't need explicit free.
2018-03-28 19:11:27 +02:00
db9244bb7e Fix wrong function to assign texture to shader 2018-03-28 19:06:33 +02:00
b8272f724a WIP: Start to add DOF support
Still is not working. Save this commit as reference.
2018-03-28 18:09:12 +02:00
96666d38c6 Merge branch 'blender2.8' into greasepencil-object 2018-03-28 08:54:10 +02:00
c4b4719dcf Cleanup comments 2018-03-27 19:27:11 +02:00
9e0674d519 Cleanup shader code 2018-03-27 19:11:13 +02:00
2f9f3d09a9 Fix alpha double blend
The color when used alpha factor always got darker. The problem was a double blend that produced a reduction in the color saturation.

Now, there is a premult of the alpha factor before doing last blend pass.

As a result of this change, now the drawing process can be simplified and a pass can be removed. Some cleanup done too.

Still need more work in render mode. Maybe the problem in render is related to Tonemapping.

Thanks Clément Foucault for his help solving this issue.
2018-03-27 18:03:26 +02:00
d7046c4668 Merge branch 'blender2.8' into greasepencil-object 2018-03-27 10:47:11 +02:00
7bacfd320a Merge branch 'blender2.8' into greasepencil-object 2018-03-26 17:46:03 +02:00
c3c6f6e3b5 Fix multisample for render
After last merge, the multisample was not working in render mode.
2018-03-26 17:44:46 +02:00
e15e307d4c WIP: Fix texture format after merge 2018-03-26 11:32:33 +02:00
32beb07b25 WIP: Refactor darwing code after merge
A lot of changes were done in draw manager in the last merge.

This commit fix the main area, but still problems with multisample frame buffer.
2018-03-26 11:29:08 +02:00
69dfaeb96e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/DRW_render.h
	source/blender/draw/intern/draw_manager_framebuffer.c
2018-03-26 10:40:29 +02:00
3265ed2d2e Fix grease pencil paper reset loading files
The paper was reset loading any file, not only old files.
2018-03-24 13:45:35 +01:00
c3fa124d46 Make less sensible strength brush and smooth
Now the factor to apply is less sensible and after apply the strength a smooth operation is done with surrounding points.

Before the change in the opacity changed too much with small input.
2018-03-24 13:09:46 +01:00
60e18bf431 Cleanup: Fix comments 2018-03-24 12:54:34 +01:00
dcbd96eb18 Merge branch 'blender2.8' into greasepencil-object 2018-03-24 12:20:37 +01:00
eaa9d64ce9 Merge branch 'blender2.8' into greasepencil-object 2018-03-23 14:05:51 +01:00
176d2acbb5 Merge branch 'blender2.8' into greasepencil-object 2018-03-22 19:22:20 +01:00
ccf3889b30 Merge branch 'blender2.8' into greasepencil-object 2018-03-22 19:13:41 +01:00
4c078cb2af Cleanup: Make code more compact 2018-03-22 17:24:40 +01:00
619d989600 Update depsgraph for stroke transforms
This is required to work with COW
2018-03-22 16:45:44 +01:00
d767fc2e27 Update depsgraph for sculpt and select
This is required to work with COW
2018-03-22 16:45:18 +01:00
6ebab4a90a Fix simple points drawing with line mode
If using line mode, simple points must be drawn with point shader, not line shader.
2018-03-22 16:20:32 +01:00
e3af67703e Cleanup unused code block 2018-03-22 16:13:54 +01:00
cf521a7f32 Update depsgrah tag while painting
If this update is not done, the cow object used for display, does not show the current stroke.
2018-03-22 16:10:22 +01:00
54ede1d53a Force Depsgraph recalculation when cache is dirty 2018-03-22 10:23:11 +01:00
0b0d3e67c6 Cleanup: Remove redundant code 2018-03-22 10:06:42 +01:00
3fc0c418a1 Remove Custom Brush icon
Now the user can assign as icon any custom image with the brush options.
2018-03-21 19:49:12 +01:00
fc18bfc532 UI: Replace Eraser icons 2018-03-21 19:44:13 +01:00
c47c6a32ea Cleanup: Rename field and add comments 2018-03-21 17:35:31 +01:00
71f465b01a Use evaluated camera for render 2018-03-21 17:14:11 +01:00
2c0acc9eb5 Merge branch 'blender2.8' into greasepencil-object 2018-03-21 16:48:17 +01:00
28a6ed8885 Remove use of LIB_TAG_NO_MAIN for temp objects
Instead to use the tag to identify temp objects, now a internal flag managed by cache is used.

This is required because the LIB_TAG_NO_MAIN created conflicts with depsgraph.

This solves any concern of D3111
2018-03-21 16:47:01 +01:00
9bdd8a4aa5 Cleanup: Get rid of last uses of BKE_gpencil_batch_cache_alldirty_main()
* For any cases that weren't operating on a specific bGPdata instance,
  the DEG_id_type_tag() should do the trick to tag all GP datablocks.

* For the palette case, tagging the palette should trigger just the
  GP datablocks using that palette (and not all of them) to get updated.
2018-03-21 19:19:59 +13:00
b59139eddc Merge branch 'blender2.8' into greasepencil-object 2018-03-20 19:47:36 +01:00
9ab33bf9be Cleanup: Remove unused definition 2018-03-20 19:47:04 +01:00
c01e6a3c50 Cleanup: Improve comments 2018-03-20 19:30:40 +01:00
286d4e77a7 Fix error with copy-on-write
Verify tag of cow before remove temp objects.
2018-03-20 18:59:59 +01:00
5c47c5de68 Fix Users count
The value must be 2, not 3.
2018-03-20 15:56:32 +01:00
d0ce4d838b Fix problem to enter in edit mode with Tab key 2018-03-20 12:41:58 +01:00
3c5342649b Cleanup: Move GP Object specific properties panels to properties_data_gpencil.py
Note:
* Layers and Onion Skinning panels haven't been moved yet.
  This is so that we can reconsider what (if any) changes
  need to be made to share common elements between GP Object
  and annotation GP use cases.
2018-03-20 20:14:48 +13:00
e2b78f68a8 Cleanup: Remove unused code 2018-03-20 17:13:56 +13:00
5dd8c7fa42 More Brush Appearance Panel tweaks
* Always show this panel. Previously, it wouldn't get shown for the Eraser,
  meaning that if you accidentally changed a brush to an eraser, you couldn't
  change it back

* Always allow changing the brush icon. Previously, this could only be done
  for "Draw" brushes, but there isn't really any reason why this shouldn't
  be allowed.
2018-03-20 17:01:48 +13:00
c6ecbb9508 Brush Appearance Panel - Cleanup + Tweaks
* The "Draw" case was discarding the settings.brush value and redefining
  its own brush variable. Reoranised code so that this doesn't need to
  happen
* Reorganised order of properties - all brush type/icon related stuff
  comes first now
* Remove extra/excess layout elements/lines
2018-03-20 16:58:28 +13:00
5d96c8abb4 Don't collapse "Brush Appearance" panel
It's in a tab by itself already, so there's no need to make ti even harder
to access its settings.
2018-03-20 16:37:09 +13:00
404e817a11 Merge branch 'blender2.8' into greasepencil-object 2018-03-20 16:14:20 +13:00
4e33ce736f Change library order 2018-03-19 20:35:31 +01:00
350cd7fce2 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	build_files/cmake/macros.cmake
2018-03-19 19:46:31 +01:00
dd4e968bea UI: Move brush type to appearance panel
This option is not used all the time and putting in the main panel, near of the brush selector, can be weird for the user.
2018-03-19 19:43:28 +01:00
03c3136c10 Cleanup: use MEM_SAFE_FREE 2018-03-19 09:56:41 +01:00
cb8ebffa48 Merge branch 'blender2.8' into greasepencil-object 2018-03-19 09:39:28 +01:00
d435719fb4 Do not draw fill control lines in multiwindow
If enable the fill control lines, these must be drawn only in the current window.
2018-03-19 09:38:01 +01:00
2042995dce Cleanup: Warnings and Codepage errors 2018-03-18 12:10:42 +01:00
ae1a08632c Merge branch 'blender2.8' into greasepencil-object 2018-03-18 11:48:36 +01:00
5c47a33362 Enable Loop Onion in Relative mode 2018-03-18 11:48:06 +01:00
d5a6568816 Fix link Palette error with textures
The link was not loading the referenced images.
2018-03-17 17:01:10 +01:00
ea63d431f1 New Onion Skinning Loop option
When draw an animation with a loop it's very useful to have an indication of the first frame.

Some changes in the order of the parameters too.
2018-03-17 16:48:46 +01:00
5330415de2 UI: Move angle factor to top of the panel 2018-03-16 18:54:29 +01:00
ab42439d52 Merge branch 'blender2.8' into greasepencil-object 2018-03-16 18:07:52 +01:00
a900b2d2a1 Replace Random checkboxes by Factors
As we have a new Random section in the stroke panel, it's not logic to have buttons in the main panel.

Now, these random parameters work equal to other random factors.
2018-03-16 18:07:06 +01:00
988d180616 UI: Remove unlink text for default palette
This is not standard and we remove while we found a better solution.
2018-03-16 15:44:33 +01:00
bccbc935a0 Outliner: Clicking on GP Layers will activate them 2018-03-17 03:09:26 +13:00
Dalai Felinto
82ab5668d0 Fix bug: Appended brush comes with empty palette 2018-03-16 10:10:39 -03:00
06d9f59a42 Merge branch 'blender2.8' into greasepencil-object 2018-03-16 10:55:03 +01:00
7ded480dff Reset color name only if not valid for the palette 2018-03-16 10:51:38 +01:00
a107b3d8d7 Fix compiler error (field name wrong) 2018-03-16 10:48:10 +01:00
80840750e8 GP Color Picker - Make the highlight cover the names of each color too
This makes it more consistent with the normal big-icon popup menus
2018-03-16 19:33:12 +13:00
be53b9afe5 Fix: Adding GP Monkey didn't refresh Properties Editor 2018-03-16 19:19:19 +13:00
b9090d9229 Fix: Prevent GP Primitives (Rectangle/Circle) from getting added when active layer is locked/hidden 2018-03-16 19:06:34 +13:00
6cdba8893f GP "Add Monkey" - Shift-A can now be used in EditMode to bring up the "Add GPencil Object" menu
TODO:
It shouldn't trigger in other editors, but right now, the keymaps are
shared, so there's not much that can be done about that.
2018-03-16 18:50:27 +13:00
fabfa5a959 GP "Add Monkey" - Check if there's an existing palette/colors with the required names before adding new ones
Now, when adding a Monkey primitive to the same GP object more than once,
you won't get two separate palettes (with two separate sets of colors)
created - one for each instance. Instead, the second (and subsequent)
copies will all use the initial/existing palette instance.

Note: For layers, we still just create new ones, as it makes it easier to
isolate the instances.
2018-03-16 17:16:28 +13:00
a5e8b369e7 GP "Add Monkey" - Make this behave like a standard "Add Object" operator
* "Add GP Object" operator now works in Edit/Paint modes (so the button
  in the Create tab works)

* Multiple "Suzanne" objects can be added within the same GP datablock now
  (if in Edit/Paint modes when activating the "Add GP Object" operator)

* "Radius" operator property is respected, albeit, setting this to values
  other than 1.0 may result in weirdness as the line thickness values do
  not get adjusted.
2018-03-16 16:09:17 +13:00
0481990044 GP "Add Monkey" - Primitive geometry can now have arbitrary transforms applied to it when created 2018-03-16 16:09:16 +13:00
d00b952d4d Remove duplicate RNA name set
This broke the name property of the layer.
2018-03-15 18:49:37 +01:00
9c0eb5fe8b Merge branch 'blender2.8' into greasepencil-object 2018-03-15 17:38:36 +01:00
1c58439bef Save Simplify flags at drawing start
As the simplify can change during play, the cache was not initializated and could get an error.

Saving the flags at the start solves this issue and improve the play animation in few mseconds.
2018-03-15 17:24:31 +01:00
b3638bdd20 Missing copy curves for brushes 2018-03-15 13:23:17 +01:00
1730ef7527 Fix simplify bug due cache corruption
When enable/disable simplify options, the cache must be set as dirty.

Now, the update is done using depsgraph.
2018-03-15 13:07:04 +01:00
3b11365e96 Merge branch 'blender2.8' into greasepencil-object 2018-03-15 12:41:24 +01:00
37e8dd2b94 Add filter by View Layer when render (F12)
Now it's possible to filter the grease pencil layers by view layer for render. The filter can be inverted.

This is an additional level of object visibility.

This is used for compositing.
2018-03-15 12:02:33 +01:00
c1cd722171 Fix assert error linking palettes
Must check if the hash key was inserted before.
2018-03-14 19:44:09 +01:00
c05da356b1 Merge branch 'blender2.8' into greasepencil-object 2018-03-14 18:59:40 +01:00
3c9c9dcb32 Merge branch 'blender2.8' into greasepencil-object 2018-03-14 10:21:12 +01:00
7ac4a31ab1 UI: Add icon selector
Now it's possible to select the standard icon used by brush. This can be required when change the brush type and want to back to old icon.
2018-03-14 10:10:35 +01:00
94597cd43c Cleanup: Move enum definition to right file 2018-03-14 09:54:26 +01:00
08970951c6 Cleanup: Group all paint creations in function 2018-03-14 09:49:44 +01:00
7438a391d8 UI: Expand brush type icons
The old dropdown list button was too wide and the look of the icons below was strange.
2018-03-14 09:40:57 +01:00
3347e8f812 Add missing ID types for Brushes and Grease Pencil 2018-03-14 08:44:19 +01:00
46b2492fb2 Merge branch 'blender2.8' into greasepencil-object 2018-03-13 19:44:18 +01:00
3fd7dcad9e Fix cursor error after erase brush
When the brush is not selected, the cursor must be hidden.
2018-03-13 19:42:46 +01:00
7771049641 UI: Add a text for not linked palettes
I had to use a trick with a disabled button because the template_id collapse when nothing is selected.

Here  the operator new is not logic, so we cannot add the common "+ new" button.
2018-03-13 16:11:16 +01:00
90e005e567 UI: Hide cursor color for drawing brushes 2018-03-13 15:49:40 +01:00
09ede1f3bb UI: Move default color to main brush panel 2018-03-13 15:47:18 +01:00
118f7e28f3 Increase User number for palettes 2018-03-13 15:45:21 +01:00
fde0e44aa4 Use Brush default color for cursor
If the brush has assigned a default color, the cursor must use this color, not the context default color.
2018-03-13 15:16:17 +01:00
6f83bc24b5 Fix problem when change mode in brush color default 2018-03-13 13:06:25 +01:00
338903f5f5 New default color for Brush
If the brush defines a default Palette and Color, when draw the color used is this and not the current context default color.

Still there is problem when change drawing mode from Line to Dots.
2018-03-13 12:59:19 +01:00
8d1538fbf5 Merge branch 'blender2.8' into greasepencil-object 2018-03-13 10:55:40 +01:00
f9e280dafe Cleanup unused code 2018-03-12 16:48:34 +01:00
5f3bcba63e UI: Change brush type icon and panel layout
Small modifications to some parameters and added text to type of brush.
2018-03-12 16:34:39 +01:00
6722c6e5a8 Cleanup: Remove duplicated condition 2018-03-12 10:36:03 +01:00
f012e1de32 Remove brush mode panel and add icon
The panel was not needed and was replaced by icons in the main panel.

Notice: I have reused standard icons, but maybe need custom icons in the future, but we will wait to the main redesign 2.8 interface task.
2018-03-12 10:30:02 +01:00
a83065a5d3 Merge branch 'blender2.8' into greasepencil-object 2018-03-12 10:00:46 +01:00
301651ae51 Change Brush names to organize alphabetically
As the panel is sorted by name, it's better to have names that keep brushes grouped.
2018-03-12 09:53:53 +01:00
95655f008c Change Eraser icon depending of eraser mode 2018-03-12 09:49:25 +01:00
ff2260527f Remove unused and duplicate code
After moving bGPDbrush to Brush, some data is duplicated or not used.
2018-03-12 09:37:03 +01:00
944812a1e8 Fix problem when change mode if no brushes
When chnage mode, create the default brushes if they are missing.
2018-03-11 20:12:18 +01:00
03c4d48cda Fix problem with Brush Datablock icons
The icons of grease pencil brushes did not work because the poll return false.
2018-03-11 20:04:11 +01:00
4071460fe1 WIP: more work moving datablock
All references to old bGPDbrush struct has been removed and basic functionality working again now.

Still the icons of the brushes are missing.
2018-03-11 18:03:30 +01:00
c44e8a016b WIP: Fist step moving bGPDbrush to Brush datablock
Still a lot of work ahead, but this commit is to save the situation before remove bGPDbrush struct.
2018-03-11 11:48:29 +01:00
d093792ab6 Code refactor: Missing in previous commit 2018-03-10 13:29:07 +01:00
20ddf3a147 Code refactor: Rename fields to prepare for ID datablock
Rename some fields to prepare the code to move the brushes (bGPDbrush) to reuse ID datablock ID_BR (Brush).
2018-03-10 13:25:36 +01:00
739a9cef23 Merge branch 'blender2.8' into greasepencil-object 2018-03-10 12:24:01 +01:00
65ec69492d Cleanup: Rename brush input_samples field 2018-03-09 19:38:07 +01:00
d610ef059a Cleanup: Rename brush type field 2018-03-09 19:27:22 +01:00
040ec894a4 Cleanup: Rename brush icon field 2018-03-09 18:31:48 +01:00
827a5289ef Cleanup: Rename subdivide field 2018-03-09 17:52:49 +01:00
afcacf987a Cleanup: iterator macros 2018-03-09 11:07:15 +01:00
d1658af025 Merge branch 'blender2.8' into greasepencil-object 2018-03-09 10:53:02 +01:00
6fe83d88b9 Enable Settings by default in predefined brushes 2018-03-09 10:31:56 +01:00
052105b72f Reorganize Stroke panel grouping Settings 2018-03-09 10:29:03 +01:00
b74e90656e Reorganize Brush parameters panel
As we have a lot of options, the panel required a reorganization and clarify what parameters affect after the stroke is created.

Also added options to enable/disable effects like smooth without changing the values.
2018-03-08 19:50:24 +01:00
0dc8adbbab Cleanup smooth code and add one step more
It's better add a loop instead to repeat function call. This is cleaner and we can add more steps if required.
2018-03-08 16:01:58 +01:00
dd9855ed50 Colorpicker must be only in active window
When there are multiwindows, the color picker only must work in the region that originated the operator.
2018-03-08 11:02:59 +01:00
a2a4608a3d WIP: Make active smooth for 2 last points
The smooth now works with the last two points, but for oldest (p-2), uses a reduction factor to avoid strong changes.

This commit is part of the experimental smooth test.
2018-03-08 10:00:53 +01:00
a5e881c9fd Merge branch 'blender2.8' into greasepencil-object 2018-03-08 09:36:57 +01:00
bc99d6246c Missing in previous active smooth commit
The parameter must be used when call smooth function.

Fix error in values too.
2018-03-07 19:10:40 +01:00
ff5eba33ae Minor tweaks to input samples function
Now, the thickness is reduced at different levels depending of samples. The values have been obtained by experimentation.
2018-03-07 18:10:44 +01:00
9e23f80d82 WIP: Smooth while drawing stroke
Initial implementation of active smooth while drawing.

The UI parameter is experimental, so maybe in the future is removed/replaced.
2018-03-07 17:44:41 +01:00
7cc8d31f4c Remove unused affect_pressure parameter in smooth
This parameter was defined but internally was never used. The reason to disable this was that after testing, smooth the pressure got weird autistics results.
2018-03-07 11:06:05 +01:00
1b4ee92652 Chnage overlap factor for Dots to 0.5
The value used before was affected by a bug in point fragment shader. After fixing this bug, the right value here is 0.5 not 0.3.
2018-03-07 10:50:25 +01:00
ef80c41fb9 Make Dots mode thickness equal to Line mode
The dots was using half of thickness and when change the mode to line, the line was thicker.

Now, both thickness are equal.
2018-03-07 09:44:19 +01:00
d8689a421a Merge branch 'blender2.8' into greasepencil-object 2018-03-07 08:23:21 +01:00
40b1caae8f Merge branch 'blender2.8' into greasepencil-object 2018-03-06 19:15:23 +01:00
6fa4ac542d WIP: Integrate Cycles render
This is the first try to integrate the Cycles render with Grease Pencil.

Eevee uses its own call and don't need all this stuff because reuse all Eevee initialization code.
2018-03-06 19:14:04 +01:00
2ac968c167 Merge branch 'blender2.8' into greasepencil-object 2018-03-06 15:45:12 +01:00
6901b7294e Merge branch 'blender2.8' into greasepencil-object 2018-03-05 15:52:40 +01:00
7d9427aa77 Prepare eraser icon to use different images
The code is ready to change the icon for each type of eraser, but as it's not decided yet, we keep the same image in all of them while we decide new design.
2018-03-05 15:51:53 +01:00
3c28f6f727 Move mode type check before set mode
The mode must be verified for this object type before apply new mode.
2018-03-04 16:13:50 +01:00
1010b75aaf More changes in object mode switch
The outliner does not need special code.

Mode change still need more work, because in some situations, still the old mode remains activated.
2018-03-04 13:52:03 +01:00
7c466e1699 UI: Move brush mode to separated panel
This option has been moved to a separated panel because   is too disruptive to have in the main brush panel.

Maybe in the future must be moved to new location, but we put here while we found a better place.
2018-03-03 16:52:12 +01:00
629a5dfb42 UI: Change Pin icon location 2018-03-03 16:18:18 +01:00
d6a25d6262 Fix error using different eraser modes
If the bursh was eraser, the brush was not using the eraser mode.
2018-03-03 16:08:09 +01:00
abbcf1172f UI: Define pin icon for default eraser
Using pin button keep UI consistency better than a checkbox.
2018-03-03 11:38:16 +01:00
34296ab1d8 Merge branch 'blender2.8' into greasepencil-object 2018-03-03 10:55:08 +01:00
9321612879 Avoid drawing with Eraser brush
If the current brush is eraser and try to draw, cancel the operator.

This could be activated with the D key and must be forbidden.
2018-03-03 10:51:55 +01:00
16e0f2fa86 Implement brush eraser quick switch
This eraser switch works very similar to smooth sculpt brush in object sculpt mode.

When the user press Ctrl, the current drawing brush is replaced by the default eraser brush while hold the key.

After release the override key, the brush back to the drawing brush.
2018-03-03 10:39:33 +01:00
cc93479e3b UI: Hide appeareance panel for Eraser brush 2018-03-03 10:17:31 +01:00
c691ab8c79 Create a full set of eraser brushes
Create Soft, Hard and Stroke eraser brushes.
2018-03-03 10:12:15 +01:00
d1d5c99d12 Add new property Default Eraser
This property will be used when the eraser is enabled using fast switch key while drawing with other type of brush.
2018-03-03 00:07:16 +01:00
a2f8d2eb28 Merge branch 'blender2.8' into greasepencil-object 2018-03-02 23:24:25 +01:00
68683f2d4a Add new Eraser modes to UI panel
Now there are 3 types of Eraser in UI panel:

Soft: Need several passes to clean stroke.
Hard: One pass, clean points.
Stroke: Clean all stroke when touch any point.

This modes were available before using modifier keys, but it was not easy to discover.
2018-03-02 23:19:40 +01:00
4a7d969702 Cleanup: Move eraser brush draw to function and avoid duplicated code 2018-03-02 21:13:06 +01:00
9387647ee0 Fix problem with Eraser cursor size
The problem was the internal red area was not using the same size of the external lines.
2018-03-02 20:56:41 +01:00
7a0ee16f25 Change Eraser brush to use brush radius not global value
The old configuration uses a global user prefs value, but now must be the brush size.

Still need to fix the problem when resize size of the brush.
2018-03-02 20:15:51 +01:00
3058310638 Enable right cursor for Erase brush
The cursor must show that you are using the eraser
2018-03-02 20:04:47 +01:00
32c4bc3417 WIP: New Eraser brush
This new brush is equal to the old eraser, but it makes the interface more consistent.

Still need more work to adapt all eraser features, limit other actions not related to eraser and brush switching.
2018-03-02 19:30:39 +01:00
4a2cb1937c Cleanup previous commit
Make more compact the code
2018-03-02 16:57:15 +01:00
5b07881c52 Hide Draw cursor when Eraser is enabled
If the eraser is enabled, the little color dot used as cursor for drawing must be hidden and replaced by dash line circle cursor only.
2018-03-02 16:53:37 +01:00
90b8960bf6 Remove duplicate line
This line had to be removed in a previous commit.
2018-03-02 16:41:00 +01:00
a8818d53a9 Merge branch 'blender2.8' into greasepencil-object 2018-03-02 16:00:05 +01:00
a73d902b02 Fix again grease pencil modes after merge 2018-03-02 15:53:39 +01:00
40c13d2a7a Small change to capture algorithm 2018-03-02 14:15:09 +01:00
c652eb0a45 Adapt code after merge
THe code was moved to new module
2018-03-02 11:39:12 +01:00
b98df2831c Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/object/object_edit.c
	source/blender/editors/object/object_select.c
2018-03-02 11:29:28 +01:00
5855c23a64 Tweak missing event algorithm for extreme zoom
Due int number limitations, when the zoom factor is extreme, the points are captured with gaps. This change try to minimize this effect, but it's impossible to solve this issue completely.

The problem is the mouse position is always defined by a pair of int number, so the maximum precision is limited to that, so when project the point in 3D space, there are small precission erros.
2018-03-02 11:26:04 +01:00
e8ba703f80 Cleanup: macro's w/ an _END need a matching _BEGIN 2018-03-01 19:02:39 +01:00
31df0f7508 Merge branch 'blender2.8' into greasepencil-object 2018-03-01 18:44:04 +01:00
ccf99ea3b4 Cleanup more compiler warnings 2018-03-01 18:43:36 +01:00
bd769050cd Cleanup: Silent multiple compiler warnings 2018-03-01 17:30:25 +01:00
2d0babbbc7 Cleanup variable initialization 2018-03-01 16:47:34 +01:00
893694ffc0 Cleanup comment mistake 2018-03-01 16:31:29 +01:00
ca0ecfc234 Fast mouse event capture afected by zoom factor
Before, the number of points was not equal at different zoom levels.

To get this work, the pixel size is calculated and the distance is relative to 30% of the brush thickness multiplied by the number of samples.

The number of samples has been reduced too, because the new method doesn't need big values.
2018-03-01 16:30:25 +01:00
Dalai Felinto
c5950874b2 Fix blenderplayer (tm) 2018-03-01 10:50:18 -03:00
a474726eb2 Merge branch 'blender2.8' into greasepencil-object 2018-03-01 11:32:00 +01:00
a057e55981 Fix grease pencil mode problems after merge 2018-02-28 20:03:12 +01:00
b45349dee1 More merge fixes 2018-02-28 19:05:10 +01:00
ee93194f9c Fix missing line after merge 2018-02-28 18:34:04 +01:00
073d6d07e4 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/scene.c
	source/blender/editors/object/object_select.c
2018-02-28 18:28:38 +01:00
65b450d9cd Add new Brush Eraser icon
This is part of the new eraser brush.

Design by Matias Mendiola
2018-02-28 18:22:49 +01:00
55772c2c67 Fix error in Fill due pixscale
I missed to change this pixel factor
2018-02-28 17:54:39 +01:00
c6ef2f587e Replace brush type by enum
This is the first step to add eraser brush
2018-02-28 17:21:43 +01:00
6f5c47ea3e Change icon for Fill Brush
After some reviews by Pablo Vazquez and Matias Mendiola, they decided to change color to keep UI icons consistency.
2018-02-28 17:20:49 +01:00
611337cad5 Fix refresh error when change mode to Boxes
I had forgotten to pass the parameter to shader.
2018-02-28 14:23:16 +01:00
aa342de7c0 Cleanup: Remove typo error
Thanks to Nikola Ivanov for catch the error.
2018-02-28 14:18:46 +01:00
edb1c5c10b Cleanup: Make function static 2018-02-28 10:38:15 +01:00
5a37f69467 New Draw mode "Boxes"
This draw rectangles instead of Dots and allow new artistic effects.
2018-02-28 10:28:24 +01:00
ee71026222 Fixes after merge 2018-02-28 10:14:05 +01:00
811a6c298c Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/DRW_render.h
        source/blender/draw/intern/draw_manager.c
2018-02-28 10:05:27 +01:00
019365698a More tweaks to samples algorithm 2018-02-27 17:12:56 +01:00
85dbec66e2 Merge branch 'blender2.8' into greasepencil-object 2018-02-27 17:00:40 +01:00
3b8fa28855 Minor changes to Input Samples algorithm
Now the number of slices is rounded using a ceiling value.
2018-02-27 16:59:28 +01:00
21a09cbdcc Merge branch 'blender2.8' into greasepencil-object 2018-02-27 12:05:47 +01:00
6ba26e6ab5 Fix infinite loop if color is missing
Usually, this never happens, but if any color is missing, needed to add to hash to avoid the creation of duplicate materials.
2018-02-27 11:47:03 +01:00
98d1b46417 Fix wrong interpolation for fake events
The distribution was not even and it was slightly moved because it was not necessary to copy point between segments.
2018-02-27 09:53:29 +01:00
0336d60151 Merge branch 'blender2.8' into greasepencil-object 2018-02-26 22:11:02 +01:00
1c045f64d0 Merge branch 'blender2.8' into greasepencil-object 2018-02-26 19:37:08 +01:00
c1c1b52556 Invert Input Samples value
In order to keep UI consistency, the value now it's inverted. Bigger values, means more precission.

A value of Zero means, no additional sampling.
2018-02-26 19:34:52 +01:00
a636f3fbd1 Generate missing mouse event
When the artist moves very fast the mouse, there are event that are not captured due hardware limitations, so need to interpolate the position and generate the missing control points in the stroke.
2018-02-26 18:38:03 +01:00
0014d0959c Fix Monkey stroke scale
This was missing when Pixfactor was changed
2018-02-26 14:54:18 +01:00
841745a33b Use Onion colors for Textured strokes
Before, if the stroke was textured, the onion frames were not using the assigned for prev and next frames in the onion skin panel.
2018-02-25 19:24:59 +01:00
ecad07aeae Merge branch 'blender2.8' into greasepencil-object 2018-02-25 17:02:20 +01:00
36efa02db3 Revert "GWN: Fix immediate mode when closing a window."
This reverts commit https://developer.blender.org/rBe7c4a9d1ef76f6edff95ca9f418a65fc42a453dc
2018-02-25 16:54:11 +01:00
1c375729c6 Cleanup: Fix stupid typo error in previous commit 2018-02-25 11:40:40 +01:00
1f19e0fd6c Merge branch 'blender2.8' into greasepencil-object 2018-02-25 11:30:23 +01:00
9dab2a5892 Back removed property and set as deprecated 2018-02-25 11:29:33 +01:00
ab3d9b6e8c Enable Fill for DOTs mode
The fill was disabled for dots mode and only used in line mode. Now, as Dots can be used to draw, the fill is required.
2018-02-25 11:16:45 +01:00
debf38840b Replace Use Dots for a Enum menu
Instead to define a checkbox, now the dots is a mode.
2018-02-24 21:58:28 +01:00
8198668228 Apply strength factor to textured strokes 2018-02-24 20:01:14 +01:00
208b018edf Adapt render code after merge
Again, the function parameter list has changed in Draw Manager and the gpencil code need changes.
2018-02-24 18:28:19 +01:00
e5220e2f7e Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/draw_manager.c
2018-02-24 18:02:36 +01:00
803f80c673 Add UV rotation option to Smooth and Noise modifiers
To be consistent, the modifiers must work with UV rotation as the sculpt brushes do.
2018-02-24 18:00:07 +01:00
71f0e59b2e Apply Smooth and Random sculpt to UV rotation
Now it's possible apply the sculpt to the rotation of the UV texture.
2018-02-23 23:55:27 +01:00
4f504f2780 Update strokes UV when change UV factor in color
Recalc UV data for any stroke that is using the color.
2018-02-23 23:33:57 +01:00
59bd7c34ba UI: Rename Pixel Factor to Scale
From artist point of view it's more clear the new name. Pixel factor can be technically correct, but it's look weird.
2018-02-23 17:08:50 +01:00
3d479a5cc5 Cleanup extra empty line
This line was introduced in previous commit by error.
2018-02-23 10:49:52 +01:00
89316bc784 Merge branch 'blender2.8' into greasepencil-object 2018-02-23 10:39:13 +01:00
45f94cb02a Rescale Pixel Factor to to something more manageable
The old scale between 30 and 10000 was not user friendly and it was inverted (bigger value got smaller stroke)

Now the default scale is 1.0 and bigger values get thickerr strokes.
2018-02-23 10:37:01 +01:00
8299296ed1 Cleaunp previous commit
This avoid pass one matrix
2018-02-22 18:52:29 +01:00
42f2ec08d2 Fix error in VFX Pixelate modifier
The location must be multiplied by ModelViewProjection matrix.
2018-02-22 18:35:09 +01:00
055123bd58 Depsgraph: Wrap all arguments for modifiers relations update into a struct 2018-02-22 16:03:34 +01:00
3bb51bb162 Merge branch 'blender2.8' into greasepencil-object 2018-02-22 15:48:25 +01:00
b2bde994e9 Merge branch 'blender2.8' into greasepencil-object 2018-02-22 12:59:20 +01:00
f175657591 Rename pixel parameter
The name pixel can be confusing. It's better use UV factor because pixel concept is something intern.
2018-02-22 10:03:37 +01:00
b9ee2fb77c MSVC 2013 Compile Fix/Workaround for "static thread_local" vars
Apparently MSVC 2013 has trouble with stuff that's been declared
"static thread_local" (and/or maybe even the "thread_local" keyword).

https://stackoverflow.com/questions/29399494/what-is-the-current-state-of-support-for-thread-local-across-platforms
2018-02-22 19:22:50 +13:00
d9d57fe8f5 Merge branch 'blender2.8' into greasepencil-object 2018-02-22 19:10:40 +13:00
280fe8f91c Merge branch 'blender2.8' into greasepencil-object 2018-02-21 20:28:50 +01:00
e9727767a2 Calculate UVs while drawing
Now the UV while drawing is calculated using same logic used in final UV.

There will be differences between drawing and final due simplify and smooth postprocessing, but the look is more similar now.
2018-02-21 19:59:18 +01:00
f3370eb2bb Redo UV calculation using color factor
Now the Pixel size ratio is determined by a parameter of the color and not by view pixelsize.

This solves various problems and allow the user define dfifferent effects.

NOTE: Still pending to use the same logic while draw.
2018-02-21 19:32:17 +01:00
c4c60b3f94 Cleanup: Rename function 2018-02-21 16:21:42 +01:00
ca6ee0ef72 Use UV randomness UV rotation parameter 2018-02-21 11:09:27 +01:00
11910fdb50 New UI parameter to define UV rotation randomness 2018-02-21 11:04:14 +01:00
a12b8dbc40 Merge branch 'blender2.8' into greasepencil-object 2018-02-21 10:39:13 +01:00
e07aa09bd2 Fix pattern for Fill stroke 2018-02-21 09:35:07 +01:00
36b2a8fb6c Fix pattern mode for strokes
Now use the alpha channel
2018-02-21 09:30:09 +01:00
23f5f28a15 Adapt grease pencil render code after last merge 2018-02-20 17:01:49 +01:00
f7dad2b0f8 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/draw_manager.c
2018-02-20 16:13:05 +01:00
0b03ef7000 Use same rotation factor in both sides 2018-02-20 16:09:24 +01:00
b0744c7855 Use fix UVs for solid stroke
If the stroke is solid, use fixed uvs to avoid any possible gap.
2018-02-20 16:06:36 +01:00
30096e1e18 Extract Render code to separated function 2018-02-20 10:25:30 +01:00
3a5f46bd7f Fix error in UV rotation when subdivide 2018-02-20 10:15:58 +01:00
44d3c80a74 WIP: Add UV rotation for Dot texture
Now the ramdom is fixed. Need parameters to adjust.
2018-02-20 10:07:15 +01:00
978f50a0c8 Add ToDo comment for fixing later 2018-02-19 19:28:23 +01:00
2c2ff7826a Missing in previous commit (encaps for solid only) 2018-02-19 19:25:17 +01:00
bc30fbd832 Use stroke encaps only for solid mode
If use endcaps in texture mode, sometimes the texture is not correct if the type of texture used is not defined in a way that can be doubled.
2018-02-19 19:08:45 +01:00
32a1cba504 Calc UV data while painting 2018-02-19 19:07:06 +01:00
3e468e5556 WIP: Improved use of UV along the path and speedup
Now the texture is calculated using the pixelsize along the stroke.

Added a precalculation of fill and Uvs caches in order to avoid recalculation on frame change. This makes first play a little more slow (few miliseconds), but the next time the frame is used, all cache data is precalculated and the overall FPS is better when use fill strokes.
2018-02-19 17:54:00 +01:00
d674891da3 Add new UV data parameters to shaders
Add new parameters to transfer UV data information in order to texture the stroke along the path.

WIP: Still not working
2018-02-19 11:01:21 +01:00
63d331b5de Calc UV factor along the stroke
This data will be used in texture strokes
2018-02-18 18:19:40 +01:00
f0419a4a2a New point fields for UV data
These fields will be used to save information about texture coordinates of the point.
2018-02-18 17:11:53 +01:00
b767d3ac08 Fix compiler warnings (extra parameter)
This was missing in previous commits
2018-02-18 16:52:14 +01:00
388eeebdfa Rename include after merge 2018-02-18 16:50:42 +01:00
7c3be5bfb5 Merge branch 'blender2.8' into greasepencil-object 2018-02-18 16:38:09 +01:00
94daab8ba0 Fix tone mapping error in vfx
The tone mapping parameter for shader was missing.
2018-02-18 12:23:47 +01:00
7245f72b8a Remove old tonemapping code
This code was slower than current fragment code.
2018-02-18 12:16:55 +01:00
14533f446c Change tonemapping to shader
This makes faster the tonemapping and fix texture issues.

Still pending clear old colorspace code.
2018-02-18 12:04:43 +01:00
57279f84f9 Merge branch 'blender2.8' into greasepencil-object 2018-02-17 15:56:07 +01:00
36eef07e3b Fix UV scale for stroke endcaps 2018-02-16 19:06:33 +01:00
41b962f19e Fix UV coordinates for strokes 2018-02-16 18:42:07 +01:00
b0455220bf Use DRW function to check opengl render
Instead of check global value, use draw manager function to verify if it's running an opengl render.
2018-02-16 17:08:44 +01:00
ad50e0f7ca Merge branch 'blender2.8' into greasepencil-object 2018-02-16 16:53:38 +01:00
ee7134fdd3 Merge branch 'blender2.8' into greasepencil-object 2018-02-16 10:35:28 +01:00
3a0febbb75 Add warning message to enable passes
This message would be added to the main operator, or maybe if grease pencil is present, enable these passes by default.
2018-02-16 10:32:13 +01:00
f2492ab712 Cleanup: Remove unused file 2018-02-16 10:27:43 +01:00
ed6d64320e UI: Hide grease pencil paper if not gpencil object 2018-02-15 19:57:35 +01:00
1534ffe42c Fix pixelate for negative values
If the object was in negative location, the draw got full opaque.
2018-02-15 18:52:10 +01:00
db171b93f0 Fix error for render onion skin
The flag was not working as expected in renders
2018-02-15 17:02:20 +01:00
78e9821df7 Rename function macro after merge 2018-02-15 16:10:25 +01:00
f51aa64db3 Merge branch 'blender2.8' into greasepencil-object 2018-02-15 16:01:43 +01:00
adcdd047e1 Fix merge error
The line must be after grease pencil code
2018-02-15 10:32:45 +01:00
a556f170f7 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/draw_manager.c
2018-02-15 09:31:51 +01:00
d284633e80 Merge branch 'blender2.8' into greasepencil-object 2018-02-14 17:01:30 +01:00
0ea09fb553 Fix merge errors 2018-02-14 10:45:38 +01:00
79a18e1550 Merge branch 'blender2.8' into greasepencil-object 2018-02-14 10:35:21 +01:00
535277144a Fix merge compiler error 2018-02-13 17:51:26 +01:00
27ce492edb Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_select.c
	source/blender/editors/space_view3d/view3d_draw_legacy.c
	source/blender/makesrna/intern/rna_sculpt_paint.c
2018-02-13 17:38:38 +01:00
00c6e57faa Remove duplicate line 2018-02-13 17:34:18 +01:00
86cb87c0fa Chnages to use OCIO 2018-02-13 13:22:34 +01:00
0453d2fe39 Cleanup Style
Changed by error in previous commit
2018-02-13 12:59:42 +01:00
a0d6bc6af0 Fix undo modes and mode changes
Now the Ctrl+Z does not undo the mode.
2018-02-13 11:48:31 +01:00
8c5f2e1bbc Chnage lasso eraser keymap to Ctrl+Alt 2018-02-13 09:11:36 +01:00
3d55a721bc Refresh cache if render to refresh viewport 2018-02-12 20:54:49 +01:00
be9f43e57d Cleanup: Use macro 2018-02-12 19:31:59 +01:00
a8d4b0154d Create multiframe buffer only if multisample enabled 2018-02-12 17:14:31 +01:00
acd903e16e Cleanup style 2018-02-12 17:01:00 +01:00
58d293dfb3 Merge branch 'blender2.8' into greasepencil-object 2018-02-12 16:40:16 +01:00
11cbbf2855 Cleanup unused code 2018-02-12 16:35:53 +01:00
e0ea483bd7 First try to fix grease pencil object modes
After last merge of 2.8 the object modes was not working. Now we back to previous situation where the user can switch between objects and handle different modes.
2018-02-12 16:30:22 +01:00
74032304c0 Fix multisample error in render
It was checking the wrong default_fb instead of multisample_fb, so it was never created.
2018-02-12 11:21:55 +01:00
5fb9d70821 Merge branch 'blender2.8' into greasepencil-object 2018-02-12 09:15:34 +01:00
33654d77c2 Remove select operator hack
This hack was used when all modes shared the same keymaps, but now it's not necessary.
2018-02-12 09:10:52 +01:00
a18f1656c1 Fix keymap error 2018-02-11 16:58:26 +01:00
f990cf29c1 Back Lasso and Border eraser
These options were removed by error.

Due keymap conflicts, the new keymaps are:

Lasso: LMB + Ctrl + Shift
Border: B
2018-02-11 16:31:29 +01:00
6b924d1b44 Fix error when init drawing
The object is already activated, so if reactivate, the mode is missing.
2018-02-11 12:36:20 +01:00
8b2c3704db Merge branch 'blender2.8' into greasepencil-object 2018-02-11 12:07:56 +01:00
753e83e608 UI: Back Brush appearance panel and fix active mode
Back the brush appearance panel to separated tab and fix error introduced in previous commit because workspace hasn't active_object_mode
2018-02-11 11:34:48 +01:00
40cb8bf45f Change color picker keymap to P key
Replace old F6 keymap to avoid conflicts.
2018-02-11 11:23:23 +01:00
377ff0fee6 Back eraser to Ctrl keymap
Soft Eraser: LMB + Ctrl
Hard Eraser: LMB + Ctrl + Shift
Stroke Eraser: LMB + Ctrl + Alt

Straight Line: LMB + Alt
Polyline: LMB + Shift + Alt
2018-02-11 11:17:43 +01:00
6bdd1ee77b Cleanup: Rename property to avoid negative names 2018-02-11 10:49:59 +01:00
a596d5df05 Fix error in OpenGL render
As F12 and OpenGL are detected as render mode, the pixel size was not correct.

I have added a check to verify if it is a real F12 render or it's a OpenGL.

Maybe this check must be removed if the OpenGL render operator is deprecated by a new system, but we need to keep the verification until them.
2018-02-10 20:04:24 +01:00
ca550d2073 Create multisample buffer for render
As render does not create default buffers by default, the render needs to create multisample default buffer in order to use antialiasing.
2018-02-10 17:58:25 +01:00
eb54e97784 Fix render artifacts
When 3D object was in front there was some noise.
2018-02-10 17:16:29 +01:00
d7c3a09aac Fix render error when previous result is NULL 2018-02-10 13:12:28 +01:00
9ead9396d8 Fix error when sky is transparent
If the sky is transprarent the zdepth value is not valid to check, so it's better don't copy the pixels.
2018-02-10 12:56:52 +01:00
5d4b766a49 Interpolate render result for transparent colors
There is still some problems with AA.
2018-02-10 12:37:36 +01:00
294ff5ec16 Cleanup: Rename variables 2018-02-10 11:28:48 +01:00
692704543b Check exist grease pencil objects before render
If the scene has not grease pencil objects, it's not required to call grease pencil rendr functions.
2018-02-10 11:26:40 +01:00
1e7ed3d85c Missed in previous commit 2018-02-09 20:10:41 +01:00
ee6a257cab WIP: Render mixing GP and Eevee or Cycles
Still there are problems with AA, but now it's possible to get a composed result with Cycle/Eevee and Grease Pencil.
2018-02-09 20:05:26 +01:00
65f62b70c2 Temp fix for object mode
The function ED_object_base_activate() was calling again the mode set and undo the mode change.

Do we need this function? Really the object is already the active one.
2018-02-09 18:11:06 +01:00
a8fa2d9321 Fix infinite loop in mode set
The mode set entered in an infinite loop
2018-02-09 17:50:11 +01:00
f9d6b3565d Fix compiler error after merge 2018-02-09 17:09:12 +01:00
c5dc05b038 Fix on previous commit to use active_object
Need to use active_object, not object
2018-02-09 17:07:16 +01:00
50ab5db1c3 Fix python object mode changes
After last changes, need to use workspace mode
2018-02-09 17:03:40 +01:00
2f6269ca74 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenkernel/intern/paint.c
2018-02-09 16:39:17 +01:00
507e3e12b6 Merge branch 'blender2.8' into greasepencil-object 2018-02-09 10:27:55 +01:00
3df45f7f97 Cleanup: Rename function to keep render grouped
Keep all render functions name with _render prefix.
2018-02-09 10:24:59 +01:00
840612bd9d More compile Fixes for object->mode refactor
TODO: I've come across some rather fishy-looking code in a few places
      that will need more careful review later

* gpencil-select.c - 1181
* object_edit.c - 1596
* view3d_select.c - 1626
* undo.c - 230
2018-02-09 19:32:39 +13:00
3fb46529a5 Cleanup: Rename variables 2018-02-08 16:31:39 +01:00
9e2faaf0f5 WIP: Initial commit to use zdepth render data
Still not tested (branch is broken), but this commit is to keep log of the changes.
2018-02-08 16:08:44 +01:00
71b3495a08 Compile Fix: ob->mode lookups 2018-02-09 03:25:49 +13:00
99e8154098 Compile Fix: Fixes for the mode toggle operators
* Changed ob->mode / ob->restore_mode to
  workspace->object_mode_restore / workspace->object_mode

* BKE_workspace_object_mode_set() got removed.
  From the changes in rna_wm.c in (345c6298e9)
  it looks like this is all we still need to do now.
  However, this will need to be reviewed more carefully later.
  For now, this will do!
2018-02-09 03:17:07 +13:00
781cf304a4 Compile Fix: Use proper flag for tagging temporary datablocks created for drawing only 2018-02-09 00:20:04 +13:00
ffc77a4e67 Merge branch 'blender2.8' into greasepencil-object 2018-02-08 23:47:09 +13:00
46c5fe3d8c WIP: Temporary hack to get something showing up when using GP in 2D editors for annotations
Temporary restoration of init_palettes() for the non-2D case. Ultimately,
this will not remain, but we need to retain support for this until the
drawing code is sorted out.
2018-02-08 23:43:42 +13:00
51a60c9990 Fix render pixel size
The calculation must be equal to the viewport, because using the camera pixel size, the result is not correct.
2018-02-08 11:07:42 +01:00
225f174970 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
2018-02-08 16:16:58 +13:00
e89ac16ac0 Fix: Data-Blocks view in Outliner no longer displayed property values, making it semi-useless
Partially revert efe1af3d11

The offending commit over-zealously removed the datablocks viewer case
as well, when only the condition needed to be modified.
2018-02-08 16:13:55 +13:00
106c212b1a Cleanup - Use builtin function for clarity 2018-02-08 16:09:15 +13:00
5fb42459e6 Fix crashes trying to draw GP strokes in 2D editors
Currently nothing appears when you try to draw still, but at least it
won't crash.
2018-02-08 15:46:07 +13:00
27c63de39c Cleanup
* Reduce number of extra/excess layout.row() elements with a single item
* Simplify logic (redundant check)
2018-02-08 14:54:07 +13:00
ecb4d23df9 Try to fix pixsize in render mode
Still the pixsize is not working becaus ethe values are not valid.
2018-02-07 19:41:11 +01:00
f1dfddd723 WIP: More work on render
Now get a result, but still the stroke is missing and replace any other render image.
2018-02-07 18:18:56 +01:00
690f118cfb WIP: Initial steps to define render to image functions
This commit is to put in place all components of the render, but still not working and only enabled in debug mode.
2018-02-07 16:58:28 +01:00
316a356c54 Calculate zdepth relative to camera plane if rv3d is null
If the viewport is not available, RegionView3D is null, so to calculate the z-depth must use the camera plane.

This is a preliminary step to integrate render (F12)
2018-02-07 16:32:14 +01:00
f828777fbe Disable grease pencil paper in render mode
This is a preliminary step to integrate render (F12)
2018-02-07 14:12:32 +01:00
0bcde767a9 Merge branch 'blender2.8' into greasepencil-object 2018-02-07 11:07:31 +01:00
1e6e4b326d Cleanup: Reduce number of passes using pointers
Instead to define different passes for mixing final result, now reuse the passes and use pointers to replace input textures.
2018-02-07 11:04:44 +01:00
f4051f05cb Cleanup style 2018-02-07 10:31:12 +01:00
5d274778f5 Fix: Don't show "Brush Appearance" panel in Edit Mode 2018-02-07 21:00:56 +13:00
f3d894db65 GP UI: WIP Attempt to cleanup some weird alignment/nesting/spacing issues
It's unclear to my why all these fields seemed to be individually wrapped
in both a row and column layout, but with "align=True" enabled, causing
the widgets to be oddly separated in the UI
2018-02-07 15:58:09 +13:00
bb30a721b4 GP Eraser Panel: Expose button to activate eraser
It's currently impossible to activate the eraser in the 3D view otherwise
if you're using a mouse (unlikely for most serious 2D artists, but possible
for non-sculpting modellers/animators) or if your tablet doesn't have an
eraser end (IIRC some non-Wacom styluses may have this limitation)

Also noted that we should also expose the hard/soft mode, and/or strength
settings here too (as opposed to having these hardcoded and/or mapped to
hardcoded modifier keys only)
2018-02-07 15:28:33 +13:00
6c13ef9f94 GP UI - 2D/3D Split: Move all 3D toolbar only panel code to space_view3d_toolbar.py
* All toolbar panels that are only used in the 3D view have now been
  moved out of properties_gpencil_common.py, as they are *only* used
  in that editor.

* Sculpt, Edit, and Eraser panel definiitions remain in the common file
  for now, as it's still possible for these to be used in other editors
  (at least in theory - there may be some new limitations I haven't found yet)
2018-02-07 15:14:00 +13:00
c8844ef24b GP UI - 2D/3D Split: Split out the "Create Shapes" and "DrawingToolsPanel" into separate classes
The 3D/GP Object only used part of the old "DrawingToolsPanel" to
draw the "Shapes" panel, going so far as to use an empty label +
custom draw header function to dynamically change the label.

This commit properly fixes the code here by separating out the code for
the two use cases:
* The GP object case is now handled by a dedicated "GreasePencilCreateShapesPanel"
  that only does the "Shapes" stuff
* I've reverted the other case back to the master version, as this is more
  suitable for use by all the other 2D editors
2018-02-07 14:36:10 +13:00
17fa87aa5a Clean Boundary Fill: Clarify Labels/Tooltips 2018-02-07 14:18:11 +13:00
3ec422182f GP "Strokes Edit" Panel: Consolidate a few items in preparation for restoration of 2D GPencil (WIP)
The groupings here are not final, and can still be adjusted/scrapped.

1) Used "operator_menu_enum"'s in place of listing out all the modes of
   certain operators with multiple modes. This brings those operators more
   in line with the other ops here (and in other parts).

2) Fixed the code to not show 3D only operators if this panel gets used
   anywhere else.
2018-02-07 14:17:47 +13:00
f78059a4f0 Cleanup: Style fixes 2018-02-07 13:52:31 +13:00
70a41a5200 Cleanup: Move modal operator draw callbacks out of ED_gpencil.h
Turns out that these were only actually used from within the gpencil
module (i.e. they were defined in drawgpencil.c, and called from the
gpencil_<opname>.c files), so it's not even necessary to export these
function prototypes in the ED_gpencil.h header.
2018-02-07 13:09:19 +13:00
a4b72a41a4 Cleanup: Remove color picker defines from headers
There's no need for these defines to be in any headers, as this operator
is entirely self-contained in its own file now.
2018-02-07 12:33:28 +13:00
96ba61cf21 Merge branch 'blender2.8' into greasepencil-object 2018-02-06 17:23:18 +01:00
c0cef0a393 Remove limitation of fill only colors
Now, when a fill brush is selected, the color picker shows all colors, not only fill colors. This makes the palette more consistent.
2018-02-06 17:17:09 +01:00
d56a035f7d Fix enum after merge
The code has been moved to new header file, so new definitions were missed.
2018-02-06 16:30:04 +01:00
c1401c7966 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/object/object_modifier.c
	source/blender/editors/space_outliner/outliner_tree.c
	source/blender/makesdna/DNA_object_types.h
2018-02-06 16:18:59 +01:00
36b64064f1 GP Toolbar UI: Move the "Eraser" and "Brush Appearance" panels to the Tools tab in Draw Mode
It was awkward having these in the "Options" tab, where they were
likely to get missed. This change will perhaps make more sense
after some of my other upcoming changes here.
2018-02-07 03:05:03 +13:00
f4f230381d Cleanup: Simplify various bits of the GP Color Picker code
* Removed the redundant init() wrapper
* Got the "focus" text highlight working again (missed from previous commit)
* Removed some unused vars
* Clarified reason why poll fails
2018-02-07 03:05:02 +13:00
2bc6c2de06 Fix: GP Color Picker text positioning/sizing was using an absolute pixel size for an offset
This would break when changing the DPI settings
2018-02-07 03:05:02 +13:00
c9c2e888e2 GP Color Picker: Highlight the color under the mouse
Previously, the color picker provided no feedback on which
color under the mouse would get applied when clicking.
It also wasn't that clear what the current active color
was.

This commit fixes this, making the UI feel more like a
standard Blender menu/popup, and less like a glitchy
non-interactive graphic, by drawing a highlight rect
behind the item currently under the mouse. By default,
the current/active color will be highlighted before
the mouse enters the panel.
2018-02-07 03:05:01 +13:00
71c423f6b3 GP Color Picker: Shrink thickness of outlines around color swatches
Now it looks less cartoonish, and more in line with other UI widgets
2018-02-07 03:05:00 +13:00
6861ea7cdd Cleanup: Use BLI_rect functions instead of inlining boundbox range checks 2018-02-07 03:05:00 +13:00
2637686bd1 Fix error of render when select object not GP
The problem was the cache was not set to dirty if the active object was not a GP object.
2018-02-05 18:03:47 +01:00
90387cfa0f Merge branch 'blender2.8' into greasepencil-object 2018-02-05 16:12:37 +01:00
f276b08714 Convert colors to linear for OpenGL render
This is a workaround to convert the colors to linear space instead of sRGB for opengl render.

This can change in the future, but now this fix is required in order to produce the renders of Hero open movie.
2018-02-04 20:05:45 +01:00
e59a9210fd Merge branch 'blender2.8' into greasepencil-object 2018-02-04 13:42:19 +01:00
cb72b906d8 Merge branch 'blender2.8' into greasepencil-object 2018-02-03 16:26:14 +01:00
49cf21487a Replace BKE_object_is_visible by context function 2018-02-03 12:37:22 +01:00
18e4a28665 Add missing initialization values to DrawEngineType
Some new callback variables have been added to the DrawEngineType struct. These values are not used, but need to be initializated properly with NULL.
2018-02-03 11:10:54 +01:00
ef3a03c810 Improve Stabilizer tooltip 2018-02-03 11:03:12 +01:00
1c32299a2b Merge branch 'blender2.8' into greasepencil-object 2018-02-03 09:51:14 +01:00
f2d0df82fa Keep selection after Split stroke
When split a section of the stroke is better to keep the selection.
2018-02-02 20:39:32 +01:00
59828ced95 Cleanup: Remove unused variables 2018-02-02 20:15:46 +01:00
bd77846825 Cleanup: Fix comments 2018-02-02 17:48:19 +01:00
20d85e457c Merge branch 'blender2.8' into greasepencil-object 2018-02-02 17:32:17 +01:00
2987202deb Merge branch 'blender2.8' into greasepencil-object 2018-02-02 17:01:38 +01:00
d7a3669304 New Split operator
Split selected points in a new stroke in the same frame. The stroke is not created in the current frame, but in the frame of the original stroke.

Shortcut: V
2018-02-02 16:59:10 +01:00
3586981e8f Cleanup: Remove duplicate operation
It was stupid add and sub the same value
2018-02-02 11:22:34 +01:00
814373f13e Make color picker panel more compact
There was too many space between colors and panel borders.

Also changed the aspect ratio for small number of colors.
2018-02-02 10:49:54 +01:00
19aec0a376 Merge branch 'blender2.8' into greasepencil-object 2018-02-02 10:34:37 +01:00
0cc0b89013 Cleanup: Create function to duplicate stroke to avoid code duplication. 2018-02-02 10:34:04 +01:00
23aa0fdc36 Cleanup: De-duplicate dynamic enum function used for setting GP brush icons
It turned out that there were slight differences between these two
versions (namely, where they searched for the list of active brushes),
but it's not too much of a stretch to use the same code for this with
a few minor tweaks, as per this commit.
2018-02-02 19:43:27 +13:00
ea55e31f27 Cleanup: Remove unused/deprecated dynamic enum stuff 2018-02-02 16:15:41 +13:00
27e3b782e4 New option to separate Points
Added an option to separate selected points and not only whole stroke.

Also some cleanup task as rename vars and reorganize code.
2018-02-01 19:18:05 +01:00
af1c1ff2a1 Add P key shortcut for Separate operator 2018-02-01 18:23:16 +01:00
faaf20c3a2 UI changes for color picker
* Colors have labels, so previews don't need to be as big, GP_BOX_SIZE  set to 32.
* More padding between items, they are too close to each other at the moment GP_BOX_GAP set to 24.
* Round boxes  are  a bit less round to match the rest of the UI 0.2f  (before used 0.4f)
* Cursor should not change to color picker. We are performing an action (selecting an item), not picking UI colors per se.

Thanks Pablo Vazquez for the feedback
2018-02-01 17:11:03 +01:00
0319fd82e4 Merge branch 'blender2.8' into greasepencil-object 2018-02-01 16:31:49 +01:00
cbe20b9a2d Cleanup: Define a shared poll method for edit 3D 2018-02-01 16:22:03 +01:00
e5989702ee New Separate operator
This operator works similar to mesh separate operator, but for grease pencil strokes.

Two options:

a) Selected Strokes
b) Active Layer
2018-02-01 16:22:03 +01:00
dd7e0353c7 Cleanup: Remove unnecessary flags and fix typo 2018-02-01 16:22:03 +01:00
28b9dfeece Move int <-> float 2d vector funcs from GP code to Math Lib
We now have the following two new functions:
* copy_v2fl_v2i(float r[2], const int a[2])  <-- Copies 2D int vector to float vector
* round_v2i_v2fl(int r[2], const float a[2]) <-- Copies 2D float vector to int vector, by rounding the values
2018-02-01 20:38:41 +13:00
e6b8221652 Merge branch 'blender2.8' into greasepencil-object 2018-01-31 10:17:30 +01:00
8115103911 Cleanup: Use standard mathlib functions here, instead of inlined pointer magic/etc. 2018-01-31 18:58:27 +13:00
b05f4c7132 More self-contained fix for previous commit 2018-01-31 18:32:19 +13:00
2e64865c51 Cleanup: Various fixes
* Remove redundant operations (e.g. extra copies of data)

* Remove duplicate functions (e.g. vector copying, for non-floats)
  TODO: We still have copy_v2int_v2float() and copy_v2float_v2int()
        to fix (i.e. rename + move to BLI_math.h)

* Cleanup redundant struct forward defs in headers (including some duplicates)

* Hacky fix for compiler warning in gpencil_colorpick.c (about const vs non-const)
  UI_FSTYLE_WIDGET is const, but UI_text_clip_middle_ex() needs non-const
2018-01-31 18:30:29 +13:00
e1ae00c38b Cleanup: More simple fixes 2018-01-31 17:27:44 +13:00
6701e8348e Cleanup: Style fixes 2018-01-31 17:22:06 +13:00
a99c4c7290 Cleanup: Move ED_gpencil_stroke_minmax() to blenkernel
The rest of the boundbox/minmax code is already there. We might as well
have the function for grabbing this info from a single stroke there too.
2018-01-31 17:06:21 +13:00
bc125b415d Cleanup: Reshuffling order of code in file
In future: Keep related code together, instead of just dumping
it "wherever" (aka at the end of the file, since it's most
convenient right now)

(In the process, I've ended up flagging a few pieces of code
for further investigation. They likely duplicate some code
elsewhere in other modules)
2018-01-31 15:50:04 +13:00
b186698d9b Cleanup: Prefix all exported functions with module prefix 2018-01-31 14:23:04 +13:00
0cd8cdd8d4 Cleanup: Fix mixed use of tab/space whitespace 2018-01-31 14:21:58 +13:00
fdc1a1c06b Cleanup: Move private/internal operator state data out of public header for GPencil module
This commit moves the defines for several modal operators
(Interpolate, Fill, and Add Primitives) out of the editors/gpencil
module's public headerfile ("ED_gpencil.h") into the module's
internal headerfile ("gpencil_intern.h").

We should not be spraying the internal implementation details of
operators in public headers. In this case, these defines weren't
even being used outside of the gpencil module - they were only
put in a header so that drawgpencil.c (which lives in the same
module) could access this data (and even then, I wonder those
callbacks need access to everything).

Note: I couldn't get rid of the ED_numinput.h include in the header
yet, as several of the operators define NumInput members inline.
2018-01-31 14:10:04 +13:00
833afb75ae Fix error in fill stroke thickness
To avoid gaps, the thickness of the internal strokes must be reduced, but the previous code only worked when the factor was different of 0.
2018-01-30 17:45:08 +01:00
2aa5950562 Merge branch 'blender2.8' into greasepencil-object 2018-01-30 17:18:54 +01:00
0f8af3a5ce Rename "lazy Mouse" to "Stabilizer"
Also changed "Radius" to "Distance"

Thanks Pablo Vazquez for the feedback.
2018-01-30 17:18:22 +01:00
3fde3902c1 Merge branch 'blender2.8' into greasepencil-object 2018-01-30 09:52:08 +01:00
7d48923671 GP Add Primitive: Don't make a copy of the new stroke. Just copy it over! 2018-01-30 19:04:54 +13:00
496064f1f3 GP Add Primitives: Attempted fix for double-clicking on the toolbar button
Check for what type of mouse-press it was, instead of just assuming
that the clicks are what we think they are.

Note: If things still go wrong, there's also now a debug-print there
(debug-mode only) to help track things down.
2018-01-30 19:04:54 +13:00
4cd2f80f9d Cleanup: Streamline logic here - just check once, not twice 2018-01-30 19:04:53 +13:00
e12b1c2a27 GP Add Primitive Ops: Remove the "avoid fast double clicks" event hack
This was making the operator unnecessarily clumsy to use, especially
for anyone used to the way that drawing tools everywhere else work.

Old workflow (with the hack):
1) Click Rectangle/Circle to start the operator
2) Click (Press & Release) in the 3D view to start drawing the shape
3) Click again (Press & Release) to stop drawing
(4) Click again, realising that you forgot to release the mouse in step 2
    (provided you realised why it "wasn't working")

New workflow (more in line with standard workflows):
1) Click Rectangle/Circle to start the operator
2) Press and drag in the 3D view to start drawing the shape
3) Release to stop drawing
2018-01-30 19:04:52 +13:00
e70d497e3e GP Add Primitives: Allow operator to work in Edit Mode too
It didn't really make sense why this was restricted to Draw mode only.
In particular, there are 2 good arguments for allowing it in editmode too:
 1) In many ways, it's more similar to a Copy/Paste or Duplicate
    operation in that it just dumps a bunch of stroke geometry
    into the scene without you having to draw anything. We allow those,
    so why not this.

 2) Users are used to being able to go into Edit Mode and add a primitive
    shape into the datablock to begin editing it. For consistency with
    other modes, and also to prevent the "Creation" tab looking stupid
    and redundant in EditMode, let's enable this.

Note:
* Sculpt/Weight Paint modes do not have this enabled for now. In those
  modes, users are less likely to be concerned with adding geometry,
  and more with modifying the existing geometry.
2018-01-30 19:04:52 +13:00
388bb6ec85 Cleanup: Use M_PI instead of converting from degrees to radians
Note: While the center/radius calcs may benefit from using the
BLI_math funcs, the current implementation is more direct.
2018-01-30 19:04:51 +13:00
4d99df8a9b GP Add Primitives: De-duplicate code
Most of the logic in gp_primitive_rectangle() and gp_primitive_circle()
was duplicated, and responsible for performing space-conversion stuff
on the 2d/screen-space coordinates.

This commit properly separates out these concerns, de-duplicating
code, and fixing a few other minor issues at the same time
(e.g. superfluous copies, and "edges" not getting initialised properly)
2018-01-30 19:04:50 +13:00
de29d5fe00 GP Add Primitives: Removed the requirement for an active layer
Previously, the add primitive operator (rectangle/circle) required
there to be an active layer present before it would allow you to draw
a new primitive. However, this reduced the usefulness of this tool
(especially if you intended to use these tools to roughly block out
the requried shapes first in a new/blank GP object).

There was no real reason for this limitation, so no, the operator will
create a new layer itself if necessary, just like the Draw operator
has done since day one!
2018-01-30 19:04:50 +13:00
00fe5d45d3 Cleanup: Remove redundant functions
These were just adding extra layers of abtraction/complexity
without serving any actual purpose.
2018-01-30 19:04:49 +13:00
498c203130 Rename "Chessboard" to "Checker Board" 2018-01-29 23:11:57 +01:00
240dbd295f Support multiframe for change color operator 2018-01-29 19:59:48 +01:00
c85edc8bcc Fix Undo problem with color picker 2018-01-29 19:48:11 +01:00
458aee0a94 Redesign off GP icons
Designed by Matias Mendiola

Thanks Pablo Vazquez for the feedback
2018-01-29 19:45:18 +01:00
99ee18c5a2 Merge branch 'blender2.8' into greasepencil-object 2018-01-29 18:33:11 +01:00
8f7f79e825 Enable drawing start with Shift + Mouse
This is necessary for lazy mode start
2018-01-29 18:24:09 +01:00
32a2edb985 Change Pattern drawing to use standard functions
Now the drawing is using the standard functions instead of custom drawing.

Thanks Pablo Vazquez for the trick
2018-01-29 18:15:09 +01:00
c5786b5430 Disable brush temp override for lazy mouse 2018-01-29 18:03:48 +01:00
5fc8ecd129 Use Shift key to toggle Lazy Mouse
Now while drawing you can enable or disable the lazy mouse with the shift key.

If the brush has lazy enabled, shift key disable it. If the brush has lazy disabled, shift key enable it.
2018-01-29 17:45:02 +01:00
5662874163 Replace Polygon Keymap to Ctrl+Shift
This keymap has been changed in order to free the shift key for Lazy Mouse
2018-01-29 16:54:26 +01:00
43a25f9e0f Remove Select keymaps in Drawing mode
These keymaps were enabled by error in this mode
2018-01-29 16:48:25 +01:00
db58fb6c9d Fix cursor error drawing polygons
The cursor had a wrong line due lazy mouse cursor mode that must be hidden in poly mode.
2018-01-29 16:39:52 +01:00
b7df69d3f4 Refine filter event for lazy mouse 2018-01-28 16:33:34 +01:00
bc309de654 Redesign how lazy mouse works
Before it was smoothing the stroke, but this was not the request. Now interpolate mouse position only.
2018-01-28 16:28:10 +01:00
e17f5584e1 Disable cursor color for fill brush 2018-01-28 13:56:15 +01:00
46d4ae5846 Changes in cursor size for lazy mouse 2018-01-28 13:43:54 +01:00
1a2dabbdc7 Small adjust to lazy mouse parameters 2018-01-28 13:36:14 +01:00
e99d2e2b82 Use brush color for lazy mouse line 2018-01-28 13:17:24 +01:00
8ae3c555ec Merge branch 'blender2.8' into greasepencil-object 2018-01-28 11:35:02 +01:00
b3e2c36c87 Fix error in rotation
When rotate using falloff the stroke was scaled because the scale factors was changed by falloff.
2018-01-28 11:20:33 +01:00
04da7dadbb Fix error in cursor color for sculpt modes
The cursor color only must be vsisible in draw mode, not in sculpt
2018-01-28 10:49:45 +01:00
b6d456b5de Fix error when delete all colors and redraw
When delete all colors and draw again, the color index was wrong.
2018-01-27 18:35:03 +01:00
459d4d0e43 Display current color on cursor 2018-01-27 18:27:27 +01:00
8b4dd2a234 More work for Lazy Mouse
Now, the last point is always added in order to get precise end points.
2018-01-27 17:19:26 +01:00
d3834fef65 UI: Move Lazy Mouse options to Stroke panel 2018-01-27 13:44:47 +01:00
6e2ac778b1 Merge branch 'blender2.8' into greasepencil-object 2018-01-27 13:34:17 +01:00
e44fa49310 New Lazy Mouse option
This option delays the mouse movements to create more controlled strokes.

The function calculate the optimal location anmix with th current location.
2018-01-27 13:25:02 +01:00
634e269887 Apply onion opacity factor when fade disabled
If the fade option is disabled, the opacity of the onion strokes is defined by opacity factor and not fixed as before.
2018-01-26 18:19:34 +01:00
bc1f58723c Rename new GP monkey object to "Suzanne"
(Same as we do for mesh monkey)
2018-01-26 16:29:14 +01:00
e3c802a404 Rename empty Grease Pencil object from "GP Object" to "Blank"
Also, name the Monkey palette "Suzanne" (same as we do for mesh datablock/object name)
2018-01-26 16:16:57 +01:00
e38b5adc4f Change minimum alpha value for Onion
Sometimes is necessary to make transprarent and before it was not possible using opacity slider.
2018-01-26 16:07:29 +01:00
13afe1db81 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_edit.c
	source/blender/editors/space_action/action_select.c
2018-01-26 10:54:44 +01:00
501f6b2f75 Merge branch 'blender2.8' into greasepencil-object 2018-01-25 12:25:45 +01:00
a43d39387c Merge branch 'blender2.8' into greasepencil-object 2018-01-24 16:43:39 +01:00
d695bcf28c Merge branch 'blender2.8' into greasepencil-object 2018-01-24 09:44:11 +01:00
fd2517559a Use "Grease Pencil" (not "GPencil") in the Add and Edit menus 2018-01-23 16:46:13 +01:00
Dalai Felinto
1cdcd77831 Fix one of many warnings ... 2018-01-23 12:14:02 -02:00
Dalai Felinto
1d5db1cf43 Icon names fixes after last merge
Bonus: Fix tooltip of GP object
2018-01-23 12:11:11 -02:00
Dalai Felinto
8a9ab51f4d Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2018-01-23 12:02:08 -02:00
6ac4f76fd2 Merge branch 'blender2.8' into greasepencil-object 2018-01-23 10:34:47 +01:00
c695406536 Remove experimental brush 2018-01-22 19:22:16 +01:00
b0993bf7ec Set BOTH mode as default for fill brush 2018-01-22 19:22:16 +01:00
Dalai Felinto
adf93be121 Fix old .dat file for object origin icon 2018-01-22 15:47:52 -02:00
Dalai Felinto
38735cbb1c Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2018-01-22 15:42:05 -02:00
Dalai Felinto
ec90897383 Leave it out uneeded changes from the .svg file 2018-01-22 15:21:48 -02:00
Dalai Felinto
779591efc6 Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2018-01-22 15:14:17 -02:00
0813b3fd42 Merge branch 'blender2.8' into greasepencil-object 2018-01-22 17:54:30 +01:00
fa4c1ad525 Add option to reproject fill on Surface
Before, only origin was supported, now it can be reproject on object surface
2018-01-22 17:21:37 +01:00
55f7d9c127 Merge branch 'blender2.8' into greasepencil-object 2018-01-22 09:19:21 +01:00
d5db310737 Change Special menu to call picker
When the list of colors is too long, the menu is too long, so it's better call the picker menu.
2018-01-22 09:17:39 +01:00
23e365f559 Do no render edit points
The edit points are only visible in viewport but are disabled when make a render.
2018-01-21 16:40:56 +01:00
b8b2fc5660 Add color picker button 2018-01-21 16:25:57 +01:00
1899f24018 Use menu theme colors for color picker panel
Now, the panel colors are consistents with other UI areas.
2018-01-21 16:21:09 +01:00
e631de9a72 Change look of grease pencil color picker
As first step to convert to template, use rounded boxes and standard drawing routines.
2018-01-20 19:10:11 +01:00
4566ff6670 Use different Texture quality for render 2018-01-20 17:35:24 +01:00
689ddd24d8 Merge branch 'blender2.8' into greasepencil-object 2018-01-20 17:10:44 +01:00
bbd71c879e Fix modifier enable/disable on render mode
The old test to verify if the modifier was enabled in render mode used G_RENDER_OGL flag, but for new draw manager, there is a function for that: DRW_state_is_image_render()

Also fixed the problem the cache was not set as dirty before render, so the flags were not updated to draw the correct image.
2018-01-20 16:51:31 +01:00
b0c08068e8 Remove simplify render options
This options are not necessary because for render and viewport use the same options
2018-01-20 13:18:19 +01:00
e4e3f9a244 Fill stroke boundary must be included in strokes draw
If the option of boundary is Strokes, the special boundary strokes must be included as limits.
2018-01-19 16:52:53 +01:00
9533811eac Several fixes after merge
Mainly due parameter list changes and rename of macros.
2018-01-19 16:39:38 +01:00
d314cbe06d Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/gpencil_paint.c
	source/blender/editors/include/ED_gpencil.h
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_view3d/view3d_draw_legacy.c
2018-01-19 16:31:03 +01:00
b1de16e8c2 Merge branch 'blender2.8' into greasepencil-object 2018-01-18 16:59:18 +01:00
6d37f37cf2 Cleanup redundant parameters 2018-01-18 13:16:21 +01:00
4492e1d08a Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/makesdna/DNA_scene_types.h
2018-01-18 12:01:18 +01:00
cfa7daf3a9 Fix problem with buffer when cursor outside camera view
Before, the stroke buffer was converted using the 3D cursor location, but if the camera moves and the cursor was on back of camera, the stroke buffer was not visible while painting.

Now, the conversion is done using the origin of the object and this avoid this problem.
2018-01-18 11:58:17 +01:00
c4a2515628 Merge branch 'blender2.8' into greasepencil-object 2018-01-17 16:09:09 +01:00
dff3ea0647 Change default smooth parameters for brushes 2018-01-17 14:14:17 +01:00
cd3c95afab Merge branch 'blender2.8' into greasepencil-object 2018-01-16 17:20:02 +01:00
0ff7c037bf Merge branch 'blender2.8' into greasepencil-object 2018-01-15 19:21:15 +01:00
abc361736b Fix error with normal vector calculation
In some weird situations, the normal vector of the stroke cannot be calculated and this produces errors, specially in modifiers like lighting modifier.

Now, if the stroke selected is not valid, try with the next stroke to get a right value.
2018-01-15 19:18:21 +01:00
b4a491234c Cleanup and fix comments 2018-01-15 10:47:27 +01:00
f65dbc81d7 Merge branch 'blender2.8' into greasepencil-object 2018-01-15 09:43:09 +01:00
a19b54a1c2 Changed panel back color
The panel back color makes the boxes more visible.
2018-01-14 14:41:40 +01:00
67d9b53868 Change text color for active color
The color of name text change if the color has the focus.
2018-01-14 14:36:57 +01:00
231efa8d58 Fix pattern error
After adding the color name in previous commit, the BLEND option was disabled and the pattern was invisible
2018-01-14 12:09:22 +01:00
43a226cc0a Allow a very long list of colors in picker
For very long palettes, resize panel.
2018-01-14 12:02:20 +01:00
ddcce00885 Merge branch 'blender2.8' into greasepencil-object 2018-01-14 11:17:07 +01:00
09f376ad8d New full set of Brush icons
Icons designed by Matias Mendiola
2018-01-14 11:10:21 +01:00
efe41cecfc Avoid colorpicker window outside view area
Some minor changes too.
2018-01-13 19:04:46 +01:00
de0ca25d6e Make color picker a floating panel 2018-01-13 18:25:22 +01:00
800dae17f9 Include color name in picker 2018-01-13 17:02:20 +01:00
d1f89c9362 New operator to clean boundary strokes
This operator is used to remove the boundary strokes that were created during fill.
2018-01-13 16:26:28 +01:00
25579ab43a Copy color name to color picked temp data 2018-01-13 16:03:11 +01:00
74d3f3c980 Merge branch 'blender2.8' into greasepencil-object 2018-01-13 13:05:17 +01:00
c29fccbccc New no fill strokes for fill boundaries
This special strokes can only be generated using a fill brush and pressing Alt key.

This type of strokes are required to draw fast boundary with the fill color for opened areas to use the automatic fill later.

The color of these strokes will be the fill color and not the stroke color.
2018-01-13 12:50:55 +01:00
d6a5007c81 Merge branch 'blender2.8' into greasepencil-object 2018-01-12 20:02:44 +01:00
b0595c30da Reformat draw mode and help lines for fill
Now the show help lines is a separated option and the draw mode can be used internally without intermediate step.
2018-01-12 20:01:56 +01:00
fad223212f Separate help modes for filling
Now the selector for help lines is separated. Before, some modes where not available because there was some UI options conflict.
2018-01-11 17:19:23 +01:00
e8e47db11e Cleanup. Fix comment 2018-01-11 16:49:19 +01:00
6812848350 Fix error when use fill only colors
The index of the color used was wrong.
2018-01-11 16:47:37 +01:00
520cfab17a Merge branch 'blender2.8' into greasepencil-object 2018-01-11 16:28:22 +01:00
b1af3e26e6 Minor adjust to pattern color transparency 2018-01-11 16:26:59 +01:00
cefa6ca482 Add Ctrl keymap while fill for free drawing
If press Ctrl key while using a fill brush, the brush is used as a normal drawing brush and the artist can draw any shape freely.
2018-01-11 16:11:06 +01:00
430091c8f3 Cleanup unused code 2018-01-11 15:51:12 +01:00
85d4986b7f Fix error after merge
The function name has changed
2018-01-11 12:25:12 +01:00
8df44ca45d Merge branch 'blender2.8' into greasepencil-object 2018-01-11 12:06:10 +01:00
f6b7278a89 For fill brush use only fill colors
If the brush is for fill, the list of color must be limited to fill colors only, except the flag to override this, is enabled.
2018-01-11 12:05:24 +01:00
7e49ba94b3 Small adjust to panel size 2018-01-11 11:55:58 +01:00
63b05784bc Change panel back color 2018-01-11 11:54:04 +01:00
c3e28bad8d Add a pattern to see alpha colors
If the color has alpha, need a pattern to see the transparency effect.
2018-01-11 11:48:33 +01:00
ecba7db010 Add diagonal line if fill color
Add a line if the color box include stroke and fill color.
2018-01-11 11:25:09 +01:00
3fea7cb073 Add ui_scale factor to color picker 2018-01-11 10:04:36 +01:00
50da4885c9 Merge branch 'blender2.8' into greasepencil-object 2018-01-10 19:27:26 +01:00
682685ba22 End operator if click out of panel 2018-01-10 19:15:52 +01:00
b929682dab Remove header text functions
This text is not used in this operator
2018-01-10 19:12:17 +01:00
5d2975382c Set color function 2018-01-10 19:09:36 +01:00
f9426cd686 WIP: Redo colorpicker drawing and mouse cursor 2018-01-10 18:06:05 +01:00
88381086b2 Cleanup code 2018-01-10 14:22:49 +01:00
b8475a1d4c Replace reverse findlink
Fix error in previous commit using reverse find
2018-01-10 14:20:28 +01:00
3138d4468e WIP: Display colors bar
Basic display of colors.

Still the selector is not working.
2018-01-10 11:17:36 +01:00
2549076da1 WIP: Basic structure for new Color PIcker
This operator is enabled using F6.
2018-01-09 19:36:27 +01:00
2774a47f38 Merge branch 'blender2.8' into greasepencil-object 2018-01-09 17:32:25 +01:00
3a7c7c621a Merge branch 'blender2.8' into greasepencil-object 2018-01-09 16:41:46 +01:00
d8ff7b2d15 Disable points if disable_fill is enabled 2018-01-09 08:59:41 +01:00
0c11d68b22 if disable fill, the colors with fill must be omitted
This is done to avoid double borders when fill a previous filled area.
2018-01-08 17:28:19 +01:00
b043ea26ca Use Shift key to fill on back
This key override the draw on back option of the panel for the current fill only.
2018-01-08 17:23:41 +01:00
87d2586c9d Fix Fill over filled colors
The fill offscreen render never must use the fill to avoid false filled areas.
2018-01-08 16:43:08 +01:00
ad29094f91 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/datafiles/locale
        release/scripts/addons
	release/scripts/addons_contrib
2018-01-08 10:41:43 +01:00
807c7b7819 New Weight Smooth operator
Operator to smooth the weights of strokes.
2018-01-07 22:24:59 +01:00
40229d2ab9 Include Thickness of new Fill Stroke
This parameter defines the thickness of the stroke created by fill operator.
2018-01-07 20:27:25 +01:00
c9fb4c8932 Fix problem with drawing flags 2018-01-07 20:15:18 +01:00
f59bbc8524 WIP: More work on fill using new drawing method 2018-01-07 18:09:36 +01:00
7bca6c0b94 Apply new shader to old draw method
(used in modal operators like fill, primitives or interpolate)
2018-01-07 17:46:20 +01:00
607b72584d Missing in previous commit 2018-01-07 17:31:24 +01:00
b31f3c556d WIP: Reorganize parameters in old draw mode
The list of parameters was too long and it's better pass a struct.

This is the first step to use the new shaders with the same functions of Draw manager. This is used in interpolations, filling and primitives while the operator is running.
2018-01-07 17:22:08 +01:00
0562da8166 New Weight Invert operator
This operator invert the weights of the strokes.
2018-01-07 11:59:22 +01:00
bb809c27b2 Make weight paint vertices smaller 2018-01-06 20:17:58 +01:00
33b0d64b24 UI: Change Simplify Name 2018-01-06 17:02:17 +01:00
4b644ea59f Enable Draw on Back for fill Brushes 2018-01-06 14:17:42 +01:00
a21a04efe4 Merge branch 'blender2.8' into greasepencil-object 2018-01-06 10:56:42 +01:00
617839721d Scale stroke thickness when scale stroke
Now when scale a stroke, the thickness is scale to.

The operator to scale only thickness is available too using Shift+S
2018-01-06 10:53:17 +01:00
3c705f4b49 Merge branch 'blender2.8' into greasepencil-object 2018-01-05 17:28:30 +01:00
5606eeeb19 Apply falloff to Scale 2018-01-05 17:24:28 +01:00
67a03921fd Apply falloff to rotation 2018-01-05 17:18:22 +01:00
f2c2f6edec Apply falloff to transform 2018-01-05 16:35:12 +01:00
7ce68ff910 WIP: Save falloff factor for transformations
This data must be used by transformation to determine the effect of the change.

Also enabled the falloff option for edit mode.
2018-01-05 10:48:28 +01:00
a8eec08cf3 Add new parameter after merge
The function has a new parameter
2018-01-04 11:44:19 +01:00
232e805cf4 Merge branch 'blender2.8' into greasepencil-object 2018-01-04 11:31:32 +01:00
abdce7f6ac New simplify fixed operator
This simplify used the same algorithm used in modifier.
2018-01-04 11:29:25 +01:00
2b0c317fb2 New option to fill using colors without fill
This option allows to use for filling a color without fill. This can be very useful for create clean strokes base on several strokes.
2018-01-04 11:13:06 +01:00
96e33c428e Add simplify level
Added a new parameter to define the number of times the new fill stroke is simplified using fixed simplify algorithm.

This simplify reduces the number of points but also the precision of the filling shape for large values.
2018-01-04 11:03:03 +01:00
902c9d01d9 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
2018-01-04 09:44:50 +01:00
dfb68726eb Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
2018-01-04 09:41:09 +01:00
2dfdff0c2e WIP: Improve interface for fill brush
Now is possible to delete it and can have several of them.
2018-01-04 09:37:20 +01:00
b744f47eed Cleanup: Remove dead code, Fix incorrect labels, and Make things more Pythonic 2018-01-04 13:13:14 +13:00
80caab7f5d Don't show edit lines while play animation
The edit lines and points are hidden when the animation is playing.
2018-01-03 19:31:15 +01:00
bd30471479 UI: Make visible only fill color in fill mode
The special menu only shows colors with fill when using fill brush
2018-01-03 19:25:52 +01:00
889a0707c1 Make boundary lines display optional
Now the red lines display that help to show the boundary of strokes is optional.
2018-01-03 19:21:47 +01:00
7f3c86731a WIP: More work for filling brush 2018-01-03 17:46:42 +01:00
99645fcb0c UI: Remove fill operator
Now it's a brush
2018-01-03 17:46:42 +01:00
ba85cecc63 New icons for drawing brushes
Icons designed by Matias Mendiola
2018-01-03 17:46:42 +01:00
b26307991b WIP: Use a brush for filling
Still need more work, but this commit adds the basic structure.
2018-01-03 17:46:41 +01:00
37dab69d96 Merge branch 'blender2.8' into greasepencil-object 2018-01-03 13:00:32 +13:00
8353739de6 Merge branch 'blender2.8' into greasepencil-object 2018-01-02 22:14:09 +01:00
e91f2852eb WIP: Add a leak tolerance for narrow gaps
This is a initial implementation for filling areas with narrow gaps between strokes.

Maybe the limit of the pixel size must be visible in UI panel.
2018-01-02 22:12:56 +01:00
f094eb7c5f Fix memory leak 2018-01-02 13:35:13 +01:00
1d56dce4b7 Cleaunp blank line 2018-01-02 12:58:08 +01:00
a37437af56 UI: Reorganize draw specials menu options 2018-01-02 12:23:20 +01:00
98174d2fa4 New color selection in draw specials menu
A quick color selection in draw special menu. In the future it would be good to add a small icon with the color, but now is not working in the menu
2018-01-02 12:17:30 +01:00
160e02e570 UI: Fix pie menu 2018-01-02 11:57:44 +01:00
905e079dea Add P keymap for fill operator 2018-01-02 10:22:27 +01:00
b0cb6135c2 Remove use of Global Main 2018-01-02 10:17:45 +01:00
6559123149 Cleanup code 2018-01-01 17:45:04 +01:00
dca261bb25 Cleanup: Remove redundant code 2018-01-01 17:22:53 +01:00
18f31a1bc9 Free image memory 2018-01-01 17:13:22 +01:00
389c25e438 Fix problem with axis reproject
Need to convert to object space before reproject
2018-01-01 11:30:01 +01:00
b3848230b3 New reprojection mode: Axis
This new mode reproject the strokes using the same logic of drawing in a locked axis.
2017-12-31 17:16:05 +01:00
240b47b69d Fix error with colorname
This solve the Undo problems too.
2017-12-31 11:03:21 +01:00
60357ef217 Fix error with colorname 2017-12-31 11:03:00 +01:00
26fcf08a4a WIP: First step to support undo in filling 2017-12-30 19:44:11 +01:00
d6d0fbf824 Remove Undo flag 2017-12-30 19:28:23 +01:00
2e57a146ed Cleanup code 2017-12-30 19:13:10 +01:00
0984218adb WIP: Add fixed simplify
The RDP simplify is not working fine, so the simple mode is used now.
2017-12-30 19:11:38 +01:00
42573e00a5 Add stroke to tail
The initial idea was to add to head (on back), but after testing it's better add at the end on top of previous strokes.
2017-12-30 17:25:14 +01:00
be6a5008d7 Merge branch 'blender2.8' into greasepencil-object 2017-12-30 16:58:55 +01:00
c59f6df5eb Fix reproject error for filling 2017-12-30 16:58:03 +01:00
a53a6a80fd Fix problem with primitive reproject
The apply parent must be applied after reproject.
2017-12-30 13:18:07 +01:00
d5ca7d20ed Add primitives to draw special menu 2017-12-30 12:50:58 +01:00
c6ff9d7164 Avoid fill with color without fill enabled 2017-12-30 12:04:05 +01:00
9b60e79b65 Add fill operator to special menu 2017-12-30 12:03:25 +01:00
6726150803 WIP: Fix problems with stroke location
Still problems with reproject
2017-12-29 18:03:47 +01:00
f0ce194137 Use general function to reproject stroke 2017-12-29 17:06:14 +01:00
1fac2cda96 WIP: Add status message and new keys
Still on progress
2017-12-29 10:24:29 +01:00
9c59025289 Remove warning message 2017-12-28 22:12:44 +01:00
5d5a146f6a WIP: Apply smooth to fill 2017-12-28 22:12:28 +01:00
4ca90c7a99 WIP: Create stroke for fill
First step to create strokes
2017-12-28 19:45:48 +01:00
24c6476daf Extract function to be shared in other modules 2017-12-28 16:25:40 +01:00
76518e2a9b WIP: First steps to implement Moore-Neighborhood algorithm
This algorithm is to detect the outline of a image. Now, the function only adds a blue line with the shape to the debug image.

Next step is use this array of points to create a stroke.
2017-12-28 13:34:43 +01:00
6cc0e65f70 Merge branch 'blender2.8' into greasepencil-object 2017-12-28 11:12:31 +01:00
87353fd9f3 Cleanup: Remove debug lines and change some comments 2017-12-28 11:10:55 +01:00
919cdad3e4 New duplicate frame operator and special menu
This operator duplicates the active frame in active (or all) layers. This is very handy for creating step by step animation.

Also, added new special menu in sculpt with W key.
2017-12-28 10:57:51 +01:00
b5696a4701 Merge branch 'blender2.8' into greasepencil-object 2017-12-27 17:04:58 +01:00
d49c6bbd6d WIP: More work in boundary fill 2017-12-27 17:04:00 +01:00
a56c7a5cac WIP: Improve offscreen render
Now, all the render is done in a image to debug results.
2017-12-26 17:58:49 +01:00
6e81d08783 WIP: Add debug lines to show boundary 2017-12-26 12:34:19 +01:00
02680cab7e WIP: Implement Boundary fill algorithm
This algorithm is used to fill the shape that will be used to create the new stroke after analyze the external outline.

The fill is no working yet becaus ethe offscreen drawing is still on progress.
2017-12-25 17:19:02 +01:00
2c6605cd79 Merge branch 'blender2.8' into greasepencil-object 2017-12-23 12:38:39 +01:00
08edee5736 Fix fill problem in opacity modifier
The fill color must be set separated of stroke color. This error was produced by previous commit.
2017-12-22 22:10:36 +01:00
feb0b0ddec Fix opacity modifier using vertex group
Changes in how the vertex group is used in modifier.
2017-12-22 20:02:08 +01:00
3e9db0a92b Fix merge error in brackets 2017-12-22 16:58:41 +01:00
046d8ef6f1 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2017-12-22 16:46:27 +01:00
4523a35c1f Cleanup: Put includes in alphabetical order 2017-12-22 17:07:47 +13:00
3c5d358d89 Joining GP objects also merges + fixes animation data for the merged datablocks 2017-12-22 17:04:22 +13:00
8931c901bf Cleanup: Make it clearer which datablock/object we're dealing with
* gpd_act -> gpd_dst   ("_act" could also mean "active one we're looking at now)
* gpd     -> gpd_src   (we sometimes refer to "gpd" as the active one we're working on)
2017-12-22 15:03:44 +13:00
3d7732eca0 Fix parameter list after merge 2017-12-21 18:21:46 +01:00
aef22a2bb5 Merge branch 'blender2.8' into greasepencil-object 2017-12-21 18:10:31 +01:00
43adb12a1c Cleanup: comments and reorganize 2017-12-21 18:08:55 +01:00
e6e7ba4a08 Apply all modifiers first
The previous commit was the Context missing as parameter and this was the reason of the errors
2017-12-21 17:59:16 +01:00
5f39d41c1f WIP: Initial code to apply modifiers 2017-12-21 16:55:50 +01:00
0362987c0a Copy Vertexgroup when join
The vertex groups were not included in the join.
2017-12-21 16:29:38 +01:00
b7e96c5001 Fix duplicate layer name when join 2017-12-21 13:33:05 +01:00
d92bc7d09a WIP: Basic Join object operator for grease pencil
Still pending:

- Modifiers
- Animation data
2017-12-21 12:52:17 +01:00
be58b71cfc Merge branch 'blender2.8' into greasepencil-object 2017-12-21 10:44:46 +01:00
Dalai Felinto
143f4e52c5 Fix for T53599: OpenGL render with transparent background
I had to make Eevee draw its scene in the scene pass (before it was doing it
in the background pass). This is not ideal since reference images require
a separation between scene and background.

But it's the best way to solve it now. Clay is working fine.
2017-12-20 19:11:38 +01:00
44408d6539 Add warning for Fill operator not implemented yet 2017-12-20 17:47:44 +01:00
796aae61d9 WIP: Define basic struct/functions for modal fill
Not implement yet.

Prepare the different elements required by modal operator.
2017-12-20 17:38:50 +01:00
5cb127a7bd Merge branch 'blender2.8' into greasepencil-object 2017-12-20 16:55:16 +01:00
1dba3b5a23 Remove temp hack for MSVSC2017 compiler 2017-12-20 10:24:32 +01:00
54feb32d9c Fix segment fault when rotate in empty frame
The problem was with the new created frame that was not assigned to loop variable.
2017-12-19 19:41:50 +01:00
9f0978ace6 Provisional hack for fixing MSVC2017 error
This fix will be replaced by final Sergey solution.
2017-12-19 19:15:58 +01:00
6cc85be8c9 Fix desgraph code missing in merge 2017-12-19 17:54:48 +01:00
bb81a12459 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/datafiles/blender_icons.svg
	release/datafiles/locale
	source/blender/depsgraph/intern/depsgraph_tag.cc
	source/tools
2017-12-19 17:43:29 +01:00
259d7a23e6 Reorganize versioning code
After last 2.80.3 version bump, the code can be reorganized and it can be removed any custom hack for Hero files.
2017-12-19 17:06:38 +01:00
cd0f974ce3 Fix segment fault when play with onion
For some reason, when press play there is a delay in the animation flag check and this produces errors. To be sure, we set cache as dirty because the frame is changing.
2017-12-19 16:47:41 +01:00
dc834e25ba Fix compiler warning
The previous commit was wrong
2017-12-18 19:20:16 +01:00
2d533461f1 Fix compiler warning 2017-12-18 19:17:07 +01:00
86c3fbf0db Add alpha factor to mask while filling
If the color fill opacity is equal to 1.0, it's very hard to see the strokes that you want to fill. With this change, always the stroke is visible while painting.
2017-12-18 17:50:21 +01:00
0a3e36df55 Fix UI warning 2017-12-18 17:43:52 +01:00
a6730c6995 Fix problem with merge down
The problem was if the layer below had animation in frames not present in top layer. As the active frame of top layer was the previous keyframe, after merging, the draw of bottom layer replaced the draw of top layer and the result was that some drawings were missing.

The solution was to duplicate the active frame in top layer before merge the bottom layer.
2017-12-18 17:29:09 +01:00
6efbe39712 Fix: Don't assume that rect starts from 0,0 2017-12-19 01:14:49 +13:00
140649b872 Fix: Missed these in last commit 2017-12-19 01:13:33 +13:00
cbe4c97de3 Cleanup - Save off multiedit state instead of querying it all the time 2017-12-19 00:53:47 +13:00
9c30702372 Cleanup - Split out the GP stroke sculpting loop-over-strokes logic into a separate function 2017-12-19 00:35:35 +13:00
4015bed382 Cleanup + Optimisations for GP Sculpt Multiframe
* Only initialise the falloff curve's internal data once per run,
  instead of once per layer. We can probably even make this only happen
  once for each run of the operator, as it shouldn't be possible to change
  the curve in the meantime (requiring the data to be recalculated)

* Save off the multiframe falloff option into a variable instead of
  doing the full check each time.

* Only calculate "diff_mat" once for each layer, instead of once for
  each GP frame for multiedit. (Note: We weren't taking the frame numbers
  into account anyway, so it doesn't matter to pull this out. However,
  technically, if the layer was parented, we'd actually need to have been
  recalculating the parents transforms for each of the multiedit frames
  to get the real intended effects)
2017-12-18 21:47:28 +13:00
f1996fa124 Minor Optimisation for GP Grab brush
Write directly to the point instead of writing to a temporary value first
2017-12-18 21:29:30 +13:00
56e73e31ce WIP: Replace GL types by generic types 2017-12-17 20:36:08 +01:00
5fdb22ffd7 WIP: Initial test for offscreen render
Initial test to make a proof of concept of the render in textures.
2017-12-17 20:16:29 +01:00
92c3b81490 Fix segment fault when delete object
The active object got null and this produced a segment fault.
2017-12-17 19:57:33 +01:00
09bc242bfd Use round caps while drawing 2017-12-17 17:16:41 +01:00
6147d8c9d3 Reduce size of round cap 2017-12-17 17:16:25 +01:00
7e52e6839c Merge branch 'blender2.8' into greasepencil-object 2017-12-17 16:28:02 +01:00
95dcd183fe New rounded end caps
Now the stroke ends are rounded to get more artistic look.
2017-12-17 16:18:16 +01:00
51a22cd6db Merge branch 'blender2.8' into greasepencil-object 2017-12-16 10:54:31 +01:00
2dff68f423 Fix multiframe error when lock layer
There was a segment fault if the some layer was locked and enable multiframe edit / sculpt or weight paint.

The shading group must be created because is used in multiedit lines.
2017-12-16 10:46:09 +01:00
5f527f0885 WIP: Experimental Offscreen buffer for fill
Simple implementation of stroke drawing to texture
2017-12-15 18:34:27 +01:00
8dfc08d14e Fix merge errors
There was a problem with struct byte alignment.
2017-12-15 13:17:20 +01:00
384d1f80ad Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
	source/blender/draw/intern/draw_cache_impl.h
	source/blender/makesdna/DNA_scene_types.h
2017-12-15 12:44:37 +01:00
ca6588d5da Delete with Border select in paint mode
This commit is similar to Lasso, but for border select.
2017-12-15 12:34:31 +01:00
c4dbe9448c New Eraser with Lasso select
When you are in paint mode, if press Ctrl+Alt and select with lasso tool, the points are removed.

This is a request of the Hero team after been working in cleanup process. The Lasso delete allows to remove very fast areas of the drawing.
2017-12-15 12:31:13 +01:00
4de69e3e1a Cleanup: Function to avoid code duplication 2017-12-15 11:44:38 +01:00
fa2cd280ac Add Erase stroke with Ctrl key
If press Ctrl over a stroke while using the eraser, the stroke is fully deleted, not point by point
2017-12-15 11:40:22 +01:00
7f419a5615 Enable Hard Eraser with SHIFT
While you are drawing, if press Shift key, the eraser delete points with one contact only and does not depends of pressure.

This is very useful for fast remove.
2017-12-14 18:16:09 +01:00
fe4f00d31b WIP: Basic modal structure for fill operator
This is the first step to implement a fill operator.

This commit only adds the modal operator but the filling is not implemented yet.
2017-12-14 17:05:20 +01:00
858cc7ac9d Merge branch 'blender2.8' into greasepencil-object 2017-12-13 16:48:31 +01:00
e4a3c50d12 Cleanup: Use mathlib funcs instead of inlined math 2017-12-13 22:28:21 +13:00
aed2a49571 Cleanup: Whitespace 2017-12-13 22:18:37 +13:00
f775fff246 Cleanup: Split GP Sculpt and Weight Paint panels into separate classes
This resolves the need for the draw_header() + empty bl_label
hacks used to try and get this changing dynamically.
2017-12-13 22:09:43 +13:00
54aefbf789 Cleanup: Various small issues noticed earlier
* Rename BKE_get_falloff_factor() to BKE_gpencil_multiframe_falloff_calc()
  and make it return value instead of passing in a pointer to fill.

* Rename "gso->falloff" to "gso->mf_falloff" to be less ambiguous

* Fix indentation issues in gpencil_brush.c
2017-12-13 22:09:41 +13:00
411e9b6731 Fix: Remove leftover debug print 2017-12-13 22:09:40 +13:00
a0c462ed42 Fix problem when hide collection
When hide the collection the strokes were not hidden.
2017-12-12 17:24:03 +01:00
2bba82ad7f Merge branch 'blender2.8' into greasepencil-object 2017-12-12 10:32:31 +01:00
d1cf5b54b5 Apply scale weight to Offset modifier
This parameter was using the weight in a wrong way. As the offset is a change in the values, the default value change is 0, not 1, so a scale offset of 1 means add 1 to default scale.
2017-12-12 09:29:22 +01:00
dd5e338661 Merge branch 'blender2.8' into greasepencil-object 2017-12-11 10:40:03 +01:00
7babe1f40c Improve Simplify modifier
- Now it's possible to define number of iterations for fixed mode.
- New mode selector instead of checkboxes
- Changes in UI
2017-12-10 17:10:49 +01:00
2ed89b09d2 Added ID_GD to the OB_DATA_SUPPORT_ID/OB_DATA_SUPPORT_ID_CASE macros
From the looks of things, all object-linked ID types should be
included in here.

While checking on this, I also found a missing case for GP object
in Main.objects.new()
2017-12-11 00:42:40 +13:00
5b56788cee Merge branch 'blender2.8' into greasepencil-object 2017-12-10 10:21:16 +01:00
ad7d868870 Change Hook modifier flags
There were some flags that must be removed.
2017-12-10 10:20:28 +01:00
dc686e1d82 Simplify use of VFX shading groups
The drawing functions was using an additional shading group pointer that it was not used, so it can be removed.
2017-12-10 10:16:51 +01:00
87fe1e5af2 Cleanup: Remove intermediate variable for Wsize 2017-12-10 09:24:14 +01:00
e166558ddd Rename property for full color and fill 2017-12-10 09:20:37 +01:00
df07efeeef Fix typo error using wrong variable 2017-12-09 23:27:45 +01:00
6957967e99 Apply weight only for loc/rot
The weight cannot be used for scale.
2017-12-09 22:52:57 +01:00
eb47e7e219 Offset modifier cannot use weight
The weight is a parameter that produces weird results.

Remove this option while find a better solution.
2017-12-09 20:58:59 +01:00
740506c7af Add new option to simplify alternate points
THis option remove alternated vertex from stroke except the extremes
2017-12-09 20:52:20 +01:00
c4e595aaf3 New Normalize thickness parameter
Now the thickness modifier has a parameter to assign the same thickness to all strokes.
2017-12-09 20:09:43 +01:00
fc38575461 New Vertex Group menu with Ctrl+G in Edit mode 2017-12-09 19:54:12 +01:00
40e6d673d8 UI: Expand default palette color list
The gray color was hidden.
2017-12-09 19:34:49 +01:00
62c694817e Change name in Add Object menu 2017-12-09 17:44:24 +01:00
25dbc0a9d4 Change Q key to show editlines and multiedit lines
New keymap:

Q: Toggle Edit lines
Shift+Q: Toggle Multiframe lines
2017-12-09 17:40:30 +01:00
4aee6cf376 Show Edit Lines must be a main switch
This option must be a general switch and not be affected by multiframe edition
2017-12-09 17:23:08 +01:00
fbdc28bab7 Disable by default simple subdivision 2017-12-09 17:15:20 +01:00
b1e9fd5e2b UI: Add alpha to colors in color list
Sometimes is better to access to alpha from here and not from stroke or fill panel.
2017-12-09 17:09:57 +01:00
7335e09129 Add default grey color with fill to default Palette 2017-12-09 17:02:35 +01:00
73d5253681 UI: Remove slider mode for thickness change 2017-12-09 16:58:01 +01:00
23a0b821d3 Remove strength curve in Pencil brush
This default was not working fine in all devices.
2017-12-09 16:52:48 +01:00
568f55e3cc New Draw Specials menu with X key
Now this menu only has the option to delete frame, but can hold more options in the future.
2017-12-09 16:50:33 +01:00
9c350fa98f Change default onion mode to keyframes 2017-12-09 16:42:10 +01:00
7141870483 Cleanup: Remove unused code 2017-12-09 16:35:21 +01:00
1955607d69 Fix pixel scale in VFX pixel 2017-12-09 16:34:34 +01:00
4cf759493d Avoid div by zero 2017-12-09 16:30:38 +01:00
b6b9e14fb6 Remove unused field 2017-12-09 16:25:43 +01:00
8707d29917 Fix VFX Swirl modifier
There was a problem with the conversion between screen space and camera space.
2017-12-09 16:20:39 +01:00
ac102ff163 Change Energy scale * 100 2017-12-08 19:48:21 +01:00
dc70a28c89 Fix problems with vfx light modifier
There was some problems with coordinate system between screen space and
camera space.
2017-12-08 19:19:22 +01:00
4286b5d424 Fix problems with VFX light modifer
There was a problem with the conversion of coordinate system between screen space a camera space.
2017-12-08 19:12:29 +01:00
3052223870 Fix: Add depsgraph relations from Palettes to GP data
This fixes problems where changing Palette setings (such as fill opacity)
should refresh the viewport (e.g. if there wasn't a fill before, changing
the slider should make it appear, instead of requiring a framechange to
make that happen).
2017-12-08 18:25:14 +13:00
401b9ee907 Fix compiler warning 2017-12-08 17:13:50 +13:00
28d9ad0ce1 Merge branch 'blender2.8' into greasepencil-object 2017-12-08 15:50:23 +13:00
a8fac7eca9 WIP: Testing new system to define light position 2017-12-07 22:50:17 +01:00
e77117f87f Cleanup: Remove unused variables 2017-12-07 10:07:50 +01:00
9df920be2e WIP - Some debug code to try to figure out why artists are getting random crashes here
Start blender with the debug (-d) flag to see debug prints for
cases of unhandled updates.
2017-12-07 19:40:09 +13:00
b2c84c5363 Fix merge error 2017-12-06 22:22:59 +01:00
35f774d269 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
2017-12-06 22:15:18 +01:00
e051af9cfd Add VFX Light a object to define light position 2017-12-06 22:07:14 +01:00
2772e1564e Remove color of light
After run some test, this value is not valid in 2D. To tink there is a modifier already.
2017-12-06 21:32:05 +01:00
fabf8717b3 Use function to avoid duplicated code 2017-12-06 17:50:10 +01:00
a3930268e1 New VFX light modifier
This modifier simulates a point light over the stroke. There is not shadows support and use its own internal lamp point. Only ambient and diffuse.

The use of this VFX is to get special effects. In the future, a real lighting system can be implemented using normal Blender lamps, but this is different of this modifier.
2017-12-06 17:41:56 +01:00
b2f32605d2 Merge branch 'blender2.8' into greasepencil-object 2017-12-05 19:05:04 +01:00
4420dc9d71 Merge branch 'blender2.8' into greasepencil-object 2017-12-05 17:05:06 +01:00
0daa869514 Change Drawing brushes default radio 2017-12-05 17:03:31 +01:00
6b4a7cd104 Make Noise position factor less sensitive 2017-12-05 15:53:58 +01:00
ac8e2772dc Change default Drawing brushes 2017-12-05 12:39:11 +01:00
2bb3c94b54 Increase again the maximum value for sculpt brushes
For some operations the old value was too small.
2017-12-05 11:14:46 +01:00
1739e1d6eb Change default edit line color
The alpha was too low
2017-12-05 11:09:35 +01:00
0dfa3436d8 UI: Add show edit line button to bottom bar 2017-12-05 11:05:56 +01:00
859eefde45 Change default Sculpt brush to PUSH
This default only works for new files, but it doesn't change old files.
2017-12-05 10:55:55 +01:00
a0c2f41d12 Set Ink brush as default 2017-12-05 10:45:22 +01:00
055bbc43e6 Increase maximum sculpt brush size 2017-12-05 10:42:53 +01:00
10228e6a3b UI: Move brush settings to bottom 2017-12-05 10:33:13 +01:00
2b50ea8eaf Increase maximum thickness 2017-12-05 10:32:46 +01:00
0891946c24 Change default pixfactor to 1000 2017-12-05 10:28:04 +01:00
bb217e42ca UI: Set panels closed by default 2017-12-05 10:21:21 +01:00
f635700d3d Merge branch 'blender2.8' into greasepencil-object 2017-12-04 16:56:09 +01:00
40cc91e630 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/readfile.c
2017-12-04 15:57:10 +01:00
1ddd023be1 Merge branch 'blender2.8' into greasepencil-object 2017-12-04 08:29:08 +01:00
4775b84ad9 Merge branch 'blender2.8' into greasepencil-object 2017-12-03 08:47:31 +01:00
a5ea509f38 Revert "Temp fix to compile"
This reverts commit 06950efb94.
2017-12-03 08:46:23 +01:00
06950efb94 Temp fix to compile
I change this lines waiting for Sergey final fix in Blender2.8 branch
2017-12-02 12:25:08 +01:00
1dce29a10f Cleanup previous fix code 2017-12-02 11:41:06 +01:00
3fb13ea5ff WIP: Fix some merge errors
Still some more errors pending
2017-12-02 11:39:28 +01:00
6f213c32e8 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2017-12-02 11:28:07 +01:00
05b82b21cc Increase default sise of batch slots 2017-12-02 11:17:10 +01:00
f6c77e51dc Cleanup: Remove unused parameter 2017-12-02 11:04:08 +01:00
dedeee51ac Replace hardcode value with define 2017-12-02 10:46:30 +01:00
ddec812c5b Fix crashes after selecting GP keyframes with onion skinning enabled
The code here was still using the old approach of just tagging all
GP datablocks for recalculation, instead of the newer depsgraph
tagging approach.
2017-12-02 11:37:11 +13:00
3f8be67811 Minor tweak to the "bell" curve for Multiframe Falloff for smoother curve
While this may not be "technically" correct for a Gaussian curve,
visually (judging from the curve) this seems to be a lot smoother.
2017-12-02 11:11:50 +13:00
809fc4807a Make falloff function external to reuse
Move the calculation of falloff factor to a separated function to be reused in transformations.
2017-12-01 17:27:51 +01:00
c78e8b0563 Merge branch 'blender2.8' into greasepencil-object 2017-12-01 15:58:09 +01:00
fbd80673c8 Fix falloff error when layer has no active frame 2017-12-01 15:56:33 +01:00
a960060ef2 UI: Minor changes to enable/disable multiframe options 2017-12-01 10:53:48 +01:00
4e3fb10dc4 Merge branch 'blender2.8' into greasepencil-object 2017-12-01 10:35:28 +01:00
36188466da UI: Show falloff only in sculpt mode
Changed the icon and other minor changes.
2017-12-01 10:32:49 +01:00
d6ec57055f Redo Hero initialization curve hack code
There was a problem aving files. The curve was reset for each reload.
2017-12-01 10:09:43 +01:00
1b5561cf03 GP Modifiers: Split into multiple columns
The modifiers list was starting to get a bit long to just have all of
them in the same column.

Also fixed various typos and tweaked some tool tips.
2017-12-01 16:19:11 +13:00
4324242557 UI Tweak: Move the multiedit toggle to the panel header (instead of being a separate button inside) 2017-12-01 15:30:11 +13:00
4af8f8574a Added comment noting why the GreasePencilStrokeSculptPanel has an empty label 2017-12-01 15:27:16 +13:00
e13875ec17 Cleanup: Fix comment 2017-11-30 23:09:52 +01:00
e7dea06ba5 Temp Hack: Fix initialization code for Hero open movie files
The initialization code must be moved to next version to manage Hero files.

This section of code must be merged to the previous version as described in the comments.
2017-11-30 22:06:53 +01:00
042298f6a3 Adjust UI to use new properties for falloff 2017-11-30 20:11:10 +01:00
6979cc61e9 WIP: Calculate falloff factor 2017-11-30 20:03:59 +01:00
cee80b3317 New function to get frame range selected 2017-11-30 19:11:45 +01:00
4cbd5933f7 WIP: New Gauss bell curve preset 2017-11-30 18:55:05 +01:00
c787419600 WIP: Implement new cuve for multiframe falloff
Still need to define curve with bell shape and apply the falloff to multiedit.
2017-11-30 17:34:48 +01:00
ee7e4d25d5 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/object/object_relations.c
2017-11-30 15:34:21 +01:00
f86f826f19 GP Build Modifier - Layer Masking support 2017-11-30 17:17:16 +13:00
52aa4a8af5 Fix: Menu with various extra operators for active palette color was missing 2017-11-30 16:34:58 +13:00
00c18441bf Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
2017-11-29 18:58:08 +01:00
ca348646a3 Fix merge errors 2017-11-29 16:59:23 +01:00
c89d24ccbd Merge branch 'blender2.8' into greasepencil-object 2017-11-29 16:49:39 +01:00
0ecbe2171a New Grease Pencil Offset modifier 2017-11-29 16:47:25 +01:00
645b146395 Avoid some operators in multiframe edit mode
As initial idea is better to keep limited to single edit mode, but maybe in the future we can enable it.

The reason to limit them is because in some situations the artist can get confused with the edition he did if multiframe is activated and could consider the operation as a bug when really was working as expected.
2017-11-29 12:22:28 +01:00
e425cbb99f Fix multiframe delete
The stroke delete was not working with multiframe because it was checking only active frame and not the whole selected frames range.
2017-11-29 12:06:40 +01:00
849337bd78 Move Paper settings to View
Now the paper can be enabled by view and not by scene as before because this is a view settings.

Thank Pablo Vazquez for his UI feedback.
2017-11-29 11:45:43 +01:00
7c9f41f98f Merge branch 'blender2.8' into greasepencil-object 2017-11-29 10:38:03 +01:00
2392dc8246 New VFX Flip modifier
This modifier flip horiz. or vertically the current gp object image. The flip works in screen space
2017-11-29 09:36:43 +01:00
47898a5777 Fix rename fields after merge 2017-11-28 16:27:36 +01:00
61f9310bda Merge branch 'blender2.8' into greasepencil-object 2017-11-28 16:16:46 +01:00
7b8e127902 Reuse show_keys_from_selected_only for jump frames
It's better to reuse this option that is already defined by scene.
2017-11-28 14:11:11 +01:00
94efac4297 Add edit point custom shader
The previous shader was not working in some Intel cards, and these commit is to replace with a new shader that works in all card types.
2017-11-28 13:45:05 +01:00
aef88cd76a Fix chnaged lines by error in previous commit 2017-11-28 11:17:29 +01:00
ee157def31 Merge branch 'blender2.8' into greasepencil-object 2017-11-27 17:26:10 +01:00
dde37368ed UI: Change to only selected icon 2017-11-27 17:22:47 +01:00
c29174eedf Dopesheet jump frame in active layer
This new function allows to enable the frame jump only in active layer and not in all visible layer.

This was a request of Hero open movie artist team.
2017-11-27 17:07:45 +01:00
bb72601d89 Merge branch 'blender2.8' into greasepencil-object 2017-11-27 10:12:28 +01:00
3a686cdf24 Merge branch 'blender2.8' into greasepencil-object 2017-11-26 09:22:12 +01:00
fe04bf0800 Use weight in Hook modifier 2017-11-25 16:10:22 +01:00
70e87a7ac1 Change Hook modifier default parameters 2017-11-25 13:53:24 +01:00
9ea7fb3982 WIP: Fix write hook data 2017-11-25 13:47:30 +01:00
9215e2a097 WIP: Hook modifier initial basic stage 2017-11-25 13:36:57 +01:00
fe82a8257a Merge branch 'blender2.8' into greasepencil-object 2017-11-25 11:18:26 +01:00
e37b251d7a Merge branch 'blender2.8' into greasepencil-object 2017-11-24 16:45:14 +01:00
b1035ae3ac Cleanup code 2017-11-24 16:43:57 +01:00
d41095f308 Use theme default grid color 2017-11-24 11:04:15 +01:00
19624c8dd7 UI: Redo paper panel 2017-11-24 10:41:58 +01:00
6f8ee14340 Change color for grid lines 2017-11-24 10:38:53 +01:00
5517049481 Add grid option to grease pencil paper
Default values added too.
2017-11-23 22:37:13 +01:00
e2adbc9bca WIP: New paper function
This function allows to cover full viewport with a predefined color. This allows to hide the geometry in complex scenes and make the drawing area cleaner.

This function was requested by artist after working in Hero open movie using complex scenes with a lot of geometry "behind" of the grease pencil drawings.
2017-11-23 19:54:56 +01:00
8102646a9f WIP: New smooth thickness parameter
These parameters are part of the smooth test and can be removed in the future.
2017-11-23 18:23:27 +01:00
acad042fdf Remove Brush test parameters
After doing some test, remove several parameters added to verify smooth stroke.
2017-11-23 18:23:27 +01:00
Dalai Felinto
3ac2577e86 Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2017-11-23 15:05:23 -02:00
5e37797caf Cleanup debug prints 2017-11-24 03:29:55 +13:00
260b747d33 GP Build Modifier: Fix "Concurrent" Mode
The last segment of shorter strokes was always suddenly appearing.
it turns out the at the formulations for those factors was off.
2017-11-24 03:29:55 +13:00
5edb6d437a GP Build Modifier: Rename direction -> transition, and rearrange UI panel 2017-11-24 03:29:54 +13:00
3b4afd5ca1 GP Build Mod Fixes
* Sequential mode now works - Accidentally removed the important tallying
  step when cleaning up the code earlier

* Typo - Was looking for "direction" values in the wrong field
2017-11-24 03:29:53 +13:00
57344862d9 Fix crashes
* Forgot to remove strokes from frame before deleting their data
* Typo - Used old "gps" pointer not "cell->gps"
2017-11-24 03:29:52 +13:00
f43aecba88 GP Build Modifier - RNA + UI 2017-11-24 03:29:52 +13:00
bb090d1acd Show an error message if a GP modifier cannot be applied instead of failing silently 2017-11-24 03:29:51 +13:00
47c9dda076 GP Build Modifier: Initial WIP implementation of this modifier
It's likely that there are still many bugs here, so caution is advised.
2017-11-24 03:29:50 +13:00
05f5dc14a0 Partially revert rBc038bbbce2b 2017-11-24 03:28:11 +13:00
Dalai Felinto
7c7ab48dec Remaining warning in grease pencil 2017-11-23 10:50:45 -02:00
Dalai Felinto
9f47ddeb8a Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2017-11-23 10:49:58 -02:00
Dalai Felinto
a6d584fc46 Merge commit '3abe8b3292cf7a50a9200b95401993384df24d9a' into greasepencil-object
Note: Since grease pencil had its own subversion, and this merge brings 2.80
subversion 2 as well, the files should be saved BEFORE this commit, to be sure
that all the doversion happened.
2017-11-23 10:44:51 -02:00
Dalai Felinto
fd9407ada5 Merge commit '3abe8b3292cf7a50a9200b95401993384df24d9a^' into greasepencil-object 2017-11-23 10:20:44 -02:00
Dalai Felinto
c038bbbce2 Silence warnings
Please keep the code warnings-free as much as possible.
2017-11-23 10:17:22 -02:00
2a47ede614 UI: Add buttons at bottom bar
Add Only Render and Lock Camera View options to bottom toolbar because use the options in panels break the drawing workflow and use a lot of space in the drawing area.
2017-11-22 19:11:51 +01:00
c9c8bfdba1 Fix error after merge 2017-11-22 19:00:24 +01:00
b24034544c Merge branch 'blender2.8' into greasepencil-object 2017-11-22 18:50:53 +01:00
7fee462be0 Merge branch 'blender2.8' into greasepencil-object 2017-11-22 16:31:49 +01:00
59f1f76151 Merge branch 'blender2.8' into greasepencil-object 2017-11-21 10:22:19 +01:00
a5995d8161 Move BKE_gpencil_batch_cache_alldirty()'s debug value to 66
This Makes it possible to set this without seeing all the stats in the way
2017-11-21 12:17:08 +13:00
6c7bd14ac3 Cleanup - This code shouldn't be needed anymore 2017-11-21 12:17:07 +13:00
a666a5d016 UI: Rename MultiEdit to MultiFrame 2017-11-20 19:12:52 +01:00
df9b547323 Merge branch 'blender2.8' into greasepencil-object 2017-11-20 10:42:27 +01:00
48bb9e1697 Merge branch 'blender2.8' into greasepencil-object 2017-11-19 15:53:39 +01:00
23d820c240 Cleanup include files 2017-11-17 16:38:33 +01:00
9a6be73429 Fix merge error
VS2017 crash in the midle of the merge process and created wrong git tag lines
2017-11-17 16:29:01 +01:00
b3a0b423a6 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/draw/intern/draw_cache_impl.h
2017-11-17 16:27:55 +01:00
ff6e2e82ea Fix: Crash when moving GP frame so that it replaces the one before it
This crash only occurred in a particular file, when onion skinning was
enabled. For some reason, the fact that this function was clearing the
layer's actframe (when the frame being deleted wasn't currently active)
was causing problems. I'm guessing that the GP draw engine code currently
assumes that gpl->actframe will always be set/valid?
2017-11-18 02:46:29 +13:00
a9482038ed Merge branch 'blender2.8' into greasepencil-object 2017-11-16 18:48:29 +01:00
d9d5166953 Merge branch 'blender2.8' into greasepencil-object 2017-11-16 14:35:15 +01:00
d772b1d934 Fix crashes when loading old GP files from 2.79
Moved all the datablock-twiddling version patching magic to the
"after_liblink" version patching function. Apparently the problem
was that many of the old pointers had not been fixed up at that point,
causing problems if relying on accessing their contents.
2017-11-17 01:16:40 +13:00
d482857965 Merge branch 'blender2.8' into greasepencil-object 2017-11-15 19:31:48 +01:00
815c00270c WIP: Create SceneLayer if missing 2017-11-15 17:24:53 +01:00
b4f08d135b Change texture format
Due draw manager changes, the texture must be DRW_TEX_DEPTH_24_STENCIL_8 instead of DRW_TEX_DEPTH_24
2017-11-15 09:47:45 +01:00
b7efe91893 Merge branch 'blender2.8' into greasepencil-object 2017-11-15 14:33:01 +13:00
e6a0b442c7 Enable antialiasing while drawing
The antialiasing was not activated for previous strokes, only for current.
2017-11-14 16:04:41 +01:00
8c5bff94d1 Fix: Temporary fix for crashes when moving GP keyframes when toggling Onion Skinning
ANIM_list_elem_update() was not doing anything as ale->id was null,
and we were filtering the channels by "animdata" blocks (i.e. the GP
datablocks). While technically what we're doing here isn't totally
correct (I'll need to come up with a better fix tomorrow), this will
be a good quick-fix for the crashes they animators are currently getting.
2017-11-15 02:57:01 +13:00
8c07cf1385 Fix compile errors after merge 2017-11-14 23:49:55 +13:00
8119b65b86 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/versioning_280.c
2017-11-14 23:49:51 +13:00
715c58d6bf Cleanup: Remove unused code 2017-11-14 09:53:38 +01:00
28142f5fa5 WIP: More work in smooth process 2017-11-13 19:31:40 +01:00
0dc9be1ef9 Fix merge errors 2017-11-13 19:13:12 +01:00
c03361474b Merge branch 'blender2.8' into greasepencil-object 2017-11-13 19:02:50 +01:00
0b7c2ef28b Smooth Strength and Thickness too 2017-11-13 18:12:52 +01:00
aaed57792f Improve subdivide stroke while drawing
Now instead of create a point half way, a smooth process is applicated.
2017-11-13 17:58:58 +01:00
5819ab66fa WIP: Check minimum tablet pressure
In some tablets when the user ends the stroke the tablet send several events with a pressure of 0 or with very low values. These low pressure values produce weird lines at the end of the stroke.
2017-11-13 16:45:33 +01:00
330febba5a Cleanup UI and unused fields 2017-11-13 14:35:14 +01:00
8b97a539aa New Smooth modifer
Allow to apply smooth to the stroke after drawing.

This is not related to the smooth of the stroke while drawing.
2017-11-13 11:01:44 +01:00
98cf19c7ed Cleanup extra space 2017-11-11 19:12:14 +01:00
541d7415bf WIP: Remove smooth lower limit
These lines were for debug only and must be removed
2017-11-11 18:55:11 +01:00
4126de5114 Fix merge errors
The ruler was using old grease pencil structure and palettes.

This need more attention in the future.
2017-11-11 16:35:17 +01:00
1d8b9681fe Merge branch 'blender2.8' into greasepencil-object 2017-11-11 16:16:41 +01:00
333e32e0e1 WIP: Smooth Thickness and Strength
This mooth the thickness of the strokes using points before and after. The same for strength (alpha)

Some cleanup too.
2017-11-11 16:13:55 +01:00
42b43925fb Fix error in previous commits 2017-11-10 20:12:11 +01:00
4cb437d42f WIP: Readjust smooth thickness weights 2017-11-10 20:10:21 +01:00
c5131c95e7 WIP: Readjust weight for stabilize 2017-11-10 20:09:36 +01:00
fce610eeed WIP: First test for smooth thickness 2017-11-10 20:08:51 +01:00
cbd15d1452 WIP: More work to get better drawing feeling
Thre was some problems in previous commits
2017-11-10 19:14:58 +01:00
6d272e612e Remap pixel scale parameter
The value for control point density was strange.
2017-11-10 09:00:06 +01:00
7bf104abd7 Compile fixes after merge 2017-11-10 12:39:28 +13:00
5354c80037 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/draw/modes/object_mode.c
	source/blender/editors/include/ED_gpencil.h
	source/blender/editors/space_view3d/view3d_draw_legacy.c
2017-11-10 11:43:38 +13:00
464eb5b042 Cleanup: Fix compiler warnings 2017-11-09 19:29:57 +01:00
ff13b291b0 Cleanup: Supress compiler warning 2017-11-09 19:23:58 +01:00
526e2291ff WIP: New parameters for brushes
More parameters to define how the stroke is stabilized.

This parameters maybe are not necessary on UI, but we need them now for testing different values.
2017-11-09 16:41:10 +01:00
712c3a86ed WIP: Fix error in smooth lines
Need to check the distance of previous points, not new with previous.
2017-11-09 12:46:22 +01:00
a73f098668 WIP: Reduce points when stroke is slow
Initial work to reduce the noise when the stroke is done very slow removing points not relevant.
2017-11-09 11:50:51 +01:00
6484646103 Merge branch 'blender2.8' into greasepencil-object 2017-11-09 19:34:42 +13:00
e7a016d368 Fix compiler error 2017-11-08 08:52:52 +01:00
f1b0d3f349 Merge branch 'blender2.8' into greasepencil-object 2017-11-08 08:37:32 +01:00
23981fad45 WIP: As a temporary measure for fixing GP cache invalidation crashes,
re-enable BKE_gpencil_batch_cache_alldirty_main() when debug_value = 660
2017-11-08 14:15:53 +13:00
ab83695711 Updating the hacky eval_ctx construction to use more official functions 2017-11-08 13:22:54 +13:00
7b9595d366 Fix: Added some more tags/relations in depsgraph to fix crashes when Onion Skinning is enabled
* id_tag_update_object_data() - Added a case for the GP datablock type
  so that depsgraph tagging via the GPencil datablock's RNA properties
  works. Previously, only the object.data case (i.e. modifiers) was handled.
  This fixes a crash when enabling onion skinning, and a ghost can be shown
  on the neighbouring frames.

* DepsgraphRelationBuilder::build_obdata_geom() - Added a relation between
  timesource and GP geometry (i.e. where cache rebuild occurs). This fixes
  a crash after scrubbing the timeline when onion skinning is enabled
  (I'm guessing due to onion skinning suddenly getting re-shown, but the cache
  not doesn't contain this info due to the previously being updated for animation)
2017-11-08 13:22:25 +13:00
fa3c3438a2 Apply stabilization in segments with a minimum size
If the points are too near, the stabilization must be disabled.

This modification is still WIP, needs more artist feedback to verify if works.
2017-11-07 18:34:40 +01:00
94a3f0f089 Merge branch 'blender2.8' into greasepencil-object 2017-11-07 16:15:44 +01:00
98556dc965 Improve stabilization function
Now the previous point is smoothed too to get a better transition.
2017-11-07 16:12:35 +01:00
2a86495125 Improve thickness fix when no locked axis
There was some problems with the thickness when the axis was not locked that were not fixed in previous commit.
2017-11-07 13:46:09 +01:00
82eaf7a13d Merge branch 'blender2.8' into greasepencil-object 2017-11-07 12:30:25 +01:00
53822bd1d7 Fix error when axis not locked
The size of the stroke was not correct when the axis was not locked.

It needs a vector to the view to calculate the real size of the stroke.
2017-11-07 11:58:22 +01:00
9fc8ec1817 Redo Fix in previous commit and add missing lines 2017-11-07 11:30:21 +01:00
30cfbec6e2 UI: Remove deprecated property
The OBJECT mode was removed as property.
2017-11-07 11:08:30 +01:00
e19e686edb Merge branch 'blender2.8' into greasepencil-object 2017-11-07 10:44:43 +01:00
a051c2e870 New parameter to adjust stabilization
Parameter to control the stabilization amount of the brush.

This stabilization works as a dynamic smooth using the previous points to calculate the estimated position and average the position to get smoother strokes.

This is not a replace of smooth factor that works after finish stroke. This new parameter is applyed while drawing before ending the stroke.
2017-11-07 10:43:55 +01:00
e176d66cbe Fix: Depsgraph was complaining in debug mode about the "geometry_eval" opnode for GPencil not having any function attached
In future, maybe we should move the derived_gpf calculations
(and by extension, the modifier-evaluation loops) into the
BKE_gpencil_eval_geometry() callback added in this commit.
2017-11-07 20:51:54 +13:00
806aa232fe WIP 2017-11-07 19:41:53 +13:00
03235ea672 GP drawing: Try to init the eval_ctx from draw_ctx, if C isn't provided 2017-11-07 19:41:52 +13:00
866c4a881d Fix merge errors 2017-11-06 18:56:55 +01:00
fdf0191d78 Merge branch 'blender2.8' into greasepencil-object 2017-11-06 18:44:25 +01:00
92a3028e92 Merge branch 'blender2.8' into greasepencil-object 2017-11-06 17:47:18 +01:00
51ca8f81ed Fix problem after merge
One BKE function used changed
2017-11-06 17:17:19 +01:00
a66cae8737 Merge branch 'blender2.8' into greasepencil-object 2017-11-06 16:56:51 +01:00
e2a18af69d Smooth new points while drawing
A new smooth algorithm is used for each new buffer point using the last two points to calculate the estimated position and average this point with the current mouse position.

This smooth reduce the jitter of the stroke and allows to use lower post smooth values to reduce stroke change after finish stroke.

Now the factor is hardcoded, but after some more testing maybe we need add a parameter by brush.
2017-11-06 16:55:50 +01:00
e45633335a Merge branch 'blender2.8' into greasepencil-object 2017-11-05 16:37:06 +01:00
204db92965 Merge branch 'blender2.8' into greasepencil-object 2017-11-04 16:33:08 +01:00
67b74e5352 Fix delay cleaning previous frame when drawing
The fast drawing was not cleaning the previous frame when the artist create a new one and only was redraw after release mouse.
2017-11-04 16:31:56 +01:00
8432097669 Fix crash on trying to save files with GP objects
Quick fix for context being NULL when the thumbnail renderer gets triggered
while trying to save files.

TODO: We need a better solution here for passing eval_ctx down to GP modifiers
2017-11-05 00:23:02 +13:00
2290a4e8ed Fix: Pass a usable EvaluationContext to GP Modifiers
This is needed for some modifiers (e.g. Build), which rely on time
2017-11-04 21:55:39 +13:00
12074daebc Fix: Alt-Shift-SelectMouse wasn't working to add an entire stroke to the current selection 2017-11-04 18:23:31 +13:00
53238de132 GP Object: Added missing support for the "Apply Transforms" operators 2017-11-04 17:43:48 +13:00
cde66cdfc5 Cleanup: Style fixes 2017-11-04 17:43:48 +13:00
1559771cb6 Pre-emptive fixes for crashes occurring when GP strokes have no palette/color info assigned 2017-11-04 17:43:47 +13:00
02e3eb1ee7 Fix: Crash when unhiding a GP layer in the dopesheet if the frame has changed in the meantime 2017-11-04 17:43:47 +13:00
c355869cb1 Cleanup: Remove a whole bunch of manual GP cache tagging (marked for review) 2017-11-04 17:43:46 +13:00
4c542f6c37 Fix: Added "missing link" preventing depsgraph id_tag getting to GPencil updates
This was causing problems like making the modifier show/hide button not
work for Grease Pencil objects
2017-11-04 17:43:45 +13:00
c706a78683 GP Modifiers: Finish porting over last modifier (Simplify) and Cleanup Code 2017-11-04 17:43:45 +13:00
f5852bedde Cleanup: Use vec2f instead of defining our own 2d point type 2017-11-04 17:43:44 +13:00
583b871ec7 Cleanup: Ported Lattice Modifier code over to new callbacks 2017-11-04 17:43:44 +13:00
7db53c109e Outliner: Indicate which GP layer is active
Active layers get the colored pencil, while inactive ones get the dot
2017-11-04 17:43:43 +13:00
4b4bb0c838 Outliner now displays icons for GP Modifiers 2017-11-04 17:43:42 +13:00
df289455c7 GP Modifiers: Replace defunct "Duplication" modifier with "Build" modifier
It doesn't actually do anything now, and most of its properties are
undefined as well, but we don't want to break any existing files now
(as renumbering the other modifiers would cause issues)

Note: BKE_gpencil_reset_modifiers() has been removed. If the array modifier
needs this, we will have to find another solution to this.
2017-11-04 17:43:42 +13:00
a88cdce5db Fixes to various GP Modifiers
* Array modifier can be shown in editmode
  (TODO: When "Make Objects" is enabled, this breaks)

* Color (hue/sat) modifier was still using G.main
  -> Updated to use palette slots instead
2017-11-04 17:43:38 +13:00
bac4029926 Fix: Inconsistent behaviour between different GP array modifier cases
The main culprits here were:
1) Wrong order of matrix multiplication (resulting in inverted grid layout)

2) Directly reading off diagonals from matrix as scale, which failed when
   objects were rotated
2017-11-04 17:43:38 +13:00
cbe0626e8e Cleanup: Remove a bunch of redundant/bad old code 2017-11-04 17:43:37 +13:00
442d3f2697 GP Array Modifier: Bring back draw-engine hack for array modifier drawing
This time, it only runs when "Make Objects" is enabled on a modifier,
giving users a workaround for the z-ordering problems.
2017-11-04 17:43:36 +13:00
4311de9d86 Fix UI breakage (GP Modifiers / 3D View header) after ob->gpd --> ob->data refactor 2017-11-04 17:43:36 +13:00
1d27ca9be3 Fix: GP Modifiers UI was broken during the ob->gpd --> ob->data refactor 2017-11-04 17:43:35 +13:00
bb1475053e Fix: GP array modifier's "count" property should have a lower "sane" limit
Previously, the upper bound for dragging in the UI was effectively unlimited.
This has the unfortunate consequence of causing hard resets (out of bounds/memory)
as I found out last night while testing this.
2017-11-04 17:43:35 +13:00
b7ad3ea653 GP Modifiers - Merge Array and Duplication modifiers
Array and Duplication modifiers basically implemented the same functionality,
except that:
1) Array was slightly more powerful (i.e. it could make a 3D grid instead of
   just putting everything in a single line), and
2) Array created new objects when "Applying", while Duplication added to the
   current datablock

This commit basically merges the functionality of both into the Array modifier.
I ended up recoding this modifier to hopefully work a lot faster.
* The resulting modifier more closely resembles the behaviour of the normal
  Blender Array modifier.
* Performance should be better now with over 25 objects (previous array modifier
  implementation lagged badly with more than 25-30 instances). The previous approach
  of manually creating objects didn't work too well.

TODO:
* The functionality to disable the instance creation when the simplify options
  are enabled is currently lost. Still need to figure out how to restore it
* The stubs/shell for the old Duplication modifier are still around. To be removed!
2017-11-04 17:43:34 +13:00
cc9eb7b26c Restored manual gpencil_batch_cache_dirty() call when adding modifiers
There are too many problems leaving it out, even if in theory the depsgraph
calls should be taking care of it.
2017-11-04 17:43:33 +13:00
52edc1a9c6 Port Subdiv GP Modifier 2017-11-04 17:43:33 +13:00
b19021ecfa Temporary (?) fix so that Hero project files get version patched correctly 2017-11-04 17:43:32 +13:00
32e49c732b Porting more GP Modifiers
* Opacity modifier
* Color modifier
* Thickness modifier
* Tint modifier
2017-11-04 17:43:31 +13:00
abf0f70296 Cleanup: Remove unused function 2017-11-04 17:43:31 +13:00
0fdfff51d9 Fix: GP modifiers not updating when properties changed
Added back an explicit call to BKE_gpencil_batch_cache_dirty()
in the rna update callback for GPencil modifier properties.

However, instead of polluting the general rna_Modifier_update(),
this time we do this in a special wrapper/update callback for
dedicated GP modifier usage.

I'm unsure why the depsgraph isn't properly updating this case
- there's probably a missing relation between modifier properties
and GP ubereval (which calls the tagging), but where?!
2017-11-04 17:43:30 +13:00
30780a4238 GP Modifier: Set up stubs for geometry modifiers too 2017-11-04 17:43:29 +13:00
b05b0900d3 GP Modifiers: Fully ported Noise modifier over to new system 2017-11-04 17:43:29 +13:00
0ca86c6ab5 Fix: "deformStrokes(..., bGPDframe *)" callback should really have been "deformStroke(..., bGPDstroke *)" instead 2017-11-04 17:43:28 +13:00
88972d1698 Cleanup - Various cleanups for GP modifier files
* Remove redundant checks
* Use M_PI_2 instead of hardcoding a magic number
* Fix license text year info
* Properly handle new palette creation in Tint modifier
2017-11-04 17:43:27 +13:00
9e1685cb13 Cleanup: De-duplicate mode checking macros for GPencil 2017-11-04 17:43:27 +13:00
8b18d7a51e Cleanup - Use existing vertex groups function instead of defining out own 2017-11-04 17:43:26 +13:00
217c58917c Cleanup - Move helper functions for GP modifiers into the modifiers module 2017-11-04 17:43:26 +13:00
68e00c852f Fix compiler warning about const vs non-const 2017-11-04 17:43:25 +13:00
1d9a8be513 Fix "Apply Modifier" operator to use the new callbacks 2017-11-04 17:43:24 +13:00
26efbf16b6 GP Modifiers - Change all applyModifier callbacks to bakeModifierGP callbacks 2017-11-04 17:43:24 +13:00
7163e8c190 ModifierTypeInfo - Add 3 dedicated callbacks to support GP modifier evaluation and operations
* deformStrokes - Handles the "stroke" modifiers currently evaluated in
                  BKE_gpencil_stroke_modifiers() - e.g. Thickness, Noise

* generateStrokes - Handles the "geometry" modifiers currently evaluated
                    in BKE_gpencil_geometry_modifiers() - e.g. Array

* bakeModifierGP - Dedicated callback for hosting the code currently
                   wrongly-placed in applyModifier. This gets called
                   when pressing the "Apply" button on a GP modifier.
2017-11-04 17:43:23 +13:00
a16f60ad44 Compile fix: Missed a reference in previous commit
TODO: Calls to BKE_gpencil_layer_delframe() need to trigger a refresh
2017-11-04 17:43:22 +13:00
96e607f017 Cleanup: Eliminate BKE_gpencil_batch_cache_alldirty()
This accessed the global G.main directly, which we're trying to remove
2017-11-04 17:43:21 +13:00
61c129b57e Cleanup - Remove direct BKE_gpencil_batch_cache_dirty() code in favor of depsgraph tagging 2017-11-04 17:43:21 +13:00
49b8f73715 Fix: Version patching code was creating extra GP datablocks and throwing them away
After modifying the BKE_object_add() function to create a new GP datablock
by default, this change in behaviour would cause problems for the version
patching code fixing the old scene->gpd.
2017-11-04 17:43:20 +13:00
b3a4b8ec47 Cleanup - Style 2017-11-04 17:43:19 +13:00
346699bc9f Cleanup - Remove unused var 2017-11-04 17:43:19 +13:00
99d13d1c65 Cleanup: Remove the redundant GP_TOOL_SOURCE_OBJECT stuff
Since we only have GP objects in the 3D view now, this is the only
setting that should be used. Therefore, there's no need to set this
setting or check if for any reasons anymore.
2017-11-04 17:43:18 +13:00
1346ab8d98 Cleanup: Use standard logic for duplicating OB_GPENCIL objects and their data 2017-11-04 17:43:17 +13:00
b95b48f149 Fix: GP objects should get created with GP datablocks initialised already
(just like all other object types)

Previously, because the GP datablock was stored in a different place,
this had to be handled differently from other datablocks. But that
doesn't hold anymore, so it's time to fix that.
2017-11-04 17:43:17 +13:00
2aa87cdf67 Make BKE_gpencil_data_addnew() accept Main as an argument instead of using G.main 2017-11-04 17:43:16 +13:00
c109b5e59d Fix: Remove temporary debugging prints 2017-11-04 17:43:16 +13:00
66df7d9b74 Fix: Remove most of the code for treating GP as a special case in the vertex group poll functions
These were causing crashes on GP datablocks with ob->data not set
when clicking on the Vertex Groups panel (i.e. as the operator lookups
would cause problems)
2017-11-04 17:43:15 +13:00
e56a139e02 Fix typo causing crashes when trying to draw GP objects 2017-11-04 17:43:14 +13:00
f834845de0 Fix: Properties Editor was still showing the datablock selector for the old Object.grease_pencil 2017-11-04 17:43:14 +13:00
de2cafef29 Fix: Some more sanity checks for cases not handled 2017-11-04 17:43:13 +13:00
e1023560df Fix crashes on startup 2017-11-04 17:43:12 +13:00
faf93e0cc6 Fix some missed ob->gpd references 2017-11-04 17:43:12 +13:00
70380ef188 Fix typos and crash on startup 2017-11-04 17:43:11 +13:00
6c75e0c33b WIP Temporarily knock out some of the bad modifier/update hacks being used
These will hopefully be removed after some more testing, but in the meantime,
just commenting them out to test if things work still.
2017-11-04 17:43:10 +13:00
04e439513b GP Branch: Use ob->data instead of ob->gpd for storing GP object's GPencil datablock
WARNING: Old files created in the GP branch may break after this commit!

* There won't be data loss, but it will be necessary to manually fix this
  per-file as needed. The old ob->gpd pointer remains for now to ease the
  transition.

* The code will attempt to version patch old files that store data in this
  pointer. However, right now, this only works for GP Objects and for Empties.
2017-11-04 17:43:10 +13:00
7ca4c512a7 Hacky WIP code to verify that GPencil-Dopesheet Integration (for modifiers) is working
This code should be replaced, as it currently just duplicates the
modifier-looping logic (bad!). However, this is just a temporary placeholder
needed to get the updateDepsgraph() calls to run at all.

In any case, this would've been easier if I'd done the ob->gpd ==> ob->data
fixes first, since this hack wouldn't be needed.
2017-11-04 17:43:09 +13:00
b5c994cd72 Make GP cache tagging happen in the BKE_object_eval_uber_data callback 2017-11-04 17:43:08 +13:00
8b4d22db99 GP Lattice Modifier - Define updateDepsgraph() callback to add needed relations
and remove manula updates
2017-11-04 17:43:08 +13:00
ed612d9ed5 Knock out old "tag all" functions so that we can check if everything is working properly 2017-11-04 17:43:07 +13:00
e42adf6fc3 Merge branch 'blender2.8' into greasepencil-object 2017-11-03 17:44:44 +01:00
abaab202f9 Merge branch 'blender2.8' into greasepencil-object 2017-11-02 15:44:28 +01:00
af421a45e6 Merge branch 'blender2.8' into greasepencil-object 2017-11-01 09:33:31 +01:00
b381e84ec3 Merge branch 'blender2.8' into greasepencil-object 2017-10-30 09:25:35 +01:00
eb1d7a9ba7 Merge branch 'blender2.8' into greasepencil-object 2017-10-28 10:54:28 +02:00
b229e65eb7 Merge branch 'blender2.8' into greasepencil-object 2017-10-26 13:11:43 +13:00
37168c76fe Merge branch 'blender2.8' into greasepencil-object 2017-10-25 23:52:10 +13:00
55b4f89539 Merge branch 'blender2.8' into greasepencil-object 2017-10-25 12:37:41 +13:00
e4369b6663 Merge branch 'blender2.8' into greasepencil-object 2017-10-24 19:35:12 +02:00
3083a9c05e Fix memory leak in GPU
The problem was the flag was not checked and in some situations this avoided the batch clear.
2017-10-24 19:26:59 +02:00
41025e1550 Fix: GP-related menus were only available in "Edit Mode" but not any of the other modes
Instead, the Object Mode menus were being shown, which could be quite confusing
and useless in general.
2017-10-25 00:56:11 +13:00
2c71b7ec6c Code Cleanup - Fix name of helper function to be less misleading 2017-10-25 00:56:11 +13:00
007b43dcb3 Fix more issues raised in code review 2017-10-25 00:56:10 +13:00
06fb27296a Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2017-10-24 13:45:54 +02:00
5cb7cc4939 Fix after merge error 2017-10-24 13:45:31 +02:00
c541a58928 Merge branch 'blender2.8' into greasepencil-object 2017-10-24 13:35:51 +02:00
bf390d5748 Code Cleanup - Style, indentation 2017-10-24 21:25:00 +13:00
bc283c2e4f Code Cleanup - Simplify code here based on issues raised in code review 2017-10-24 21:07:38 +13:00
Dalai Felinto
76772f29f4 Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2017-10-23 18:42:55 -02:00
Dalai Felinto
17c92b96af Merge remote-tracking branch 'origin/blender2.8' into greasepencil-object 2017-10-23 18:06:40 -02:00
746380bbc5 Replace loop index to post addition 2017-10-23 20:44:57 +02:00
51e3735653 Fix wrong allocation
The allocation was allocating batches, but must be an array of pointers to batches.
2017-10-23 20:09:53 +02:00
6f7eecc47b Remove uses of BKE_gpencil_batch_cache_alldirty() 2017-10-23 15:58:24 +02:00
b61e158d90 Remove more G.main uses 2017-10-23 12:14:43 +02:00
2ebe4da826 Remove G.Main from RNA code
Remove the use of global main in RNA functions
2017-10-23 12:09:55 +02:00
15a84215da Merge branch 'blender2.8' into greasepencil-object 2017-10-23 10:45:10 +02:00
991bb5b567 Fix Thickness curve intialization error
When reload file, the curve was not initializated and produces segment fault.
2017-10-22 10:56:03 +02:00
20da47b003 Cleanup: use relative imports in bl_ui
More changes missing in previous merge
2017-10-21 17:50:43 +02:00
a0673038ab Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/properties_scene.py
        release/scripts/startup/bl_ui/space_clip.py
	release/scripts/startup/bl_ui/space_image.py
	release/scripts/startup/bl_ui/space_node.py
	release/scripts/startup/bl_ui/space_view3d.py
	release/scripts/startup/bl_ui/space_view3d_toolbar.py
2017-10-21 17:36:18 +02:00
f64c881f58 Fix merge error
In a previous merge, this file was wrong.
2017-10-21 09:26:11 +02:00
b1d6f6e3c3 Cleanup: Remove unused code 2017-10-20 19:39:35 +02:00
0fa2873c5d Pass bmain explicitly rather than via bContext
Passing main makes function easier for re-use.
2017-10-20 19:33:52 +02:00
c8a9df6a2c Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
2017-10-20 19:21:02 +02:00
72babc41b0 Cleanup style 2017-10-20 19:17:47 +02:00
52cb675171 Cleanup style and variable names 2017-10-20 19:09:39 +02:00
dec99c6b68 Cleanup style 2017-10-20 19:03:35 +02:00
6528b0b169 Cleanup style 2017-10-20 19:00:54 +02:00
227ddeb435 Cleanup: Replace duplicated poll lines by function 2017-10-20 18:53:22 +02:00
082b32c53a Rename texture_shift to texture_offset 2017-10-20 18:32:58 +02:00
ff756fb902 CMake: Fix order of libraries to address linking errors on Linux 2017-10-20 15:26:27 +02:00
6e203baa54 Cleanup: Use modifier scene 2017-10-20 10:07:27 +02:00
68efeb2066 Merge branch 'greasepencil-object' of git.blender.org:blender into greasepencil-object 2017-10-20 10:03:20 +02:00
dc43067cae Cleanup: Rename passindex to pass_index 2017-10-20 10:03:00 +02:00
5b40247dda Cleanup: redundant casts 2017-10-20 13:31:47 +11:00
0ff23fd671 Merge branch 'blender2.8' into greasepencil-object 2017-10-20 12:48:58 +11:00
6aeb92ac95 Fix draw on parented object
When the gp object was parented, the location was not using obmatrix and the position was wrong.
2017-10-19 17:09:38 +02:00
699a88c06e Cleanup: Add end line 2017-10-19 16:29:16 +02:00
631a267fa8 Reorganize shgroups creation
Improve the creation of shading groups and fix some memory leaks when the shading group was created but not used in any pass.
2017-10-19 15:58:43 +02:00
ac3ce46e1e Merge branch 'blender2.8' into greasepencil-object 2017-10-20 02:11:35 +13:00
cddbe11bee Minor RNA tweaks for MultiEdit
* Rename RNA properties to bring them more in line with standard naming
* Make it clearer in the tooltip for MultiEdit that only selected keyframes
  will be edited
2017-10-20 02:05:53 +13:00
8d9c1f03da Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
2017-10-19 19:15:15 +13:00
ac521fc0bf Refresh gp cache while transform
The geometry cache must be recalculated when move keyframes in action editors.
2017-10-18 17:38:44 +02:00
e6dc574f9a Merge branch 'blender2.8' into greasepencil-object 2017-10-18 16:45:51 +02:00
36e5d42d1d Version bump to 2.80.2 and initialization code
As Grease Pencil branch is developed using 2.80 as base, it's necessary to bump the version and move all initialization code to keep running all Hero open movie files that were created with GP branch.
2017-10-18 16:38:48 +02:00
3057a6d6cf Fix after merge errors 2017-10-18 10:47:36 +02:00
a038fa5d40 Merge branch 'blender2.8' into greasepencil-object 2017-10-18 10:19:42 +02:00
1eafff4bf1 Merge branch 'blender2.8' into greasepencil-object 2017-10-18 19:06:15 +13:00
44c7411220 Remove unused code
Turns out this chunk of code won't get run at all (since GP objects
store the GP datablock on the ob->gpd pointer and not ob->data like
every other object type).
2017-10-18 13:28:54 +13:00
6a7bf3b058 Set cache as dirty in Dopesheet
After a transformation, the cache must be set as dirty.
2017-10-17 17:29:54 +02:00
c8071080e9 Redo previous commit for Join
If the weight memory is not duplicated, when the initial stroke is released the memory can get corrupted.
2017-10-17 16:19:48 +02:00
08e3f32bb0 Fix segment fault when join
The join strokes operator did not copied the weights and this resulted in segment fault.
2017-10-17 12:49:51 +02:00
01e77ef532 Cleanup: warnings 2017-10-17 16:26:07 +11:00
7031f9672a Merge branch 'blender2.8' into greasepencil-object 2017-10-17 16:19:48 +11:00
833a2855fe Merge branch 'blender2.8' into greasepencil-object 2017-10-17 16:17:46 +11:00
4e33a12185 Merge branch 'blender2.8' into greasepencil-object 2017-10-17 16:07:48 +11:00
8c10596c19 Restore part of comment for xray_mode, left out during earlier fix 2017-10-17 14:56:59 +13:00
b2a3df653e Remove last_palette_name field
This isn't used for anything anymore. Removing it (and the padding) doesn't
seem to cause any new glitches, so this should be ok.
2017-10-17 14:56:28 +13:00
cfc11c5e4a Code Cleanup - Remove all uses of gpd->last_palette_name
The reason for this has been superseeded by the Palette Slots system
2017-10-17 01:03:37 +13:00
feadd7651c Merge branch 'blender2.8' into greasepencil-object 2017-10-16 12:47:29 +02:00
bf2287a036 Fix typo error 2017-10-16 12:37:39 +02:00
5c3dcad7f3 New Select Alternate operator
This operator allows to select alternative points in a selected stroke. This can be useful to disolve or modify.
2017-10-16 12:33:51 +02:00
07ec03d4f8 Rename Panel Primitives to Shapes
The "Primitive" name can be confusing. It's better to use "Shapes" because these options are to add new strokes with a predefined shape, not a new GP object with this shape.
2017-10-16 09:33:23 +02:00
2803d7c06f Update cyclic logic in old draw methods
The first adjacency point must be equal to last one if cyclic enabled.
2017-10-16 08:43:21 +02:00
f7a7a89039 Improve cyclic join
The join of the first point was not perfect.
2017-10-15 19:27:35 +02:00
a99411a1aa Fix cyclic wrong opacity
When enable stroke cyclic, the opacity of the final segment of the stroke was darker.

The problem was related to the adjacency points used.
2017-10-15 18:33:41 +02:00
1363002b57 Rectangle and Circle primitives
Completed the work to create rectangles and circles.
2017-10-15 17:51:28 +02:00
9dddefcbae WIP: Basic rectangle primitive
Still pending to show the feedback ghost image while create the primitive.
2017-10-15 13:31:38 +02:00
d27fa507d5 Cleanup: Remove unused code 2017-10-14 11:54:28 +02:00
5c939d58ef Merge branch 'blender2.8' into greasepencil-object 2017-10-14 11:28:14 +02:00
d62dde9a73 Cleanup: Change debug code
No functional changes.
2017-10-14 11:25:47 +02:00
d55b5603f5 Fix casting to bool before checking the flag 2017-10-14 04:35:54 +11:00
d07f2b12c3 Cleanup: style 2017-10-14 04:32:32 +11:00
df2e134d33 Merge branch 'blender2.8' into greasepencil-object 2017-10-12 17:13:39 +02:00
37b04f1aa5 Fix error selecting camera
The edit shgroup creation must check active object to verify if it's a OB_GPENCIL
2017-10-12 17:10:43 +02:00
7cb871a380 Check object type 2017-10-12 13:09:18 +02:00
c803ed9b80 Fix zdepth order with 3D objects
When draw a new stroke, the stroke must be visible over all 3D objects and not in back of them.

A new mix pass has been created to make a mix with default framebuffer using a gl_FragDepth = 0.0 to force to be in front .
2017-10-12 12:33:35 +02:00
8cae0736fe Check drawing mode flag 2017-10-12 11:55:46 +02:00
d76b27e766 Fix bug of memory corruption
The strokes were transparent and zdepth was doing weird things when using 2 GP objects. This error was introduced by commit: 27/09/2017 08:34 5c8e1dfc28

The problem was the field xray_mode. If move below in the struct, the value is corrupted and draw manager does not work fine..
2017-10-12 11:28:18 +02:00
32322044a0 Fix PaletteSlot memory leak 2017-10-11 20:41:43 +02:00
c82ddb7549 Merge branch 'blender2.8' into greasepencil-object 2017-10-11 10:26:08 +02:00
895ec88857 Set default framebuffer
After detach textures must set the default buffer again.

Also checked the number of samples, not only framebuffer.
2017-10-11 09:58:10 +02:00
1e250b1b83 Fix opacity change when drawing
When draw a stroke with a color with opacity < 1.0, there was a opacity change when finish stroke.

This was related to the blend pass that was used, so the drawing in fast mode must pass through the temp framebuffer to get same alpha values in blend.
2017-10-10 18:49:53 +02:00
f3d3579751 New MSAA macros
Define macros for cleanup code.
2017-10-10 18:41:06 +02:00
7efb8f5477 Cleanup: Remove redundant code 2017-10-10 12:32:42 +02:00
b8161bd9af Fix error introduced in previous commit
The macro used was wrong
2017-10-10 11:19:51 +02:00
4cec3f3ccd Merge branch 'blender2.8' into greasepencil-object 2017-10-10 11:14:00 +02:00
89105e2556 Initialize selection alpha
There is a problem with this value for old 2.7x files, so the value is set to 1.0 when the file is from previous versions.

The initialization is done in weighttype section because this is a safe checking for old files and it is a related parameter.
2017-10-10 11:10:50 +02:00
5c2ee58c7c Cleanup: Define macros for GP modes
Define new macros for checking grease pencil object mode to cleanup code.
2017-10-09 23:47:01 +02:00
089835469a Fix error in default gp object after delete
If delete the gp object and it is assigned as default scene gp object, must be cleared.
2017-10-09 19:19:58 +02:00
049eb49f9a Enable MSAA for strokes
This AA is activated with Multisample parameter of user preferences screen.
2017-10-09 16:19:17 +02:00
2af1a0b628 Merge branch 'blender2.8' into greasepencil-object 2017-10-09 10:21:21 +02:00
465ca2659d Merge branch 'blender2.8' into greasepencil-object 2017-10-07 13:14:50 +02:00
a99f812902 Merge branch 'blender2.8' into greasepencil-object 2017-10-06 23:56:56 +02:00
c09fe51f9d GP Branch Version Patching - Use palette slots instead of creating palettes directly 2017-10-06 19:24:36 +13:00
d911287d91 Revert whitespace edits in interface_utils.c
These appear to be accidental, and are unrelated to the purpose of this branch.
2017-10-06 16:55:36 +13:00
d225202f05 Merge branch 'blender2.8' into greasepencil-object 2017-10-05 18:54:11 +02:00
32c0a98c27 Merge branch 'blender2.8' into greasepencil-object 2017-10-05 10:06:12 +13:00
31efc624dc Fix: Palettes were getting freed before GPencil datablocks on exit 2017-10-05 10:01:21 +13:00
cf87d5759b First test to implement FXAA 2017-10-04 15:12:03 +02:00
c3d6b5ebcf Merge branch 'blender2.8' into greasepencil-object 2017-10-05 01:52:27 +13:00
432bd31276 Fix compile error after merge
(Also added convenience API to make it easier to add new palettes to GP
datablock without having to worry about manually fixing usercount)
2017-10-05 01:16:24 +13:00
59310a9259 Fix: When adding 2D Monkey, the Palette got too many users assigned 2017-10-05 00:52:57 +13:00
b83d72242b Added missing support for duplicating Palette Slots when copying GP data
For now, it will only increment the usercount of the referenced palettes.
2017-10-05 00:52:57 +13:00
ebe0113ba3 Code Cleanup / TODO Notes (re- reuse of palettes when validating) 2017-10-05 00:52:56 +13:00
df62778a55 Tweak behaviour of adding a new GP Palette (to match other parts of Blender)
When creating a new Palette with an existing Palette assigned to a slot,
a copy of the old Palette will be created (i.e. the new copy will have all
the same colours), instead of creating a blank palette.

This makes it easier to create different versions of the same palette.
2017-10-05 00:52:55 +13:00
bacca732cc Code Cleanup / Compile Fix
Further cleanups for the 2D monkey primitive - this time, to move
all the data arrays out of the single massive function, and out to file level.

Hopefully this solves the compile problems with GCC.

If nothing else, the file now compiles much faster here on MSVC
(i.e. previously, it was taking ~10-20 seconds to compile)
2017-10-05 00:52:55 +13:00
490a3bb944 Palette Slots - Temporary verison-patching code to add slots for early 2.8 files saved without these 2017-10-05 00:52:54 +13:00
1369e9d298 Palette Slots - Add operators to Add/Remove Palette Slots
* Add will create a new (empty) slot by default

* Remove will shown an error if the slot is currently still used by
  any strokes. Perhaps in future, it should remap the strokes instead?

* Added icon for Palette Slots (it uses the same icon as Palettes now)
2017-10-05 00:52:53 +13:00
5dbb81a638 Fix: Missing undo flags for various GP operators 2017-10-05 00:52:53 +13:00
8c8c80701b Code Cleanup - Remove old/non-existent operator defines 2017-10-05 00:52:52 +13:00
cc1a0fc314 Fix: Newly created palettes for palette slots got an extra/unneeded user 2017-10-05 00:52:52 +13:00
49f394946e Various fixes to get GP Palettes UI working
* Switched the UI to using the "active_gpencil_palette" (and palette color) context
  vars (in favor of the "active_palette"/color) ones for retrieving the active
  palette. For some unknown reason, context.active_object returns null when
  trying to use it in the Properties Editor when drawing UI layouts, but it works
  perfectly fine when operators calling operator.poll() or running operators.

* Sanitise many of the hacks added to the Palette operators to make them usable
  for Grease Pencil-linked palettes (e.g. remove special hacky args)

* Add RNA support for getting the active GP palette slot
2017-10-05 00:52:51 +13:00
0f83cba7d2 BKE_palette_get_active_from_context(C) now retrieves GP palettes from the active palette slot
if the active object is a GP object

This makes it possible to reuse all the Palette operators as-is,
without having to add a lot of GP-specific duplicates, and also
simplifies much of the context polling stuff.
2017-10-05 00:52:50 +13:00
7c9467ae1f Palette Slots - Add UI panel for Palette slots 2017-10-05 00:52:50 +13:00
aed1892c24 Code Cleanup: Move panel definitions for Palette-based colors to the Material panels file
Annotations (GP in 2D editors) will not be using this stuff,
as they will not have most of the fancy drawing options (as
they are based on the traditional 2D api instead).
2017-10-05 00:52:49 +13:00
6d6e06d39b Palette Slots - Changing assigned palette via RNA calls relevant API func to set things correctly 2017-10-05 00:52:48 +13:00
3dced61b1d Fix: Don't create redundant palette for Monkey 2017-10-05 00:52:48 +13:00
ac68a69294 Fix: Add 2D monkey adds palette link 2017-10-05 00:52:47 +13:00
c3b9b7b8e4 Fix: Strokes weren't visible while drawing
Missed this usage of palettes in previous commit
2017-10-05 00:52:46 +13:00
8cbc7334f0 Palette Slots - Replace all places initialising GP palettes 2017-10-05 00:52:46 +13:00
924112241b GP: Modify existing operators to use new palette api's 2017-10-05 00:52:45 +13:00
d01d7d053e Code Cleanup - Group all palette initialisation stuff together in same function 2017-10-05 00:52:44 +13:00
8f34d5cdb3 Cleanup - Change naming of Palette Slot vars to be easier to type 2017-10-05 00:52:44 +13:00
5d69c71adf Palette Slots: Internal API's for managing Palettes 2017-10-05 00:52:43 +13:00
ec6f392bc9 Merge branch 'blender2.8' into greasepencil-object 2017-10-03 18:28:51 +02:00
0e99d51a38 Remove antialiasing code
These functions are not working here. Need a new approach using FXAA.
2017-10-03 18:27:03 +02:00
ba077b368c Add function to fix palette bug
Added a function to fix old files with palette set to NULL by program error.

This fix will be removed in the future, but now it's required to work in open movie files.
2017-10-03 17:58:34 +02:00
61d6c4f8b9 Merge branch 'blender2.8' into greasepencil-object 2017-10-02 20:12:46 +02:00
7c3588c603 Cleanup comment 2017-10-02 11:13:09 +02:00
90152f6bcb Add Antialiasing to Grease Pencil 2017-10-02 11:07:46 +02:00
53ca11ad13 Merge branch 'blender2.8' into greasepencil-object 2017-10-01 19:16:03 +02:00
ef4c69a715 Add curve options to Thick modifier
New options to adjust the thickness of the stroke using a curve to get more artistics effects.
2017-10-01 18:54:30 +02:00
dbf2a0c54f Fix merge error 2017-09-30 16:53:38 +02:00
606679fd75 Merge branch 'blender2.8' into greasepencil-object 2017-09-30 16:06:19 +02:00
2473eb2b67 Optimize Fast Drawing memory management 2017-09-28 16:16:04 +02:00
18576dff30 Various RNA fixes (noticed while adding palette slot support)
* Added missing define for GP Object datatype in rna_Object_data_typef
* Improved a few descriptions/comments
2017-09-29 02:47:17 +13:00
c751391082 Fixes for various problems with the linked-datablock handling code for GP features
* The new "Scene->gp_object" field was not being relinked in various places

* The "bGPDstroke->palette" relinking calls were missing the standard "id.lib" args

* "bGPDlayer->parent" should be handled in lib_link_gpencil() not direct_link_gpencil(),
  It was also not handled in the expand_doit()
2017-09-29 02:47:17 +13:00
d1c33f87cc Code Cleanup - Some leftover cruft/reshuffling/formatting 2017-09-29 02:47:16 +13:00
a0acc64d35 Palette Slots - File IO and Basic RNA support 2017-09-29 02:47:15 +13:00
b77cfd7bf8 Palettes Slots - Fix incomplete DNA changes from previous commit 2017-09-29 02:47:15 +13:00
1b7b2a9a9f Merge branch 'blender2.8' into greasepencil-object 2017-09-28 13:02:52 +02:00
3c2186cbbf GP Palette Slots - Initial DNA structures
Start of support for GP "Palette Slots". These act like "Material Slots"
in that they allow a single GP datablock to refer to multiple Palette
datablocks, making it easier for the user to manage the set of available
palettes.
2017-09-27 19:41:59 +13:00
5c8e1dfc28 Code Cleanup - Clarifying names, comments, and shuffling fields for clarity 2017-09-27 19:34:01 +13:00
5a52a54c0e Code Cleanup - Move all old/deprecated bGPDpalette stuff together to be easier to remove/disable in future 2017-09-27 17:05:17 +13:00
f4eeb87fa2 Code Cleanup 2017-09-27 17:04:23 +13:00
a38d43d461 Build fixes after merge
iroundf -> round_fl_to_int
2017-09-27 14:31:48 +13:00
c6e4456778 Merge branch 'blender2.8' into greasepencil-object
Conflicts:
	source/blender/editors/transform/transform_manipulator.c
2017-09-27 14:27:17 +13:00
adda09c418 Code Cleanup: Move 2D Monkey code to its own file in editors/gpencil 2017-09-27 14:01:22 +13:00
5dfe46b985 Fix: The code to reset GP Objects to Object Mode on load wasn't working 2017-09-27 14:01:21 +13:00
009faf1cb3 UI: Remove Palette Panel header 2017-09-26 12:42:30 +02:00
eca2d5f405 Merge branch 'blender2.8' into greasepencil-object 2017-09-26 10:57:13 +02:00
04fcd84794 Code Cleanup: Replaced inlined layer-copying code with a call to the copy_ex() method 2017-09-26 15:40:46 +13:00
2cb0e188e2 Fix: Make Single User wasn't supported for GP Objects 2017-09-26 15:13:22 +13:00
5b45258fff Fix: Doing a Scene "full-copy" wouldn't relink the gp_object 2017-09-26 15:12:50 +13:00
e7395c75d5 Fix: When transforming GP strokes in "Local" mode, the strokes would get obscured by
the transform constraint lines
2017-09-26 12:50:37 +13:00
f25541be38 Fix: If the active object is not a GP object, starting to draw
with D-LMB would create a new GP object

This was behaviour was bad if you were trying to use GPencil for
anything other than 2D-3D art (e.g. for creating freehand input
for addons/Pose Sketching, annotating your work in EditMode, etc.)
as you could easily end up with all your annotations/sketches in heaps
of separate GP objects.

This commit improves the sitation slightly, by introducing an
"GPencil Object" property to Scene (similar to the existing "Active Camera"
and "Active Clip" settings).
* The idea is that the first GP object added to the scene as the "default
  GPencil Object".
* Everytime you start sketching with GPencil AND the active object isn't
  a GPencil Object, this "default GPencil Object" will become the active object,
  and any strokes you draw will be added to this object (instead of a new
  GP object being created)

TODO:
* Investigate if we can do this without losing whatever mode the user was
  in previously. This new workflow makes GPencil a lot less useful for a
  bunch of different annotation/addon workflows it could be used for in 2.7
2017-09-26 01:15:25 +13:00
04f25532ed Code Cleanup 2017-09-26 01:15:24 +13:00
7d08bf4a66 Rename "Copy" color operator to "Rename" 2017-09-25 11:14:05 +02:00
38dd6a75c0 Merge branch 'blender2.8' into greasepencil-object 2017-09-25 10:29:35 +02:00
d7a7bb8753 Merge branch 'blender2.8' into greasepencil-object 2017-09-22 16:33:25 +02:00
1cf6eaa154 Merge branch 'blender2.8' into greasepencil-object 2017-09-21 22:56:08 +02:00
7fb657c854 Merge branch 'blender2.8' into greasepencil-object 2017-09-21 19:29:22 +02:00
49e9738d6e Change replace palette UI text
Some minor changes to make it clearer.
2017-09-21 18:01:07 +02:00
7ff31e0270 New Enable/Disable editing lines option
Allows to disable the new editing lines. Now the option is in Display panel, but maybe need to be moved to new panel or reorganize.
2017-09-20 12:04:49 +02:00
329d3fe59b Fix typo error in Onion Panel 2017-09-20 11:32:49 +02:00
404f547683 Fi T51923: Crashes on selecting bone in edit mode
Need to verify FBO state before initialize framebuffer
2017-09-20 10:27:48 +02:00
a155734fac GP Properties: Tidy up Onion Skinning and Display panels
Initial attempts to tidy these panels up, according to points identified
in last night's review.
2017-09-20 13:07:38 +12:00
b1f871d031 Code Cleanup: PEP-8 2017-09-20 12:45:17 +12:00
2e77290873 GP Mode Menu Tweaks
* Rename "Stroke Paint" mode to "Draw", and make it the last item
* Use standard EditMode icon
2017-09-20 10:54:52 +12:00
0099e867bf Arrange strokes in several layers
It's more convenient to arrange strokes in all layers, and not only in active one.
2017-09-19 16:38:24 +02:00
c9654e6e88 Set Onion frame range to 1 as default 2017-09-19 10:44:07 +02:00
8ca7a46086 Merge branch 'blender2.8' of git@git.blender.org:blender.git into greasepencil-object 2017-09-19 16:49:33 +12:00
036f60d300 Cleanup: Remove unused code 2017-09-18 12:22:58 +02:00
6a1d59c188 Cleanup: quiet warnings for GCC 2017-09-18 19:50:50 +10:00
4adb6cac66 Fix bad range checks 2017-09-18 19:10:14 +10:00
d8fdae6132 Merge branch 'blender2.8' into greasepencil-object 2017-09-17 17:14:27 +02:00
773f9f19d8 UI: Disable Onion filter at Layer level
If main switch is disabled, thios column must be disabled too.
2017-09-16 19:39:03 +02:00
2527c2c3e7 Solve some minor issues in onion panel 2017-09-16 16:01:28 +02:00
6ce8857dba Fix problem with onion override
There were some conflicts in the override with main options.
2017-09-16 10:19:58 +02:00
9d31574dd1 Merge branch 'blender2.8' into greasepencil-object 2017-09-15 17:26:32 +02:00
0c3a83a8be UI: Change label text 2017-09-15 17:24:43 +02:00
8955328719 Add override options for onion skinning
This commit add options to modify at layer level the default onion skinning parameters defined at object level.
2017-09-15 17:19:56 +02:00
9fee39af71 Move onion skin settings to GP datablock
Now that we have GP object, it's better to move onion skining settings at object level and keeep only a flag to enable disable at layer level.
2017-09-15 10:34:59 +02:00
d1ac3fd077 Fix error in onion skinning
The shgroup id was not updated in the loop.
2017-09-14 18:42:34 +02:00
54c7ac2c7a Fix opacity problem with fast drawing.
The pass was doing double blending.

Thanks to Clement Foucault for his help solving this issue.
2017-09-14 16:54:47 +02:00
2f8d9d1cc8 Fix Blur problem wit opacity.
There was a double blending that reduced opacity
2017-09-14 16:36:51 +02:00
9291c0e3d7 Fix functions renamed by merged commit 6d359e 2017-09-14 12:50:05 +02:00
684ca04786 Merge branch 'blender2.8' into greasepencil-object 2017-09-14 12:32:43 +02:00
5f9b2ae2f0 Add option to disable fast drawing
This option has been added to compare viewport speed while drawing, but maybe can be good to keep it.
2017-09-13 20:32:57 +02:00
afdbad9924 Fix missing line of previous commit 2017-09-13 09:28:15 +02:00
ffda00ee71 Rework in Fast Drawing to avoid lags
Try to avoid any lag for very short and fast strokes
2017-09-13 08:17:17 +02:00
f7d40ced53 Merge branch 'blender2.8' into greasepencil-object 2017-09-12 17:09:55 +02:00
ed9b98c63f New Viewport Fast Drawing
Now a temp texture is used while the user is drawing to get an instant feedback.
2017-09-12 14:54:50 +02:00
2801dbffe3 Merge branch 'blender2.8' into greasepencil-object 2017-09-11 16:43:15 +02:00
11dc55f3c6 Fix segment Fault in Onion Skin after play
Sometimes, after run animation or change the frame , the drawing cache was not set as invalid and produced a segment fault.
2017-09-11 16:16:55 +02:00
65081e17f7 Add new Fade and Opacity to Onion
New parameters to define the opacity and a parameter to enable/disable fade effect.
2017-09-11 12:43:49 +02:00
69aea4c596 Make paint cursor size fix
After some testing, display the real size of the brush is not practical because is too disruptive and the size of cursor does not change with zoom factor. The decision was to use a fix size, instead of  paintbrush->thickness value.
2017-09-11 10:34:28 +02:00
11d2b76aa4 UI: Change simplify options order 2017-09-10 19:38:53 +02:00
5bc000a901 Fix error in simplify
The simplify was pplied with master check disabled
2017-09-10 19:18:16 +02:00
0421076179 Simplify: new option to remove fill lines
For filling areas, sometimes is good to have a way to hide the external line of the stroke that makes the fill when select simplify.

Fixed the error of render flag because the storage field was too small, so a new field has been added for simplify only.
2017-09-10 16:55:48 +02:00
890b9249d4 New Information Panel
This panel shows information about number of layers, frames, strokes, points and palettes used.

Notes: The number of frames in the internal data, not the number of different keyframes number.

The panel is not updated automatically to avoid performace issues. Close and reopen panel to refresh. Maybe, this could be changed, but need to be checked before.
2017-09-10 12:16:04 +02:00
63ea7124e1 Merge branch 'blender2.8' into greasepencil-object 2017-09-10 10:04:28 +02:00
4a89c0cd58 New Simplify panel
These options allow to speed up the viewport similar to mesh simplify.

Note: The render options are disabled while the render workflow is defined.
2017-09-10 10:02:40 +02:00
d1768b616d Apply lattice modifer in each frame
The lattice must be evaluated in each frame, not in the location of the first frame only.
2017-09-09 16:17:06 +02:00
95636294f1 Merge branch 'blender2.8' into greasepencil-object 2017-09-07 12:19:42 +02:00
76474b09d0 Merge branch 'blender2.8' into greasepencil-object 2017-09-06 16:09:05 +02:00
ebd72c93a5 Enable MultiEdit keys in Sculpt/Weight Paint modes
The Q and Shift+Q keys can be used in Sculpt and Weight Paint modes too, and not only in Edit mode.
2017-09-04 11:45:53 +02:00
19764a20c4 Enable Multiedit in Weight Paint mode 2017-09-04 11:42:45 +02:00
1f5bf340c5 Cleanup: Replace int text to double quotes 2017-09-03 11:07:14 +02:00
47dcf365f7 Merge branch 'blender2.8' into greasepencil-object 2017-09-03 11:03:20 +02:00
99420e96a8 Merge branch 'blender2.8' into greasepencil-object 2017-09-01 09:59:17 +02:00
291d253326 Fix drawing error when object has been scaled
If the object was scaled, the thickness of the stroke must be scaled while drawing.
2017-08-31 17:33:14 +02:00
de4dfd664f Change default values for Pencil Brush 2017-08-31 17:05:41 +02:00
ac521ef853 Set Pencil brush as default
This is only valid if the brush list was not created before
2017-08-31 17:02:13 +02:00
0c9ef211c9 Change default PixSize to 500
Thios value is better to keep default Blender size: 1 bu = 1 mts
2017-08-31 16:57:31 +02:00
9a1ba7b122 UI: Move Eraser radius to Option tab as new panel 2017-08-31 16:43:00 +02:00
a6a84a5ab6 UI: Rename Panel Brush Options to Strokes 2017-08-31 16:33:39 +02:00
0d2fdedb57 Merge branch 'blender2.8' into greasepencil-object 2017-08-31 12:23:01 +02:00
cd3f0eea03 Fix screen update after select keyframes
This problem was related to Onion Skinning and Multi Edit when selected a keyframe in dopesheet.
2017-08-31 12:19:33 +02:00
92eb3572c5 Add Shift+Q to enable only multiedit lines 2017-08-31 11:11:05 +02:00
7e5fe13205 Enable Onion Skinning in Edit and Sculpt mode
Only disabled in weight paint mode
2017-08-30 17:03:48 +02:00
63e651d9db Merge branch 'blender2.8' into greasepencil-object 2017-08-30 16:42:35 +02:00
c248778601 Show only lines for MultiEdit strokes 2017-08-30 16:41:28 +02:00
abea4e7c9b New option to define color of edit line
A new field for MultiEdit was added too
2017-08-30 16:15:03 +02:00
db08a30cd9 New toggle MultiEdit operator with Key Q
This allows to switch very fast between edit modes
2017-08-30 11:26:30 +02:00
b0d6cbfeec Speed up multiedit loop
If not multiedit, avoid the loop in select
2017-08-30 10:52:29 +02:00
130d522064 MultiEdit in Sculpt Mode
Allow to use Multi Edit in Sculpt mode. Now the brushes can be applied to several frames.
2017-08-29 16:10:08 +02:00
81feb43461 UI: Move multiedit to 3Dview bar
Remove from panel and add to the bottom 3D View options bar
2017-08-29 15:41:59 +02:00
4033f05c30 Add transformation data for multiedit 2017-08-29 12:59:49 +02:00
d42feef6f8 Change define to select mulñtiple strokes
This define is used in selection of points
2017-08-29 12:32:37 +02:00
d3f5314716 Change editable_gpencil_stroke context for multiedit 2017-08-29 12:17:12 +02:00
27f90459b7 Merge branch 'greasepencil-object' into GP-MultiEdit 2017-08-29 11:48:04 +02:00
a9256f2e92 Merge branch 'blender2.8' into greasepencil-object 2017-08-29 11:47:38 +02:00
c1518938d8 Draw several frames when multiedit is enabled 2017-08-29 11:46:05 +02:00
3879c96e6b Add new flag for MultiEdit
Note: The new UI options now appears in display panel but it will be moved out in future changes.
2017-08-28 13:28:43 +02:00
63039cf442 UI: Fix onion options error when no layers 2017-08-28 12:28:34 +02:00
7e93fcca80 Merge branch 'blender2.8' into greasepencil-object 2017-08-28 12:06:10 +02:00
9ebf679a0b Merge branch 'blender2.8' into greasepencil-object 2017-08-27 18:57:05 +02:00
1774a7b290 Merge branch 'blender2.8' into greasepencil-object 2017-08-25 16:48:45 +02:00
26dbbef14c Fix Lock icons
This icons were removed by error in an old merge commit
2017-08-25 09:51:45 +02:00
c1bc167f98 Change maximum range for pixel size 2017-08-24 19:38:17 +02:00
07b191ef5a Remove previous commit
This is not required because the widget manage the transformation
2017-08-24 18:47:29 +02:00
63ba22713c Fix problem with axis in Local transformations 2017-08-24 18:33:20 +02:00
e20c0e3615 Merge branch 'blender2.8' into greasepencil-object 2017-08-24 16:24:50 +02:00
13e72721f9 Rotate manipulator for Grease Pencil
Before only global orientation was supported
2017-08-24 16:04:11 +02:00
05f7b06d70 Merge branch 'blender2.8' into greasepencil-object 2017-08-24 11:48:06 +02:00
ae1cce7831 WIP: Move points in local space
Still  a problem with manipulator and axis feedback lines that are not rotated to local space
2017-08-24 11:23:45 +02:00
38b6e10780 Disable onion skinning in edit modes 2017-08-23 16:46:27 +02:00
aca714c18f Fix merge error 2017-08-23 13:28:41 +02:00
3e972fb582 Merge branch 'blender2.8' into greasepencil-object 2017-08-23 12:58:46 +02:00
c0d0aba8b6 Reorganize Onion drawing and hide on Play
Hide on play the onion skinning and refactor drawing functions for onion skining
2017-08-23 12:55:06 +02:00
bd62abc592 Set cache as dirty when remove frame 2017-08-22 20:13:13 +02:00
0eb7227e3c Remove Previous/Next mode in Onion Skinning 2017-08-22 20:08:31 +02:00
7e4ce1e804 Make Vertex Group operator available in Sculpt mode
As vertex group tools are used to manage vertices is good to have these tools available in Sculpt mode too.
2017-08-22 19:11:25 +02:00
a0439804a6 UI: Create a new panel for Brush options 2017-08-22 18:58:25 +02:00
b8afabf0f1 Fix memory leak in VBOs
After the last change in GWN_BATCH_DISCARD_SAFE(), is necessary to create the Batch using GWN_BATCH_OWNS_VBO to free the memory.
2017-08-22 17:19:51 +02:00
46ea09ef3c Check if modifiers before calling function 2017-08-22 13:33:27 +02:00
6692bb03a6 Merge branch 'blender2.8' into greasepencil-object 2017-08-22 11:30:41 +02:00
1e1eac9836 Cleanup: Rename Onion modes 2017-08-21 11:33:11 +02:00
92cb02bb4e Merge branch 'blender2.8' into greasepencil-object 2017-08-21 11:12:20 +02:00
7a3cf91a01 New Onion modes
Add options to set the range of frames in absolute or relative mode. Reorganized UI panel too.
2017-08-21 11:09:10 +02:00
678b02436a Merge branch 'blender2.8' into greasepencil-object 2017-08-20 18:33:17 +02:00
bceec2c62a Merge branch 'blender2.8' into greasepencil-object 2017-08-20 15:32:02 +02:00
01360899c2 Merge branch 'blender2.8' into greasepencil-object 2017-08-20 11:53:06 +02:00
d31de4f490 New Onion skinning for select frames only
Add an option to display only the frames selected in dopesheet.
2017-08-19 22:55:54 +02:00
0d80a85816 Cleanup code and comments 2017-08-19 16:48:38 +02:00
26e796c04f Chnage angle limits to allow negative values 2017-08-19 13:39:37 +02:00
f69944d046 Change UI panel 2017-08-19 13:28:01 +02:00
aa9cf8e1f9 Merge branch 'blender2.8' into greasepencil-object 2017-08-19 12:23:42 +02:00
d2a34bc4ce Use object location as center for swirl 2017-08-19 12:22:57 +02:00
faee6037bb Merge branch 'blender2.8' into greasepencil-object 2017-08-19 10:51:57 +02:00
9d55e5f5ed First try to apply Lattice GP modifier in all frames
Still not working but define the initial steps to do it.
2017-08-18 16:21:51 +02:00
6cb1d3c8f1 New VFX Swirl modifier 2017-08-18 13:10:16 +02:00
e9230845ec Merge branch 'blender2.8' into greasepencil-object 2017-08-18 10:37:02 +02:00
41f06ff9b2 Fix error checking edit mode button in VFX 2017-08-17 19:35:55 +02:00
08842f1171 Merge branch 'blender2.8' into greasepencil-object 2017-08-17 18:58:10 +02:00
48f985d080 New VFX pixelate modifier 2017-08-17 17:37:18 +02:00
9bb932a842 Support MSVSC 2017 15.3.0 (compiler 19.11)
The compiler version has changed in the last VS2017 update to 1911 and the old 1910 version is not working anymore.
2017-08-16 15:58:09 +02:00
89667fa0d3 Rename function 2017-08-16 14:11:56 +02:00
c6a66b1966 Merge branch 'blender2.8' into greasepencil-object 2017-08-16 13:21:33 +02:00
80631317a7 Change const type
Add const modifier to eval_ctx defiition to follow merged code rules.
2017-08-16 13:03:06 +02:00
93a0cc9c46 Merge branch 'blender2.8' into greasepencil-object 2017-08-16 10:33:55 +02:00
470851aeba Fix error in Onion skinning
THe onion was not working because when create derived_gpf, the next and prev frames were set to NULL by error.
2017-08-16 10:28:32 +02:00
87c7d4d2a3 New options to copy colors attenuated 2017-08-15 19:06:08 +02:00
c23526ac73 Fix segment fault when draw polygons 2017-08-15 12:16:07 +02:00
23d224101a Cleanup typo error 2017-08-14 16:52:10 +02:00
e6d82c9873 Cleanup comments 2017-08-14 16:33:21 +02:00
96b41a2c7f Change Blur algorithm 2017-08-14 16:19:18 +02:00
ffbe876fdd New buffer use in Blur modifier
The previous version created a loop with the framebuffer. Now a ping pong framebuffer is used.
2017-08-14 15:49:41 +02:00
ccb6a043bf Fix error in change Palette
Must change all frames not only active
2017-08-13 17:56:15 +02:00
490971b3e6 Change default values 2017-08-13 13:02:40 +02:00
1f7e171575 Merge branch 'blender2.8' into greasepencil-object 2017-08-12 10:48:29 +02:00
cc220781aa Reorganize VFX modifiers code 2017-08-11 17:30:58 +02:00
4545b30dd8 Second step to include Pixel Factor
This add the final changes to use pixfactor in shaders
2017-08-11 17:16:36 +02:00
0feed8bb23 First step to include Pixel Factor
This is equal to old commit but step by step to avoid z-depth error. Doing the commit more granulate allow to debug better the code.
2017-08-11 17:08:32 +02:00
54eb034c08 Revert "Add new factor to define pixel scale due z-depth error"
Produce unexpected errors in z-depth and need more review before apply.

This reverts commit 62677a73e1.
2017-08-11 16:35:18 +02:00
b793e07d0c Change strengthin Tint modifier 2017-08-11 15:39:57 +02:00
5225f43235 Change Opacify modifier again
The fill color only must be changed if was defined with an opacity factor.
2017-08-11 13:25:50 +02:00
625f799514 Remove Opacity factor soft limit
Now the range is free from 0 to 2
2017-08-11 10:24:13 +02:00
1eadb4e8e1 Fix Opacity modifier do not change fill opacity
The fill opacity cannot be set to 1
2017-08-11 10:14:06 +02:00
3749310734 Fix error setting origin to 3D cursor 2017-08-10 20:23:45 +02:00
af1587ecd0 Cleanup space line 2017-08-10 17:53:01 +02:00
e078a42e4e Merge branch 'blender2.8' into greasepencil-object 2017-08-10 17:42:27 +02:00
1a00c6ae36 Fix errors after merge 2017-08-10 17:40:38 +02:00
b5a116dad4 Merge branch 'blender2.8' into greasepencil-object 2017-08-10 17:37:26 +02:00
a6f5adb836 Fix Lattice memory leak
The loop need to free memory to avoid memory leak
2017-08-10 17:11:58 +02:00
be36035058 Tint modifier change alpha if value > 1
The alpha only change if the value of the factor is greater than 1. Whith a value of 2, get a full tint with full opacity.
2017-08-10 16:39:18 +02:00
62677a73e1 Add new factor to define pixel scale
This new parameter allows to define the factor to convert stroke thickness to pixel scale.

By default the factor was set to 40 that gets a good result.
2017-08-10 16:27:28 +02:00
beb2ec2bb4 Cleanup: Remove compiler warning 2017-08-10 12:28:05 +02:00
448241cf96 Fix Tint error when factor is 1
When factor is 1, must override the alpha of the original color
2017-08-10 11:42:24 +02:00
23b37b7c2f Fix opacity modifier error with values greater than 1.0
If the opacity is set to >1 values, the alpha must be overrided.
2017-08-10 11:19:25 +02:00
288c2c4999 New Dissolve modes
Now is possible dissolve between selected points or unselected points.

This is used to simplify a stroke.
2017-08-10 10:40:50 +02:00
9d99c9f379 Include Eraser radius on UI and add keymap
The eraser radius must be available on Paint mode
2017-08-09 17:03:20 +02:00
77291e0305 Fix error with tablet eraser pen
Detect if the eraser pen is enabled without pressing any key.
2017-08-09 16:52:51 +02:00
1829f693bb Add samples option to VFX Blur modifier 2017-08-09 16:09:16 +02:00
eafc840faf Cleanup compiler warning 2017-08-09 10:26:29 +02:00
44479daa2f UI: Reorganize Stroke style panel 2017-08-08 20:29:04 +02:00
cd3ff68df3 Fix opacity modifier problem with 2.0 value
When the value is set to 2.0, the stroke opacity must be set to 1.0 to force a complete solid drawing.
2017-08-08 16:40:38 +02:00
34afceb924 New Simplify stroke operator
Internally runs the same function used in Simplify modifier, but as operator.
2017-08-07 16:58:13 +02:00
dfadb0a9b6 Cleanup: Fix typo error 2017-08-07 16:51:20 +02:00
d9890fdb7a Cleanup: Remove unused variable 2017-08-07 16:46:50 +02:00
fe393bd2a9 Keep color selected when move
When move up or down in the color list, the color must keep selected.

The code has been cleanup too.
2017-08-07 16:21:16 +02:00
cbb019718c UI: Move options to side menu button 2017-08-07 16:03:28 +02:00
1cc673ebcc UI: Move buttons in panel 2017-08-07 16:00:42 +02:00
9acbf720a0 UI: Add space between fill type and color 2017-08-07 15:52:51 +02:00
a42c59d27c UI: Set some panels closed by default 2017-08-07 15:50:11 +02:00
9f7f310e25 Fix z-depth problems in wave modifier 2017-08-07 13:14:51 +02:00
91407293bf Fix segment fault with Dupli modifier
This error was introduced after adding support for modifiers in edit mode
2017-08-07 12:13:02 +02:00
b85916efdd Merge branch 'blender2.8' into greasepencil-object 2017-08-07 11:28:42 +02:00
be12ccff4a VFX Wave modifier uses PI range
The sinusoidal curve uses a loop between 0 and PI to get better and smooth result
2017-08-07 11:04:41 +02:00
a9a37ac46c Fix problem of VFX double drawing
The vfx pass needs a separate framebuffer to avoid double drawing of the strokes.

If necessary, a full copy of the initial texture is done to be used by all vfx modifiers.
2017-08-07 10:52:00 +02:00
6abd28097d New VFX Wave modifier
Distorsion using sinusoidal wave
2017-08-06 17:07:53 +02:00
e1a798c375 Cleanup: Reorganize code 2017-08-06 15:55:52 +02:00
0c6ddc2a7b New VFX Gaussian Blur modifier
This modifier works only at viewport level and cannot be applied.
2017-08-06 13:20:50 +02:00
72b709c4a4 Cleanup: Reorganize code 2017-08-05 18:20:14 +02:00
b57d6e920e WIP: Basic structure of VFX Gaussian Blur
This is the first step to implement a system for adding VFX modifiers that are applied to viewport and not to strokes
2017-08-05 17:52:45 +02:00
4e0cd81d25 Hide Apply and Copy button for GP
The VFX modifiers cannot be copied or applied
2017-08-05 17:51:40 +02:00
24ceb20f54 WIP: Basic shader for gaussian blur 2017-08-05 17:04:57 +02:00
bf869459bb Merge branch 'blender2.8' into greasepencil-object 2017-08-05 11:19:06 +02:00
890f9d315c Minor changes to simplify modifier 2017-08-05 11:05:24 +02:00
4ab7104a97 Cleanup: Rename function 2017-08-05 10:39:38 +02:00
0e1933512c Cleanup: Remove unnecessary struct 2017-08-04 21:02:56 +02:00
61d6eb84c3 Fix mistake in previous commit 2017-08-04 21:00:20 +02:00
8f46b719da WIP: New simplify modifier
The modifier uses Ramer Douglas Peucker algorith to simplify lines.

New more work to get more control.
2017-08-04 17:49:53 +02:00
5b54c66334 Make default object display size smaller 2017-08-04 10:36:14 +02:00
a583c5ed91 Make edit lines more transparent 2017-08-04 10:35:05 +02:00
5abe6b0f3c Fix select error with Suzanne 2D
The strokes must be created with 3D space flag enabled.
2017-08-04 10:26:44 +02:00
cf19500907 UI: Cleanup error when context object is none 2017-08-03 23:21:28 +02:00
37acc75871 Cleanup: Fix some minor issues in Suzanne 2D 2017-08-03 23:09:33 +02:00
8f0e5be8aa Add a primitive for 2D Suzanne 2017-08-03 20:42:19 +02:00
f7726a09f0 Add a line when edit strokes
This thin line helps to determine the stroke shape
2017-08-03 14:10:43 +02:00
d83774c003 WIP: Basic support to display modif in edit mode
Still more work needed, but this commit add basic support to display the modifiers in edit , sculpt and paint mode.
2017-08-03 13:02:32 +02:00
173ba2e6f3 Merge branch 'blender2.8' into greasepencil-object 2017-08-03 11:13:04 +02:00
19f6e3b72a Rename file to avoid compiler error 2017-08-02 10:31:09 +02:00
3e63990dd3 UI: Hide options in weight paint mode 2017-08-01 17:39:50 +02:00
d62acd434c Cleanup: Change some definitions 2017-08-01 14:02:56 +02:00
aab881520d Merge branch 'blender2.8' into greasepencil-object 2017-08-01 13:21:04 +02:00
c618a6cf92 WIP: New weight painting mode
New mode to define the weights by stroke point.
2017-08-01 12:49:16 +02:00
6551b09f41 WIP: Weight paint mode
Initial work to implement new weight paint mode.

Now only the new weight paint brush in sculpt mode is available, but not the mode itself.

New brush paint icon design by Matias Mendiola.
2017-07-31 20:55:45 +02:00
9a413c47a4 Merge branch 'blender2.8' into greasepencil-object 2017-07-31 13:05:44 +02:00
f4abac2d78 Add bContext to Lattice modifier data for future uses 2017-07-31 12:14:23 +02:00
bdafec8488 Cleanup: Review modifier stack for lattice 2017-07-31 11:56:20 +02:00
1aeeb0bd69 Remove and move weight when remove vertex group
When remove a vertex group, moves the index of other weights
2017-07-31 11:34:51 +02:00
c3f0a0477b Cleanup: Reorganize and rename
New gpencil_modider.c module for modifiers and rename functions to keep naming convention
2017-07-31 10:42:42 +02:00
bf83610263 WIP: More work for vertexgroups
Apply vertexgroups to modifiers
2017-07-31 10:15:50 +02:00
8bab103f42 WIP: Fisrt step to implement Vertex Groups
Still more work is required to use the vertex groups, but this commit add the data to bGPDspoint struct and basic functionalities.
2017-07-30 19:08:41 +02:00
abb4147391 Move update of lattice outside
The update of the GPD cache  is moved to the corresponding update functions
2017-07-29 10:31:41 +02:00
5e03de11b7 Merge branch 'blender2.8' into greasepencil-object 2017-07-28 15:47:33 +02:00
c5a2c5699f Cleanup: Remove duplicate header definition 2017-07-28 15:40:37 +02:00
2bad140c09 Fix missing object after reload
When reload a file the lattice object assigned to the modifier was missing.

The object neede a relink inside the modifier
2017-07-28 15:35:54 +02:00
6d1a991d9a WIP: Basic Lattice modifier
Still problems loading a previous file and other issues
2017-07-27 21:07:32 +02:00
fd4a629b4d Move LatticeDeformData struct definition to header
This struct is used outside of the lattice module now and the definition now can be shared in other modules.
2017-07-27 12:13:46 +02:00
02543bf7a1 Fix segment fault when free GHash
If the GHash is null, don't free again
2017-07-26 16:51:56 +02:00
c34bcd5edf Fix rotate 3D view segment fault
The context was wrong for new modes
2017-07-26 16:28:15 +02:00
15919f4039 WIP: more work in cache 2017-07-26 16:11:42 +02:00
6016d3b539 Cleanup: Remove redundant parameter 2017-07-26 14:03:50 +02:00
3f26e92d0f Remove CACHE_REUSE
If we use a different area by object, the cache never can be reused
2017-07-26 13:55:13 +02:00
d78bf6ef99 Fix memory leak 2017-07-26 13:48:36 +02:00
53cb7be722 WIP: Basic new batch_cache by object
Need more work and review memory leaks
2017-07-26 13:29:56 +02:00
76ffc76b40 WIP: Add hash for derived frame
This is the first step to allow multi-user datablock
2017-07-26 12:02:29 +02:00
92e343258a Merge branch 'blender2.8' into greasepencil-object 2017-07-26 10:09:01 +02:00
553373be96 Fix error when rotate using 3D cursor
The rotation of the strokes must use cursor in local space.
2017-07-25 20:52:16 +02:00
030990fe45 Merge branch 'blender2.8' into greasepencil-object 2017-07-25 15:47:26 +02:00
e0bd578742 Fix error when make single user 2017-07-25 12:51:20 +02:00
da56864439 Fix memory leak 2017-07-25 12:01:15 +02:00
6622673b3f Fix error with user number
When apply array modifier the gpd is not reused, so the us must remain equal.
2017-07-25 11:14:18 +02:00
02800b747d Fix error when apply Array with more modifiers
When apply an array modiifer is necessary to create new GP datablocks and remove in the duplicate object the array modifier to avoid double effect.
2017-07-25 10:21:26 +02:00
7f444d8b34 Fix error if apply modifier with multi-user GP
The modifier cannot be applied if the GP datablock is used for more than 1 objects.
2017-07-25 10:04:49 +02:00
739960a0e1 Set all default HSV range to 1 2017-07-24 20:24:49 +02:00
1566beb4b2 Fix error when apply color related modifiers
The effect was duplicated for each stroke and the result was wrong
2017-07-24 16:46:03 +02:00
63971f4c63 New Hue/Saturation modifier 2017-07-24 13:49:19 +02:00
6bc0375d22 Opacity modifer affect strength
If the factor is > 1, the strength of the stroke is affected by modifier
2017-07-24 12:42:10 +02:00
b7d4ad7d7f Clamp to valid range 2017-07-24 12:15:17 +02:00
ff39754a95 Remove object control for Opacity
There was several problems to use an object to control opacity and how change fill opacity, so it's better to remove this and find an alternative (maybe using  shaders)
2017-07-24 11:27:36 +02:00
b9e90d53f5 Cleanup: Remove double initialization
The minmax function does this initialization.
2017-07-24 10:47:45 +02:00
f620f73b5f Filter index pass only if > 0 in modifiers
If the pass index is equal to 0, the filter is disabled. This is a handy way of reset the filter without adding new flags.
2017-07-24 10:46:24 +02:00
040d763042 WIP: Basic implementation of Opacity modifier
Still pending the target functionality.
2017-07-24 10:44:38 +02:00
3f64a0df1d Add Set Origin to Geometry
New option to set origin at the center of the strokes of the current frame.
2017-07-23 20:09:54 +02:00
54c4712888 Cleanup: Remove unused variables 2017-07-23 20:08:50 +02:00
509d1328ef Fix error duplicating object with modiifers 2017-07-23 17:50:26 +02:00
0dec2be679 More work on create objects when apply array modifier 2017-07-23 17:22:33 +02:00
f7597d1be7 Cleanup: Use standard function 2017-07-23 16:43:00 +02:00
137fdb1a66 Move define to share 2017-07-23 16:25:11 +02:00
be9d97bbe3 Cleanup code 2017-07-23 16:20:39 +02:00
03c2b29a12 Array modifier is not visible in edit mode 2017-07-23 12:40:24 +02:00
a6fd5d7c4c Fix context parameter to eval_context
The context is eval_context not bContext
2017-07-23 12:34:35 +02:00
4bba60dedc Fix error to apply modifier in wrong modes
The modifier only can be applied in object mode
2017-07-23 12:33:45 +02:00
5e1259f7da Cleanup compiler warning 2017-07-23 12:12:54 +02:00
7d25a2eb34 Merge branch 'blender2.8' into greasepencil-object 2017-07-23 11:48:09 +02:00
27b1129d57 Rename of modifiers completed
Now the old Dupli modifier is named Array and Array named Dupli
2017-07-23 11:19:30 +02:00
20e94d7f92 Before to swap array and dupli names
It's more logic to name Array the modifier called Dupli, so I'm going to swap the names
2017-07-23 10:14:20 +02:00
b2a829ea78 Cleanup: Fix typo error 2017-07-22 12:05:20 +02:00
b2d5a0b722 WIP: New Duplication modifier
This modifer works similar to use dupliobjects for the current GP object.

Still pending apply button.
2017-07-22 11:48:39 +02:00
63066150b3 Tint modifier: Create colors in new palette 2017-07-21 20:57:33 +02:00
4e50a1eb3a Cleanup: Change calculation using only matrix 2017-07-21 20:40:39 +02:00
3626088926 Cleanup: Remove some uses of G.main 2017-07-21 17:24:47 +02:00
fb299a9eed Merge branch 'blender2.8' into greasepencil-object 2017-07-21 16:40:50 +02:00
f2fe6d28f6 Fix parameter list after 2.8 merge 2017-07-21 16:34:31 +02:00
67c2eab6a1 Merge branch 'blender2.8' into greasepencil-object 2017-07-21 16:10:48 +02:00
6c05a3a99a Set cache as dirty after apply modifier 2017-07-21 15:52:33 +02:00
2b1056183c WIP: More work on modifiers
Reorganize the system to create new strokes in array modifier
2017-07-21 09:29:04 +02:00
188b1c9b29 Basic support for rotation/scale in array modifier 2017-07-20 17:26:27 +02:00
87ff38cd9e More work on modifiers
Complete rework, now the modifier data is saved in a cache and is not recalculated for each redrawing. The previous version had the problem the array strokes suffered of effect acumulation.

The array modifier is pending to add the rotation and scale parameters. Now only appear in UI panel but don't work.
2017-07-20 17:21:11 +02:00
188412246c New field to save derived data from modifiers 2017-07-20 12:03:15 +02:00
1b40b4ba30 Prepare data for new options in array modifier 2017-07-20 11:16:19 +02:00
20b1ca6cdf Fix problem when tint array strokes
The new strokes had different color because the tint was done two times
2017-07-19 16:57:40 +02:00
23c42898a1 Add inverse filter options for modifiers 2017-07-19 14:03:57 +02:00
fdd24be794 Merge branch 'blender2.8' into greasepencil-object 2017-07-19 13:18:08 +02:00
9cc10c5154 Enbale Random by default in Noise modifier 2017-07-19 13:15:21 +02:00
cb312e3a3e WIP: Initial implementation of array modifier 2017-07-19 12:23:34 +02:00
334b5e8707 Fix missing definition 2017-07-18 17:18:42 +02:00
148898479b Fix T52111: Buffer stroke obscured by buffer fill 2017-07-18 17:08:08 +02:00
92d7c9b71e More work on Noise modifier 2017-07-18 16:56:05 +02:00
6f55b2c2a5 Verify scene pointer before moving frame 2017-07-18 14:25:26 +02:00
1db1e9f816 Noise modifier move full stroke
Now it's possible to move points or full stroke
2017-07-18 14:16:53 +02:00
abfa37f715 Add step parameter to Noise modifier
Now it is possible to define a number of frames between recalculate random noise. This allows to reduce the speed of change because before, sometimes  was too fast.
2017-07-18 12:06:54 +02:00
e2a26260b5 Support several palettes in Tint modifier
When create a new set of color, support to have several colors with the same name in different palettes
2017-07-18 10:50:50 +02:00
05058ab443 Fix T52100: Buffer stroke is not visible if paint over fill
If paint  a stroke over a fill area, the drawing stroke was not visible while drawing and only when finish the stroke.

The drawing pass was mixing the with mix pass and now reuse the stroke mix. This solve the problem and increase the drawing speed because only one mix pass is necessary
2017-07-18 10:20:26 +02:00
8abb684546 Change Name of new modifiers
If use the prefix GP_, the name is not visible if the panel is narrow
2017-07-18 09:45:08 +02:00
0b2c081943 New Tint modifier
This modifier allows to tint with a color all strokes and create a new set of colors when apply the modifier
2017-07-17 20:40:42 +02:00
792ed2babc Cleanup: Fix comment 2017-07-17 16:04:10 +02:00
6ece5080cd Merge branch 'blender2.8' into greasepencil-object 2017-07-17 13:45:02 +02:00
9b293649ed Fix line removed by error
The cache must be checked
2017-07-17 13:38:51 +02:00
0c034ade43 Fix problem when check spacetype 2017-07-17 13:20:44 +02:00
2245dc80da Fix error with fill and modifiers
The modifiers must be evaluated before to affect stroke and fill
2017-07-17 13:08:15 +02:00
2f22054670 Apply smooth to subdivision modifier 2017-07-17 12:26:56 +02:00
c569634b72 WIP: More work on modifiers
Add new modifier for thickness and reorganize code
2017-07-17 12:05:44 +02:00
cd27283fde Fix modifier update when change mode 2017-07-16 18:54:06 +02:00
b424845bb5 New subdivide stroke modifier
This modifier add intermediary points to stroke to get more control points for other modifiers as Noise.

This is not a subsurf modifier. This will be a different one.
2017-07-16 17:40:29 +02:00
3c6f2af764 Refresh cache when modifiers are changed
The draw cache must be set as dirty after move up/down or remove modifier
2017-07-16 17:27:09 +02:00
4ce5b85fe1 Cleanup: Replace by standard function 2017-07-16 15:48:29 +02:00
171f6b9ab0 Cleanup: Remove unused define 2017-07-16 15:32:54 +02:00
da957a2678 More changes to noise modifier
Apply more changes and add support functions for apply, remove, etc.
2017-07-16 13:24:55 +02:00
3474115e73 WIP: First modifier for grease pencil 2017-07-15 19:46:06 +02:00
677aa38b0f Proof of concept to duplicate stroke 2017-07-15 11:29:13 +02:00
348c240924 Merge branch 'blender2.8' into greasepencil-object 2017-07-14 20:41:54 +02:00
be708092ac Merge branch 'blender2.8' into greasepencil-object 2017-07-13 18:06:38 +02:00
f1088f32f5 Merge branch 'blender2.8' into greasepencil-object 2017-07-13 18:03:31 +02:00
5e31d6ca40 Merge branch 'blender2.8' into greasepencil-object 2017-07-13 17:25:51 +02:00
01acf2e3cf Merge branch 'blender2.8' into greasepencil-object 2017-07-13 16:46:39 +02:00
b9c2800249 Merge branch 'blender2.8' into greasepencil-object 2017-07-13 11:34:52 +02:00
5b2b5d177e Remember last Palette used
When select a GP Object, the last palette used for drawing is selected. The palette only is selected if one stroke was drawn with this palette.
2017-07-13 11:33:12 +02:00
f0a7567154 Cleanup: Replace by generic function
Call generic default creation code
2017-07-13 10:59:37 +02:00
ef71351961 UI: Rename panel caption 2017-07-12 20:35:14 +02:00
a1f00219ce UI: Move frame lock and opacity to layer panel 2017-07-12 20:33:57 +02:00
125e2092ca Create default brushes and colors
Create a set of colors and drawing brushes when add a new GP object.
2017-07-12 20:31:03 +02:00
119ee390e7 UI: New Options panel by layer 2017-07-12 16:53:52 +02:00
b611d03952 UI: New parent layer panel
Move these options to new panel and reorganize layer options
2017-07-12 16:19:42 +02:00
34822e1c72 UI: New panel for onion skinning 2017-07-12 16:05:10 +02:00
227ae3021f Fix error if use several GP objects
The flag was set wrong
2017-07-12 14:17:57 +02:00
541e81ac96 Fix color distorsion while drawing
Need to use the mix_pass in order to get the same color while drawing. If the pass is not mixed with the same pass than strokes, there is a change in the color between drawing stroke and final stroke due the process to mix.

This is slower, but needed and while drawing the time delay is negligible
2017-07-12 14:12:14 +02:00
32a244caa1 Merge branch 'blender2.8' into greasepencil-object 2017-07-12 13:04:42 +02:00
6b0814af9f UI: Reorganize Palette Colors panels (WIP)
Create new panels for stroke and fill parameters
2017-07-12 13:02:56 +02:00
535ae9e1b1 Rename volumetric stroke type 2017-07-12 11:42:03 +02:00
9b1b46951c UI: Change ruler panel header
Now the panel is empty in some modes because we will add primitives in the future, but we want to keep the panel as reference.
2017-07-11 17:16:01 +02:00
738fd20839 UI: Move show direction to data panel 2017-07-11 17:03:18 +02:00
f3384e79da Fix error when undo
The drawing cache must set to dirty to avoid segment fault
2017-07-11 16:46:59 +02:00
f82f9738c5 UI: Keep tab order consistency
The tabs must be on the same order when change mode
2017-07-11 15:56:02 +02:00
4a3b7b12b5 Merge branch 'blender2.8' into greasepencil-object 2017-07-11 13:47:37 +02:00
13c60e2a52 Change Cursor management
Change how the cursor is displayed on screen and mimic standard look and feel for grease pencil
2017-07-11 13:45:33 +02:00
573074eb22 UI: move convert to geometry and ruler
Move the convert to geometry to new panel and hide rler if enable gp modes
2017-07-09 20:26:09 +02:00
ba026ff848 UI: Hide Relations and Physics panel
Hide these panel if enter in special GP modes
2017-07-09 17:36:41 +02:00
fc2e1c3a5e Fix error drawing polyline
Drawing polyline to old files produced segment fault because the cache was not marked as dirty.
2017-07-09 16:23:36 +02:00
628946ac66 Use cache_dirty instead of cache_free 2017-07-09 15:51:27 +02:00
7f29c49f89 Fix error setting origin
The calculation was not right if the object had rotations
2017-07-09 13:33:11 +02:00
adb8104c7d Finish polyline session releasing Shift
For artist is better cancel polyline drawing session releasing the shift key instead to press Esc or Enter.

Now, to draw polylines keep shift pressed and finish releasing this key.
2017-07-09 11:41:37 +02:00
24ea750659 WIP: Boundbox for GP object
This is the first implementation but cannot test because Eevee not support bounding box yet.
2017-07-08 21:22:12 +02:00
5636c5e486 UI: Enable set origin for GPENCIL type 2017-07-08 19:24:41 +02:00
a122bb8f1c Merge branch 'blender2.8' into greasepencil-object 2017-07-08 18:58:27 +02:00
612dc1008d Cleanup: remove unused line 2017-07-08 18:17:52 +02:00
2d85ed0547 Add warning if mode is not supported
Warning user if try to use a non supported set origin option
2017-07-08 18:00:05 +02:00
a21c36a272 Remove custom set origin operator
This change has been integrated in standard set origin operator
2017-07-08 17:38:56 +02:00
79f55f9544 Include set origin in standard origin operator
Instead to use a dedicated operator use standard
2017-07-08 17:33:37 +02:00
679d46ff02 Add menu to set origin operator
In order to keep the UI consistency I have added a menu.

This menu has only one option, but the UI panel looks more consistent
2017-07-08 17:10:06 +02:00
dc2e2704ad New Set Origin operator
This operator allows to change the pivot point origin for strokes.

Only valid in Edit Mode

Keymap: Ctrl+Alt+Shift+C
2017-07-08 16:24:07 +02:00
41b1687bb9 Merge branch 'blender2.8' into greasepencil-object 2017-07-07 17:00:40 +02:00
2c3ba5ef64 Cleanup: Rename icon identifier 2017-07-07 16:59:41 +02:00
80df0932bc Use new object origin icon 2017-07-07 16:52:31 +02:00
e427056b2c New Object Origin Icon
This icon is used to define stroke placement

Designed by Matias Mendiola
2017-07-07 16:52:06 +02:00
4486e89de7 Add stroke placement 3D Cursor
Add the option for 3D cursor in list of placement options and not as separated option to make UI more consistent.
2017-07-07 13:35:15 +02:00
31732af410 UI: reorganize animation panel
Create a grease pencil animation panel and separate again interpolate panel.

The default animation panel is hidden when GP Object is selected and enable some GP mode
2017-07-07 12:37:24 +02:00
f6079d5019 Merge branch 'blender2.8' into greasepencil-object 2017-07-06 12:04:00 +02:00
01738f7ad9 Change range limit for line_width 2017-07-06 12:01:01 +02:00
90a6621b25 Fix error loading old files
After a previous commit to relink palettes old files did not work
2017-07-05 20:44:00 +02:00
2381e70541 UI: Hide draw buttons
Remove these buttons from panel to keep  UI consistency
2017-07-05 16:20:00 +02:00
e5f5913625 Add new keymaps for straight and poly strokes
Line: Ctrl+LMB
Poly: Shift+LMB
2017-07-05 16:16:05 +02:00
95a7dfe4ca Merge branch 'blender2.8' into greasepencil-object 2017-07-04 17:42:59 +02:00
24c35bbf41 UI: Change interpolate panel header
Rename the header and add some options to make UI cleaner
2017-07-04 17:27:51 +02:00
c494f6cc8d Set GP modes from outliner
Set special gp modes if the object is selected in outliner
2017-07-04 17:19:37 +02:00
233d03934a UI: Make interpolate panel open by default 2017-07-04 16:55:34 +02:00
e4465f7f96 Increase paint brush size range 2017-07-04 16:48:40 +02:00
68bca5c640 Keymap F to change paint brush size 2017-07-04 16:43:11 +02:00
e4692002a0 Remove Stroke placement option 2017-07-04 16:01:21 +02:00
0b5d287b83 Reorganize stroke materials panel
The stroke style now has only solid or volumetric type and the texture and pattern have been moved as options shared by both styles.
2017-07-04 12:41:44 +02:00
c922172ca9 Cleanup: Remove unused variables 2017-07-03 20:27:55 +02:00
fb5f9763fa WIP: Add volumetric while drawing 2017-07-03 20:14:12 +02:00
d3c486fcc3 Cleanup: Remove unused line 2017-07-03 19:37:04 +02:00
35dccf35f1 WIP: Add geometry shader for volumetrics 2017-07-03 19:36:06 +02:00
9d2fce6479 UI: Hide stroke color if stroke style is texture 2017-07-03 09:10:46 +02:00
f9d625a1a1 UI: Move additive drawing to animation tab 2017-07-02 18:49:50 +02:00
dda3c11b4d UI: Move Insert/Delete frames to animation tab 2017-07-02 18:46:58 +02:00
4de700a8a6 UI: Move Draw on back to brush panel 2017-07-02 18:39:41 +02:00
3d7e5f2578 UI: Hide continuous drawing option in 3D view 2017-07-02 18:37:00 +02:00
a2e079918f UI: Move interpolate panel to animation 2017-07-02 18:35:05 +02:00
cbad88435c WIP: Basic stroke volumetric support
This need more work to expand volumetric features. Commit these changes to put in place all the pieces of the system.

We keep as is today while we decide the final design.
2017-07-02 18:10:08 +02:00
065013a957 Fix error when play animation
If the same datablock was used, there was a crash. The frame change must be evaluated before other checks.
2017-07-02 16:49:27 +02:00
2317f8c14a New stroke styles: Texture and Pattern 2017-07-01 17:06:46 +02:00
927694fd13 Changes in previous fix for T51942
The previous commit broken the stroke color update
2017-06-30 20:49:07 +02:00
8d4072f434 Merge branch 'blender2.8' into greasepencil-object 2017-06-30 20:14:29 +02:00
d0c17ef893 Fix T51942: Color not updated in UI panel
When update the color in the panel, the color box was not updated after release control.
2017-06-30 20:02:44 +02:00
d958084187 Merge branch 'blender2.8' into greasepencil-object 2017-06-30 15:39:06 +02:00
073ef79840 Fix T51936: Show draw strokes since first stroke
The drawing stroke must not be related to cache drawing because only one stroke is done at time.
2017-06-30 15:34:34 +02:00
1af42b70d1 Minimize Alpha stroke issue
Here we need is OIT (Order Independant Transparency) which is still an open issue in the realtime field (and also for Eevee). The best OIT method I know of is somewhat complex and not very precise (still not 1:1 with the ordered version). It involves more framebuffers and performance cost.

I may need to implement that in the draw manager in the future so that all engines can use it.

Thanks to Clement Foucault for the support provided.
2017-06-30 14:41:59 +02:00
4e17d1086a Merge branch 'blender2.8' into greasepencil-object 2017-06-29 16:44:33 +02:00
b8df9f6531 Merge branch 'blender2.8' into greasepencil-object 2017-06-28 13:15:04 +02:00
401086a012 Show edit points only for active object
The GP edit points are only visible for the active object, as defined in 2.8 for mesh editing, to keep UI consistency.

Before 2.8 version the edit points were visible for all objects sharing same datablock.
2017-06-28 13:12:38 +02:00
1ea4ca5faf Fix error when edit datablock used in several objects
When edit the datablock got segment fault.

Now a new hash is used to determine if the object was duplicated. This hash speed up drawing process too.
2017-06-28 10:40:05 +02:00
230d089a30 Cleanup: Improve debug messages 2017-06-27 17:43:21 +02:00
f0ada8377b Cleanup: Remove unused uniform 2017-06-27 16:52:51 +02:00
95c2c1c06f Initialize index fields for shgroups 2017-06-27 13:02:30 +02:00
9343e9cde3 Merge branch 'blender2.8' into greasepencil-object 2017-06-27 12:43:31 +02:00
b3693fa30e Fix error in GP modes for undo
When undo the special gp modes did not work.
2017-06-27 12:39:36 +02:00
76498ed570 Avoid load files with gp modes enabled
The new files must be loaded in Object mode and not in special grease pencil modes.
2017-06-27 12:05:17 +02:00
6fe488e849 WIP: Draw only the shading groups of the object 2017-06-26 21:23:40 +02:00
fe2b895a65 Merge branch 'blender2.8' into greasepencil-object 2017-06-26 20:43:52 +02:00
bdd32dce69 WIP: Use new DRW_draw_pass_subset
This commit is not complete yet
2017-06-26 20:23:56 +02:00
dd2372f187 Merge branch 'blender2.8' into greasepencil-object 2017-06-26 12:23:51 +02:00
c810e0b059 Merge branch 'blender2.8' into greasepencil-object 2017-06-24 12:27:05 +02:00
a0d88989b9 Cleanup: Add double cursor check inside function 2017-06-24 12:10:10 +02:00
a841490a2b Move again some passes inside loop
This will be necessary when the clear shgroups is on the loop
2017-06-24 12:02:44 +02:00
71fa7dbda9 Cleanup: Rename field 2017-06-24 11:28:07 +02:00
5e4be98317 Set texture to RGBA_16
It looks the RGBA_32 is not necessary
2017-06-23 20:31:43 +02:00
d8991b23e3 Enable point selection in sculpt mode
To use selection mask during sculpt need to use point selection operators.
2017-06-23 16:39:15 +02:00
bf30180654 Display edit point in sculpt mode
To use the sculpt mask option is necessary to see the selected points

Maybe need to include the select/unselect operators in sculpt too
2017-06-23 16:26:25 +02:00
54a3466f1c Merge branch 'blender2.8' into greasepencil-object 2017-06-23 15:56:07 +02:00
f4a4e394ff Change temp texture to DRW_TEX_RGBA_32 2017-06-23 09:30:22 +02:00
f7c57c5cd6 Fix problem with sculpt cursor
The cursor was not set when switch between object in different modes.
2017-06-23 09:22:03 +02:00
8d12ac0f31 Add DRW_STATE_DEPTH_ALWAYS to stroke pass
This option is required to use the zwrite option
2017-06-22 19:33:55 +02:00
fe6d4fd911 Merge branch 'blender2.8' into greasepencil-object 2017-06-22 19:11:15 +02:00
13ac2a49b0 WIP: First step to fix z-depth problem
Need a change in draw manager to allow writting zdepth without checking adding DRW_STATE_DEPTH_ALWAYS

Thanks to Clement Foucault for all the help fixing this bug.
2017-06-22 19:08:34 +02:00
4d0f0360a6 Cleanup: Rewrite if/else to make more compact 2017-06-22 17:13:28 +02:00
8e1bc5a4d2 Cleanup: Move edit and current pass out of loop
These passes don't need to be repited.
2017-06-22 13:16:39 +02:00
e8e714cc01 Cleanup: Remove unused function 2017-06-22 13:12:35 +02:00
90d7dcfe2f Fix drawing segment fault when hide colors
The batch cache must be set to dirty for all GP Objects and not only current one.
2017-06-22 12:55:38 +02:00
2103296faa Cleanup compiler warnings 2017-06-22 12:25:33 +02:00
71b4834adf Merge branch 'blender2.8' into greasepencil-object 2017-06-22 11:19:00 +02:00
cd813bae2b Rename functions and structs to new Gawain naming
As this branch is not the current blender2.8, these renaming was missing in grease pencil new code.
2017-06-21 21:00:07 +02:00
c0811b73b9 Fix merge error 2017-06-21 20:56:45 +02:00
7e66f8b140 Merge branch 'blender2.8' into greasepencil-object 2017-06-21 17:17:43 +02:00
2b0ad19dc3 WIP: Add a temp framebuffer to control z-depth
The stroke is rendered to temporary framebuffer and then render again using fullscreenquad to add the z-depth.

This cannot be done in one step because the strokes must keep the internal layers order without using z-depth values.

Still some problems with z-depth texture.
2017-06-21 16:53:09 +02:00
1e47f3368b Undo z-depth manipulation method
This method is not enough precise to get clean drawings, so we need to find an alternative solution.
2017-06-19 17:07:42 +02:00
8c310227d2 Cleaun: Add clamp to keep zdepth in valid range 2017-06-19 10:12:17 +02:00
bc348f274a Cleanup and move constant to defines 2017-06-19 10:09:44 +02:00
7eb1d77a3d Fix keep thicknees by object
This option must be by object, not by scene.

Cleanup some code too and rename to use better naming for variables.
2017-06-19 09:55:35 +02:00
453e6b7e74 Add mid range for zfight 2017-06-18 21:01:00 +02:00
693dfda035 WIP: adjust the shift factor with distance 2017-06-18 19:46:08 +02:00
501f22db81 Cleanup: Remove unused code 2017-06-18 18:49:56 +02:00
5fc2055c15 WIP: zfighting al most fixed.
Need a way to fix the problem of zdepth  and precision
2017-06-18 17:24:01 +02:00
c6ceb23aa9 Merge branch 'blender2.8' into greasepencil-object 2017-06-17 21:01:56 +02:00
556fe186e8 Merge branch 'blender2.8' into greasepencil-object 2017-06-17 16:42:28 +02:00
1623bdd948 Merge branch 'blender2.8' into greasepencil-object 2017-06-16 09:50:03 +02:00
c623fccfc2 Remove upper limit of stroke thickness 2017-06-16 08:32:13 +02:00
767f4f4587 Fix error in Cameraview when zoom
The problem was related to object scale
2017-06-15 20:12:14 +02:00
6fc5f241ca Fix segment fault if palette is missing
In some weird situations the palette can be removed.

We could consider to remove all strokes in this situation, but need further analysis. We keep the pointer checking as initial solution.
2017-06-15 16:57:37 +02:00
ebb8628e1a Implement a hash to relink palettes
Add a hash system when relink the colors to strokes to avoid the loop of all colors for each stroke.

Could use a hash for palettes, but as usually the number of palettes is very low, the speed up using hash doesn't worth the code complexity.
2017-06-15 16:55:57 +02:00
845c32540f New icon for Outliner and changes in Stroke Paint icon
The outliner icon for grease pencil must be gray to keep UI consistency.

Changed the stroke paint icon to make more visible.

Icon design credits go to Matias Mendiola
2017-06-15 13:10:15 +02:00
9e79b41397 Fix error with object scale and stroke thickness
With new calculation of previous commit for stroke thickness the scale of the object was not used and need to be used.

Now the scale is included and an average value is used because the axis change is not directly related to the stroke thickness.
2017-06-15 10:24:15 +02:00
7df3b33d93 Fix problem of stroke thickness when zoom
The stroke thickness was not working fine in Camera view.

The credits for this fix go to Clemnt Foucault and Luca Rood, thanks for the help!
2017-06-14 20:52:19 +02:00
9fceef3895 UI: Change icons for lock axis 2017-06-14 17:05:12 +02:00
1f42989cb9 New Stroke Paint icon
Designed by Matias Mendiola
2017-06-14 17:03:13 +02:00
5a4630c6f3 UI: Change GP Object icon
Replace the icon for a better and clean. Thanks to Matias Mendiola
2017-06-13 23:17:43 +02:00
9f88059d55 Fix compiler error
THe workspace definition was missing
2017-06-13 18:11:09 +02:00
01b929345b Move OB_GPENCIL icon to new position
The new icon used a postion used by new icons in master, so need to be moved.
2017-06-13 18:02:29 +02:00
c0bb7ba144 Merge branch 'blender2.8' into greasepencil-object 2017-06-13 17:00:26 +02:00
a2d053085b Cleaunp: Remove more unused variables 2017-06-13 16:51:56 +02:00
99c595499f Cleanup: More unused variables
Remove gpd from gp_copybuf_validate_colormap
2017-06-13 16:46:50 +02:00
c3fa0adcbe Cleanup: Remove unused variable
Remove mode for cache_dirty
2017-06-13 16:41:08 +02:00
a432511724 Mark old palettes as deprecated 2017-06-13 16:20:41 +02:00
44aad48ea0 Fix warnings for copy paste
The merge code from master used the old BGPDpalette and the code must use the new Palette
2017-06-13 16:09:36 +02:00
Dalai Felinto
8d3e2af877 Grease Pencil: Fix problems linking object with Pallete
This should at the very least use a hash system. But it could even do a
local pointer lookup. (Way) More often than not multiple strokes will
point to the same pallete color.
2017-06-13 15:58:51 +02:00
fb688a838f Cleanup: Remove duplicate definition
Added in other commit already
2017-06-13 13:36:31 +02:00
030c1d4aea Cleanup compiler warnings 2017-06-13 13:27:49 +02:00
Dalai Felinto
e534fc8a87 Silence tons of warnings 2017-06-13 12:57:56 +02:00
9d3e2d640e UI: back randomize button
This button was removed in a previous commit by error
2017-06-12 20:29:02 +02:00
546a59053e Include lock axis option to all GP sculpt brushes
Al brushes that move points use the lock
2017-06-12 20:05:32 +02:00
2d6dee880d New sculpt lock axis implementation
This solution works better and it is faster
2017-06-12 19:49:50 +02:00
20573fbdc0 Cleanup: Define camera view type for pixel size
New define to make more clear and separate the perspective and camera view modes for pixel size calculation
2017-06-12 16:56:11 +02:00
e9634349f6 Set sculpt cursor when enter in sculpt mode 2017-06-12 13:48:17 +02:00
b4ece07eef Hide VIEW option for stroke placement
This option is not logic in the new environment. Keep line for future uses
2017-06-12 12:27:11 +02:00
d1d369672b Set Xray mode to 3D space by default 2017-06-12 12:20:04 +02:00
0a76dbba5b UI: Move show points to display panel
This option is not used all the time and moving we keep layer panel cleaner
2017-06-12 12:13:22 +02:00
76a6b1a17a UI: Add missing pressure button
This button was removed in a previous commit.
2017-06-12 12:05:12 +02:00
ce09bb4330 UI: Rename Drawing Brush Thickness to Radius 2017-06-12 12:02:56 +02:00
033f1871b6 Fix error with select sculpt brush with keys
When press 3, the brush 4 was selected. Fixed the error and reorganized brushes.
2017-06-12 12:00:06 +02:00
3d186481ec Merge branch 'blender2.8' into greasepencil-object 2017-06-12 11:13:00 +02:00
bec911a9bf Fix problem with Ctrl + Tab for GP objects 2017-06-12 11:11:48 +02:00
14c252b73b Fix problem with Tab key
The Tab key must enable Edit mode and back to previous mode
2017-06-11 20:16:01 +02:00
dd27e30c01 Fix error render only when GP object is not selected
When the GP object was not selected the stroke must be drawn
2017-06-11 19:01:21 +02:00
7bd3db6f9f Change UI modes text
It is more clear to use standard nomemclature for the modes
2017-06-11 17:37:45 +02:00
6178014eaf Implement Ctrl+Tab key to swith modes
The Tab key switch between GP mode and object mode or edit if it was in object mode.

Ctrl+Tab switch between last mode
2017-06-11 17:32:28 +02:00
020d99fe92 Implement restore mode for Tab key
Now when you press Tab key the mode back to previous GP mode and not to Object mode always.
2017-06-11 17:01:11 +02:00
a653420aa9 Remove brush sensivity from UI panel 2017-06-11 16:00:52 +02:00
7bbcf05428 Change UI layers panel header text 2017-06-11 15:56:17 +02:00
33da82855a Hide panel header for datablock 2017-06-11 15:51:11 +02:00
c2c802f505 Replace UI list by icon preview for brushes 2017-06-11 15:43:29 +02:00
8a64370364 Merge branch 'blender2.8' into greasepencil-object 2017-06-11 13:36:04 +02:00
34020882c3 New enum property for drawing brushes
This property is necessary to include a icon view in the UI panel
2017-06-11 13:33:03 +02:00
a4f98bef1c New Display UI panel
Options moved to new panel to organize UI
2017-06-11 10:44:10 +02:00
ac33c2fc46 Move Grease Pencil selector to top panel
In order to keep UI consistency, the datablock must be in the top panel, not in layers
2017-06-10 20:39:07 +02:00
19deb16965 New operator and keymaps to select sculpt brushes
Now it's possible to select the sculpt brush sing a key between 1 and 9.
2017-06-10 20:02:11 +02:00
f0865ef298 Fix error in add GP object operator
The invoke callback is not necessary.
2017-06-10 19:14:41 +02:00
35bf5da436 Change UI panel registration order
This change is to keep the Tools tab on top because if the grease pencil panel are register at the end, the Tools tab change to end.
2017-06-10 16:01:47 +02:00
0e1613d303 New icons for Grease Pencil sculpt brushes
In order to keep consistency, we have added icons to GP sculpt brushes similar to object sculpt
2017-06-10 13:32:50 +02:00
b647f8653d Implement lock axis in Sculpt grab brush
This is the first implementation to lock the axis while sculpt. In some extreme angles the result is not perfect, so maybe need a review.

We keep in this way while we found a better approach, maybe using the reprojection of the point as it is done when draw new strokes could work better.
2017-06-09 13:13:38 +02:00
1f4b9356f9 Add missing UI options for sculpt and paint mode
The onion and mask buttons can be used in sculpt mode also.
2017-06-09 10:53:13 +02:00
861f0370c8 Fix only_render for GP object
For GP objects, the strokes must be drawn in all cases. When only render is enabled, only the pivot point is hidden, but not the strokes.
2017-06-08 16:38:22 +02:00
56e2f990e9 Merge branch 'blender2.8' into greasepencil-object 2017-06-08 15:47:39 +02:00
eef92d418e Remove ALT key for straight lines
There was a conflict with new Eraser keymap. Keep only CTRL.
2017-06-08 15:44:27 +02:00
2c9401b73d Eraser only available in Paint mode
During sculpt and edit this operator is not available
2017-06-08 13:42:17 +02:00
adf05b0181 Implement object change while in GP modes
Now the user can select other objects for paint or sculpt.

In edit mode is not possible in order to keep UI coherence
2017-06-08 13:39:02 +02:00
7b6c7f07d5 Fix cursor error when using eraser
The cursor did not return to paint after using eraser
2017-06-08 12:15:20 +02:00
2758319abe Hide material panel in BI render for GP Objects
When a GP object is selected, this panel must be hidden
2017-06-08 12:04:49 +02:00
9e028f5feb Hide material panel in Cycles for GP Objects
When a GP object is selected, this panel must be hidden
2017-06-08 12:04:22 +02:00
65d470291c Fix error when no object selected 2017-06-08 11:57:00 +02:00
d29ea70283 Hide material panel in Eevee for GP objects
When a GP object is selected this panel must be hidden
2017-06-08 11:49:01 +02:00
05b9a677c6 Replace Erase Keymap to LeftMouse + Alt
In order to keep consistency with Blender, the right mouse is used to select objects, so the eraser must use a different key.

This can be changed after more workflow tests
2017-06-08 11:48:29 +02:00
b0d322c603 Change how continuous drawing works in 3D view
In 3D view is not ggod for wrokflow to enable continuous mode with the new paint GP mode.
2017-06-08 11:37:27 +02:00
987b4a51ff Edit strokes panel must be expanded by default 2017-06-08 11:17:02 +02:00
399c654042 Hide transform panel in GP modes
This panel only add noise to the panel while drawing
2017-06-08 11:15:48 +02:00
d94954c19b Change assigned icons for lock axis 2017-06-08 10:59:30 +02:00
ae23f56658 WIP: More UI changes and continuous drawing
More changes in the panels and enable continuous drawing mode by
default.
2017-06-07 16:40:15 +02:00
9ed07cf461 Set sculpt cursor when enter in sculpt mode
Include some cursor reset for other modes
2017-06-07 16:35:39 +02:00
40dc9b0f04 Set the default cursor
Sometimes when restore previous cursor, the value is not the default, so it's better to set manually.
2017-06-07 16:07:05 +02:00
f7a6d72c83 WIP: More UI panel reorganization 2017-06-07 14:02:01 +02:00
63639b9ed1 Reset cursor if mode change 2017-06-07 13:53:48 +02:00
3b675b1aa3 Enbale paint window cursor when enable paint mode 2017-06-07 13:27:51 +02:00
c1bededd1c WIP: UI panels reorganization
Moved the stroke placement to bottom of the viewport instead of Tools panel.
2017-06-07 13:11:07 +02:00
99b17b64ee Merge branch 'blender2.8' into greasepencil-object 2017-06-07 12:05:33 +02:00
014325fdd2 Move PaletteColors to Materials tab
Although the grease pencil colors aren't real materials, in order to keep UI consistency, we have moved to this tab the palette control.
2017-06-07 12:01:13 +02:00
18a8aac3c9 Fix bug for filling while drawing
If the opacity was set to 0, the filling area must not be showed during drawing
2017-06-07 10:28:20 +02:00
e709239530 Change toggle Paint and Sculpt mode keymaps 2017-06-06 20:42:16 +02:00
8d13fe340b Color Palette must be visible always 2017-06-06 20:38:29 +02:00
7480b2381d New fill style using patterns
Now it is possible to use a texture to define the fill color pattern, similar to the use of noncolor textures.
2017-06-06 17:19:48 +02:00
13b283504f Create new option to keep stroke thickness
In some situations is good to be able to keep the stroke thickness when viewport zoom factor change.

This option is disabled by default.
2017-06-06 13:18:13 +02:00
69c9163baf Cleanup: Fix merge error 2017-06-06 11:57:05 +02:00
afe41ab869 Merge branch 'blender2.8' into greasepencil-object 2017-06-06 11:34:41 +02:00
79660741ae WIP: Adapt UI panels to new GP modes 2017-06-06 11:22:44 +02:00
4c216cb982 Fix problem when back from paint and sculpt modes 2017-06-06 11:22:44 +02:00
4447eff930 Change keymaps for new modes 2017-06-06 11:22:43 +02:00
941a854674 Check mode status before change 2017-06-06 11:22:43 +02:00
1a47860969 Cleanup compiler warnings 2017-06-06 11:22:43 +02:00
a57f4ca240 Define keys to switch grease pencil modes 2017-06-06 11:22:43 +02:00
dd6b008fb4 WIP: Initial implementation for paint mode
The paint mode need more work, but it start to work.
2017-06-06 11:22:43 +02:00
5db3d17c8c WM: add WM_manipulatorgrouptype_append_ptr
Needed for PyAPI registration.
2017-06-06 11:22:43 +02:00
7a02efb716 WM: de-duplicate operator append code
WM_operatortype_append(_ptr) functions had diverged.
2017-06-06 11:22:43 +02:00
9365b6ed8e PyAPI: is_staticmethod used for classmethods's too
Add note to investigate this, don't change so close to release.
2017-06-06 11:22:43 +02:00
7942057abb PyAPI: correct exception, expect 'staticmethod' 2017-06-06 11:22:42 +02:00
c5b85c9879 DwM: skip background-set objects w/ selection 2017-06-06 11:22:42 +02:00
b010a804f2 Fix alembic tests not running with debug build on windows 2017-06-06 11:22:42 +02:00
359058f4b2 Clay Engine: Improve sampling of SSAO
Replace completly random noise by Blue noisen, giving a better aspect.
Also randomize the distance in the sample direction to cover the whole distance even with 1 sample. Using another blue noise for this.
Replace spiral samples (that had tendency to align if the number of samples was near the chosen constant) with Hammersley samples that have good coverage even for low number of samples.
Use a UBO instead of Texture (a bit less latency) making things a tiny bit faster.
Move the noise data to the SceneLayerData, because each render layer can have a different sample count.
2017-06-06 11:22:42 +02:00
e4591d3576 Eevee: Modify Blue Noise. 2017-06-06 11:22:42 +02:00
a02365ae5a Eevee: Move Spherical Harmonics to a new Probe UBO.
Keep data packing tight to prevent use of padding floats
2017-06-06 11:22:42 +02:00
9e2b85e171 Cleanup: Remove unused code to set mode
This code is not used anymore in viewport with new modes
2017-06-06 11:22:42 +02:00
b56339e528 WIP: Basic structure for new object modes
Now there are 3 modes: Edit, Paint and Sculpt strokes.

These modes are only for new GP object.

Notice: Now the paint and sculpt modes can be activated but don't work.
2017-06-06 11:22:41 +02:00
9022025fca Eevee: Material code refactor.
Separate material handling inside another file.
Make use of enums to identify shader variations.
Group all 64*64 LUTs into one array texture.
Only update world probe if world changes.
2017-06-06 11:22:41 +02:00
1550fa3db6 World: Add temporary update flag. 2017-06-06 11:22:41 +02:00
da99c6aca9 Remove Edit Strokes mode for scene
This mode is not necessary because the mode is added at object level and the scene level is not available anymore.
2017-06-06 11:22:41 +02:00
e073a0aa07 Fix T51587: Blender fails to interpret a specific layer in OpenEXR multilayer file 2017-06-06 11:22:41 +02:00
nBurn
fd3d9bf9f7 PyAPI: Cleanup "Python API Overview" doc
Reword to clean up some odd grammar (mostly dangling modifiers) and
improve readability.

Differential Revision: https://developer.blender.org/D2699
2017-06-06 11:22:41 +02:00
0d749dbc77 Fix T51691: Shear cursor input scales w/ zoom
Use relative value from cursor movement.
2017-06-06 11:22:40 +02:00
060b5672ca Merge branch 'blender2.8' into greasepencil-object 2017-06-03 20:05:58 +02:00
6c0d8edbb3 Disable datablock at scene level
Now to paint in 3D view is necessary to add a GPencil object
2017-06-03 20:00:25 +02:00
743eb1df51 Set Object mode as default for new strokes 2017-06-02 18:53:22 +02:00
d8839ac928 Convert always scene GP datablock to new GPencil object 2017-06-02 17:26:08 +02:00
04974c145d Cleanup: rewrite some lines for tab key 2017-06-02 16:07:20 +02:00
ed9fb4201a Fix tab key for Edit Strokes after Workspaces merge
The tab key for enter in edit mode for GPencil objects was not working with new workspaces.

Still there is a problem with datablocks at Scene level (TBD)
2017-06-02 13:26:36 +02:00
8066729f6d Fix missing edit strokes mode after merge Workspaces
After the merge, the mode was not working because the SPACE_INFO was not included.

Some minor changes too.
2017-06-02 12:29:34 +02:00
4cf8676705 Fix merge error due VS2017 crash
During merge, VS2017 crash and abort merge for this file.
2017-06-02 10:12:09 +02:00
b628990ae8 Merge branch 'blender2.8' into greasepencil-object 2017-06-02 10:08:27 +02:00
747bd3c369 Rename identifier OB_MODE_GPENCIL
Rename to prepare for new modes
2017-06-01 20:42:25 +02:00
2ee74e94aa Fix error for ghost icon in palette
THe ghost icon was not working with new draw manager because the check was not migrated.
2017-06-01 15:46:40 +02:00
81786c91e4 Cleanup comment 2017-06-01 11:12:19 +02:00
c0c0483244 Merge branch 'blender2.8' into greasepencil-object 2017-06-01 10:42:41 +02:00
7edf993ba6 Try to use dynamic memory for shading groups
The reallocation of the memory produce weird things, so we keep allocation maximum number while we found better solution.
2017-06-01 10:35:24 +02:00
e4ef59a6a3 Fix error when drawing in an empty frame
If drawing new stroke in an empty frame, but the layer had previous frames, the cache must be set as dirty to avoid segment fault.
2017-06-01 10:20:29 +02:00
ed338ba9d0 Cleanup: Remove unused field 2017-05-31 19:18:39 +02:00
844e8fbcd0 Cleanup: Remove unused code 2017-05-31 19:16:58 +02:00
ab53b68745 Merge branch 'blender2.8' into greasepencil-object 2017-05-26 20:02:21 +02:00
02c0bd9a4c Merge branch 'blender2.8' into greasepencil-object 2017-05-24 20:14:47 +02:00
c828780ec8 Merge branch 'blender2.8' into greasepencil-object 2017-05-24 19:34:18 +02:00
2d448dfee8 Fix error when duplicate GP object
When duplicate an object, the cache must be recalculated and is not copied.
2017-05-23 20:22:49 +02:00
789b53d8bd Create a separated struct to hold shading groups 2017-05-23 17:44:41 +02:00
62ec40e4e5 Merge branch 'blender2.8' into greasepencil-object 2017-05-23 15:58:32 +02:00
b7c8f44e79 Reproject the point while drawing
If the point is not reprojected and the axis is locked, the thickness of the drawing stroke is different when the stroke is completed.

Reprojecting the stroke drawing buffer simulate the stroke thickness when it will be reprojected in 3D space and get better drawing feedback.
2017-05-22 21:03:56 +02:00
5b33f88e9a New function to reproject a point
This function will be used while drawing in draw manager gpencil engine
2017-05-22 20:30:06 +02:00
b28e35dd02 Cleanup: Rename function 2017-05-22 20:24:44 +02:00
2ab792dcfd Cleanup: extract reproject functions 2017-05-22 20:18:30 +02:00
ed24e39b54 Merge branch 'blender2.8' into greasepencil-object 2017-05-22 14:59:29 +02:00
e545a50e2a Fix segment fault when using eraser
The cache must be marked as dirty after any change operation, and the eraser change the strokes
2017-05-21 19:40:08 +02:00
cad9f2fd17 Fix UI panel problem in properties tab 2017-05-21 17:44:29 +02:00
32a8f3551f Cleanup: More unused include files, reorganization and name changes 2017-05-21 17:29:58 +02:00
7af2a45a38 Cleanup: Remove unused include files 2017-05-21 17:19:55 +02:00
ecd4984278 Merge branch 'blender2.8' into greasepencil-object 2017-05-21 16:32:28 +02:00
82e3302f44 Create a cache to drawing objects
Due speciall requirements for 2D drawing, the GP objects must be drawn after be sorteed by zdepth value.

We cannot use a simple GPU zdepth because this override the current layer/strokes order and the artists need to keep these controls as primary sorting method instead of GPU zdepth.
2017-05-21 16:28:56 +02:00
62a8d9fb12 Create a shading group by stroke
As the drawing order is very important in 2D, each stroke must use its own shading group and don't share with others or the drawing order is missing and the layer system does not work.
2017-05-21 13:20:28 +02:00
cccd0cfc12 Disable zdepth write for strokes
After some analysis, the strokes must work without affect the zdepth buffer or the layer system will not work.

The 2D artist agree that layer system must be the main zdepth order and not the GPU checking.
2017-05-21 13:10:50 +02:00
8c0f4aa557 Cleanup: Create several separated functions 2017-05-20 20:27:40 +02:00
5bd0a6d25b Enable again write depth pass for strokes only 2017-05-20 19:40:35 +02:00
f384e83475 Remove write zdepth to avoid z-fighting
The strokes don't need to write the depth buffer
2017-05-20 16:50:32 +02:00
8ea8bf4dc6 Merge branch 'blender2.8' into greasepencil-object 2017-05-20 13:04:25 +02:00
b439a9a83f Cleanup: Change some xray strings and parameter names 2017-05-20 12:58:17 +02:00
73d3f283e1 Cleanup: Remove unused code
THis code has been ported to new shaders
2017-05-20 09:43:34 +02:00
4192c8214f Implement Xray mode for strokes
Now support 3 modes: Front, 3D space and Back.

Still some problems with zfighting with layers that need to be fixed
2017-05-19 20:28:57 +02:00
382b5f9d59 Use zdepth of the position in geometry shader 2017-05-19 16:48:37 +02:00
db8e8bafe5 Merge branch 'blender2.8' into greasepencil-object 2017-05-19 16:03:01 +02:00
d2d9244230 Add more control for debug lines
Now the debug lines are only visible when code is 668
2017-05-19 15:47:19 +02:00
c96cfbb196 Merge branch 'blender2.8' into greasepencil-object 2017-05-18 20:06:37 +02:00
875bbabc1e Separate zdepth to function to use in future
Now, the value is fixed but need to be calculated.
2017-05-18 10:11:52 +02:00
4bc2308959 Cleanup unused code 2017-05-17 16:51:38 +02:00
cd9ec95130 Add debug information 2017-05-17 16:50:25 +02:00
47c1fbdc85 Add set cache to dirty when Gpencil is update in several places 2017-05-17 16:42:42 +02:00
8651d02051 Remove old opengl code 2017-05-17 13:56:28 +02:00
8451c159e9 Remove zdepth check for Drawing buffer
The drawing buffer and edit point must be always visible
2017-05-17 11:47:35 +02:00
ab9f5c23ef Enable zdepth for passes.
Actually only works for filling
2017-05-17 11:34:14 +02:00
d7fc6198ea Merge branch 'blender2.8' into greasepencil-object 2017-05-17 10:44:33 +02:00
b47e10c4c7 Remove old opengl code in shaders 2017-05-17 10:25:12 +02:00
d05e145c46 Remove check on back of camera
This check is getting weird result and create a segfault in the cache due changes in the index of the stroke depending of point of view.

Need to have a better implementation. We keep disabled while we found a better solution that not change the index of the strokes (maybe separate this check and add to cache_idx anyway)
2017-05-16 20:33:05 +02:00
d607688f96 Fix segfault error when drawing several strokes in same drawing session
The clean of the cache must be done by stroke and not at the final of the drawing session.
2017-05-16 19:25:07 +02:00
9d01058d43 Migrate scale pixel code to vertex shader 2017-05-16 18:37:41 +02:00
da11a819eb Cleanup: Rename functions 2017-05-16 13:29:43 +02:00
c6e8202816 Fix problem with UI panel for convert to GP object button 2017-05-16 13:17:13 +02:00
f1c2f8ab83 Cleanup: Add EOL at end of file 2017-05-16 12:55:39 +02:00
30fe33fba6 Merge branch 'blender2.8' into greasepencil-object 2017-05-16 12:27:20 +02:00
9fea542986 Remove separated batch cache for points
The stroke batch cache can be used for points and strokes, because both are equal and we don't need to define separated variables and use more memory.
2017-05-16 12:25:13 +02:00
239e8f3ae4 Remove flag fields to control buffer stroke creation
These fields are not necessary now.
2017-05-16 12:22:02 +02:00
48b2e05ffd Update draw manager cache when change any RNA property 2017-05-15 20:12:18 +02:00
029f8292c0 Fix merge errors 2017-05-15 11:21:15 +02:00
d91d88c810 Merge branch 'blender2.8' into greasepencil-object 2017-05-15 10:56:00 +02:00
d8a37d3e7c WIP: Add a cache system for strokes
The new cache is allocated to save the strokes and is only recalculated when there are changes.

Need more testing to be sure all situations are working fine.
2017-05-15 10:42:04 +02:00
Dalai Felinto
4195e4cc7e Fix for edit modes (sculpt, weight paint) menus not showing in header
But introduced on 2b0f02057f
2017-05-15 10:42:04 +02:00
Dalai Felinto
e58b4d228b Startup.blend: set EEVEE as the default engine
The original idea was to use Clay as the default. But since clay may not
even be in the final release, we can't afford to have a startup.blend
that doesn't deliver a reliable result regardless of build options.
2017-05-15 10:42:04 +02:00
c873fc094f Use static assert in Clay engine to ensure struct alignment 2017-05-15 10:42:04 +02:00
a38a9751bf Some minor cleanup. 2017-05-15 10:42:04 +02:00
c7c5bf8a35 Fix again DwM bbones drawing.
Stupid mistake in rB6824ee0595c9dd7d1c18864f2 fix, again reported by
@campbellbarton, thanks.
2017-05-15 10:42:03 +02:00
8ce7b1376e Mesh Center: improved center-of-mass calculation
Previous method was based on face-area, giving un-even results
based on topology and gave issues with zero area faces.

This method gives matching results for concave ngons and the same geometry triangulated.
2017-05-15 10:42:03 +02:00
Julian Eisel
fd78016ecd UI: Add template_search (version of template_ID for non-IDs)
Adds a version of template_ID that can be used for non-ID properties.
The property to search for and the collection to search in has to be
passed to it.
Like template_ID it also takes arguments to define a 'new' and 'unlink'
operator. They will be displayed as icon-only buttons then.
Also added a version that can display preview thumbnails.

Had to do some additional changes to make text-buttons support
displaying/modifying empty RNA properties.

This will be needed for workspaces, see D2451.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D2666
2017-05-15 10:42:03 +02:00
59aa170c0f Fix T51449: empty node editor continuously redrawing and using CPU. 2017-05-15 10:42:03 +02:00
2ade6b29a9 Cleanup: Rename field 2017-05-11 19:51:05 +02:00
88028209a9 Merge branch 'blender2.8' into greasepencil-object 2017-05-11 19:11:48 +02:00
9aa62c1da5 Cleanup: Extract pixel scale function 2017-05-11 11:38:06 +02:00
8da8cdff41 Merge branch 'blender2.8' into greasepencil-object 2017-05-10 16:19:31 +02:00
4d3aaaaa79 Merge branch 'blender2.8' into greasepencil-object 2017-05-09 21:56:36 +02:00
a895e8e512 Use different points for stroke ends calculation
With old method the end of the stroke sometimes looked weird
2017-05-09 21:54:05 +02:00
495f1d7a6d Increase thickness limit range 2017-05-09 15:04:52 +02:00
319362dfbe Remove static matrix definition 2017-05-09 13:02:16 +02:00
16b24358fa Fix UI panel error 2017-05-09 12:47:26 +02:00
6d640fe48c Cleanup: Remove more unused vars 2017-05-09 11:08:16 +02:00
3a3a89704c Cleanup: Remove unused variables 2017-05-08 21:05:37 +02:00
a28bbb3fdb Merge branch 'blender2.8' into greasepencil-object 2017-05-08 20:45:13 +02:00
0925574c2c Add clamp support for textures
The texture is clamp using clamp of the UVs, because if we clamp the texture using GPU_texture_wrap_mode, any place where this texture is used would be affected.
2017-05-08 20:41:16 +02:00
7c4f6e8eae Fix missing textures when reload
The texture is not saved in texturelist and is passed directly to shader
2017-05-08 20:41:16 +02:00
Dalai Felinto
0d7fd2a08f More warnings cleanup 2017-05-08 14:55:22 +02:00
Dalai Felinto
cba86fbd77 Fixing gpencil screen drawing after warning cleanup
I find strange that this needs to be static, and can see this being an issue
for simultaneous drawing in the future. That said, better leave it
working as before.
2017-05-08 14:54:35 +02:00
Dalai Felinto
e93279dc06 Fix blenderplayer build 2017-05-08 14:46:38 +02:00
Dalai Felinto
7ec7f324a3 Fix build warnings
* gcc complain if you have a "main" variable
* Missing header include in gpencil_draw.w
* A few shadowed variables (we should avoid common names in (#define) macros)
* Clear ambiguity in (!flag & VALUE) -> ((flag & VALUE) == 0)
2017-05-08 14:37:09 +02:00
3135507683 Cleaunp code 2017-05-08 12:57:37 +02:00
8a74671466 Fix memory leak and access violation
The builtin shaders are free in blender close, so the engine must not free them. The memory leak was relatred to recreate the shaders again and again, so the free only use the last copy.
2017-05-08 12:53:36 +02:00
7b8b23d1ef Merge branch 'blender2.8' into greasepencil-object 2017-05-08 12:03:47 +02:00
525b869ba6 Some missing free memory for shaders 2017-05-06 20:27:17 +02:00
501da3a717 Merge branch 'blender2.8' into greasepencil-object 2017-05-06 18:34:56 +02:00
c468922eae Merge branch 'blender2.8' into greasepencil-object 2017-05-05 20:15:30 +02:00
5d8ef4ecba Check zdepth to avoid strokes in back of camera
Do not draw if the stroke ison  back of the point of view.
2017-05-05 16:29:33 +02:00
561668d590 Cleanup: Remove unused variables 2017-05-05 13:20:05 +02:00
7bfc1b7dbd Merge branch 'blender2.8' into greasepencil-object 2017-05-05 12:15:24 +02:00
291f49b0b2 Merge branch 'blender2.8' into greasepencil-object 2017-05-04 20:23:02 +02:00
71366b9f2a Cleanup: make code more compact 2017-05-03 16:45:48 +02:00
6ad29aaeec Increase thickness limit parameter 2017-05-03 16:41:33 +02:00
f5f93bc576 WIP: new method to calculate scale of the stroke thickness
The previous scale method was not valid because only was affected by viewport, but not by GP object or Stroke location. Now, the pixel size is calculated depending of zdepth and used to scale the stroke thickness.

Maybe there are other ways to do it, but this approach works, so we keep it before finding better methods
2017-05-03 16:31:23 +02:00
f6b2b2cf38 Merge branch 'blender2.8' into greasepencil-object 2017-05-02 22:25:23 +02:00
d906c6c056 Cleanup: Move scale code to function 2017-05-02 22:09:58 +02:00
9c65a99959 WIP: Apply scale to strokes thickness 2017-05-02 20:37:35 +02:00
ded0f9604e Merge branch 'blender2.8' into greasepencil-object 2017-05-01 16:20:05 +02:00
bafd64cbd9 Draw solid area while drawing for non solid colors
For these styles, the fill is simulated with a solid color that will be replaced when the stroke is completed
2017-04-27 19:04:03 +02:00
1632446deb Rename files to align with naming conventions for drawing engines 2017-04-27 12:29:52 +02:00
f49c960ce6 Merge branch 'blender2.8' into greasepencil-object 2017-04-27 11:45:19 +02:00
c5faa0b8eb Draw scene datablock using draw manager
The scene is drawn in the populate callback, and a flag is added to do it only once per drawing cycle.
2017-04-27 11:36:00 +02:00
28edc3f46f Remove duplicate character on previous commit 2017-04-25 23:10:36 +02:00
d80b3430a0 Cleanup: remove evil context for toolsettings 2017-04-25 23:09:44 +02:00
b568227c6a Cleanup: create function with all drawing steps
This separate the drawing function in order to prepare for drawing scene datablock
2017-04-25 23:07:28 +02:00
8cd8be2929 Reduce the use of context functions and use DRWContextState members 2017-04-25 23:00:27 +02:00
28b7848069 Adapt code to new context methods 2017-04-25 21:21:58 +02:00
546b73334f Merge branch 'blender2.8' into greasepencil-object 2017-04-25 20:49:16 +02:00
0367e13089 Merge branch 'blender2.8' into greasepencil-object 2017-04-24 22:16:07 +02:00
c9b0113c13 Fix problem with layer drawing order
The fill and stroke must be in the same pass to keep layer drawing order
2017-04-23 18:32:44 +02:00
2209f6e23a Add functions to draw strokes with one point only 2017-04-23 11:24:23 +02:00
c658e4ce1b WIP: Basic texture filling support
Pending to add more options
2017-04-22 20:13:34 +02:00
1397ff2a32 Fix problems after merge 2017-04-22 19:04:20 +02:00
f29c828b6d Cleanup: Remove unused shader definition 2017-04-22 19:03:53 +02:00
2165c0ce8f Merge branch 'blender2.8' into greasepencil-object 2017-04-22 18:28:42 +02:00
886d213a14 Draw buffer if stroke shaders are not loaded yet
This fix the problem for the first stroke in the frame
2017-04-22 18:18:19 +02:00
b2c97c978c Cleanup: Replace duplicate lines by helper function 2017-04-22 18:15:46 +02:00
a2dff88140 WIP: Add current stroke buffer to drawing manager
Pending to solve the error for first stroke before frame is created
2017-04-22 12:48:07 +02:00
637ce11895 Merge branch 'blender2.8' into greasepencil-object 2017-04-19 10:50:20 +02:00
dbf89fdd7a Merge branch 'blender2.8' into greasepencil-object 2017-04-18 19:22:00 +02:00
db97503540 Merge branch 'blender2.8' into greasepencil-object 2017-04-16 15:56:06 +02:00
b2c28127e2 Fix some errors in onion skins 2017-04-15 15:14:24 +02:00
834730e123 Separate in different passes 2017-04-14 19:47:27 +02:00
5049726be2 Prepare shaders for animation onion skin data 2017-04-14 19:07:32 +02:00
f9d0b63960 Reorganize strokes drawing code 2017-04-14 16:16:49 +02:00
780d62e774 Save parent matrix in bGPDlayer
It's faster a more efficient to save this drawing matrix by layer instead to allocate memory on the fly.
2017-04-14 12:54:34 +02:00
6008e08187 Merge branch 'blender2.8' into greasepencil-object 2017-04-14 12:15:54 +02:00
3dd7267d5a Remove duplicate function
Initially, the function to calculate the matrix was different, but now both are equal, so new function can be deleted.
2017-04-14 12:13:46 +02:00
371eaac9ee Merge branch 'blender2.8' into greasepencil-object 2017-04-13 19:43:17 +02:00
30a558bce5 When remove layer parent reset stroke position
With new design when a layer parent is removed, the stroke revert to original position without parenting.
2017-04-13 19:40:27 +02:00
a831b86bfe WIP: Add layer parenting
There are some memory  leaks
2017-04-13 18:32:53 +02:00
e3cefe5ed0 Add TODO for xray functionality 2017-04-13 17:52:06 +02:00
41afab8258 Cleanup: Use macro to free shaders 2017-04-13 15:31:08 +02:00
1348caa1ab Merge branch 'blender2.8' into greasepencil-object 2017-04-13 12:29:26 +02:00
4388bbf9d6 Remove inverse matrix in drawing
With new shaders, it is better to use a object global matrix and do not calculate for each point the position.
2017-04-13 12:20:34 +02:00
c810fdd5df WIP: Add basic editing points to strokes 2017-04-13 12:08:50 +02:00
3f00d9b8b8 Add new data_size new parameter and avoid error with null gp 2017-04-12 20:15:34 +02:00
c50bbd3ac4 Merge branch 'blender2.8' into greasepencil-object 2017-04-12 19:49:28 +02:00
80acd72bab Cleanup: Remove unused include and options 2017-04-12 12:52:06 +02:00
a6e89c5151 Fix problem with fill_style
The different memory size of the variable corrupted mix_factor
2017-04-12 12:36:45 +02:00
03df48a28a WIP: add basic support for stroke filling using draw_manager 2017-04-12 12:11:34 +02:00
16e9cf2bb3 Merge branch 'blender2.8' into greasepencil-object 2017-04-12 10:14:18 +02:00
3800421d6b Fix merge error
Due error during mergetool command, the merge was wrong in previous commit.
2017-04-11 21:33:32 +02:00
980205b539 Merge branch 'blender2.8' into greasepencil-object 2017-04-11 20:03:43 +02:00
14057b670d WIP: Add basic stroke drawing using new draw manager
The position is not correct and fill is still missing
2017-04-11 19:43:53 +02:00
6eecbca309 Disable again drawing
The functions aren't ready yet
2017-04-11 11:49:02 +02:00
8500772d77 Check layer and frame before drawing 2017-04-11 11:34:31 +02:00
a4afeeadea Add volumetric shader 2017-04-11 11:23:51 +02:00
33e88a51b6 Call gpencil engine from draw_manager 2017-04-10 21:59:27 +02:00
fb1559043a Create storage and small fixes 2017-04-10 21:59:09 +02:00
33078609df Merge branch 'blender2.8' into greasepencil-object 2017-04-10 19:36:45 +02:00
9219dd9137 Register gpencil engine in draw manager 2017-04-10 19:22:06 +02:00
935b954685 Fix typo error
When build shaders the linker fails due an error in glsl datatoc name
2017-04-10 19:21:41 +02:00
a1a7e3a10c Only draw strokes if active object is grease pencil 2017-04-10 13:34:40 +02:00
870568a0ef Replace GL_FLOAT 2017-04-10 13:33:09 +02:00
fca84238f6 Merge branch 'blender2.8' into greasepencil-object 2017-04-10 11:24:34 +02:00
ffd0c3e42a Replace VertexFormat_add_attrib types to new values 2017-04-09 18:20:18 +02:00
524abadae7 Merge branch 'blender2.8' into greasepencil-object 2017-04-09 16:56:52 +02:00
ef18c6080b First steps to create new drawing mode for gpencil
Created basic structure of the drawing mode, but pending of adding all functionality and link to draw manager.
2017-04-09 16:52:36 +02:00
100f5052d4 Change function name after rename of Gawain function 2017-04-06 16:36:32 +02:00
d14258fd3f Merge branch 'blender2.8' into greasepencil-object 2017-04-06 16:01:39 +02:00
0cc77b5492 Free new symbol memory
I forget include the memory free in previous commit
2017-04-05 19:12:11 +02:00
0d668cdf79 Merge branch 'blender2.8' into greasepencil-object 2017-04-05 17:39:22 +02:00
277d0891ff Add new draw manager symbol for new ob_gpencil object type 2017-04-05 16:50:12 +02:00
9f16b6606e Include class registration for scene GP panel
After the last changes in the classes registration, need add the class to the the list.
2017-04-04 13:27:34 +02:00
a29c0a5f81 Include ModelViewProjection matrix to use in the future
This will be used to calculate the stroke thickness
2017-04-04 12:44:59 +02:00
bf4c804309 Cleanup code 2017-04-01 11:35:18 +02:00
3a0c2a7555 Remove unused ARegion parameter
This parameter was added for new shaders, but finally is not used.
2017-04-01 11:27:59 +02:00
61fe9afd29 Remove scale factor for thickness
With the new draw manager, calculate the scale in the drawing is not a solution because the batch drawing need to include the scale calculation in the shader.

TODO: Add scale calculation to shader itself.
2017-04-01 11:16:29 +02:00
77f4152124 Move initialization code to new versioning file 2017-04-01 11:13:03 +02:00
c642a697e1 Merge branch 'blender2.8' into gpencil_2.8 2017-04-01 10:42:02 +02:00
e329f01c94 Cleanup: Remove variables for cyclic and use pointers 2017-03-31 12:33:37 +02:00
de2f450347 Cleanup: Reduce variable declaration 2017-03-31 12:26:41 +02:00
d97a79cfed Cleanup: Make code more compact 2017-03-31 12:19:14 +02:00
50f6683fc8 Cleanup: Remove extra space lines 2017-03-31 12:16:18 +02:00
9891e42411 Merge branch 'blender2.8' into gpencil_2.8 2017-03-31 11:37:40 +02:00
60fca1783c Add support for cyclic stroke 2017-03-30 17:47:29 +02:00
6886e79303 Cleanup: Rename screen var and change culling factor 2017-03-30 17:47:15 +02:00
f0ea3736df Add stroke culling to avoid weird lines 2017-03-30 17:00:54 +02:00
e987e81dd4 Change stroke scale 2017-03-30 17:00:27 +02:00
8ead0c13aa Merge branch 'blender2.8' into gpencil_2.8 2017-03-30 16:20:59 +02:00
e82b18dd61 Merge branch 'blender2.8' into gpencil_2.8 2017-03-29 16:58:23 +02:00
eecc29ec67 Add offset parameters 2017-03-29 13:30:23 +02:00
70dc128de5 Replace windows size by parameters 2017-03-29 11:16:29 +02:00
0aa9cf75ed Use RegionView3D matrix instead of general Opengl matrix 2017-03-29 10:56:57 +02:00
d15e3aaa62 Shader almost working 2017-03-28 20:29:50 +02:00
4bb7f4825b Merge branch 'blender2.8' into gpencil_2.8 2017-03-28 13:07:46 +02:00
a352c887e1 Basic geometry for strokes working
Pending to remove rotation of the matrix
2017-03-28 12:50:21 +02:00
c85c3ffa67 Remove culling 2017-03-28 12:17:56 +02:00
06577d60c0 Use Opengl constant 2017-03-28 11:29:05 +02:00
7875ab1b80 Merge branch 'blender2.8' into gpencil_2.8 2017-03-28 10:24:17 +02:00
c20e292121 Change primitive types and cleanup code 2017-03-27 16:50:09 +02:00
fc2a85bbe7 Add new shaders for strokes and prepare parameters.
Note: The shader is not used yet.
2017-03-25 18:35:48 +01:00
ec775eb02d Merge branch 'blender2.8' into gpencil_2.8 2017-03-25 10:57:36 +01:00
fce04156a3 Merge branch 'blender2.8' into gpencil_2.8 2017-03-24 11:19:41 +01:00
e6ce57af84 Adapt python modules to new registration method 2017-03-23 18:55:23 +01:00
808294212e Merge branch 'blender2.8' into gpencil_2.8 2017-03-23 16:21:59 +01:00
bbe6c25c39 Merge branch 'blender2.8' into gpencil_2.8 2017-03-21 18:43:31 +01:00
4b5ce6b0c5 Merge branch 'blender2.8' into gpencil_2.8 2017-03-18 15:27:59 +01:00
b2b0de5d89 Merge branch 'blender2.8' into gpencil_2.8 2017-03-15 18:23:48 +01:00
a556bf6f64 Merge branch 'blender2.8' into gpencil_2.8 2017-03-13 13:15:49 +01:00
fc0e5d56b8 New draw at last stroke location
This option at layer level allows to draw the new strokes using as origin the last layer stroke location. This is very useful in some drawings with layers at different zdepths.
2017-03-13 12:30:06 +01:00
82b387cc47 Merge branch 'blender2.8' into gpencil_2.8 2017-03-11 18:34:13 +01:00
352e62c9ef Fix identation error 2017-03-10 17:53:12 +01:00
c067661b58 Merge branch 'blender2.8' into gpencil_2.8 2017-03-10 17:13:35 +01:00
411021d320 New operator to convert scene gp datablock to gp object 2017-03-10 17:09:09 +01:00
9eaca59968 Improve poll method for Layers UI panel 2017-03-10 17:08:12 +01:00
7b048beb5b Update properties UI panel when change 2017-03-10 17:06:28 +01:00
51395e01c3 Merge branch 'blender2.8' into gpencil_2.8 2017-03-10 11:10:13 +01:00
8bfd2a83ff Draw strokes using sorting by zdepth
Now this implemented in legacy code. When final draw will be ready, this drawing must be moved.
2017-03-10 10:45:38 +01:00
754c7792c8 Merge branch 'blender2.8' into gpencil_2.8 2017-03-09 12:36:00 +01:00
e50d19592f Merge branch 'blender2.8' into gpencil_2.8 2017-03-09 12:07:47 +01:00
8c7ca30f83 Cleanup: make function static 2017-03-09 11:08:52 +01:00
d302de0f87 Avoid error in data panel if object is not GPencil 2017-03-08 20:26:06 +01:00
e1db32d95d Cleanup: Use correct function to multiply matrix rotation only 2017-03-08 16:39:51 +01:00
5cf91943bf Merge branch 'blender2.8' into gpencil_2.8 2017-03-08 15:41:54 +01:00
9be5a7db06 Change text for Cursor mode when using GP objects 2017-03-08 13:30:58 +01:00
aad28de5f9 Reproject stroke to axis using object location and rotation 2017-03-08 12:59:13 +01:00
c032946d9e Add new property to set origin as object location or 3d cursor 2017-03-08 12:03:49 +01:00
c0aec751ba Cleanup style 2017-03-08 11:01:13 +01:00
f02ba9ef46 Change symbol of GP object in viewport to make different of Empty 2017-03-08 10:45:51 +01:00
86b0d41122 Duplicate GP datablock for OB_GPENCIL objects 2017-03-07 11:41:08 +01:00
b541ff0ed3 Do not copy old palettes when duplicate GP data 2017-03-07 11:28:47 +01:00
43dcdcab8b Change default OB_GPENCIL size
Maybe, this could be a userprefs parameter
2017-03-07 10:53:37 +01:00
c40e5e0ff4 Merge branch 'blender2.8' into gpencil_2.8 2017-03-07 10:24:20 +01:00
94c63b977d Reorganize UI panels in other space types (not 3D view) 2017-03-06 19:23:00 +01:00
31120137dd Remove GP layers from properties panel in 3D view.
All the layer info has been moved to Properties Scene or Object
2017-03-06 19:03:26 +01:00
5bee75f9f6 Change Panel to use scene in properties if context is scene 2017-03-06 18:57:35 +01:00
4e16e0e53b Change panel class name to avoid conflicts 2017-03-06 13:09:16 +01:00
475d510bb3 Add GPencil Layer to Scene UI panel 2017-03-06 12:47:32 +01:00
40df4a2ea9 Remove unused parameters in UI panel for GP Object
The type of display is not used in GPencil object.
2017-03-06 12:34:20 +01:00
08a1fdbf01 Merge branch 'blender2.8' into gpencil_2.8 2017-03-06 11:45:09 +01:00
a5d09d8667 Add a call to draw gpencil object for 2D
As the current drawing action is 2D, we need to call the function for drawing.

All previous strokes are drawn in 3D because they are converted after finish each stroke from 2d to 3d.
2017-03-04 17:42:37 +01:00
75f931d4fa Fix error in transformation when object is rotated 2017-03-04 11:56:19 +01:00
00b6810b74 Initialize rotation of GPencil Objects 2017-03-04 11:39:24 +01:00
bcbf776a88 Return datablock for GPencil 2017-03-04 11:38:37 +01:00
ed183567c0 Cleanup code doing more compact if groups 2017-03-03 22:15:41 +01:00
5719f5fe38 Create an OB_GPENCIL object automatically if not selected a previous one 2017-03-03 22:15:20 +01:00
559a4b846f Modify creation of the object to remove unused RNA and define size in header file 2017-03-03 22:14:54 +01:00
968ce60270 Remove redundant lines 2017-03-03 22:14:41 +01:00
c089f2eecd Avoid wrong activation of edit mode 2017-03-03 22:14:36 +01:00
e2f258c1da Fix error to toggle to scene. Need more work to avoid conflicts among modes. 2017-03-03 22:14:29 +01:00
f7569a8eb8 Fix error in parameter list 2017-03-03 22:12:27 +01:00
0067d283ad Apply diff_mat to transformations 2017-03-03 21:55:02 +01:00
ba00f508fb Fix parameter list for interpolate functions 2017-03-03 21:54:35 +01:00
a9dcf0f158 Apply diff_mat always and not only when layer parented. If the matrix is not necessary, a unit matrix is generated. This keeps the code cleaner and can handle scene and OB_GPENCIL objects 2017-03-03 21:54:19 +01:00
3783c0ba54 Show parent in properties panel 2017-03-03 21:54:14 +01:00
7784028569 Basic parent to object modificaction. There are errors like double drawing and editing 2017-03-03 21:54:08 +01:00
9a1c977e09 Fix error in brackets 2017-03-03 21:53:32 +01:00
119417417d Basic drawing for all gp objects strokes in the scene 2017-03-03 21:53:25 +01:00
1a672025cf First step to move GP object info to properties panel. Some decision must be taken for scene strokes because this is not visible in properties. 2017-03-03 21:53:19 +01:00
f876c51b30 Cleanup brackets style 2017-03-03 21:40:28 +01:00
6a8ae2d61f Open new section for Gpencil in properties panel. The previous change for use empty panel for both has been undone 2017-03-03 21:40:04 +01:00
1d8cdec1ba Change icon for data when using OB_GPENCIL 2017-03-03 21:39:53 +01:00
b2769b4485 Enable TAB key for enter in edit mode for OB_GPENCIL objects 2017-03-03 21:39:47 +01:00
036dbc19b4 Enable Object mode by default when create a new OB_GPENCIL object 2017-03-03 21:39:39 +01:00
d88edf6284 Change lines due update in function paramaters 2017-03-03 21:37:14 +01:00
6da453a8d7 Set object mode before call operator from outliner 2017-03-03 21:36:53 +01:00
9ee464cab5 Call edit strokes from Outliner doing click over GP datablock of GPencil object 2017-03-03 21:36:44 +01:00
79ef8d57a0 Use new outliner icon for menus 2017-03-03 21:36:39 +01:00
77d66c4c5b First steps to create OB_GPENCIL object 2017-03-03 21:33:21 +01:00
8a30cb4c13 Fix error in vertex shader to make equal to fragment shader 2017-03-03 13:22:14 +01:00
178308a52e Fix error in shader to avoid deformations when rotate viewport 2017-03-03 13:17:00 +01:00
f1ae4af473 Use perfect squares as bounding box to get square UVs 2017-03-03 13:17:00 +01:00
ac415636eb Add new fields when copy palette color 2017-03-03 13:17:00 +01:00
d9d38e5698 Disable parameters not used by some types of filling 2017-03-03 13:17:00 +01:00
ff2cdfb1e5 Change radial gradient to use inner radius 2017-03-03 13:16:59 +01:00
9814c1df67 Fix radial center shader when apply scale 2017-03-03 13:16:59 +01:00
013503dfb5 Working filling shaders with flip and scale.
Need a better gradient algorithm
2017-03-03 13:16:59 +01:00
f23137f7b6 Include new parameter for texture opacity 2017-03-03 13:16:59 +01:00
21cdccf145 Mix texture with linear gradient 2017-03-03 13:16:59 +01:00
004979f7b0 Mix texture with solid fill 2017-03-03 13:16:59 +01:00
a646859a25 Cleanup UI panel to make more intuitive and remove unused params 2017-03-03 13:16:59 +01:00
ce3cdd66d8 New property to mix texture with fill color 2017-03-03 13:16:59 +01:00
bfa228dde2 Fix rotation for gradients and replace texture center variable 2017-03-03 13:16:59 +01:00
57e36df031 Rotate texture around center and not pivot point 2017-03-03 13:16:58 +01:00
2f9f0093d4 Fix radial gradient values 2017-03-03 13:16:58 +01:00
994c019b0d Make linear gradient full color when mix in extrem values.
This is very useful for artistic animations because is more easy to change mix factor than switch to solid color.
2017-03-03 13:16:58 +01:00
9abfa2245e Change UI panel to group options 2017-03-03 13:16:58 +01:00
cdfb7e6ee2 Enable fake_user for image texture used in filling 2017-03-03 13:16:58 +01:00
74dce7aa82 Relink texture images when load file 2017-03-03 13:16:58 +01:00
86d28f9dca Basic filling options working after a complete UI rework 2017-03-03 13:16:58 +01:00
40322007f1 Basic texture support 2017-03-03 13:16:58 +01:00
73a5b137df Add shift factor to radial filling 2017-03-03 13:16:58 +01:00
111a7b7214 Add new parameters for shift.
This modification is not compilable, need a change in Gawain.
2017-03-03 13:16:57 +01:00
3b2d16619c Make fill visible if style is not solid 2017-03-03 13:16:57 +01:00
4955e5e0ee New shift properties to move filling pattern 2017-03-03 13:16:57 +01:00
0661d620c9 First steps to create new radial gradient filling 2017-03-03 13:16:57 +01:00
e48a184506 Cleanup fragment shader code 2017-03-03 13:16:57 +01:00
2824a513be Add chessboard support 2017-03-03 13:16:57 +01:00
426341a3ea Add new functions to filling shader as angle and factor 2017-03-03 13:16:56 +01:00
690bce3c51 Add defines to more clear shader code 2017-03-03 13:16:55 +01:00
8fd58139ba View mix color only if gradient mode 2017-03-03 13:16:55 +01:00
2456e1ce35 New parameters to control gradient or solid fill 2017-03-03 13:16:55 +01:00
4f100f98e5 Cleanup spaces and comments 2017-03-03 13:16:54 +01:00
d72720f7d1 Cleanup comments 2017-03-03 13:16:54 +01:00
d77de3b25a Cleanup unused variables 2017-03-03 13:16:54 +01:00
2567b8f074 Fill shader working with basic gradient support.
The shaders now are for testing only to verify workflow, no real calculation.
2017-03-03 13:16:54 +01:00
0b491e5cda Make new functions static 2017-03-03 13:16:54 +01:00
c665a0bcfa Add a basic shader for filling strokes
The shader code is very basic for testing purpose only.
2017-03-03 13:16:53 +01:00
1e56ce1d9e Add new functions to calculate texture coordinates 2017-03-03 13:16:53 +01:00
c9e9783ba7 Define new fields for saving UV data for triangles 2017-03-03 13:16:53 +01:00
5e7959f964 Add better poll method
Change poll method to check if there is a gpd datablock
2017-03-03 13:16:53 +01:00
0b870bcccd Rename animation palette conversion function 2017-03-03 13:16:53 +01:00
e16eb9b875 Fix comment typo error 2017-03-03 13:16:53 +01:00
c28dca20b7 Depsgraph: Remove unused owner argument for palette builder 2017-03-03 13:16:53 +01:00
39a45edb0d Cleanup: Fix merge error 2017-03-03 13:16:53 +01:00
df223b6c5d Move the palette versioning code outside 2.78.4 area.
This code must be included in next version area.
2017-03-03 13:16:53 +01:00
c9ede7b02f Cleanup code a remove unused driver conversion.
The old GP does not support drivers.
2017-03-03 13:16:53 +01:00
ee5c40137b Remove drivers conversion 2017-03-03 13:16:52 +01:00
3cb7c4f47a Fix merge error 2017-03-03 13:16:52 +01:00
6ca9ca7ce2 Functon to convert animation for Palettes.
Used by operator
2017-03-03 13:16:52 +01:00
b01e763c93 Operator to run palette animation conversion 2017-03-03 13:16:52 +01:00
592748176f New functions to look color by RGB and RGBA 2017-03-03 13:16:52 +01:00
8a8c2e9ebe Free animation memory when free Palettes 2017-03-03 13:16:52 +01:00
e7eee9f36e Include palettes evaluation in new desgraph system 2017-03-03 13:16:52 +01:00
3db6a3a069 Fix animation after renaming color. 2017-03-03 13:16:52 +01:00
dfa81bbdde Remove previous fix for particles animation type 2017-03-03 13:16:52 +01:00
07e219ecde Add new include file due changes in libraries 2017-03-03 13:16:52 +01:00
8f182f6571 Fix previous commit. This definition is required to compile, but it is not used and must be moved or removed when particles back. 2017-03-03 13:16:51 +01:00
a737ee4e82 Some changes to try to include in dopesheet 2017-03-03 13:16:51 +01:00
5e13609a8f Create new channel definition for Palette 2017-03-03 13:16:51 +01:00
3d2766bf08 Include palette keyframes in timeline keyframe_jump operator 2017-03-03 13:16:51 +01:00
08ded0dc73 Initial Timeline editor working without crash. Need more work 2017-03-03 13:16:51 +01:00
e5a50ffffa Add flag to use in action editors 2017-03-03 13:16:51 +01:00
8296f4a13d Include filter for palettes in Dopesheet 2017-03-03 13:16:51 +01:00
248228a716 Include palette keyframes in Timeline Editor 2017-03-03 13:16:50 +01:00
372c92e6c6 Changes to make Palettes animatable. Pending link to new desgraph.
I have only created the methods build_palette for deg_builder_relations.cc and deg_builder_nodes.cc
2017-03-03 13:16:50 +01:00
d4dda54de8 Fix error when create a non GP color after the creation of GP color.
The flag remained true, so the operator worked iqual for color for vertex paint, etc.
2017-03-03 13:16:50 +01:00
8e65fd271c Copy pass index when copy a color 2017-03-03 13:16:50 +01:00
102adeaa0b Use full row for pass_index property 2017-03-03 13:16:50 +01:00
2ad7e98c6a Change style text to avoid duplicate stroke and fill word 2017-03-03 13:16:50 +01:00
624c801a26 Replace use_volumetric as a stroke style and not as independent option 2017-03-03 13:16:50 +01:00
23d27375cd Include temporary styles for drawing buffer 2017-03-03 13:16:50 +01:00
92f59b8473 Copy new style flags when change palette 2017-03-03 13:16:49 +01:00
8c344bbf23 Copy styles when copy color 2017-03-03 13:16:49 +01:00
0822e5a3ed Include new fields for styles. These fields are not used today, but they will be used in the future with new styles like gradient, dotted, etc. 2017-03-03 13:16:49 +01:00
1424079029 Include Index Pass for future uses 2017-03-03 13:16:49 +01:00
fe46c4d1e9 Fix error checking if color list is empty 2017-03-03 13:16:49 +01:00
c5a76620f8 Remove all RNA data about bGPDpalettes and bGPDpalettecolors 2017-03-03 13:16:49 +01:00
a1bc723468 New context functions for palettes and colors 2017-03-03 13:16:49 +01:00
30179bfc01 Fix problem with rna_path function 2017-03-03 13:16:49 +01:00
638b32bc76 Remove bGPDpalettes from RNA 2017-03-03 13:16:48 +01:00
a19df1ddfd Cleanup sentences order 2017-03-03 13:16:48 +01:00
e6388a2823 Set first color as active after palette conversion 2017-03-03 13:16:48 +01:00
8509211f6b Conver old bGPDpalettes to new BelnderPalettes 2017-03-03 13:16:48 +01:00
e56e3e7204 Create a dummy palette if the datablock is missing 2017-03-03 13:16:48 +01:00
ad1cb2156f Replace operator options description 2017-03-03 13:16:48 +01:00
79387b1e64 Add new palette change operator to UI panel and fix paint error 2017-03-03 13:16:47 +01:00
269adbb9f9 Create a new operator to change the palette 2017-03-03 13:16:45 +01:00
0ce48cc056 Do not save old bGPDpalette and bGPDpalettecolor data. These structs have been replaced by Blender Palettes and colors 2017-03-03 13:16:44 +01:00
b4e2a57d39 Fix problem to save and restore colors. Now the palettes pointer is included in the stroke in order to be able to reset the color pointer.
I have fixed the problem with some RNA that were connected to bGPDpalettecolor and not to PaletteColor
2017-03-03 13:16:44 +01:00
b0553d2134 Save and relink animation data for Palettes 2017-03-03 13:16:44 +01:00
f447c8115a When join, do not force a color recalc 2017-03-03 13:16:44 +01:00
12e7449d1d Fix error in previous commit 2017-03-03 13:16:44 +01:00
5575a235b7 Remove Color name from RNA properties 2017-03-03 13:16:44 +01:00
47643aef33 Remove special context for Grease Pencil and use a more general context 2017-03-03 13:16:43 +01:00
d658407ca2 Remove parameter ToolSettings not used anymore 2017-03-03 13:16:43 +01:00
b1e1aa5318 Remove get color by name and use the gps->palcolor pointer 2017-03-03 13:16:43 +01:00
88623c0cfa Use more general paint and palette context instead of gpencil context 2017-03-03 13:16:43 +01:00
d7a7061b72 Use PaletteColor and not colorname to determine the colors to delete or change. This is necessary because now we can use several palettes at the same time and the color name can be equal in two or more palettes. 2017-03-03 13:16:43 +01:00
98e9d54874 Make palettes visibles without GPD datablock 2017-03-03 13:16:43 +01:00
25aa0d8ca0 Enable basic support for PaletteColor animation 2017-03-03 13:16:43 +01:00
0e2a707f0d Fix error when remove colors and draw again 2017-03-03 13:16:42 +01:00
82ad438c9a Remove HQ_FILL. Now always is high quality fill 2017-03-03 13:16:42 +01:00
a59b0960ec Cleanup: Changes in parameter list and function names to fix several compiler warnings 2017-03-03 13:16:42 +01:00
fc9169eb7f Cleanup: Remove unused functions 2017-03-03 13:16:42 +01:00
53bdcad097 Cleanup: Remove unused definitions 2017-03-03 13:16:42 +01:00
252e5afe4c Remove creation options for old palette system to avoid future errors 2017-03-03 13:16:42 +01:00
bbb7ae617e Remove last bGPDpalette and bGPDpalettecolor operators 2017-03-03 13:16:42 +01:00
2e93bf8432 Python modified to apply new BlenderPalettes in Tools panel 2017-03-03 13:16:41 +01:00
2b1edb4728 Rename operator 2017-03-03 13:16:41 +01:00
15ae52e90f Change operator name 2017-03-03 13:16:41 +01:00
51c85f7445 Publish active index property 2017-03-03 13:16:41 +01:00
4a4276871d New operators moved from grease pencil to Palette and PaletteColor 2017-03-03 13:16:41 +01:00
da051bc210 Remove bGPdpalette and bGPdpalettecolor operators 2017-03-03 13:16:41 +01:00
3308a96e3b Change function name to keep name consistency 2017-03-03 13:16:41 +01:00
935217e48c Basic change of bGPDpalette and bGPDpalettecolor to Palette and PaletteColor 2017-03-03 13:16:40 +01:00
28117030f1 New fucntion to retrieve color using toolsettings 2017-03-03 13:16:40 +01:00
85ef68aec4 Include palette in temporary area for painting and interpolate operators 2017-03-03 13:16:40 +01:00
e8cc2b74f1 New operator to create grease pencil palette. This operator is used in template_ID in python to create the palette in imapaint and not relative to context 2017-03-03 13:16:39 +01:00
5350475214 Several changes in context functions to make it more reliable 2017-03-03 13:16:39 +01:00
99fb0f90ff Create new operator for new palettes for grease pencil 2017-03-03 13:16:39 +01:00
4374aa531e Create palette in temp data while drawing 2017-03-03 13:16:39 +01:00
e665042bc9 Wrapper function to create a new palette in context 2017-03-03 13:16:38 +01:00
3f36cdad4d Wrapper function to get color from context in one step 2017-03-03 13:16:38 +01:00
3a52e3c2ac Delete stroke if remove the color from palette 2017-03-03 13:16:38 +01:00
bfe90e00bb Cleanup active functions and rename to keep consistency with previous code 2017-03-03 13:16:38 +01:00
e12a0f2148 Create new BKE functions to get active palette and palettecolor. Update CTX_ functions to use new kernel functions 2017-03-03 13:16:38 +01:00
fd28c06260 Add Animation struct to palettes 2017-03-03 13:16:38 +01:00
ad83162ed7 Create new context functions for Palette and PaletteColor to expose values 2017-03-03 13:16:38 +01:00
968772303f Rename color for all GPD datablocks 2017-03-03 13:16:37 +01:00
ad0d83b518 Get color by name 2017-03-03 13:16:37 +01:00
71b71a0b92 Basic changes to include new grease pencil fields in palette colors 2017-03-03 13:16:37 +01:00
1818 changed files with 240067 additions and 36626 deletions

View File

@@ -221,6 +221,17 @@ ForEachMacros:
- ITER_BEGIN
- ITER_PIXELS
- ITER_SLOTS
- ITER_SLOTS_BEGIN
- LOOP_EDITED_POINTS
- LOOP_KEYS
- LOOP_POINTS
- LOOP_SELECTED_KEYS
- LOOP_SELECTED_POINTS
- LOOP_TAGGED_KEYS
- LOOP_TAGGED_POINTS
- LOOP_UNSELECTED_POINTS
- LOOP_VISIBLE_KEYS
- LOOP_VISIBLE_POINTS
- LISTBASE_CIRCULAR_BACKWARD_BEGIN
- LISTBASE_CIRCULAR_FORWARD_BEGIN
- LISTBASE_FOREACH

22
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
# Configuration for probot-stale - https://github.com/probot/stale
# This file is used on Blender's GitHub mirror to automatically close any pull request
# and invite contributors to join the official development platform on blender.org
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 1
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 1
# Label to use when marking as stale
staleLabel: stale
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed, because this repository is only
used as a mirror of git.blender.org. Blender development happens on
developer.blender.org.
To get started contributing code, please read:
https://wiki.blender.org/wiki/Process/Contributing_Code

View File

@@ -16,6 +16,7 @@
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
#
# ***** END GPL LICENSE BLOCK *****
#-----------------------------------------------------------------------------
@@ -263,6 +264,8 @@ endif()
option(WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF)
mark_as_advanced(WITH_HEADLESS)
option(WITH_QUADRIFLOW "Build with quadriflow remesher support" ON)
option(WITH_AUDASPACE "Build with blenders audio library (only disable if you know what you're doing!)" ON)
option(WITH_SYSTEM_AUDASPACE "Build with external audaspace library installed on the system (only enable if you know what you're doing!)" OFF)
mark_as_advanced(WITH_AUDASPACE)
@@ -424,6 +427,7 @@ mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF)
option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
@@ -457,14 +461,14 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
mark_as_advanced(WITH_ASSERT_ABORT)
option(WITH_BOOST "Enable features depending on boost" ON)
option(WITH_BOOST "Enable features depending on boost" ON)
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
# Unit testsing
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
option(WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF)
# Documentation
if(UNIX AND NOT APPLE)
option(WITH_DOC_MANPAGE "Create a manual page (Unix manpage)" OFF)
@@ -581,6 +585,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Ninja")
mark_as_advanced(WITH_NINJA_POOL_JOBS)
endif()
if(UNIX AND NOT APPLE)
option(WITH_CXX11_ABI "Use native C++11 ABI of compiler" ON)
mark_as_advanced(WITH_CXX11_ABI)
endif()
# avoid using again
option_defaults_clear()
@@ -673,6 +682,7 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENVDB OFF)
set_and_warn(WITH_OPENCOLORIO OFF)
set_and_warn(WITH_QUADRIFLOW OFF)
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO)
# Keep enabled
@@ -752,14 +762,12 @@ if(NOT WITH_CUDA_DYNLOAD)
endif()
#-----------------------------------------------------------------------------
# Check for valid directories
# ... a partial checkout may cause this.
#
# note: we need to check for a known subdir in both cases.
# since uninitialized git submodules will give blank dirs
# Check check if submodules are cloned
if(WITH_INTERNATIONAL)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/datafiles/locale/languages")
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
list(LENGTH RESULT DIR_LEN)
if(DIR_LEN EQUAL 0)
message(WARNING
"Translation path '${CMAKE_SOURCE_DIR}/release/datafiles/locale' is missing, "
"This is a 'git submodule', which are known not to work with bridges to other version "
@@ -781,7 +789,9 @@ if(WITH_PYTHON)
message(FATAL_ERROR "At least Python 3.7 is required to build")
endif()
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons/modules")
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")
list(LENGTH RESULT DIR_LEN)
if(DIR_LEN EQUAL 0)
message(WARNING
"Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
"This is a 'git submodule', which are known not to work with bridges to other version "
@@ -1391,13 +1401,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull) # C only
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_RESTRICT -Wrestrict)
# C-only.
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ABSOLUTE_VALUE -Wabsolute-value)
# gcc 4.2 gives annoying warnings on every file with this
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
@@ -1606,15 +1619,19 @@ if(WITH_PYTHON)
endif()
endif()
if(
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.
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")
elseif(MSVC)
# Nothing special is needed, C++11 features are available by default.
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
endif()
@@ -1630,6 +1647,12 @@ if(
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
endif()
if(UNIX AND NOT APPLE)
if(NOT WITH_CXX11_ABI)
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
# Include warnings first, so its possible to disable them with user defined flags
# eg: -Wno-uninitialized
set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}")
@@ -1765,6 +1788,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)

View File

@@ -62,8 +62,7 @@ Testing Targets
Not associated with building Blender.
* test:
Run ctest, currently tests import/export,
operator execution and that python modules load
Run automated tests with ctest.
* test_cmake:
Runs our own cmake file checker
which detects errors in the cmake file list definitions
@@ -193,6 +192,16 @@ ifndef PYTHON
PYTHON:=python3
endif
# For macOS python3 is not installed by default, so fallback to python binary
# in libraries, or python 2 for running make update to get it.
ifeq ($(OS_NCASE),darwin)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=../lib/darwin/python/bin/python3.7m
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=python
endif
endif
endif
# -----------------------------------------------------------------------------
# additional targets for the build configuration
@@ -375,7 +384,7 @@ package_archive: .FORCE
# Tests
#
test: .FORCE
python3 ./build_files/utils/make_test.py "$(BUILD_DIR)"
$(PYTHON) ./build_files/utils/make_test.py "$(BUILD_DIR)"
# run pep8 check check on scripts we distribute.
test_pep8: .FORCE
@@ -531,11 +540,11 @@ icons_geom: .FORCE
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE
python3 ./build_files/utils/make_update.py
$(PYTHON) ./build_files/utils/make_update.py
format: .FORCE
PATH="../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
python3 source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# -----------------------------------------------------------------------------

View File

@@ -128,6 +128,7 @@ if(NOT WIN32 OR ENABLE_MINGW64)
include(cmake/ogg.cmake)
include(cmake/vorbis.cmake)
include(cmake/theora.cmake)
include(cmake/opus.cmake)
include(cmake/vpx.cmake)
include(cmake/x264.cmake)
include(cmake/xvidcore.cmake)
@@ -157,4 +158,9 @@ if(UNIX)
include(cmake/sqlite.cmake)
endif()
if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
endif()
include(cmake/harvest.cmake)

View File

@@ -17,10 +17,16 @@
# ***** END GPL LICENSE BLOCK *****
if(UNIX)
if(APPLE)
set(_libtoolize_name glibtoolize)
else()
set(_libtoolize_name libtoolize)
endif()
set(_required_software
autoconf
automake
libtoolize
${_libtoolize_name}
nasm
yasm
tclsh

View File

@@ -16,10 +16,10 @@
#
# ***** END GPL LICENSE BLOCK *****
set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include")
set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib")
set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/opus/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include")
set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/opus/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib")
set(FFMPEG_EXTRA_FLAGS --pkg-config-flags=--static --extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS})
set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR})
set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}:${mingw_LIBDIR}/vpx/lib/pkgconfig:${mingw_LIBDIR}/theora/lib/pkgconfig:${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:)
if(WIN32)
set(FFMPEG_ENV set ${FFMPEG_ENV} &&)
@@ -73,6 +73,7 @@ ExternalProject_Add(external_ffmpeg
--disable-libgsm
--disable-libspeex
--enable-libvpx
--enable-libopus
--prefix=${LIBDIR}/ffmpeg
--enable-libtheora
--enable-libvorbis
@@ -130,6 +131,7 @@ add_dependencies(
external_openjpeg
external_xvidcore
external_x264
external_opus
external_vpx
external_theora
external_vorbis

View File

@@ -192,6 +192,7 @@ harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(webp/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
@@ -199,4 +200,9 @@ harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")
harvest(mesa/lib mesa/lib "*.so*")
endif()
endif()

View File

@@ -0,0 +1,40 @@
# ***** 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(LIBGLU_CFLAGS "-static-libgcc")
set(LIBGLU_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
set(LIBGLU_LDFLAGS "-pthread -static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
set(LIBGLU_EXTRA_FLAGS
CFLAGS=${LIBGLU_CFLAGS}
CXXFLAGS=${LIBGLU_CXXFLAGS}
LDFLAGS=${LIBGLU_LDFLAGS}
)
ExternalProject_Add(external_libglu
URL ${LIBGLU_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${LIBGLU_HASH}
PREFIX ${BUILD_DIR}/libglu
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/libglu/src/external_libglu/ &&
${CONFIGURE_COMMAND_NO_TARGET} --prefix=${LIBDIR}/libglu ${LIBGLU_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/libglu/src/external_libglu/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/libglu/src/external_libglu/ && make install
INSTALL_DIR ${LIBDIR}/libglu
)

View File

@@ -0,0 +1,54 @@
# ***** 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(MESA_CFLAGS "-static-libgcc")
set(MESA_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
set(MESA_LDFLAGS "-L${LIBDIR}/zlib/lib -pthread -static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a -l:libz_pic.a")
set(MESA_EXTRA_FLAGS
CFLAGS=${MESA_CFLAGS}
CXXFLAGS=${MESA_CXXFLAGS}
LDFLAGS=${MESA_LDFLAGS}
--enable-glx=gallium-xlib
--with-gallium-drivers=swrast
--disable-dri
--disable-gbm
--disable-egl
--disable-gles1
--disable-gles2
--disable-llvm-shared-libs
--with-llvm-prefix=${LIBDIR}/llvm
)
ExternalProject_Add(external_mesa
URL ${MESA_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${MESA_HASH}
PREFIX ${BUILD_DIR}/mesa
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/mesa/src/external_mesa/ &&
${CONFIGURE_COMMAND_NO_TARGET} --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa/ && make install
INSTALL_DIR ${LIBDIR}/mesa
)
add_dependencies(
external_mesa
ll
)

View File

@@ -0,0 +1,35 @@
# ***** 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 *****
ExternalProject_Add(external_opus
URL ${OPUS_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH SHA256=${OPUS_HASH}
PREFIX ${BUILD_DIR}/opus
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/opus
--disable-shared
--enable-static
--with-pic
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/opus/src/external_opus/ && make install
INSTALL_DIR ${LIBDIR}/opus
)
if(MSVC)
set_target_properties(external_opus PROPERTIES FOLDER Mingw)
endif()

View File

@@ -16,7 +16,7 @@
#
# ***** END GPL LICENSE BLOCK *****
if (UNIX)
if(UNIX)
set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV} && export HAVE_PDFLATEX=no)
else()
set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV})

View File

@@ -192,6 +192,10 @@ set(VPX_VERSION 1.7.0)
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_HASH 1fec931eb5c94279ad219a5b6e0202358e94a93a90cfb1603578c326abfc1238)
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)
@@ -306,3 +310,11 @@ set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
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(LIBGLU_VERSION 9.0.1)
set(LIBGLU_URI ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${LIBGLU_VERSION}.tar.xz)
set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(MESA_VERSION 18.3.1)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)

View File

@@ -49,6 +49,8 @@ ExternalProject_Add(external_vpx
--disable-avx2
--disable-unit-tests
--disable-examples
--enable-vp8
--enable-vp9
${VPX_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make install

View File

@@ -431,6 +431,9 @@ X264_VERSION_MIN=0.118
VPX_USE=false
VPX_VERSION_MIN=0.9.7
VPX_DEV=""
OPUS_USE=false
OPUS_VERSION_MIN=1.1.1
OPUS_DEV=""
MP3LAME_USE=false
MP3LAME_DEV=""
OPENJPEG_USE=false
@@ -1114,7 +1117,7 @@ run_ldconfig() {
WARNING "--no-sudo enabled, impossible to run ldconfig for $1, you'll have to do it yourself..."
else
INFO "Running ldconfig for $1..."
$SUDO sh -c "echo -e \"$_lib_path\n$_lib64_path\" > $_ldconf_path"
$SUDO sh -c "/bin/echo -e \"$_lib_path\n$_lib64_path\" > $_ldconf_path"
$SUDO /sbin/ldconfig # XXX OpenSuse does not include sbin in command path with sudo!!!
fi
PRINT ""
@@ -2754,6 +2757,10 @@ compile_FFmpeg() {
extra="$extra --enable-libvpx"
fi
if [ "$OPUS_USE" = true ]; then
extra="$extra --enable-libopus"
fi
if [ "$MP3LAME_USE" = true ]; then
extra="$extra --enable-libmp3lame"
fi
@@ -2991,6 +2998,14 @@ install_DEB() {
install_packages_DEB $VPX_DEV
VPX_USE=true
fi
PRINT ""
OPUS_DEV="libopus-dev"
check_package_version_ge_DEB $OPUS_DEV $OPUS_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_DEB $OPUS_DEV
OPUS_USE=true
fi
fi
# Check cmake/glew versions and disable features for older distros.
@@ -3601,8 +3616,17 @@ install_RPM() {
install_packages_RPM $VPX_DEV
VPX_USE=true
fi
PRINT ""
install_packages_RPM libspnav-devel
PRINT ""
OPUS_DEV="libopus-devel"
check_package_version_ge_RPM $OPUS_DEV $OPUS_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_RPM $OPUS_DEV
OPUS_USE=true
fi
fi
PRINT ""
@@ -4077,6 +4101,14 @@ install_ARCH() {
install_packages_ARCH $VPX_DEV
VPX_USE=true
fi
PRINT ""
OPUS_DEV="opus"
check_package_version_ge_ARCH $OPUS_DEV $OPUS_VERSION_MIN
if [ $? -eq 0 ]; then
install_packages_ARCH $OPUS_DEV
OPUS_USE=true
fi
fi
@@ -4633,6 +4665,10 @@ print_info_ffmpeglink() {
_packages="$_packages $VPX_DEV"
fi
if [ "$OPUS_USE" = true ]; then
_packages="$_packages $OPUS_DEV"
fi
if [ "$MP3LAME_USE" = true ]; then
_packages="$_packages $MP3LAME_DEV"
fi

View File

@@ -0,0 +1,114 @@
# ##### 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>
import argparse
import os
import re
import subprocess
import sys
class Builder:
def __init__(self, name, branch):
self.name = name
self.branch = branch
self.is_release_branch = re.match("^blender-v(.*)-release$", branch) is not None
# 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.upload_dir = os.path.abspath(os.path.join('..', 'install'))
# Detect platform
if name.startswith('mac'):
self.platform = 'mac'
self.command_prefix = []
elif name.startswith('linux'):
self.platform = 'linux'
self.command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
elif name.startswith('win'):
self.platform = 'win'
self.command_prefix = []
else:
raise ValueError('Unkonw platform for builder ' + self.platform)
# Always 64 bit now
self.bits = 64
def create_builder_from_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('builder_name')
parser.add_argument('branch', default='master', nargs='?')
args = parser.parse_args()
return Builder(args.builder_name, args.branch)
class VersionInfo:
def __init__(self, builder):
# Get version information
buildinfo_h = os.path.join(builder.build_dir, "source", "creator", "buildinfo.h")
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')
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.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.is_development_build = False
else:
# Development build
self.full_version = self.version + '-' + self.hash
self.is_development_build = True
def _parse_header_file(self, filename, define):
import re
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
with open(filename, "r") as file:
for l in file:
match = regex.match(l)
if match:
return match.group(1)
return None
def call(cmd, env=None, exit_on_error=True):
print(' '.join(cmd))
# Flush to ensure correct order output on Windows.
sys.stdout.flush()
sys.stderr.flush()
retcode = subprocess.call(cmd, env=env)
if exit_on_error and retcode != 0:
sys.exit(retcode)
return retcode

View File

@@ -2,33 +2,20 @@
include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
# For libc-2.24 we are using chroot which runs on a 64bit system.
# There we can not use CPU bitness check since it is always 64bit. So instead
# we check for a specific libraries.
#
# Other builders we are running in a bare virtual machine, and the libraries
# are installed to /opt/.
# We assume that only 64bit builders exists in such configuration.
if(EXISTS "/lib/x86_64-linux-gnu/libc-2.24.so")
message(STATUS "Building in GLibc-2.24 environment")
set(LIBDIR_NAME "linux_x86_64")
elseif(EXISTS "/lib/i386-linux-gnu//libc-2.24.so")
message(STATUS "Building in GLibc-2.24 environment")
set(LIBDIR_NAME "linux_i686")
else()
message(STATUS "Building in generic 64bit environment")
set(LIBDIR_NAME "linux_x86_64")
endif()
message(STATUS "Building in CentOS 7 64bit environment")
set(LIBDIR_NAME "linux_centos7_x86_64")
# Default to only build Blender
set(WITH_BLENDER ON CACHE BOOL "" FORCE)
# ######## Linux-specific build options ########
# Options which are specific to Linux-only platforms
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
# ######## Official release-specific build options ########
# Options which are specific to Linux release builds only
set(WITH_JACK_DYNLOAD ON CACHE BOOL "" FORCE)
set(WITH_SDL_DYNLOAD ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW OFF CACHE BOOL "" FORCE)
@@ -40,7 +27,7 @@ set(WITH_PYTHON_INSTALL_REQUESTS ON CACHE BOOL "" FORCE)
# ######## Release environment specific settings ########
set(LIBDIR "/opt/blender-deps/${LIBDIR_NAME}" CACHE BOOL "" FORCE)
set(LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../lib/${LIBDIR_NAME}" CACHE STRING "" FORCE)
# Platform specific configuration, to ensure static linking against everything.

View File

@@ -18,149 +18,83 @@
# <pep8 compliant>
import buildbot_utils
import os
import subprocess
import sys
import shutil
# get builder name
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting builder name\n")
sys.exit(1)
def get_cmake_options(builder):
config_file = "build_files/cmake/config/blender_release.cmake"
options = ['-DCMAKE_BUILD_TYPE:STRING=Release', '-DWITH_GTESTS=ON']
builder = sys.argv[1]
if builder.platform == 'mac':
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'])
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"
# we run from build/ directory
blender_dir = os.path.join('..', 'blender.git')
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
options.append("-C" + os.path.join(builder.blender_dir, config_file))
options.append("-DCMAKE_INSTALL_PREFIX=%s" % (builder.install_dir))
def parse_header_file(filename, define):
import re
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
with open(filename, "r") as file:
for l in file:
match = regex.match(l)
if match:
return match.group(1)
return None
return options
if 'cmake' in builder:
# cmake
def update_git(builder):
# Do extra git fetch because not all platform/git/buildbot combinations
# update the origin remote, causing buildinfo to detect local changes.
os.chdir(builder.blender_dir)
# Some fine-tuning configuration
blender_dir = os.path.abspath(blender_dir)
build_dir = os.path.abspath(os.path.join('..', 'build', builder))
install_dir = os.path.abspath(os.path.join('..', 'install', builder))
targets = ['blender']
command_prefix = []
bits = 64
# Config file to be used (relative to blender's sources root)
cmake_config_file = "build_files/cmake/config/blender_release.cmake"
# Set build options.
cmake_options = []
cmake_extra_options = ['-DCMAKE_BUILD_TYPE:STRING=Release',
'-DWITH_GTESTS=ON']
if builder.startswith('mac'):
# Set up OSX architecture
if builder.endswith('x86_64_10_9_cmake'):
cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
elif builder.startswith('win'):
if builder.startswith('win64'):
cmake_options.extend(['-G', 'Visual Studio 15 2017 Win64'])
elif builder.startswith('win32'):
bits = 32
cmake_options.extend(['-G', 'Visual Studio 15 2017'])
elif builder.startswith('linux'):
cmake_config_file = "build_files/buildbot/config/blender_linux.cmake"
tokens = builder.split("_")
glibc = tokens[1]
if glibc == 'glibc224':
deb_name = "stretch"
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_' + deb_name + '_x86_64'
elif builder.endswith('i686_cmake'):
bits = 32
chroot_name = 'buildbot_' + deb_name + '_i686'
command_prefix = ['schroot', '-c', chroot_name, '--']
elif glibc == 'glibc217':
command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
# Prepare CMake options needed to configure cuda binaries compilation, 64bit only.
if bits == 64:
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=ON")
cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=ON")
else:
cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=OFF")
cmake_options.append("-DCMAKE_INSTALL_PREFIX=%s" % (install_dir))
cmake_options += cmake_extra_options
print("Fetching remotes")
command = ['git', 'fetch', '--all']
buildbot_utils.call(builder.command_prefix + command)
def clean_directories(builder):
# Make sure no garbage remained from the previous run
if os.path.isdir(install_dir):
shutil.rmtree(install_dir)
if os.path.isdir(builder.install_dir):
shutil.rmtree(builder.install_dir)
for target in targets:
print("Building target %s" % (target))
# Construct build directory name based on the target
target_build_dir = build_dir
target_command_prefix = command_prefix[:]
if target != 'blender':
target_build_dir += '_' + target
target_name = 'install'
# Tweaking CMake options to respect the target
target_cmake_options = cmake_options[:]
# Do extra git fetch because not all platform/git/buildbot combinations
# update the origin remote, causing buildinfo to detect local changes.
os.chdir(blender_dir)
print("Fetching remotes")
command = ['git', 'fetch', '--all']
print(command)
retcode = subprocess.call(target_command_prefix + command)
if retcode != 0:
sys.exit(retcode)
# Make sure build directory exists and enter it
if not os.path.isdir(target_build_dir):
os.mkdir(target_build_dir)
os.chdir(target_build_dir)
# Configure the build
print("CMake options:")
print(target_cmake_options)
if os.path.exists('CMakeCache.txt'):
print("Removing CMake cache")
os.remove('CMakeCache.txt')
# Remove buildinfo files to force buildbot to re-generate them.
for buildinfo in ('buildinfo.h', 'buildinfo.h.txt', ):
full_path = os.path.join('source', 'creator', buildinfo)
if os.path.exists(full_path):
print("Removing {}" . format(buildinfo))
os.remove(full_path)
retcode = subprocess.call(target_command_prefix + ['cmake', blender_dir] + target_cmake_options)
if retcode != 0:
print('Configuration FAILED!')
sys.exit(retcode)
# Make sure build directory exists and enter it
os.makedirs(builder.build_dir, exist_ok=True)
if 'win32' in builder or 'win64' in builder:
command = ['cmake', '--build', '.', '--target', target_name, '--config', 'Release']
else:
command = ['make', '-s', '-j2', target_name]
# Remove buildinfo files to force buildbot to re-generate them.
for buildinfo in ('buildinfo.h', 'buildinfo.h.txt', ):
full_path = os.path.join(builder.build_dir, 'source', 'creator', buildinfo)
if os.path.exists(full_path):
print("Removing {}" . format(buildinfo))
os.remove(full_path)
print("Executing command:")
print(command)
retcode = subprocess.call(target_command_prefix + command)
def cmake_configure(builder):
# CMake configuration
os.chdir(builder.build_dir)
if retcode != 0:
sys.exit(retcode)
cmake_cache = os.path.join(builder.build_dir, 'CMakeCache.txt')
if os.path.exists(cmake_cache):
print("Removing CMake cache")
os.remove(cmake_cache)
else:
print("Unknown building system")
sys.exit(1)
print("CMake configure:")
cmake_options = get_cmake_options(builder)
command = ['cmake', builder.blender_dir] + cmake_options
buildbot_utils.call(builder.command_prefix + command)
def cmake_build(builder):
# CMake build
os.chdir(builder.build_dir)
if builder.platform == 'win':
command = ['cmake', '--build', '.', '--target', 'install', '--config', 'Release']
else:
command = ['make', '-s', '-j2', 'install']
print("CMake build:")
buildbot_utils.call(builder.command_prefix + command)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
update_git(builder)
clean_directories(builder)
cmake_configure(builder)
cmake_build(builder)

View File

@@ -22,47 +22,38 @@
# system and zipping it into buildbot_upload.zip. This is then uploaded
# to the master in the next buildbot step.
import buildbot_utils
import os
import subprocess
import sys
import zipfile
# get builder name
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting builder name\n")
sys.exit(1)
def get_package_name(builder, platform=None):
info = buildbot_utils.VersionInfo(builder)
builder = sys.argv[1]
# Never write branch if it is master.
branch = sys.argv[2] if (len(sys.argv) >= 3 and sys.argv[2] != 'master') else ''
package_name = 'blender-' + info.full_version
if platform:
package_name += '-' + platform
if not (builder.branch == 'master' or builder.is_release_branch):
if info.is_development_build:
package_name = builder.branch + "-" + package_name
blender_dir = os.path.join('..', 'blender.git')
build_dir = os.path.join('..', 'build', builder)
install_dir = os.path.join('..', 'install', builder)
buildbot_upload_zip = os.path.abspath(os.path.join(os.path.dirname(install_dir), "buildbot_upload.zip"))
return package_name
upload_filename = None # Name of the archive to be uploaded
# (this is the name of archive which will appear on the
# download page)
upload_filepath = None # Filepath to be uploaded to the server
# (this folder will be packed)
def create_buildbot_upload_zip(builder, package_files):
import zipfile
buildbot_upload_zip = os.path.join(builder.upload_dir, "buildbot_upload.zip")
if os.path.exists(buildbot_upload_zip):
os.remove(buildbot_upload_zip)
def parse_header_file(filename, define):
import re
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
with open(filename, "r") as file:
for l in file:
match = regex.match(l)
if match:
return match.group(1)
return None
# Make sure install directory always exists
if not os.path.exists(install_dir):
os.makedirs(install_dir)
try:
z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED)
for filepath, filename in package_files:
print("Packaged", filename)
z.write(filepath, arcname=filename)
z.close()
except Exception as ex:
sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n')
sys.exit(1)
def create_tar_bz2(src, dest, package_name):
# One extra to remove leading os.sep when cleaning root for package_root
@@ -80,163 +71,106 @@ def create_tar_bz2(src, dest, package_name):
package.add(entry[0], entry[1], recursive=False)
package.close()
if builder.find('cmake') != -1:
# CMake
if 'win' in builder or 'mac' in builder:
os.chdir(build_dir)
files = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')]
for f in files:
os.remove(f)
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
# TODO(sergey): Such magic usually happens in SCon's packaging but we don't have it
# in the CMake yet. For until then we do some magic here.
tokens = result_file.split('-')
blender_version = tokens[1].split('.')
blender_full_version = '.'.join(blender_version[0:2])
git_hash = tokens[2].split('.')[1]
platform = builder.split('_')[0]
if platform == 'mac':
# Special exception for OSX
platform = 'OSX-10.9-'
if builder.endswith('x86_64_10_9_cmake'):
platform += 'x86_64'
if builder.endswith('vc2015'):
platform += "-vc14"
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
# NOTE: Blender 2.7 is already respected by blender_full_version.
if branch != '' and branch != 'blender2.7':
builderified_name = branch + "-" + builderified_name
os.rename(result_file, "{}.zip".format(builderified_name))
# create zip file
try:
if os.path.exists(buildbot_upload_zip):
os.remove(buildbot_upload_zip)
z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write("{}.zip".format(builderified_name))
z.close()
sys.exit(retcode)
except Exception as ex:
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
sys.exit(1)
elif builder.startswith('linux_'):
blender = os.path.join(install_dir, 'blender')
buildinfo_h = os.path.join(build_dir, "source", "creator", "buildinfo.h")
blender_h = os.path.join(blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
# Get version information
blender_version = int(parse_header_file(blender_h, 'BLENDER_VERSION'))
blender_version = "%d.%d" % (blender_version // 100, blender_version % 100)
blender_hash = parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
blender_glibc = builder.split('_')[1]
command_prefix = []
bits = 64
blender_arch = 'x86_64'
if blender_glibc == 'glibc224':
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_stretch_x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_stretch_i686'
bits = 32
blender_arch = 'i686'
command_prefix = ['schroot', '-c', chroot_name, '--']
elif blender_glibc == 'glibc217':
command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
# Strip all unused symbols from the binaries
print("Stripping binaries...")
subprocess.call(command_prefix + ['strip', '--strip-all', blender])
print("Stripping python...")
py_target = os.path.join(install_dir, blender_version)
subprocess.call(command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Copy all specific files which are too specific to be copied by
# the CMake rules themselves
print("Copying extra scripts and libs...")
extra = '/' + os.path.join('home', 'sources', 'release-builder', 'extra')
mesalibs = os.path.join(extra, 'mesalibs' + str(bits) + '.tar.bz2')
software_gl = os.path.join(blender_dir, 'release', 'bin', 'blender-softwaregl')
icons = os.path.join(blender_dir, 'release', 'freedesktop', 'icons')
os.system('tar -xpf %s -C %s' % (mesalibs, install_dir))
os.system('cp %s %s' % (software_gl, install_dir))
os.system('cp -r %s %s' % (icons, install_dir))
os.system('chmod 755 %s' % (os.path.join(install_dir, 'blender-softwaregl')))
# Construct archive name
package_name = 'blender-%s-%s-linux-%s-%s' % (blender_version,
blender_hash,
blender_glibc,
blender_arch)
# NOTE: Blender 2.7 is already respected by blender_full_version.
if branch != '' and branch != 'blender2.7':
package_name = branch + "-" + package_name
upload_filename = package_name + ".tar.bz2"
print("Creating .tar.bz2 archive")
upload_filepath = install_dir + '.tar.bz2'
create_tar_bz2(install_dir, upload_filepath, package_name)
else:
print("Unknown building system")
sys.exit(1)
def cleanup_files(dirpath, extension):
for f in os.listdir(dirpath):
filepath = os.path.join(dirpath, f)
if os.path.isfile(filepath) and f.endswith(extension):
os.remove(filepath)
if upload_filepath is None:
# clean release directory if it already exists
release_dir = 'release'
def pack_mac(builder):
info = buildbot_utils.VersionInfo(builder)
if os.path.exists(release_dir):
for f in os.listdir(release_dir):
if os.path.isfile(os.path.join(release_dir, f)):
os.remove(os.path.join(release_dir, f))
os.chdir(builder.build_dir)
cleanup_files(builder.build_dir, '.dmg')
# create release package
try:
subprocess.call(['make', 'package_archive'])
except Exception as ex:
sys.stderr.write('Make package release failed' + str(ex) + '\n')
sys.exit(1)
package_name = get_package_name(builder, 'macOS')
package_filename = package_name + '.dmg'
package_filepath = os.path.join(builder.build_dir, package_filename)
# find release directory, must exist this time
if not os.path.exists(release_dir):
sys.stderr.write("Failed to find release directory %r.\n" % release_dir)
sys.exit(1)
release_dir = os.path.join(builder.blender_dir, 'release', 'darwin')
bundle_sh = os.path.join(release_dir, 'bundle.sh')
# find release package
file = None
filepath = None
command = [bundle_sh]
command += ['--source', builder.install_dir]
command += ['--dmg', package_filepath]
if info.is_development_build:
background_image = os.path.join(release_dir, 'buildbot', 'background.tif')
command += ['--background-image', background_image]
buildbot_utils.call(command)
for f in os.listdir(release_dir):
rf = os.path.join(release_dir, f)
if os.path.isfile(rf) and f.startswith('blender'):
file = f
filepath = rf
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
if not file:
sys.stderr.write("Failed to find release package.\n")
sys.exit(1)
upload_filename = file
upload_filepath = filepath
def pack_win(builder):
info = buildbot_utils.VersionInfo(builder)
# create zip file
try:
upload_zip = os.path.join(buildbot_upload_zip)
if os.path.exists(upload_zip):
os.remove(upload_zip)
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write(upload_filepath, arcname=upload_filename)
z.close()
except Exception as ex:
sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')
sys.exit(1)
os.chdir(builder.build_dir)
cleanup_files(builder.build_dir, '.zip')
# CPack will add the platform name
cpack_name = get_package_name(builder, None)
package_name = get_package_name(builder, 'windows' + str(builder.bits))
command = ['cmake', '-DCPACK_OVERRIDE_PACKAGENAME:STRING=' + cpack_name, '.']
buildbot_utils.call(builder.command_prefix + command)
command = ['cpack', '-G', 'ZIP']
buildbot_utils.call(builder.command_prefix + command)
package_filename = package_name + '.zip'
package_filepath = os.path.join(builder.build_dir, package_filename)
package_files = [(package_filepath, package_filename)]
if info.version_cycle == 'release':
# Installer only for final release builds, otherwise will get
# 'this product is already installed' messages.
command = ['cpack', '-G', 'WIX']
buildbot_utils.call(builder.command_prefix + command)
package_filename = package_name + '.msi'
package_filepath = os.path.join(builder.build_dir, package_filename)
package_files += [(package_filepath, package_filename)]
create_buildbot_upload_zip(builder, package_files)
def pack_linux(builder):
blender_executable = os.path.join(builder.install_dir, 'blender')
info = buildbot_utils.VersionInfo(builder)
blender_glibc = builder.name.split('_')[1]
blender_arch = 'x86_64'
# Strip all unused symbols from the binaries
print("Stripping binaries...")
buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable])
print("Stripping python...")
py_target = os.path.join(builder.install_dir, info.version)
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
# Construct package name
platform_name = 'linux-' + blender_glibc + '-' + blender_arch
package_name = get_package_name(builder, platform_name)
package_filename = package_name + ".tar.bz2"
print("Creating .tar.bz2 archive")
package_filepath = builder.install_dir + '.tar.bz2'
create_tar_bz2(builder.install_dir, package_filepath, package_name)
# Create buildbot_upload.zip
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
# Make sure install directory always exists
os.makedirs(builder.install_dir, exist_ok=True)
if builder.platform == 'mac':
pack_mac(builder)
elif builder.platform == 'win':
pack_win(builder)
elif builder.platform == 'linux':
pack_linux(builder)

View File

@@ -21,23 +21,17 @@
# 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
# get builder name
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting builder name\n")
sys.exit(1)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
builder = sys.argv[1]
# 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"
# 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 + ".zip"
command = "rsync -avz %s %s" % (local_zip, remote_zip)
print(command)
ret = os.system(command)
sys.exit(ret)
command = ["rsync", "-avz", local_zip, remote_zip]
buildbot_utils.call(command)

View File

@@ -18,59 +18,22 @@
# <pep8 compliant>
import subprocess
import buildbot_utils
import os
import sys
# get builder name
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting builder name\n")
sys.exit(1)
def get_ctest_arguments(builder):
args = ['--output-on-failure']
if builder.platform == 'win':
args += ['-C', 'Release']
return args
builder = sys.argv[1]
def test(builder):
os.chdir(builder.build_dir)
# we run from build/ directory
blender_dir = '../blender.git'
command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder)
buildbot_utils.call(command)
if "cmake" in builder:
print("Automated tests are still DISABLED!")
sys.exit(0)
build_dir = os.path.abspath(os.path.join('..', 'build', builder))
install_dir = os.path.abspath(os.path.join('..', 'install', builder))
# NOTE: For quick test only to see if the approach work.
# n the future must be replaced with an actual blender version.
blender_version = '2.80'
blender_version_dir = os.path.join(install_dir, blender_version)
command_prefix = []
extra_ctest_args = []
if builder.startswith('win'):
extra_ctest_args += ['-C', 'Release']
elif builder.startswith('linux'):
tokens = builder.split("_")
glibc = tokens[1]
if glibc == 'glibc224':
deb_name = "stretch"
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_' + deb_name + '_x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_' + deb_name + '_i686'
command_prefix = ['schroot', '--preserve-environment', '-c', chroot_name, '--']
elif glibc == 'glibc217':
command_prefix = ['scl', 'enable', 'devtoolset-6', '--']
ctest_env = os.environ.copy()
ctest_env['BLENDER_SYSTEM_SCRIPTS'] = os.path.join(blender_version_dir, 'scripts')
ctest_env['BLENDER_SYSTEM_DATAFILES'] = os.path.join(blender_version_dir, 'datafiles')
os.chdir(build_dir)
retcode = subprocess.call(command_prefix + ['ctest', '--output-on-failure'] + extra_ctest_args,
env=ctest_env)
# Always exit with a success, for until we know all the tests are passing
# on all builders.
sys.exit(0)
else:
print("Unknown building system")
sys.exit(1)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
test(builder)

View File

@@ -18,14 +18,14 @@
# <pep8 compliant>
import buildbot_utils
import os
import runpy
import sys
# We run from build/ directory.
blender_dir = os.path.join('..', 'blender.git')
blender_dir = os.path.abspath(blender_dir)
os.chdir(blender_dir)
if __name__ == "__main__":
builder = buildbot_utils.create_builder_from_arguments()
os.chdir(builder.blender_dir)
# Run make update which handles all libraries and submodules.
make_update = os.path.join(blender_dir, "build_files", "utils", "make_update.py")
runpy.run_path(make_update)
# Run make update which handles all libraries and submodules.
make_update = os.path.join(builder.blender_dir, "build_files", "utils", "make_update.py")
buildbot_utils.call([sys.executable, make_update, '--no-blender', "--use-tests", "--use-centos-libraries"])

View File

@@ -0,0 +1,57 @@
# - Find OptiX library
# Find the native OptiX includes and library
# This module defines
# OPTIX_INCLUDE_DIRS, where to find optix.h, Set when
# OPTIX_INCLUDE_DIR is found.
# OPTIX_ROOT_DIR, The base directory to search for OptiX.
# This can also be an environment variable.
# OPTIX_FOUND, If false, do not try to use OptiX.
#=============================================================================
# Copyright 2019 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 OPTIX_ROOT_DIR was defined in the environment, use it.
IF(NOT OPTIX_ROOT_DIR AND NOT $ENV{OPTIX_ROOT_DIR} STREQUAL "")
SET(OPTIX_ROOT_DIR $ENV{OPTIX_ROOT_DIR})
ENDIF()
SET(_optix_SEARCH_DIRS
${OPTIX_ROOT_DIR}
"$ENV{PROGRAMDATA}/NVIDIA Corporation/OptiX SDK 7.0.0"
/usr/local
/sw # Fink
/opt/local # DarwinPorts
)
FIND_PATH(OPTIX_INCLUDE_DIR
NAMES
optix.h
HINTS
${_optix_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX DEFAULT_MSG
OPTIX_INCLUDE_DIR)
IF(OPTIX_FOUND)
SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
ENDIF(OPTIX_FOUND)
MARK_AS_ADVANCED(
OPTIX_INCLUDE_DIR
)
UNSET(_optix_SEARCH_DIRS)

View File

@@ -48,12 +48,20 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
if(WITH_OPENMP_STATIC)
target_link_libraries(${TARGET_NAME} ${OpenMP_LIBRARIES})
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}")
if(${DO_ADD_TEST})
add_test(NAME ${TARGET_NAME} COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>)
add_test(NAME ${TARGET_NAME} COMMAND ${TESTS_OUTPUT_DIR}/${TARGET_NAME} WORKING_DIRECTORY ${TEST_INSTALL_DIR})
# Don't fail tests on leaks since these often happen in external libraries
# that we can't fix.

View File

@@ -145,22 +145,13 @@ if(EXISTS ${SOURCE_DIR}/.git)
unset(_git_changed_files)
endif()
# BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
# BUILD_PLATFORM is taken from CMake
# but BUILD_DATE and BUILD_TIME are platform dependent
if(UNIX)
if(NOT BUILD_DATE)
execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT BUILD_TIME)
execute_process(COMMAND date "+%H:%M:%S" OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
elseif(WIN32)
if(NOT BUILD_DATE)
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT BUILD_TIME)
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT BUILD_DATE)
STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
endif()
if(NOT BUILD_TIME)
STRING(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
endif()
# Write a file with the BUILD_HASH define

View File

@@ -46,8 +46,10 @@ set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)

View File

@@ -17,6 +17,7 @@ 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_OSL OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEVICE_OPTIX OFF CACHE BOOL "" FORCE)
set(WITH_DRACO OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
@@ -50,7 +51,9 @@ set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_TBB OFF CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE OFF CACHE BOOL "" FORCE)

View File

@@ -47,8 +47,10 @@ set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_TBB ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
@@ -56,6 +58,7 @@ set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70;sm_75 CACHE STRING "" FORCE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
# platform dependent options
if(UNIX AND NOT APPLE)

View File

@@ -460,13 +460,16 @@ function(setup_liblinks
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${BLOSC_LIBRARIES})
endif()
if(WITH_OPENIMAGEIO)
target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES})
endif()
if(WITH_OPENIMAGEDENOISE)
target_link_libraries(${target} ${OPENIMAGEDENOISE_LIBRARIES} ${TBB_LIBRARIES})
target_link_libraries(${target} ${OPENIMAGEDENOISE_LIBRARIES})
endif()
if(WITH_TBB)
target_link_libraries(${target} ${TBB_LIBRARIES})
endif()
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
@@ -719,7 +722,7 @@ macro(remove_strict_flags)
endif()
if(MSVC)
remove_cc_flag(/w34189) # Restore warn C4189 (unused variable) back to w4
remove_cc_flag(/w34189) # Restore warn C4189 (unused variable) back to w4
endif()
endmacro()
@@ -1209,7 +1212,9 @@ macro(openmp_delayload
)
if(MSVC)
if(WITH_OPENMP)
if(MSVC_VERSION EQUAL 1800)
if(MSVC_CLANG)
set(OPENMP_DLL_NAME "libomp")
elseif(MSVC_VERSION EQUAL 1800)
set(OPENMP_DLL_NAME "vcomp120")
else()
set(OPENMP_DLL_NAME "vcomp140")

View File

@@ -157,7 +157,7 @@ if(WITH_CODEC_FFMPEG)
avcodec avdevice avformat avutil
mp3lame swscale x264 xvidcore
theora theoradec theoraenc
vorbis vorbisenc vorbisfile ogg
vorbis vorbisenc vorbisfile ogg opus
vpx swresample)
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
@@ -313,16 +313,13 @@ endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(TBB_INCLUDE_DIRS ${LIBDIR}/tbb/include)
set(TBB_LIBRARIES ${LIBDIR}/tbb/lib/libtbb.a)
set(OPENVDB_LIBRARIES openvdb blosc ${TBB_LIBRARIES})
set(OPENVDB_LIBRARIES openvdb blosc)
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm)
set(LLVM_VERSION 3.4)
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
else()
@@ -334,6 +331,9 @@ if(WITH_LLVM)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -384,14 +384,25 @@ endif()
if(WITH_OPENIMAGEDENOISE)
find_package(OpenImageDenoise)
find_package(TBB)
if(NOT OPENIMAGEDENOISE_FOUND)
set(WITH_OPENIMAGEDENOISE OFF)
message(STATUS "OpenImageDenoise not found")
elseif(NOT TBB_FOUND)
endif()
endif()
if(WITH_TBB)
find_package(TBB)
endif()
if(NOT WITH_TBB OR NOT TBB_FOUND)
if(WITH_OPENIMAGEDENOISE)
message(STATUS "TBB not found, disabling OpenImageDenoise")
set(WITH_OPENIMAGEDENOISE OFF)
message(STATUS "TBB not found")
endif()
if(WITH_OPENVDB)
message(STATUS "TBB not found, disabling OpenVDB")
set(WITH_OPENVDB OFF)
endif()
endif()

View File

@@ -22,14 +22,30 @@
# Detect precompiled library directory
if(NOT DEFINED LIBDIR)
# Path to a locally compiled libraries.
set(LIBDIR_NAME ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
string(TOLOWER ${LIBDIR_NAME} LIBDIR_NAME)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
set(LIBDIR_NATIVE_ABI ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
# Path to precompiled libraries with known CentOS 7 ABI.
set(LIBDIR_CENTOS7_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_centos7_x86_64)
# Choose the best suitable libraries.
if(EXISTS ${LIBDIR_NATIVE_ABI})
set(LIBDIR ${LIBDIR_NATIVE_ABI})
elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
set(LIBDIR ${LIBDIR_CENTOS7_ABI})
set(WITH_CXX11_ABI OFF)
endif()
# Avoid namespace pollustion.
unset(LIBDIR_NATIVE_ABI)
unset(LIBDIR_CENTOS7_ABI)
endif()
if(EXISTS ${LIBDIR})
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
# NOTE: Make sure "proper" compiled zlib comes first before the one
# which is a part of OpenCollada. They have different ABI, and we
@@ -244,13 +260,8 @@ endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package_wrapper(TBB)
find_package_wrapper(Blosc)
if(NOT TBB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "TBB not found, disabling OpenVDB")
elseif(NOT OPENVDB_FOUND)
if(NOT OPENVDB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it")
@@ -416,6 +427,21 @@ if(WITH_OPENSUBDIV)
endif()
endif()
if(WITH_TBB)
find_package_wrapper(TBB)
endif()
if(NOT WITH_TBB OR NOT TBB_FOUND)
if(WITH_OPENIMAGEDENOISE)
message(STATUS "TBB not found, disabling OpenImageDenoise")
set(WITH_OPENIMAGEDENOISE OFF)
endif()
if(WITH_OPENVDB)
message(STATUS "TBB not found, disabling OpenVDB")
set(WITH_OPENVDB OFF)
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
if(HAIKU)
list(APPEND PLATFORM_LINKLIBS -lnetwork)

View File

@@ -35,6 +35,22 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
else()
message("Unable to detect the Visual Studio redist directory, copying of the runtime dlls will not work, try running from the visual studio developer prompt.")
endif()
# 1) CMake has issues detecting openmp support in clang-cl so we have to provide
# the right switches here.
# 2) While the /openmp switch *should* work, it currently doesn't as for clang 9.0.0
if(WITH_OPENMP)
set(OPENMP_CUSTOM ON)
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "/clang:-fopenmp")
set(OpenMP_CXX_FLAGS "/clang:-fopenmp")
GET_FILENAME_COMPONENT(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE)
set(CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll")
set(CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib")
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
message(FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found.")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"${CLANG_OPENMP_LIB}\"")
endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
@@ -96,7 +112,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
)
@@ -475,25 +491,20 @@ endif()
if(WITH_OPENVDB)
set(BLOSC_LIBRARIES optimized ${LIBDIR}/blosc/lib/libblosc.lib debug ${LIBDIR}/blosc/lib/libblosc_d.lib)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(OPENVDB ${LIBDIR}/openVDB)
set(OPENVDB_LIBPATH ${OPENVDB}/lib)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES})
set(OPENVDB_DEFINITIONS -DNOMINMAX)
endif()
if(WITH_OPENIMAGEDENOISE)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise)
set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE}/include ${TBB_INCLUDE_DIR})
set(OPENIMAGEDENOISE_INCLUDE_DIRS ${OPENIMAGEDENOISE}/include)
set(OPENIMAGEDENOISE_LIBRARIES
optimized ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise.lib ${OPENIMAGEDENOISE_LIBPATH}/common.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn.lib
debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib
${TBB_LIBRARIES})
debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib ${OPENIMAGEDENOISE_LIBPATH}/mkldnn_d.lib)
set(OPENIMAGEDENOISE_DEFINITIONS)
endif()
@@ -558,6 +569,21 @@ if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
endif()
if(WITH_TBB)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
else()
if(WITH_OPENIMAGEDENOISE)
message(STATUS "TBB disabled, also disabling OpenImageDenoise")
set(WITH_OPENIMAGEDENOISE OFF)
endif()
if(WITH_OPENVDB)
message(STATUS "TBB disabled, also disabling OpenVDB")
set(WITH_OPENVDB OFF)
endif()
endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")

View File

@@ -18,6 +18,7 @@ def parse_arguments():
parser.add_argument("--cmake-command", default="cmake")
parser.add_argument("--svn-command", default="svn")
parser.add_argument("--git-command", default="git")
parser.add_argument("--config", default="")
parser.add_argument("build_directory")
return parser.parse_args()
@@ -26,23 +27,33 @@ git_command = args.git_command
svn_command = args.svn_command
ctest_command = args.ctest_command
cmake_command = args.cmake_command
config = args.config
build_dir = args.build_directory
if shutil.which(ctest_command) is None:
if make_utils.command_missing(ctest_command):
sys.stderr.write("ctest not found, can't run tests\n")
sys.exit(1)
if make_utils.command_missing(git_command):
sys.stderr.write("git not found, can't run tests\n")
sys.exit(1)
# Test if we are building a specific release version.
release_version = make_utils.git_branch_release_version(git_command)
branch = make_utils.git_branch(git_command)
release_version = make_utils.git_branch_release_version(branch)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
if not os.path.exists(lib_tests_dirpath):
print("Tests files not found, downloading...")
if shutil.which(svn_command) is None:
if make_utils.command_missing(svn_command):
sys.stderr.write("svn not found, can't checkout test files\n")
sys.exit(1)
if make_utils.command_missing(cmake_command):
sys.stderr.write("cmake not found, can't checkout test files\n")
sys.exit(1)
svn_url = make_utils.svn_libraries_base_url(release_version) + "/tests"
call([svn_command, "checkout", svn_url, lib_tests_dirpath])
@@ -51,5 +62,15 @@ if not os.path.exists(lib_tests_dirpath):
call([cmake_command, "."])
# Run tests
tests_dir = os.path.join(build_dir, "tests")
os.makedirs(tests_dir, exist_ok=True)
os.chdir(build_dir)
call([ctest_command, ".", "--output-on-failure"])
command = [ctest_command, ".", "--output-on-failure"]
if len(config):
command += ["-C", config]
tests_log = "log_" + config + ".txt"
else:
tests_log = "log.txt"
command += ["-O", os.path.join(tests_dir, tests_log)]
call(command)

View File

@@ -12,34 +12,33 @@ import shutil
import sys
import make_utils
from make_utils import call
# Parse arguments
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--only-code", action="store_true")
parser.add_argument("--svn-command", default="svn")
parser.add_argument("--git-command", default="git")
return parser.parse_args()
args = parse_arguments()
only_code = args.only_code
git_command = args.git_command
svn_command = args.svn_command
svn_non_interactive = [args.svn_command, '--non-interactive']
from make_utils import call, check_output
def print_stage(text):
print("")
print(text)
print("")
# Test if we are building a specific release version.
release_version = make_utils.git_branch_release_version(git_command)
# Parse arguments
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--no-libraries", action="store_true")
parser.add_argument("--no-blender", action="store_true")
parser.add_argument("--no-submodules", action="store_true")
parser.add_argument("--use-tests", action="store_true")
parser.add_argument("--svn-command", default="svn")
parser.add_argument("--git-command", default="git")
parser.add_argument("--use-centos-libraries", action="store_true")
return parser.parse_args()
def get_blender_git_root():
return check_output([args.git_command, "rev-parse", "--show-toplevel"])
# Setup for precompiled libraries and tests from svn.
if not only_code:
lib_dirpath = os.path.join('..', 'lib')
def svn_update(args, release_version):
svn_non_interactive = [args.svn_command, '--non-interactive']
lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
svn_url = make_utils.svn_libraries_base_url(release_version)
# Checkout precompiled libraries
@@ -50,6 +49,8 @@ if not only_code:
# this script is bundled as part of the precompiled libraries. However it
# is used by the buildbot.
lib_platform = "win64_vc14"
elif args.use_centos_libraries:
lib_platform = "linux_centos7_x86_64"
else:
# No precompiled libraries for Linux.
lib_platform = None
@@ -60,48 +61,163 @@ if not only_code:
if not os.path.exists(lib_platform_dirpath):
print_stage("Checking out Precompiled Libraries")
if shutil.which(svn_command) is None:
if make_utils.command_missing(args.svn_command):
sys.stderr.write("svn not found, can't checkout libraries\n")
sys.exit(1)
svn_url_platform = svn_url + lib_platform
call(svn_non_interactive + ["checkout", svn_url_platform, lib_platform_dirpath])
if args.use_tests:
lib_tests = "tests"
lib_tests_dirpath = os.path.join(lib_dirpath, lib_tests)
if not os.path.exists(lib_tests_dirpath):
print_stage("Checking out Tests")
if make_utils.command_missing(args.svn_command):
sys.stderr.write("svn not found, can't checkout tests\n")
sys.exit(1)
svn_url_tests = svn_url + lib_tests
call(svn_non_interactive + ["checkout", svn_url_tests, lib_tests_dirpath])
# Update precompiled libraries and tests
print_stage("Updating Precompiled Libraries and Tests")
if os.path.isdir(lib_dirpath):
for dirname in os.listdir(lib_dirpath):
dirpath = os.path.join(lib_dirpath, dirname)
if dirname == ".svn":
# Cleanup must be run from svn root directory if it exists.
if not make_utils.command_missing(args.svn_command):
call(svn_non_interactive + ["cleanup", lib_dirpath])
continue
dirpath = os.path.join(lib_dirpath, dirname)
svn_dirpath = os.path.join(dirpath, ".svn")
svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
if os.path.isdir(dirpath) and \
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)):
if shutil.which(svn_command) is None:
if make_utils.command_missing(args.svn_command):
sys.stderr.write("svn not found, can't update libraries\n")
sys.exit(1)
call(svn_non_interactive + ["cleanup", dirpath])
# Cleanup to continue with interrupted downloads.
if os.path.exists(svn_dirpath):
call(svn_non_interactive + ["cleanup", dirpath])
# Switch to appropriate branch and update.
call(svn_non_interactive + ["switch", svn_url + dirname, dirpath])
call(svn_non_interactive + ["update", dirpath])
# Update blender repository and submodules.
print_stage("Updating Blender Git Repository and Submodules")
# Test if git repo can be updated.
def git_update_skip(args, check_remote_exists=True):
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
if shutil.which(git_command) is None:
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
# Abort if a rebase is still progress.
rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False)
rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False)
merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False)
if os.path.exists(rebase_merge) or \
os.path.exists(rebase_apply) or \
os.path.exists(merge_head):
return "rebase or merge in progress, complete it first"
call([git_command, "pull", "--rebase"])
call([git_command, "submodule", "update", "--init", "--recursive"])
# Abort if uncommitted changes.
changes = check_output([args.git_command, 'status', '--porcelain', '--untracked-files=no'])
if len(changes) != 0:
return "you have unstaged changes"
if not release_version:
# Update submodules to latest master if not building a specific release.
# In that case submodules are set to a specific revision, which is checked
# out by running "git submodule update".
call([git_command, "submodule", "foreach", "git", "checkout", "master"])
call([git_command, "submodule", "foreach", "git", "pull", "--rebase", "origin", "master"])
# Test if there is an upstream branch configured
if check_remote_exists:
branch = check_output([args.git_command, "rev-parse", "--abbrev-ref", "HEAD"])
remote = check_output([args.git_command, "config", "branch." + branch + ".remote"], exit_on_error=False)
if len(remote) == 0:
return "no remote branch to pull from"
return ""
# Update blender repository.
def blender_update(args):
print_stage("Updating Blender Git Repository")
call([args.git_command, "pull", "--rebase"])
# Update submodules.
def submodules_update(args, release_version, branch):
print_stage("Updating Submodules")
if make_utils.command_missing(args.git_command):
sys.stderr.write("git not found, can't update code\n")
sys.exit(1)
# Update submodules to latest master or appropriate release branch.
if not release_version:
branch = "master"
submodules = [
("release/scripts/addons", branch),
("release/scripts/addons_contrib", branch),
("release/datafiles/locale", branch),
("source/tools", branch),
]
# Initialize submodules only if needed.
for submodule_path, submodule_branch in submodules:
if not os.path.exists(os.path.join(submodule_path, ".git")):
call([args.git_command, "submodule", "update", "--init", "--recursive"])
break
# Checkout appropriate branch and pull changes.
skip_msg = ""
for submodule_path, submodule_branch in submodules:
cwd = os.getcwd()
try:
os.chdir(submodule_path)
msg = git_update_skip(args, check_remote_exists=False)
if msg:
skip_msg += submodule_path + " skipped: " + msg + "\n"
else:
if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "fetch", "origin"])
call([args.git_command, "checkout", submodule_branch])
call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
finally:
os.chdir(cwd)
return skip_msg
if __name__ == "__main__":
args = parse_arguments()
blender_skip_msg = ""
submodules_skip_msg = ""
# Test if we are building a specific release version.
branch = make_utils.git_branch(args.git_command)
release_version = make_utils.git_branch_release_version(branch)
if not args.no_libraries:
svn_update(args, release_version)
if not args.no_blender:
blender_skip_msg = git_update_skip(args)
if blender_skip_msg:
blender_skip_msg = "Blender repository skipped: " + blender_skip_msg + "\n"
else:
blender_update(args)
if not args.no_submodules:
submodules_skip_msg = submodules_update(args, release_version, branch)
# Report any skipped repositories at the end, so it's not as easy to miss.
skip_msg = blender_skip_msg + submodules_skip_msg
if skip_msg:
print_stage(skip_msg.strip())
# For failed submodule update we throw an error, since not having correct
# submodules can make Blender throw errors.
# For Blender itself we don't and consider "make update" to be a command
# you can use while working on uncommitted code.
if submodules_skip_msg:
sys.exit(1)

View File

@@ -3,10 +3,11 @@
# Utility functions for make update and make tests.
import re
import shutil
import subprocess
import sys
def call(cmd):
def call(cmd, exit_on_error=True):
print(" ".join(cmd))
# Flush to ensure correct order output on Windows.
@@ -14,10 +15,27 @@ def call(cmd):
sys.stderr.flush()
retcode = subprocess.call(cmd)
if retcode != 0:
sys.exit(retcode)
if exit_on_error and retcode != 0:
sys.exit(retcode)
return retcode
def git_branch_release_version(git_command):
def check_output(cmd, exit_on_error=True):
# Flush to ensure correct order output on Windows.
sys.stdout.flush()
sys.stderr.flush()
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except subprocess.CalledProcessError as e:
if exit_on_error:
sys.stderr.write(" ".join(cmd))
sys.stderr.write(e.output + "\n")
sys.exit(e.returncode)
output = ""
return output.strip()
def git_branch(git_command):
# Test if we are building a specific release version.
try:
branch = subprocess.check_output([git_command, "rev-parse", "--abbrev-ref", "HEAD"])
@@ -25,7 +43,9 @@ def git_branch_release_version(git_command):
sys.stderr.write("Failed to get Blender git branch\n")
sys.exit(1)
branch = branch.strip().decode('utf8')
return branch.strip().decode('utf8')
def git_branch_release_version(branch):
release_version = re.search("^blender-v(.*)-release$", branch)
if release_version:
release_version = release_version.group(1)
@@ -37,3 +57,10 @@ def svn_libraries_base_url(release_version):
else:
svn_branch = "trunk"
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
def command_missing(command):
# Support running with Python 2 for macOS
if sys.version_info >= (3, 0):
return shutil.which(command) is None
else:
return False

View File

@@ -30,9 +30,15 @@ set LLVM_DIR=
:DetectionComplete
set CC=%LLVM_DIR%\bin\clang-cl
set CXX=%LLVM_DIR%\bin\clang-cl
rem build and tested against 2017 15.7
set CFLAGS=-m64 -fmsc-version=1914
set CXXFLAGS=-m64 -fmsc-version=1914
if "%BUILD_VS_YEAR%" == "2019" (
rem build and tested against 2019 16.2
set CFLAGS=-m64 -fmsc-version=1922
set CXXFLAGS=-m64 -fmsc-version=1922
) else (
rem build and tested against 2017 15.7
set CFLAGS=-m64 -fmsc-version=1914
set CXXFLAGS=-m64 -fmsc-version=1914
)
if "%WITH_ASAN%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
)

View File

@@ -1,15 +1,17 @@
REM find all dependencies and set the corresponding environment variables.
for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe
if NOT "%verbose%" == "" (
echo svn : "%SVN%"
echo cmake : "%CMAKE%"
echo ctest : "%CTEST%"
echo git : "%GIT%"
echo python : "%PYTHON%"
)
if "%CMAKE%" == "" (
echo Cmake not found in path, required for building, exiting...
exit /b 1
)
)

View File

@@ -13,7 +13,7 @@ if NOT "%1" == "" (
set BUILD_TYPE=Debug
REM Build Configurations
) else if "%1" == "builddir" (
set BUILD_DIR_OVERRRIDE="%BLENDER_DIR%..\%2"
set BUILD_DIR_OVERRRIDE=%BLENDER_DIR%..\%2
shift /1
) else if "%1" == "with_tests" (
set TESTS_CMAKE_ARGS=%TESTS_CMAKE_ARGS% -DWITH_GTESTS=On
@@ -85,13 +85,16 @@ if NOT "%1" == "" (
set BUILD_UPDATE_ARGS=
) else if "%1" == "code_update" (
SET BUILD_UPDATE=1
set BUILD_UPDATE_ARGS="--only-code"
set BUILD_UPDATE_ARGS="--no-libraries"
) else if "%1" == "ninja" (
SET BUILD_WITH_NINJA=1
) else if "%1" == "clean" (
set MUST_CLEAN=1
) else if "%1" == "verbose" (
set VERBOSE=1
) else if "%1" == "test" (
set TEST=1
set NOBUILD=1
) else if "%1" == "format" (
set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9

View File

@@ -29,3 +29,4 @@ set ASAN_CMAKE_ARGS=
set WITH_PYDEBUG=
set PYDEBUG_CMAKE_ARGS=
set FORMAT=
set TEST=

View File

@@ -13,6 +13,7 @@ echo - update ^(Update both SVN and GIT^)
echo - code_update ^(Update only GIT^)
echo - nobuild ^(only generate project files^)
echo - showhash ^(Show git hashes of source tree^)
echo - test ^(Run automated tests with ctest^)
echo - format [path] ^(Format the source using clang-format, path is optional, requires python 3.x to be available^)
echo.
echo Configuration options

View File

@@ -0,0 +1,13 @@
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found in lib folder
exit /b 1
:detect_python_done
REM Use -B to avoid writing __pycache__ in lib directory and causing update conflicts.
%PYTHON% -B %BLENDER_DIR%\build_files\utils\make_test.py --git-command "%GIT%" --svn-command "%SVN%" --cmake-command="%CMAKE%" --ctest-command="%CTEST%" --config="%BUILD_TYPE%" %BUILD_DIR%
:EOF

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "V2.81"
PROJECT_NUMBER = "V2.82"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -30,11 +30,11 @@ and <output-filename> is where to write the generated man page.
# <pep8 compliant>
import os
import subprocess
import sys
import time
import datetime
def man_format(data):
@@ -52,11 +52,18 @@ outfilename = sys.argv[2]
cmd = [blender_bin, "--help"]
print(" executing:", " ".join(cmd))
blender_help = subprocess.check_output(cmd).decode(encoding="utf-8")
blender_version = subprocess.check_output([blender_bin, "--version"]).decode(encoding="utf-8").strip()
blender_version = blender_version.split("build")[0].rstrip()
blender_version = blender_version.partition(" ")[2] # remove 'Blender' prefix.
date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")
blender_help = subprocess.run(
cmd, env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8")
blender_version = subprocess.run(
[blender_bin, "--version"], env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8").strip()
blender_version, blender_date = (blender_version.split("build") + [None, None])[0:2]
blender_version = blender_version.rstrip().partition(" ")[2] # remove 'Blender' prefix.
if blender_date is None:
# Happens when built without WITH_BUILD_INFO e.g.
date_string = time.strftime("%B %d, %Y", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
else:
blender_date = blender_date.strip().partition(" ")[2] # remove 'date:' prefix
date_string = time.strftime("%B %d, %Y", time.strptime(blender_date, "%Y-%m-%d"))
outfile = open(outfilename, "w")
fw = outfile.write
@@ -80,7 +87,7 @@ is a full-featured 3D application. It supports the entirety of the 3D pipeline -
Use Blender to create 3D images and animations, films and commercials, content for games, architectural and industrial visualizatons, and scientific visualizations.
http://www.blender.org''')
https://www.blender.org''')
fw('''
.SH OPTIONS''')

View File

@@ -35,7 +35,7 @@ class OBJECT_OT_evaluated_example(bpy.types.Operator):
# modifiers.
#
# For mesh objects the object.data will be a mesh with all modifiers applied.
# This means that in access to vertices or faces after modifier stack happens via fields of
# This means that in access to vertices or faces after modifier stack happens via fields of
# object_eval.object.
#
# For other types of objects the object_eval.data does not have modifiers applied on it,

View File

@@ -210,4 +210,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -301,7 +301,7 @@ Advantages include:
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/index.php/User:Ideasman42/BlenderAsPyModule>`_
`Building Blender as a Python module <https://wiki.blender.org/wiki/Building_Blender/Other/BlenderAsPyModule>`_
Python Safety (Build Option)

View File

@@ -94,10 +94,10 @@ def main():
rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
blenver = blenver_zip = ""
blenver = api_blenver = api_blenver_zip = ""
api_name = ""
branch = ""
is_release = False
is_release = is_beta = False
# I) Update local mirror using rsync.
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
@@ -118,11 +118,14 @@ def main():
"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 else '%s\\n' % branch)\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"
)
@@ -130,8 +133,9 @@ def main():
"--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd)
with open(getver_file) as f:
is_release, branch, blenver, blenver_zip = f.read().split("\n")
is_release, is_beta, branch, blenver, api_blenver, api_blenver_zip = f.read().split("\n")
is_release = bool(int(is_release))
is_beta = bool(int(is_beta))
os.remove(getver_file)
# IV) Build doc.
@@ -143,14 +147,17 @@ def main():
os.chdir(curr_dir)
# V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
api_name = blenver
api_name = api_blenver
api_dir = os.path.join(args.mirror_dir, api_name)
if os.path.exists(api_dir):
shutil.rmtree(api_dir)
if os.path.islink(api_dir):
os.remove(api_dir)
else:
shutil.rmtree(api_dir)
os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
# VI) Create zip archive.
zip_name = "blender_python_reference_%s" % blenver_zip # We can't use 'release' postfix here...
zip_name = "blender_python_reference_%s" % api_blenver_zip # We can't use 'release' postfix here...
zip_path = os.path.join(args.mirror_dir, zip_name)
with zipfile.ZipFile(zip_path, 'w') as zf:
for dirname, _, filenames in os.walk(api_dir):
@@ -163,12 +170,27 @@ def main():
# VII) Create symlinks and html redirects.
if is_release:
symlink = os.path.join(args.mirror_dir, "current")
os.remove(symlink)
if os.path.exists(symlink):
if os.path.islink(symlink):
os.remove(symlink)
else:
shutil.rmtree(symlink)
os.symlink("./%s" % api_name, symlink)
with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
elif is_beta:
# We do not have any particular symlink for that stage.
pass
elif branch == "master":
# Also create a symlink from version number to actual master api doc.
symlink = os.path.join(args.mirror_dir, blenver)
if os.path.exists(symlink):
if os.path.islink(symlink):
os.remove(symlink)
else:
shutil.rmtree(symlink)
os.symlink("./%s" % api_name, symlink)
with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)

View File

@@ -105,3 +105,8 @@ if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_CMAKE_CFG ${CMAKE_CURRENT_SOURCE_DIR}/audaspace/blender_config.cmake)
add_subdirectory(audaspace)
endif()
if(WITH_QUADRIFLOW)
set(QUADRIFLOW_CMAKE_CFG ${CMAKE_CURRENT_SOURCE_DIR}/quadriflow/blender_config.cmake)
add_subdirectory(quadriflow)
endif()

View File

@@ -78,7 +78,7 @@ bool SoftwareDevice::SoftwareHandle::pause(bool keep)
}
SoftwareDevice::SoftwareHandle::SoftwareHandle(SoftwareDevice* device, std::shared_ptr<IReader> reader, std::shared_ptr<PitchReader> pitch, std::shared_ptr<ResampleReader> resampler, std::shared_ptr<ChannelMapperReader> mapper, bool keep) :
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(1.0f), m_old_volume(0), m_loopcount(0),
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(0.0f), m_old_volume(0.0f), m_loopcount(0),
m_relative(true), m_volume_max(1.0f), m_volume_min(0), m_distance_max(std::numeric_limits<float>::max()),
m_distance_reference(1.0f), m_attenuation(1.0f), m_cone_angle_outer(M_PI), m_cone_angle_inner(M_PI), m_cone_volume_outer(0),
m_flags(RENDER_CONE), m_stop(nullptr), m_stop_data(nullptr), m_status(STATUS_PLAYING), m_device(device)

View File

@@ -859,6 +859,23 @@ int cuewNvrtcVersion(void) {
return 0;
}
static size_t safe_strnlen(const char *s, size_t maxlen) {
size_t length;
for (length = 0; length < maxlen; s++, length++) {
if (*s == '\0') {
break;
}
}
return length;
}
static char *safe_strncpy(char *dest, const char *src, size_t n) {
const size_t src_len = safe_strnlen(src, n - 1);
memcpy(dest, src, src_len);
dest[src_len] = '\0';
return dest;
}
int cuewCompilerVersion(void) {
const char *path = cuewCompilerPath();
const char *marker = "Cuda compilation tools, release ";
@@ -874,7 +891,7 @@ int cuewCompilerVersion(void) {
}
/* get --version output */
strncpy(command, path, sizeof(command));
safe_strncpy(command, path, sizeof(command));
strncat(command, " --version", sizeof(command) - strlen(path));
pipe = popen(command, "r");
if (!pipe) {

View File

@@ -0,0 +1,26 @@
The main developers of release series 1.x are
* Balazs Dezso <deba@inf.elte.hu>
* Alpar Juttner <alpar@cs.elte.hu>
* Peter Kovacs <kpeter@inf.elte.hu>
* Akos Ladanyi <ladanyi@tmit.bme.hu>
For more complete list of contributors, please visit the history of
the LEMON source code repository: http://lemon.cs.elte.hu/hg/lemon
Moreover, this version is heavily based on version 0.x of LEMON. Here
is the list of people who contributed to those versions.
* Mihaly Barasz <klao@cs.elte.hu>
* Johanna Becker <beckerjc@cs.elte.hu>
* Attila Bernath <athos@cs.elte.hu>
* Balazs Dezso <deba@inf.elte.hu>
* Peter Hegyi <hegyi@tmit.bme.hu>
* Alpar Juttner <alpar@cs.elte.hu>
* Peter Kovacs <kpeter@inf.elte.hu>
* Akos Ladanyi <ladanyi@tmit.bme.hu>
* Marton Makai <marci@cs.elte.hu>
* Jacint Szabo <jacint@cs.elte.hu>
Again, please visit the history of the old LEMON repository for more
details: http://lemon.cs.elte.hu/hg/lemon-0.x

View File

@@ -0,0 +1,373 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
SET(PROJECT_NAME "LEMON")
PROJECT(${PROJECT_NAME})
INCLUDE(FindPythonInterp)
INCLUDE(FindWget)
IF(EXISTS ${PROJECT_SOURCE_DIR}/cmake/version.cmake)
INCLUDE(${PROJECT_SOURCE_DIR}/cmake/version.cmake)
ELSEIF(DEFINED ENV{LEMON_VERSION})
SET(LEMON_VERSION $ENV{LEMON_VERSION} CACHE STRING "LEMON version string.")
ELSE()
EXECUTE_PROCESS(
COMMAND
hg log -r. --template "{latesttag}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HG_REVISION_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
COMMAND
hg log -r. --template "{latesttagdistance}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HG_REVISION_DIST
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
EXECUTE_PROCESS(
COMMAND
hg log -r. --template "{node|short}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HG_REVISION_ID
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF(HG_REVISION_TAG STREQUAL "")
SET(HG_REVISION_ID "hg-tip")
ELSE()
IF(HG_REVISION_TAG STREQUAL "null")
SET(HG_REVISION_TAG "trunk")
ELSEIF(HG_REVISION_TAG MATCHES "^r")
STRING(SUBSTRING ${HG_REVISION_TAG} 1 -1 HG_REVISION_TAG)
ENDIF()
IF(HG_REVISION_DIST STREQUAL "0")
SET(HG_REVISION ${HG_REVISION_TAG})
ELSE()
SET(HG_REVISION
"${HG_REVISION_TAG}+${HG_REVISION_DIST}-${HG_REVISION_ID}")
ENDIF()
ENDIF()
SET(LEMON_VERSION ${HG_REVISION} CACHE STRING "LEMON version string.")
ENDIF()
SET(PROJECT_VERSION ${LEMON_VERSION})
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
FIND_PACKAGE(Doxygen)
FIND_PACKAGE(Ghostscript)
SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
SET(LEMON_ENABLE_SOPLEX YES CACHE STRING "Enable SoPlex solver backend.")
IF(LEMON_ENABLE_GLPK)
FIND_PACKAGE(GLPK 4.33)
ENDIF(LEMON_ENABLE_GLPK)
IF(LEMON_ENABLE_ILOG)
FIND_PACKAGE(ILOG)
ENDIF(LEMON_ENABLE_ILOG)
IF(LEMON_ENABLE_COIN)
FIND_PACKAGE(COIN)
ENDIF(LEMON_ENABLE_COIN)
IF(LEMON_ENABLE_SOPLEX)
FIND_PACKAGE(SOPLEX)
ENDIF(LEMON_ENABLE_SOPLEX)
IF(GLPK_FOUND)
SET(LEMON_HAVE_LP TRUE)
SET(LEMON_HAVE_MIP TRUE)
SET(LEMON_HAVE_GLPK TRUE)
ENDIF(GLPK_FOUND)
IF(ILOG_FOUND)
SET(LEMON_HAVE_LP TRUE)
SET(LEMON_HAVE_MIP TRUE)
SET(LEMON_HAVE_CPLEX TRUE)
ENDIF(ILOG_FOUND)
IF(COIN_FOUND)
SET(LEMON_HAVE_LP TRUE)
SET(LEMON_HAVE_MIP TRUE)
SET(LEMON_HAVE_CLP TRUE)
SET(LEMON_HAVE_CBC TRUE)
ENDIF(COIN_FOUND)
IF(SOPLEX_FOUND)
SET(LEMON_HAVE_LP TRUE)
SET(LEMON_HAVE_SOPLEX TRUE)
ENDIF(SOPLEX_FOUND)
IF(ILOG_FOUND)
SET(DEFAULT_LP "CPLEX")
SET(DEFAULT_MIP "CPLEX")
ELSEIF(COIN_FOUND)
SET(DEFAULT_LP "CLP")
SET(DEFAULT_MIP "CBC")
ELSEIF(GLPK_FOUND)
SET(DEFAULT_LP "GLPK")
SET(DEFAULT_MIP "GLPK")
ELSEIF(SOPLEX_FOUND)
SET(DEFAULT_LP "SOPLEX")
ENDIF()
IF(NOT LEMON_DEFAULT_LP OR
(NOT ILOG_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CPLEX")) OR
(NOT COIN_FOUND AND (LEMON_DEFAULT_LP STREQUAL "CLP")) OR
(NOT GLPK_FOUND AND (LEMON_DEFAULT_LP STREQUAL "GLPK")) OR
(NOT SOPLEX_FOUND AND (LEMON_DEFAULT_LP STREQUAL "SOPLEX")))
SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
"Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)" FORCE)
ELSE()
SET(LEMON_DEFAULT_LP ${DEFAULT_LP} CACHE STRING
"Default LP solver backend (GLPK, CPLEX, CLP or SOPLEX)")
ENDIF()
IF(NOT LEMON_DEFAULT_MIP OR
(NOT ILOG_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CPLEX")) OR
(NOT COIN_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "CBC")) OR
(NOT GLPK_FOUND AND (LEMON_DEFAULT_MIP STREQUAL "GLPK")))
SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
"Default MIP solver backend (GLPK, CPLEX or CBC)" FORCE)
ELSE()
SET(LEMON_DEFAULT_MIP ${DEFAULT_MIP} CACHE STRING
"Default MIP solver backend (GLPK, CPLEX or CBC)")
ENDIF()
IF(DEFINED ENV{LEMON_CXX_WARNING})
SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
ELSE()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
ELSEIF(MSVC)
# This part is unnecessary 'casue the same is set by the lemon/core.h.
# Still keep it as an example.
SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
# Suppressed warnings:
# C4250: 'class1' : inherits 'class2::member' via dominance
# C4355: 'this' : used in base member initializer list
# C4503: 'function' : decorated name length exceeded, name was truncated
# C4800: 'type' : forcing value to bool 'true' or 'false'
# (performance warning)
# C4996: 'function': was declared deprecated
ELSE()
SET(CXX_WARNING "-Wall")
ENDIF()
ENDIF()
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
IF(MSVC)
SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
"Flags used by the C++ compiler during maintainer builds."
)
SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
"Flags used by the C compiler during maintainer builds."
)
SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used for linking binaries during maintainer builds."
)
SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the shared libraries linker during maintainer builds."
)
ELSE()
SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
"Flags used by the C++ compiler during maintainer builds."
)
SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
"Flags used by the C compiler during maintainer builds."
)
SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used for linking binaries during maintainer builds."
)
SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the shared libraries linker during maintainer builds."
)
ENDIF()
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_MAINTAINER
CMAKE_C_FLAGS_MAINTAINER
CMAKE_EXE_LINKER_FLAGS_MAINTAINER
CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
IF(CMAKE_CONFIGURATION_TYPES)
LIST(APPEND CMAKE_CONFIGURATION_TYPES Maintainer)
LIST(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
"Add the configurations that we need"
FORCE)
endif()
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel Maintainer."
FORCE )
INCLUDE(CheckTypeSize)
CHECK_TYPE_SIZE("long long" LONG_LONG)
SET(LEMON_HAVE_LONG_LONG ${HAVE_LONG_LONG})
INCLUDE(FindThreads)
IF(NOT LEMON_THREADING)
IF(CMAKE_USE_PTHREADS_INIT)
SET(LEMON_THREADING "Pthread")
ELSEIF(CMAKE_USE_WIN32_THREADS_INIT)
SET(LEMON_THREADING "Win32")
ELSE()
SET(LEMON_THREADING "None")
ENDIF()
ENDIF()
SET( LEMON_THREADING "${LEMON_THREADING}" CACHE STRING
"Choose the threading library, options are: Pthread Win32 None."
FORCE )
IF(LEMON_THREADING STREQUAL "Pthread")
SET(LEMON_USE_PTHREAD TRUE)
ELSEIF(LEMON_THREADING STREQUAL "Win32")
SET(LEMON_USE_WIN32_THREADS TRUE)
ENDIF()
ENABLE_TESTING()
IF(${CMAKE_BUILD_TYPE} STREQUAL "Maintainer")
ADD_CUSTOM_TARGET(check ALL COMMAND ${CMAKE_CTEST_COMMAND})
ELSE()
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND})
ENDIF()
ADD_SUBDIRECTORY(lemon)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
ADD_SUBDIRECTORY(contrib)
ADD_SUBDIRECTORY(demo)
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(test)
ENDIF()
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/cmake/LEMONConfig.cmake.in
${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
@ONLY
)
IF(UNIX)
INSTALL(
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
DESTINATION share/lemon/cmake
)
ELSEIF(WIN32)
INSTALL(
FILES ${PROJECT_BINARY_DIR}/cmake/LEMONConfig.cmake
DESTINATION cmake
)
ENDIF()
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/cmake/version.cmake.in
${PROJECT_BINARY_DIR}/cmake/version.cmake
@ONLY
)
SET(ARCHIVE_BASE_NAME ${CMAKE_PROJECT_NAME})
STRING(TOLOWER ${ARCHIVE_BASE_NAME} ARCHIVE_BASE_NAME)
SET(ARCHIVE_NAME ${ARCHIVE_BASE_NAME}-${PROJECT_VERSION})
ADD_CUSTOM_TARGET(dist
COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
COMMAND hg archive ${ARCHIVE_NAME}
COMMAND cmake -E copy cmake/version.cmake ${ARCHIVE_NAME}/cmake/version.cmake
COMMAND tar -czf ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_NAME}
COMMAND zip -r ${ARCHIVE_BASE_NAME}-nodoc-${PROJECT_VERSION}.zip ${ARCHIVE_NAME}
COMMAND cmake -E copy_directory doc/html ${ARCHIVE_NAME}/doc/html
COMMAND tar -czf ${ARCHIVE_NAME}.tar.gz ${ARCHIVE_NAME}
COMMAND zip -r ${ARCHIVE_NAME}.zip ${ARCHIVE_NAME}
COMMAND cmake -E copy_directory doc/html ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
COMMAND tar -czf ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.tar.gz ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
COMMAND zip -r ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}.zip ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
COMMAND cmake -E remove_directory ${ARCHIVE_NAME}
COMMAND cmake -E remove_directory ${ARCHIVE_BASE_NAME}-doc-${PROJECT_VERSION}
DEPENDS html
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
# CPACK config (Basically for NSIS)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
SET(CPACK_PACKAGE_VENDOR "EGRES")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"LEMON - Library for Efficient Modeling and Optimization in Networks")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
SET(CPACK_PACKAGE_INSTALL_DIRECTORY
"${PROJECT_NAME} ${PROJECT_VERSION}")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${PROJECT_NAME} ${PROJECT_VERSION}")
SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
"C++ header files")
SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
"DLL and import library")
SET(CPACK_COMPONENT_BIN_DESCRIPTION
"Command line utilities")
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
"Doxygen generated documentation")
SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
"Components needed to develop software using LEMON")
SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
"Documentation of LEMON")
SET(CPACK_ALL_INSTALL_TYPES Full Developer)
SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
SET(CPACK_GENERATOR "NSIS")
SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
#SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
")
SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
")
INCLUDE(CPack)
ENDIF()

View File

@@ -0,0 +1,167 @@
Installation Instructions
=========================
This file contains instructions for building and installing LEMON from
source on Linux. The process on Windows is similar.
Note that it is not necessary to install LEMON in order to use
it. Instead, you can easily integrate it with your own code
directly. For instructions, see
https://lemon.cs.elte.hu/trac/lemon/wiki/HowToCompile
In order to install LEMON from the extracted source tarball you have to
issue the following commands:
1. Step into the root of the source directory.
$ cd lemon-x.y.z
2. Create a build subdirectory and step into it.
$ mkdir build
$ cd build
3. Perform system checks and create the makefiles.
$ cmake ..
4. Build LEMON.
$ make
This command compiles the non-template part of LEMON into
libemon.a file. It also compiles the programs in the 'tools' and
'demo' subdirectories.
5. [Optional] Compile and run the self-tests.
$ make check
5. [Optional] Generate the user documentation.
$ make html
The release tarballs already include the documentation.
Note that for this step you need to have the following tools
installed: Python, Doxygen, Graphviz, Ghostscript, LaTeX.
6. [Optional] Install LEMON
$ make install
This command installs LEMON under /usr/local (you will need root
privileges to be able to do that). If you want to install it to
some other location, then pass the
-DCMAKE_INSTALL_PREFIX=DIRECTORY flag to cmake in Step 3.
For example:
$ cmake -DCMAKE_INSTALL_PREFIX=/home/username/lemon'
Configure Options and Variables
===============================
In Step 3, you can customize the build process by passing options to CMAKE.
$ cmake [OPTIONS] ..
You find a list of the most useful options below.
-DCMAKE_INSTALL_PREFIX=PREFIX
Set the installation prefix to PREFIX. By default it is /usr/local.
-DCMAKE_BUILD_TYPE=[Release|Debug|Maintainer|...]
This sets the compiler options. The choices are the following
'Release': A strong optimization is turned on (-O3 with gcc). This
is the default setting and we strongly recommend using this for
the final compilation.
'Debug': Optimization is turned off and debug info is added (-O0
-ggdb with gcc). If is recommended during the development.
'Maintainer': The same as 'Debug' but the compiler warnings are
converted to errors (-Werror with gcc). In addition, 'make' will
also automatically compile and execute the test codes. It is the
best way of ensuring that LEMON codebase is clean and safe.
'RelWithDebInfo': Optimized build with debug info.
'MinSizeRel': Size optimized build (-Os with gcc)
-DTEST_WITH_VALGRIND=YES
Using this, the test codes will be executed using valgrind. It is a
very effective way of identifying indexing problems and memory leaks.
-DCMAKE_CXX_COMPILER=path-to-compiler
Change the compiler to be used.
-DBUILD_SHARED_LIBS=TRUE
Build shared library instead of static one. Think twice if you
really want to use this option.
-DLEMON_DOC_SOURCE_BROWSER=YES
Include the browsable cross referenced LEMON source code into the
doc. It makes the doc quite bloated, but may be useful for
developing LEMON itself.
-DLEMON_DOC_USE_MATHJAX=YES
Use MathJax (http://mathjax.org) for rendering the math formulae in
the doc. It of much higher quality compared to the default LaTeX
generated static images and it allows copy&paste of the formulae to
LaTeX, Open Office, MS Word etc. documents.
On the other hand, it needs either Internet access or a locally
installed version of MathJax to properly render the doc.
-DLEMON_DOC_MATHJAX_RELPATH=DIRECTORY
The location of the MathJax library. It defaults to
http://www.mathjax.org/mathjax, which necessitates Internet access
for proper rendering. The easiest way to make it usable offline is
to set this parameter to 'mathjax' and copy all files of the MathJax
library into the 'doc/html/mathjax' subdirectory of the build
location.
See http://docs.mathjax.org/en/latest/installation.html for more details.
-DLEMON_ENABLE_GLPK=NO
-DLEMON_ENABLE_COIN=NO
-DLEMON_ENABLE_ILOG=NO
Enable optional third party libraries. They are all enabled by default.
-DLEMON_DEFAULT_LP=GLPK
Sets the default LP solver backend. The supported values are
CPLEX, CLP and GLPK. By default, it is set to the first one which
is enabled and succesfully discovered.
-DLEMON_DEFAULT_MIP=GLPK
Sets the default MIP solver backend. The supported values are
CPLEX, CBC and GLPK. By default, it is set to the first one which
is enabled and succesfully discovered.
-DGLPK_ROOT_DIR=DIRECTORY
-DCOIN_ROOT_DIR=DIRECTORY
-DILOG_ROOT_DIR=DIRECTORY
Root directory prefixes of optional third party libraries.
Makefile Variables
==================
make VERBOSE=1
This results in a more verbose output by showing the full
compiler and linker commands.

View File

@@ -0,0 +1,32 @@
LEMON code without an explicit copyright notice is covered by the following
copyright/license.
Copyright (C) 2003-2012 Egervary Jeno Kombinatorikus Optimalizalasi
Kutatocsoport (Egervary Combinatorial Optimization Research Group,
EGRES).
===========================================================================
Boost Software License, Version 1.0
===========================================================================
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

337
extern/quadriflow/3rd/lemon-1.3.1/NEWS vendored Normal file
View File

@@ -0,0 +1,337 @@
2014-07-07 Version 1.3.1 released
Bugfix release.
#484: Require CMAKE 2.8
#471, #472, #480: Various clang compatibility fixes
#481, #482: Fix shared lib build and versioning
#476: Fix invalid map query in NearestNeighborTsp
#478: Bugfix in debug checking and lower bound handling
in min cost flow algorithms
#479, #465: Bugfix in default LP/MIP backend settings
#476: Bugfix in tsp_test
#487: Add missing include header and std:: namespace spec.
#474: Fix division by zero error in NetworkSimplex
2013-08-10 Version 1.3 released
This is major feature release
* New data structures
#69 : Bipartite graph concepts and implementations
* New algorithms
#177: Port Edmonds-Karp algorithm
#380, #405: Heuristic algorithm for the max clique problem
#386: Heuristic algorithms for symmetric TSP
----: Nagamochi-Ibaraki algorithm [5087694945e4]
#397, #56: Max. cardinality search
* Other new features
#223: Thread safe graph and graph map implementations
#442: Different TimeStamp print formats
#457: File export functionality to LpBase
#362: Bidirectional iterator support for radixSort()
* Implementation improvements
----: Network Simplex
#391: Better update process, pivot rule and arc mixing
#435: Improved Altering List pivot rule
#417: Various fine tunings in CostScaling
#438: Optional iteration limit in HowardMmc
#436: Ensure strongly polynomial running time for CycleCanceling
while keeping the same performance
----: Make the CBC interface be compatible with latest CBC releases
[ee581a0ecfbf]
* CMAKE has become the default build environment (#434)
----: Autotool support has been dropped
----: Improved LP/MIP configuration
#465: Enable/disable options for LP/MIP backends
#446: Better CPLEX discovery
#460: Add cmake config to find SoPlex
----: Allow CPACK configuration on all platforms
#390: Add 'Maintainer' CMAKE build type
#388: Add 'check' target.
#401: Add contrib dir
#389: Better version string setting in CMAKE
#433: Support shared library build
#416: Support testing with valgrind
* Doc improvements
#395: SOURCE_BROWSER Doxygen switch is configurable from CMAKE
update-external-tags CMAKE target
#455: Optionally use MathJax for rendering the math formulae
#402, #437, #459, #456, #463: Various doc improvements
* Bugfixes (compared to release 1.2):
#432: Add missing doc/template.h and doc/references.bib to release
tarball
----: Intel C++ compatibility fixes
#441: Fix buggy reinitialization in _solver_bits::VarIndex::clear()
#444: Bugfix in path copy constructors and assignment operators
#447: Bugfix in AllArcLookUp<>
#448: Bugfix in adaptor_test.cc
#449: Fix clang compilation warnings and errors
#440: Fix a bug + remove redundant typedefs in dimacs-solver
#453: Avoid GCC 4.7 compiler warnings
#445: Fix missing initialization in CplexEnv::CplexEnv()
#428: Add missing lemon/lemon.pc.cmake to the release tarball
#393: Create and install lemon.pc
#429: Fix VS warnings
#430: Fix LpBase::Constr two-side limit bug
#392: Bug fix in Dfs::start(s,t)
#414: Fix wrong initialization in Preflow
#418: Better Win CodeBlock/MinGW support
#419: Build environment improvements
- Build of mip_test and lp_test precede the running of the tests
- Also search for coin libs under ${COIN_ROOT_DIR}/lib/coin
- Do not look for COIN_VOL libraries
#382: Allow lgf file without Arc maps
#417: Bug fix in CostScaling
#366: Fix Pred[Matrix]MapPath::empty()
#371: Bug fix in (di)graphCopy()
The target graph is cleared before adding nodes and arcs/edges.
#364: Add missing UndirectedTags
#368: Fix the usage of std::numeric_limits<>::min() in Network Simplex
#372: Fix a critical bug in preflow
#461: Bugfix in assert.h
#470: Fix compilation issues related to various gcc versions
#446: Fix #define indicating CPLEX availability
#294: Add explicit namespace to
ignore_unused_variable_warning() usages
#420: Bugfix in IterableValueMap
#439: Bugfix in biNodeConnected()
2010-03-19 Version 1.2 released
This is major feature release
* New algorithms
* Bellman-Ford algorithm (#51)
* Minimum mean cycle algorithms (#179)
* Karp, Hartman-Orlin and Howard algorithms
* New minimum cost flow algorithms (#180)
* Cost Scaling algorithms
* Capacity Scaling algorithm
* Cycle-Canceling algorithms
* Planarity related algorithms (#62)
* Planarity checking algorithm
* Planar embedding algorithm
* Schnyder's planar drawing algorithm
* Coloring planar graphs with five or six colors
* Fractional matching algorithms (#314)
* New data structures
* StaticDigraph structure (#68)
* Several new priority queue structures (#50, #301)
* Fibonacci, Radix, Bucket, Pairing, Binomial
D-ary and fourary heaps (#301)
* Iterable map structures (#73)
* Other new tools and functionality
* Map utility functions (#320)
* Reserve functions are added to ListGraph and SmartGraph (#311)
* A resize() function is added to HypercubeGraph (#311)
* A count() function is added to CrossRefMap (#302)
* Support for multiple targets in Suurballe using fullInit() (#181)
* Traits class and named parameters for Suurballe (#323)
* Separate reset() and resetParams() functions in NetworkSimplex
to handle graph changes (#327)
* tolerance() functions are added to HaoOrlin (#306)
* Implementation improvements
* Improvements in weighted matching algorithms (#314)
* Jumpstart initialization
* ArcIt iteration is based on out-arc lists instead of in-arc lists
in ListDigraph (#311)
* Faster add row operation in CbcMip (#203)
* Better implementation for split() in ListDigraph (#311)
* ArgParser can also throw exception instead of exit(1) (#332)
* Miscellaneous
* A simple interactive bootstrap script
* Doc improvements (#62,#180,#299,#302,#303,#304,#307,#311,#331,#315,
#316,#319)
* BibTeX references in the doc (#184)
* Optionally use valgrind when running tests
* Also check ReferenceMapTag in concept checks (#312)
* dimacs-solver uses long long type by default.
* Several bugfixes (compared to release 1.1):
#295: Suppress MSVC warnings using pragmas
----: Various CMAKE related improvements
* Remove duplications from doc/CMakeLists.txt
* Rename documentation install folder from 'docs' to 'html'
* Add tools/CMakeLists.txt to the tarball
* Generate and install LEMONConfig.cmake
* Change the label of the html project in Visual Studio
* Fix the check for the 'long long' type
* Put the version string into config.h
* Minor CMake improvements
* Set the version to 'hg-tip' if everything fails
#311: Add missing 'explicit' keywords
#302: Fix the implementation and doc of CrossRefMap
#308: Remove duplicate list_graph.h entry from source list
#307: Bugfix in Preflow and Circulation
#305: Bugfix and extension in the rename script
#312: Also check ReferenceMapTag in concept checks
#250: Bugfix in pathSource() and pathTarget()
#321: Use pathCopy(from,to) instead of copyPath(to,from)
#322: Distribure LEMONConfig.cmake.in
#330: Bug fix in map_extender.h
#336: Fix the date field comment of graphToEps() output
#323: Bug fix in Suurballe
#335: Fix clear() function in ExtendFindEnum
#337: Use void* as the LPX object pointer
#317: Fix (and improve) error message in mip_test.cc
Remove unnecessary OsiCbc dependency
#356: Allow multiple executions of weighted matching algorithms (#356)
2009-05-13 Version 1.1 released
This is the second stable release of the 1.x series. It
features a better coverage of the tools available in the 0.x
series, a thoroughly reworked LP/MIP interface plus various
improvements in the existing tools.
* Much improved M$ Windows support
* Various improvements in the CMAKE build system
* Compilation warnings are fixed/suppressed
* Support IBM xlC compiler
* New algorithms
* Connectivity related algorithms (#61)
* Euler walks (#65)
* Preflow push-relabel max. flow algorithm (#176)
* Circulation algorithm (push-relabel based) (#175)
* Suurballe algorithm (#47)
* Gomory-Hu algorithm (#66)
* Hao-Orlin algorithm (#58)
* Edmond's maximum cardinality and weighted matching algorithms
in general graphs (#48,#265)
* Minimum cost arborescence/branching (#60)
* Network Simplex min. cost flow algorithm (#234)
* New data structures
* Full graph structure (#57)
* Grid graph structure (#57)
* Hypercube graph structure (#57)
* Graph adaptors (#67)
* ArcSet and EdgeSet classes (#67)
* Elevator class (#174)
* Other new tools
* LP/MIP interface (#44)
* Support for GLPK, CPLEX, Soplex, COIN-OR CLP and CBC
* Reader for the Nauty file format (#55)
* DIMACS readers (#167)
* Radix sort algorithms (#72)
* RangeIdMap and CrossRefMap (#160)
* New command line tools
* DIMACS to LGF converter (#182)
* lgf-gen - a graph generator (#45)
* DIMACS solver utility (#226)
* Other code improvements
* Lognormal distribution added to Random (#102)
* Better (i.e. O(1) time) item counting in SmartGraph (#3)
* The standard maps of graphs are guaranteed to be
reference maps (#190)
* Miscellaneous
* Various doc improvements
* Improved 0.x -> 1.x converter script
* Several bugfixes (compared to release 1.0):
#170: Bugfix SmartDigraph::split()
#171: Bugfix in SmartGraph::restoreSnapshot()
#172: Extended test cases for graphs and digraphs
#173: Bugfix in Random
* operator()s always return a double now
* the faulty real<Num>(Num) and real<Num>(Num,Num)
have been removed
#187: Remove DijkstraWidestPathOperationTraits
#61: Bugfix in DfsVisit
#193: Bugfix in GraphReader::skipSection()
#195: Bugfix in ConEdgeIt()
#197: Bugfix in heap unionfind
* This bug affects Edmond's general matching algorithms
#207: Fix 'make install' without 'make html' using CMAKE
#208: Suppress or fix VS2008 compilation warnings
----: Update the LEMON icon
----: Enable the component-based installer
(in installers made by CPACK)
----: Set the proper version for CMAKE in the tarballs
(made by autotools)
----: Minor clarification in the LICENSE file
----: Add missing unistd.h include to time_measure.h
#204: Compilation bug fixed in graph_to_eps.h with VS2005
#214,#215: windows.h should never be included by LEMON headers
#230: Build systems check the availability of 'long long' type
#229: Default implementation of Tolerance<> is used for integer types
#211,#212: Various fixes for compiling on AIX
----: Improvements in CMAKE config
- docs is installed in share/doc/
- detects newer versions of Ghostscript
#239: Fix missing 'inline' specifier in time_measure.h
#274,#280: Install lemon/config.h
#275: Prefix macro names with LEMON_ in lemon/config.h
----: Small script for making the release tarballs added
----: Minor improvement in unify-sources.sh (a76f55d7d397)
2009-03-27 LEMON joins to the COIN-OR initiative
COIN-OR (Computational Infrastructure for Operations Research,
http://www.coin-or.org) project is an initiative to spur the
development of open-source software for the operations research
community.
2008-10-13 Version 1.0 released
This is the first stable release of LEMON. Compared to the 0.x
release series, it features a considerably smaller but more
matured set of tools. The API has also completely revised and
changed in several places.
* The major name changes compared to the 0.x series (see the
Migration Guide in the doc for more details)
* Graph -> Digraph, UGraph -> Graph
* Edge -> Arc, UEdge -> Edge
* source(UEdge)/target(UEdge) -> u(Edge)/v(Edge)
* Other improvements
* Better documentation
* Reviewed and cleaned up codebase
* CMake based build system (along with the autotools based one)
* Contents of the library (ported from 0.x)
* Algorithms
* breadth-first search (bfs.h)
* depth-first search (dfs.h)
* Dijkstra's algorithm (dijkstra.h)
* Kruskal's algorithm (kruskal.h)
* Data structures
* graph data structures (list_graph.h, smart_graph.h)
* path data structures (path.h)
* binary heap data structure (bin_heap.h)
* union-find data structures (unionfind.h)
* miscellaneous property maps (maps.h)
* two dimensional vector and bounding box (dim2.h)
* Concepts
* graph structure concepts (concepts/digraph.h, concepts/graph.h,
concepts/graph_components.h)
* concepts for other structures (concepts/heap.h, concepts/maps.h,
concepts/path.h)
* Tools
* Mersenne twister random number generator (random.h)
* tools for measuring cpu and wall clock time (time_measure.h)
* tools for counting steps and events (counter.h)
* tool for parsing command line arguments (arg_parser.h)
* tool for visualizing graphs (graph_to_eps.h)
* tools for reading and writing data in LEMON Graph Format
(lgf_reader.h, lgf_writer.h)
* tools to handle the anomalies of calculations with
floating point numbers (tolerance.h)
* tools to manage RGB colors (color.h)
* Infrastructure
* extended assertion handling (assert.h)
* exception classes and error handling (error.h)
* concept checking (concept_check.h)
* commonly used mathematical constants (math.h)

View File

@@ -0,0 +1,50 @@
=====================================================================
LEMON - a Library for Efficient Modeling and Optimization in Networks
=====================================================================
LEMON is an open source library written in C++. It provides
easy-to-use implementations of common data structures and algorithms
in the area of optimization and helps implementing new ones. The main
focus is on graphs and graph algorithms, thus it is especially
suitable for solving design and optimization problems of
telecommunication networks. To achieve wide usability its data
structures and algorithms provide generic interfaces.
Contents
========
LICENSE
Copying, distribution and modification conditions and terms.
NEWS
News and version history.
INSTALL
General building and installation instructions.
lemon/
Source code of LEMON library.
doc/
Documentation of LEMON. The starting page is doc/html/index.html.
demo/
Some example programs to make you easier to get familiar with LEMON.
scripts/
Scripts that make it easier to develop LEMON.
test/
Programs to check the integrity and correctness of LEMON.
tools/
Various utilities related to LEMON.

View File

@@ -0,0 +1,110 @@
SET(COIN_ROOT_DIR "" CACHE PATH "COIN root directory")
FIND_PATH(COIN_INCLUDE_DIR coin/CoinUtilsConfig.h
HINTS ${COIN_ROOT_DIR}/include
)
FIND_LIBRARY(COIN_CBC_LIBRARY
NAMES Cbc libCbc
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_CBC_SOLVER_LIBRARY
NAMES CbcSolver libCbcSolver
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_CGL_LIBRARY
NAMES Cgl libCgl
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_CLP_LIBRARY
NAMES Clp libClp
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_COIN_UTILS_LIBRARY
NAMES CoinUtils libCoinUtils
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_OSI_LIBRARY
NAMES Osi libOsi
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_OSI_CBC_LIBRARY
NAMES OsiCbc libOsiCbc
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_OSI_CLP_LIBRARY
NAMES OsiClp libOsiClp
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_OSI_VOL_LIBRARY
NAMES OsiVol libOsiVol
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_VOL_LIBRARY
NAMES Vol libVol
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_ZLIB_LIBRARY
NAMES z libz
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
FIND_LIBRARY(COIN_BZ2_LIBRARY
NAMES bz2 libbz2
HINTS ${COIN_ROOT_DIR}/lib/coin
HINTS ${COIN_ROOT_DIR}/lib
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(COIN DEFAULT_MSG
COIN_INCLUDE_DIR
COIN_CBC_LIBRARY
COIN_CBC_SOLVER_LIBRARY
COIN_CGL_LIBRARY
COIN_CLP_LIBRARY
COIN_COIN_UTILS_LIBRARY
COIN_OSI_LIBRARY
COIN_OSI_CBC_LIBRARY
COIN_OSI_CLP_LIBRARY
# COIN_OSI_VOL_LIBRARY
# COIN_VOL_LIBRARY
)
IF(COIN_FOUND)
SET(COIN_INCLUDE_DIRS ${COIN_INCLUDE_DIR})
SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARY};${COIN_COIN_UTILS_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY}")
IF(COIN_ZLIB_LIBRARY)
SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_ZLIB_LIBRARY}")
ENDIF(COIN_ZLIB_LIBRARY)
IF(COIN_BZ2_LIBRARY)
SET(COIN_CLP_LIBRARIES "${COIN_CLP_LIBRARIES};${COIN_BZ2_LIBRARY}")
ENDIF(COIN_BZ2_LIBRARY)
SET(COIN_CBC_LIBRARIES "${COIN_CBC_LIBRARY};${COIN_CBC_SOLVER_LIBRARY};${COIN_CGL_LIBRARY};${COIN_OSI_LIBRARY};${COIN_OSI_CBC_LIBRARY};${COIN_OSI_CLP_LIBRARY};${COIN_ZLIB_LIBRARY};${COIN_BZ2_LIBRARY};${COIN_CLP_LIBRARIES}")
SET(COIN_LIBRARIES ${COIN_CBC_LIBRARIES})
ENDIF(COIN_FOUND)
MARK_AS_ADVANCED(
COIN_INCLUDE_DIR
COIN_CBC_LIBRARY
COIN_CBC_SOLVER_LIBRARY
COIN_CGL_LIBRARY
COIN_CLP_LIBRARY
COIN_COIN_UTILS_LIBRARY
COIN_OSI_LIBRARY
COIN_OSI_CBC_LIBRARY
COIN_OSI_CLP_LIBRARY
COIN_OSI_VOL_LIBRARY
COIN_VOL_LIBRARY
COIN_ZLIB_LIBRARY
COIN_BZ2_LIBRARY
)

View File

@@ -0,0 +1,55 @@
SET(GLPK_ROOT_DIR "" CACHE PATH "GLPK root directory")
SET(GLPK_REGKEY "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Glpk;InstallPath]")
GET_FILENAME_COMPONENT(GLPK_ROOT_PATH ${GLPK_REGKEY} ABSOLUTE)
FIND_PATH(GLPK_INCLUDE_DIR
glpk.h
PATHS ${GLPK_REGKEY}/include
HINTS ${GLPK_ROOT_DIR}/include
)
FIND_LIBRARY(GLPK_LIBRARY
glpk
PATHS ${GLPK_REGKEY}/lib
HINTS ${GLPK_ROOT_DIR}/lib
)
IF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
FILE(READ ${GLPK_INCLUDE_DIR}/glpk.h GLPK_GLPK_H)
STRING(REGEX MATCH "define[ ]+GLP_MAJOR_VERSION[ ]+[0-9]+" GLPK_MAJOR_VERSION_LINE "${GLPK_GLPK_H}")
STRING(REGEX REPLACE "define[ ]+GLP_MAJOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MAJOR "${GLPK_MAJOR_VERSION_LINE}")
STRING(REGEX MATCH "define[ ]+GLP_MINOR_VERSION[ ]+[0-9]+" GLPK_MINOR_VERSION_LINE "${GLPK_GLPK_H}")
STRING(REGEX REPLACE "define[ ]+GLP_MINOR_VERSION[ ]+([0-9]+)" "\\1" GLPK_VERSION_MINOR "${GLPK_MINOR_VERSION_LINE}")
SET(GLPK_VERSION_STRING "${GLPK_VERSION_MAJOR}.${GLPK_VERSION_MINOR}")
IF(GLPK_FIND_VERSION)
IF(GLPK_FIND_VERSION_COUNT GREATER 2)
MESSAGE(SEND_ERROR "unexpected version string")
ENDIF(GLPK_FIND_VERSION_COUNT GREATER 2)
MATH(EXPR GLPK_REQUESTED_VERSION "${GLPK_FIND_VERSION_MAJOR}*100 + ${GLPK_FIND_VERSION_MINOR}")
MATH(EXPR GLPK_FOUND_VERSION "${GLPK_VERSION_MAJOR}*100 + ${GLPK_VERSION_MINOR}")
IF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
SET(GLPK_PROPER_VERSION_FOUND FALSE)
ELSE(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
SET(GLPK_PROPER_VERSION_FOUND TRUE)
ENDIF(GLPK_FOUND_VERSION LESS GLPK_REQUESTED_VERSION)
ELSE(GLPK_FIND_VERSION)
SET(GLPK_PROPER_VERSION_FOUND TRUE)
ENDIF(GLPK_FIND_VERSION)
ENDIF(GLPK_INCLUDE_DIR AND GLPK_LIBRARY)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLPK DEFAULT_MSG GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_PROPER_VERSION_FOUND)
IF(GLPK_FOUND)
SET(GLPK_INCLUDE_DIRS ${GLPK_INCLUDE_DIR})
SET(GLPK_LIBRARIES ${GLPK_LIBRARY})
SET(GLPK_BIN_DIR ${GLPK_ROOT_PATH}/bin)
ENDIF(GLPK_FOUND)
MARK_AS_ADVANCED(GLPK_LIBRARY GLPK_INCLUDE_DIR GLPK_BIN_DIR)

View File

@@ -0,0 +1,10 @@
INCLUDE(FindPackageHandleStandardArgs)
FIND_PROGRAM(GHOSTSCRIPT_EXECUTABLE
NAMES gs gswin32c
PATHS "$ENV{ProgramFiles}/gs"
PATH_SUFFIXES gs8.61/bin gs8.62/bin gs8.63/bin gs8.64/bin gs8.65/bin
DOC "Ghostscript: PostScript and PDF language interpreter and previewer."
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ghostscript DEFAULT_MSG GHOSTSCRIPT_EXECUTABLE)

View File

@@ -0,0 +1,102 @@
FIND_PATH(ILOG_ROOT_DIR
NAMES cplex
DOC "CPLEX STUDIO root directory"
PATHS /opt/ibm/ILOG /usr/local/ibm/ILOG /usr/local/ILOG /usr/local/ilog
PATHS "$ENV{HOME}/ILOG" "$ENV{HOME}/.local/ILOG"
PATHS "$ENV{HOME}/ibm/ILOG" "$ENV{HOME}/.local/ibm/ILOG"
PATHS "C:/Program Files/IBM/ILOG"
PATH_SUFFIXES "CPLEX_Studio126" "CPLEX_Studio125"
"CPLEX_Studio124" "CPLEX_Studio123" "CPLEX_Studio122"
NO_DEFAULT_PATH
)
IF(WIN32)
IF(MSVC_VERSION STREQUAL "1400")
SET(ILOG_WIN_COMPILER "windows_vs2005")
ELSEIF(MSVC_VERSION STREQUAL "1500")
SET(ILOG_WIN_COMPILER "windows_vs2008")
ELSEIF(MSVC_VERSION STREQUAL "1600")
SET(ILOG_WIN_COMPILER "windows_vs2010")
ELSE()
SET(ILOG_WIN_COMPILER "windows_vs2008")
ENDIF()
IF(CMAKE_CL_64)
SET(ILOG_WIN_COMPILER "x64_${ILOG_WIN_COMPILER}")
SET(ILOG_WIN_PLATFORM "x64_win32")
ELSE()
SET(ILOG_WIN_COMPILER "x86_${ILOG_WIN_COMPILER}")
SET(ILOG_WIN_PLATFORM "x86_win32")
ENDIF()
ENDIF()
FIND_PATH(ILOG_CPLEX_ROOT_DIR
NAMES include/ilcplex
HINTS ${ILOG_ROOT_DIR}/cplex ${ILOG_ROOT_DIR}/cplex121
${ILOG_ROOT_DIR}/cplex122 ${ILOG_ROOT_DIR}/cplex123
DOC "CPLEX root directory"
NO_DEFAULT_PATH
)
FIND_PATH(ILOG_CONCERT_ROOT_DIR
NAMES include/ilconcert
HINTS ${ILOG_ROOT_DIR}/concert ${ILOG_ROOT_DIR}/concert29
DOC "CONCERT root directory"
NO_DEFAULT_PATH
)
FIND_PATH(ILOG_CPLEX_INCLUDE_DIR
ilcplex/cplex.h
HINTS ${ILOG_CPLEX_ROOT_DIR}/include
NO_DEFAULT_PATH
)
FIND_PATH(ILOG_CONCERT_INCLUDE_DIR
ilconcert/ilobasic.h
HINTS ${ILOG_CONCERT_ROOT_DIR}/include
NO_DEFAULT_PATH
)
FIND_LIBRARY(ILOG_CPLEX_LIBRARY
cplex cplex121 cplex122 cplex123 cplex124
HINTS ${ILOG_CPLEX_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
${ILOG_CPLEX_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
${ILOG_CPLEX_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
${ILOG_CPLEX_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
NO_DEFAULT_PATH
)
FIND_LIBRARY(ILOG_CONCERT_LIBRARY
concert
HINTS ${ILOG_CONCERT_ROOT_DIR}/lib/x86_sles10_4.1/static_pic
${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_sles10_4.1/static_pic
${ILOG_CONCERT_ROOT_DIR}/lib/x86_debian4.0_4.1/static_pic
${ILOG_CONCERT_ROOT_DIR}/lib/x86-64_debian4.0_4.1/static_pic
${ILOG_CONCERT_ROOT_DIR}/lib/${ILOG_WIN_COMPILER}/stat_mda
NO_DEFAULT_PATH
)
FIND_FILE(ILOG_CPLEX_DLL
cplex121.dll cplex122.dll cplex123.dll cplex124.dll
HINTS ${ILOG_CPLEX_ROOT_DIR}/bin/${ILOG_WIN_PLATFORM}
NO_DEFAULT_PATH
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ILOG
DEFAULT_MSG ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR
)
IF(ILOG_FOUND)
SET(ILOG_INCLUDE_DIRS ${ILOG_CPLEX_INCLUDE_DIR} ${ILOG_CONCERT_INCLUDE_DIR})
SET(ILOG_LIBRARIES ${ILOG_CPLEX_LIBRARY} ${ILOG_CONCERT_LIBRARY})
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ENDIF(ILOG_FOUND)
MARK_AS_ADVANCED(
ILOG_CPLEX_LIBRARY ILOG_CPLEX_INCLUDE_DIR ILOG_CPLEX_DLL
ILOG_CONCERT_LIBRARY ILOG_CONCERT_INCLUDE_DIR ILOG_CONCERT_DLL
)

View File

@@ -0,0 +1,23 @@
SET(SOPLEX_ROOT_DIR "" CACHE PATH "SoPlex root directory")
FIND_PATH(SOPLEX_INCLUDE_DIR
soplex.h
HINTS ${SOPLEX_ROOT_DIR}/src
)
FIND_LIBRARY(SOPLEX_LIBRARY
soplex
HINTS ${SOPLEX_ROOT_DIR}/lib
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SOPLEX DEFAULT_MSG SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)
IF(SOPLEX_FOUND)
SET(SOPLEX_INCLUDE_DIRS ${SOPLEX_INCLUDE_DIR})
SET(SOPLEX_LIBRARIES ${SOPLEX_LIBRARY})
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(SOPLEX_LIBRARIES "${SOPLEX_LIBRARIES};z")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ENDIF(SOPLEX_FOUND)
MARK_AS_ADVANCED(SOPLEX_LIBRARY SOPLEX_INCLUDE_DIR)

View File

@@ -0,0 +1,13 @@
SET(LEMON_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" CACHE PATH "LEMON include directory")
SET(LEMON_INCLUDE_DIRS "${LEMON_INCLUDE_DIR}")
IF(UNIX)
SET(LEMON_LIB_NAME "libemon.a")
ELSEIF(WIN32)
SET(LEMON_LIB_NAME "lemon.lib")
ENDIF(UNIX)
SET(LEMON_LIBRARY "@CMAKE_INSTALL_PREFIX@/lib/${LEMON_LIB_NAME}" CACHE FILEPATH "LEMON library")
SET(LEMON_LIBRARIES "${LEMON_LIBRARY}")
MARK_AS_ADVANCED(LEMON_LIBRARY LEMON_INCLUDE_DIR)

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1 @@
SET(LEMON_VERSION "1.3.1" CACHE STRING "LEMON version string.")

View File

@@ -0,0 +1 @@
SET(LEMON_VERSION "@LEMON_VERSION@" CACHE STRING "LEMON version string.")

View File

@@ -0,0 +1,19 @@
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
)
LINK_DIRECTORIES(
${PROJECT_BINARY_DIR}/lemon
)
# Uncomment (and adjust) the following two lines. 'myprog' is the name
# of the final executable ('.exe' will automatically be added to the
# name on Windows) and 'myprog-main.cc' is the source code it is
# compiled from. You can add more source files separated by
# whitespaces. Moreover, you can add multiple similar blocks if you
# want to build more than one executables.
# ADD_EXECUTABLE(myprog myprog-main.cc)
# TARGET_LINK_LIBRARIES(myprog lemon)

View File

@@ -0,0 +1,19 @@
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
)
LINK_DIRECTORIES(
${PROJECT_BINARY_DIR}/lemon
)
SET(DEMOS
arg_parser_demo
graph_to_eps_demo
lgf_demo
)
FOREACH(DEMO_NAME ${DEMOS})
ADD_EXECUTABLE(${DEMO_NAME} ${DEMO_NAME}.cc)
TARGET_LINK_LIBRARIES(${DEMO_NAME} lemon)
ENDFOREACH()

View File

@@ -0,0 +1,112 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2010
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
///\ingroup demos
///\file
///\brief Argument parser demo
///
/// This example shows how the argument parser can be used.
///
/// \include arg_parser_demo.cc
#include <lemon/arg_parser.h>
using namespace lemon;
int main(int argc, char **argv)
{
// Initialize the argument parser
ArgParser ap(argc, argv);
int i;
std::string s;
double d = 1.0;
bool b, nh;
bool g1, g2, g3;
// Add a mandatory integer option with storage reference
ap.refOption("n", "An integer input.", i, true);
// Add a double option with storage reference (the default value is 1.0)
ap.refOption("val", "A double input.", d);
// Add a double option without storage reference (the default value is 3.14)
ap.doubleOption("val2", "A double input.", 3.14);
// Set synonym for -val option
ap.synonym("vals", "val");
// Add a string option
ap.refOption("name", "A string input.", s);
// Add bool options
ap.refOption("f", "A switch.", b)
.refOption("nohelp", "", nh)
.refOption("gra", "Choice A", g1)
.refOption("grb", "Choice B", g2)
.refOption("grc", "Choice C", g3);
// Bundle -gr* options into a group
ap.optionGroup("gr", "gra")
.optionGroup("gr", "grb")
.optionGroup("gr", "grc");
// Set the group mandatory
ap.mandatoryGroup("gr");
// Set the options of the group exclusive (only one option can be given)
ap.onlyOneGroup("gr");
// Add non-parsed arguments (e.g. input files)
ap.other("infile", "The input file.")
.other("...");
// Throw an exception when problems occurs. The default behavior is to
// exit(1) on these cases, but this makes Valgrind falsely warn
// about memory leaks.
ap.throwOnProblems();
// Perform the parsing process
// (in case of any error it terminates the program)
// The try {} construct is necessary only if the ap.trowOnProblems()
// setting is in use.
try {
ap.parse();
} catch (ArgParserException &) { return 1; }
// Check each option if it has been given and print its value
std::cout << "Parameters of '" << ap.commandName() << "':\n";
std::cout << " Value of -n: " << i << std::endl;
if(ap.given("val")) std::cout << " Value of -val: " << d << std::endl;
if(ap.given("val2")) {
d = ap["val2"];
std::cout << " Value of -val2: " << d << std::endl;
}
if(ap.given("name")) std::cout << " Value of -name: " << s << std::endl;
if(ap.given("f")) std::cout << " -f is given\n";
if(ap.given("nohelp")) std::cout << " Value of -nohelp: " << nh << std::endl;
if(ap.given("gra")) std::cout << " -gra is given\n";
if(ap.given("grb")) std::cout << " -grb is given\n";
if(ap.given("grc")) std::cout << " -grc is given\n";
switch(ap.files().size()) {
case 0:
std::cout << " No file argument was given.\n";
break;
case 1:
std::cout << " 1 file argument was given. It is:\n";
break;
default:
std::cout << " "
<< ap.files().size() << " file arguments were given. They are:\n";
}
for(unsigned int i=0;i<ap.files().size();++i)
std::cout << " '" << ap.files()[i] << "'\n";
return 0;
}

View File

@@ -0,0 +1,29 @@
@nodes
label
0
1
2
3
4
5
6
7
@arcs
label capacity
0 1 0 16
0 2 1 12
0 3 2 20
1 2 3 10
1 4 4 10
1 5 5 13
2 3 6 10
2 4 7 8
2 6 8 8
5 3 9 20
3 6 10 25
4 7 11 15
5 7 12 15
6 7 13 18
@attributes
source 0
target 7

View File

@@ -0,0 +1,206 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
/// \ingroup demos
/// \file
/// \brief Demo of the graph drawing function \ref graphToEps()
///
/// This demo program shows examples how to use the function \ref
/// graphToEps(). It takes no input but simply creates seven
/// <tt>.eps</tt> files demonstrating the capability of \ref
/// graphToEps(), and showing how to draw directed graphs,
/// how to handle parallel egdes, how to change the properties (like
/// color, shape, size, title etc.) of nodes and arcs individually
/// using appropriate graph maps.
///
/// \include graph_to_eps_demo.cc
#include<lemon/list_graph.h>
#include<lemon/graph_to_eps.h>
#include<lemon/math.h>
using namespace std;
using namespace lemon;
int main()
{
Palette palette;
Palette paletteW(true);
// Create a small digraph
ListDigraph g;
typedef ListDigraph::Node Node;
typedef ListDigraph::NodeIt NodeIt;
typedef ListDigraph::Arc Arc;
typedef dim2::Point<int> Point;
Node n1=g.addNode();
Node n2=g.addNode();
Node n3=g.addNode();
Node n4=g.addNode();
Node n5=g.addNode();
ListDigraph::NodeMap<Point> coords(g);
ListDigraph::NodeMap<double> sizes(g);
ListDigraph::NodeMap<int> colors(g);
ListDigraph::NodeMap<int> shapes(g);
ListDigraph::ArcMap<int> acolors(g);
ListDigraph::ArcMap<int> widths(g);
coords[n1]=Point(50,50); sizes[n1]=1; colors[n1]=1; shapes[n1]=0;
coords[n2]=Point(50,70); sizes[n2]=2; colors[n2]=2; shapes[n2]=2;
coords[n3]=Point(70,70); sizes[n3]=1; colors[n3]=3; shapes[n3]=0;
coords[n4]=Point(70,50); sizes[n4]=2; colors[n4]=4; shapes[n4]=1;
coords[n5]=Point(85,60); sizes[n5]=3; colors[n5]=5; shapes[n5]=2;
Arc a;
a=g.addArc(n1,n2); acolors[a]=0; widths[a]=1;
a=g.addArc(n2,n3); acolors[a]=0; widths[a]=1;
a=g.addArc(n3,n5); acolors[a]=0; widths[a]=3;
a=g.addArc(n5,n4); acolors[a]=0; widths[a]=1;
a=g.addArc(n4,n1); acolors[a]=0; widths[a]=1;
a=g.addArc(n2,n4); acolors[a]=1; widths[a]=2;
a=g.addArc(n3,n4); acolors[a]=2; widths[a]=1;
IdMap<ListDigraph,Node> id(g);
// Create .eps files showing the digraph with different options
cout << "Create 'graph_to_eps_demo_out_1_pure.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_1_pure.eps").
coords(coords).
title("Sample .eps figure").
copyright("(C) 2003-2009 LEMON Project").
run();
cout << "Create 'graph_to_eps_demo_out_2.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_2.eps").
coords(coords).
title("Sample .eps figure").
copyright("(C) 2003-2009 LEMON Project").
absoluteNodeSizes().absoluteArcWidths().
nodeScale(2).nodeSizes(sizes).
nodeShapes(shapes).
nodeColors(composeMap(palette,colors)).
arcColors(composeMap(palette,acolors)).
arcWidthScale(.4).arcWidths(widths).
nodeTexts(id).nodeTextSize(3).
run();
cout << "Create 'graph_to_eps_demo_out_3_arr.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_3_arr.eps").
title("Sample .eps figure (with arrowheads)").
copyright("(C) 2003-2009 LEMON Project").
absoluteNodeSizes().absoluteArcWidths().
nodeColors(composeMap(palette,colors)).
coords(coords).
nodeScale(2).nodeSizes(sizes).
nodeShapes(shapes).
arcColors(composeMap(palette,acolors)).
arcWidthScale(.4).arcWidths(widths).
nodeTexts(id).nodeTextSize(3).
drawArrows().arrowWidth(2).arrowLength(2).
run();
// Add more arcs to the digraph
a=g.addArc(n1,n4); acolors[a]=2; widths[a]=1;
a=g.addArc(n4,n1); acolors[a]=1; widths[a]=2;
a=g.addArc(n1,n2); acolors[a]=1; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=2; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=3; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=4; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=5; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=6; widths[a]=1;
a=g.addArc(n1,n2); acolors[a]=7; widths[a]=1;
cout << "Create 'graph_to_eps_demo_out_4_par.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_4_par.eps").
title("Sample .eps figure (parallel arcs)").
copyright("(C) 2003-2009 LEMON Project").
absoluteNodeSizes().absoluteArcWidths().
nodeShapes(shapes).
coords(coords).
nodeScale(2).nodeSizes(sizes).
nodeColors(composeMap(palette,colors)).
arcColors(composeMap(palette,acolors)).
arcWidthScale(.4).arcWidths(widths).
nodeTexts(id).nodeTextSize(3).
enableParallel().parArcDist(1.5).
run();
cout << "Create 'graph_to_eps_demo_out_5_par_arr.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_5_par_arr.eps").
title("Sample .eps figure (parallel arcs and arrowheads)").
copyright("(C) 2003-2009 LEMON Project").
absoluteNodeSizes().absoluteArcWidths().
nodeScale(2).nodeSizes(sizes).
coords(coords).
nodeShapes(shapes).
nodeColors(composeMap(palette,colors)).
arcColors(composeMap(palette,acolors)).
arcWidthScale(.3).arcWidths(widths).
nodeTexts(id).nodeTextSize(3).
enableParallel().parArcDist(1).
drawArrows().arrowWidth(1).arrowLength(1).
run();
cout << "Create 'graph_to_eps_demo_out_6_par_arr_a4.eps'" << endl;
graphToEps(g,"graph_to_eps_demo_out_6_par_arr_a4.eps").
title("Sample .eps figure (fits to A4)").
copyright("(C) 2003-2009 LEMON Project").
scaleToA4().
absoluteNodeSizes().absoluteArcWidths().
nodeScale(2).nodeSizes(sizes).
coords(coords).
nodeShapes(shapes).
nodeColors(composeMap(palette,colors)).
arcColors(composeMap(palette,acolors)).
arcWidthScale(.3).arcWidths(widths).
nodeTexts(id).nodeTextSize(3).
enableParallel().parArcDist(1).
drawArrows().arrowWidth(1).arrowLength(1).
run();
// Create an .eps file showing the colors of a default Palette
ListDigraph h;
ListDigraph::NodeMap<int> hcolors(h);
ListDigraph::NodeMap<Point> hcoords(h);
int cols=int(std::sqrt(double(palette.size())));
for(int i=0;i<int(paletteW.size());i++) {
Node n=h.addNode();
hcoords[n]=Point(1+i%cols,1+i/cols);
hcolors[n]=i;
}
cout << "Create 'graph_to_eps_demo_out_7_colors.eps'" << endl;
graphToEps(h,"graph_to_eps_demo_out_7_colors.eps").
scale(60).
title("Sample .eps figure (Palette demo)").
copyright("(C) 2003-2009 LEMON Project").
coords(hcoords).
absoluteNodeSizes().absoluteArcWidths().
nodeScale(.45).
distantColorNodeTexts().
nodeTexts(hcolors).nodeTextSize(.6).
nodeColors(composeMap(paletteW,hcolors)).
run();
return 0;
}

View File

@@ -0,0 +1,70 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
///\ingroup demos
///\file
///\brief Demonstrating graph input and output
///
/// This program gives an example of how to read and write a digraph
/// and additional maps from/to a stream or a file using the
/// \ref lgf-format "LGF" format.
///
/// The \c "digraph.lgf" file:
/// \include digraph.lgf
///
/// And the program which reads it and prints the digraph to the
/// standard output:
/// \include lgf_demo.cc
#include <iostream>
#include <lemon/smart_graph.h>
#include <lemon/lgf_reader.h>
#include <lemon/lgf_writer.h>
using namespace lemon;
int main() {
SmartDigraph g;
SmartDigraph::ArcMap<int> cap(g);
SmartDigraph::Node s, t;
try {
digraphReader(g, "digraph.lgf"). // read the directed graph into g
arcMap("capacity", cap). // read the 'capacity' arc map into cap
node("source", s). // read 'source' node to s
node("target", t). // read 'target' node to t
run();
} catch (Exception& error) { // check if there was any error
std::cerr << "Error: " << error.what() << std::endl;
return -1;
}
std::cout << "A digraph is read from 'digraph.lgf'." << std::endl;
std::cout << "Number of nodes: " << countNodes(g) << std::endl;
std::cout << "Number of arcs: " << countArcs(g) << std::endl;
std::cout << "We can write it to the standard output:" << std::endl;
digraphWriter(g). // write g to the standard output
arcMap("capacity", cap). // write cap into 'capacity'
node("source", s). // write s to 'source'
node("target", t). // write t to 'target'
run();
return 0;
}

View File

@@ -0,0 +1,91 @@
INCLUDE_DIRECTORIES(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/lemon.pc.in
${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
@ONLY
)
SET(LEMON_SOURCES
arg_parser.cc
base.cc
color.cc
lp_base.cc
lp_skeleton.cc
random.cc
bits/windows.cc
)
IF(LEMON_HAVE_GLPK)
SET(LEMON_SOURCES ${LEMON_SOURCES} glpk.cc)
INCLUDE_DIRECTORIES(${GLPK_INCLUDE_DIRS})
IF(WIN32)
INSTALL(FILES ${GLPK_BIN_DIR}/glpk.dll DESTINATION bin)
INSTALL(FILES ${GLPK_BIN_DIR}/libltdl3.dll DESTINATION bin)
INSTALL(FILES ${GLPK_BIN_DIR}/zlib1.dll DESTINATION bin)
ENDIF()
ENDIF()
IF(LEMON_HAVE_CPLEX)
SET(LEMON_SOURCES ${LEMON_SOURCES} cplex.cc)
INCLUDE_DIRECTORIES(${ILOG_INCLUDE_DIRS})
ENDIF()
IF(LEMON_HAVE_CLP)
SET(LEMON_SOURCES ${LEMON_SOURCES} clp.cc)
INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
ENDIF()
IF(LEMON_HAVE_CBC)
SET(LEMON_SOURCES ${LEMON_SOURCES} cbc.cc)
INCLUDE_DIRECTORIES(${COIN_INCLUDE_DIRS})
ENDIF()
IF(LEMON_HAVE_SOPLEX)
SET(LEMON_SOURCES ${LEMON_SOURCES} soplex.cc)
INCLUDE_DIRECTORIES(${SOPLEX_INCLUDE_DIRS})
ENDIF()
ADD_LIBRARY(lemon ${LEMON_SOURCES})
TARGET_LINK_LIBRARIES(lemon
${GLPK_LIBRARIES} ${COIN_LIBRARIES} ${ILOG_LIBRARIES} ${SOPLEX_LIBRARIES}
)
IF(UNIX)
SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon VERSION ${LEMON_VERSION} SOVERSION ${LEMON_VERSION})
ENDIF()
INSTALL(
TARGETS lemon
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library
)
INSTALL(
DIRECTORY . bits concepts
DESTINATION include/lemon
COMPONENT headers
FILES_MATCHING PATTERN "*.h"
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
DESTINATION include/lemon
COMPONENT headers
)
INSTALL(
FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
DESTINATION lib/pkgconfig
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,473 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2010
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#include <lemon/arg_parser.h>
namespace lemon {
void ArgParser::_terminate(ArgParserException::Reason reason) const
{
if(_exit_on_problems)
exit(1);
else throw(ArgParserException(reason));
}
void ArgParser::_showHelp(void *p)
{
(static_cast<ArgParser*>(p))->showHelp();
(static_cast<ArgParser*>(p))->_terminate(ArgParserException::HELP);
}
ArgParser::ArgParser(int argc, const char * const *argv)
:_argc(argc), _argv(argv), _command_name(argv[0]),
_exit_on_problems(true) {
funcOption("-help","Print a short help message",_showHelp,this);
synonym("help","-help");
synonym("h","-help");
}
ArgParser::~ArgParser()
{
for(Opts::iterator i=_opts.begin();i!=_opts.end();++i)
if(i->second.self_delete)
switch(i->second.type) {
case BOOL:
delete i->second.bool_p;
break;
case STRING:
delete i->second.string_p;
break;
case DOUBLE:
delete i->second.double_p;
break;
case INTEGER:
delete i->second.int_p;
break;
case UNKNOWN:
break;
case FUNC:
break;
}
}
ArgParser &ArgParser::intOption(const std::string &name,
const std::string &help,
int value, bool obl)
{
ParData p;
p.int_p=new int(value);
p.self_delete=true;
p.help=help;
p.type=INTEGER;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::doubleOption(const std::string &name,
const std::string &help,
double value, bool obl)
{
ParData p;
p.double_p=new double(value);
p.self_delete=true;
p.help=help;
p.type=DOUBLE;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::boolOption(const std::string &name,
const std::string &help,
bool value, bool obl)
{
ParData p;
p.bool_p=new bool(value);
p.self_delete=true;
p.help=help;
p.type=BOOL;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::stringOption(const std::string &name,
const std::string &help,
std::string value, bool obl)
{
ParData p;
p.string_p=new std::string(value);
p.self_delete=true;
p.help=help;
p.type=STRING;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::refOption(const std::string &name,
const std::string &help,
int &ref, bool obl)
{
ParData p;
p.int_p=&ref;
p.self_delete=false;
p.help=help;
p.type=INTEGER;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::refOption(const std::string &name,
const std::string &help,
double &ref, bool obl)
{
ParData p;
p.double_p=&ref;
p.self_delete=false;
p.help=help;
p.type=DOUBLE;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::refOption(const std::string &name,
const std::string &help,
bool &ref, bool obl)
{
ParData p;
p.bool_p=&ref;
p.self_delete=false;
p.help=help;
p.type=BOOL;
p.mandatory=obl;
_opts[name]=p;
ref = false;
return *this;
}
ArgParser &ArgParser::refOption(const std::string &name,
const std::string &help,
std::string &ref, bool obl)
{
ParData p;
p.string_p=&ref;
p.self_delete=false;
p.help=help;
p.type=STRING;
p.mandatory=obl;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::funcOption(const std::string &name,
const std::string &help,
void (*func)(void *),void *data)
{
ParData p;
p.func_p.p=func;
p.func_p.data=data;
p.self_delete=false;
p.help=help;
p.type=FUNC;
p.mandatory=false;
_opts[name]=p;
return *this;
}
ArgParser &ArgParser::optionGroup(const std::string &group,
const std::string &opt)
{
Opts::iterator i = _opts.find(opt);
LEMON_ASSERT(i!=_opts.end(), "Unknown option: '"+opt+"'");
LEMON_ASSERT(!(i->second.ingroup),
"Option already in option group: '"+opt+"'");
GroupData &g=_groups[group];
g.opts.push_back(opt);
i->second.ingroup=true;
return *this;
}
ArgParser &ArgParser::onlyOneGroup(const std::string &group)
{
GroupData &g=_groups[group];
g.only_one=true;
return *this;
}
ArgParser &ArgParser::synonym(const std::string &syn,
const std::string &opt)
{
Opts::iterator o = _opts.find(opt);
LEMON_ASSERT(o!=_opts.end(), "Unknown option: '"+opt+"'");
LEMON_ASSERT(_opts.find(syn)==_opts.end(), "Option already used: '"+syn+"'");
ParData p;
p.help=opt;
p.mandatory=false;
p.syn=true;
_opts[syn]=p;
o->second.has_syn=true;
return *this;
}
ArgParser &ArgParser::mandatoryGroup(const std::string &group)
{
GroupData &g=_groups[group];
g.mandatory=true;
return *this;
}
ArgParser &ArgParser::other(const std::string &name,
const std::string &help)
{
_others_help.push_back(OtherArg(name,help));
return *this;
}
void ArgParser::show(std::ostream &os,Opts::const_iterator i) const
{
os << "-" << i->first;
if(i->second.has_syn)
for(Opts::const_iterator j=_opts.begin();j!=_opts.end();++j)
if(j->second.syn&&j->second.help==i->first)
os << "|-" << j->first;
switch(i->second.type) {
case STRING:
os << " str";
break;
case INTEGER:
os << " int";
break;
case DOUBLE:
os << " num";
break;
default:
break;
}
}
void ArgParser::show(std::ostream &os,Groups::const_iterator i) const
{
GroupData::Opts::const_iterator o=i->second.opts.begin();
while(o!=i->second.opts.end()) {
show(os,_opts.find(*o));
++o;
if(o!=i->second.opts.end()) os<<'|';
}
}
void ArgParser::showHelp(Opts::const_iterator i) const
{
if(i->second.help.size()==0||i->second.syn) return;
std::cerr << " ";
show(std::cerr,i);
std::cerr << std::endl;
std::cerr << " " << i->second.help << std::endl;
}
void ArgParser::showHelp(std::vector<ArgParser::OtherArg>::const_iterator i)
const
{
if(i->help.size()==0) return;
std::cerr << " " << i->name << std::endl
<< " " << i->help << std::endl;
}
void ArgParser::shortHelp() const
{
const unsigned int LINE_LEN=77;
const std::string indent(" ");
std::cerr << "Usage:\n " << _command_name;
int pos=_command_name.size()+2;
for(Groups::const_iterator g=_groups.begin();g!=_groups.end();++g) {
std::ostringstream cstr;
cstr << ' ';
if(!g->second.mandatory) cstr << '[';
show(cstr,g);
if(!g->second.mandatory) cstr << ']';
if(pos+cstr.str().size()>LINE_LEN) {
std::cerr << std::endl << indent;
pos=indent.size();
}
std::cerr << cstr.str();
pos+=cstr.str().size();
}
for(Opts::const_iterator i=_opts.begin();i!=_opts.end();++i)
if(!i->second.ingroup&&!i->second.syn) {
std::ostringstream cstr;
cstr << ' ';
if(!i->second.mandatory) cstr << '[';
show(cstr,i);
if(!i->second.mandatory) cstr << ']';
if(pos+cstr.str().size()>LINE_LEN) {
std::cerr << std::endl << indent;
pos=indent.size();
}
std::cerr << cstr.str();
pos+=cstr.str().size();
}
for(std::vector<OtherArg>::const_iterator i=_others_help.begin();
i!=_others_help.end();++i)
{
std::ostringstream cstr;
cstr << ' ' << i->name;
if(pos+cstr.str().size()>LINE_LEN) {
std::cerr << std::endl << indent;
pos=indent.size();
}
std::cerr << cstr.str();
pos+=cstr.str().size();
}
std::cerr << std::endl;
}
void ArgParser::showHelp() const
{
shortHelp();
std::cerr << "Where:\n";
for(std::vector<OtherArg>::const_iterator i=_others_help.begin();
i!=_others_help.end();++i) showHelp(i);
for(Opts::const_iterator i=_opts.begin();i!=_opts.end();++i) showHelp(i);
_terminate(ArgParserException::HELP);
}
void ArgParser::unknownOpt(std::string arg) const
{
std::cerr << "\nUnknown option: " << arg << "\n";
std::cerr << "\nType '" << _command_name <<
" --help' to obtain a short summary on the usage.\n\n";
_terminate(ArgParserException::UNKNOWN_OPT);
}
void ArgParser::requiresValue(std::string arg, OptType t) const
{
std::cerr << "Argument '" << arg << "' requires a";
switch(t) {
case STRING:
std::cerr << " string";
break;
case INTEGER:
std::cerr << "n integer";
break;
case DOUBLE:
std::cerr << " floating point";
break;
default:
break;
}
std::cerr << " value\n\n";
showHelp();
}
void ArgParser::checkMandatories() const
{
bool ok=true;
for(Opts::const_iterator i=_opts.begin();i!=_opts.end();++i)
if(i->second.mandatory&&!i->second.set)
{
if(ok)
std::cerr << _command_name
<< ": The following mandatory arguments are missing.\n";
ok=false;
showHelp(i);
}
for(Groups::const_iterator i=_groups.begin();i!=_groups.end();++i)
if(i->second.mandatory||i->second.only_one)
{
int set=0;
for(GroupData::Opts::const_iterator o=i->second.opts.begin();
o!=i->second.opts.end();++o)
if(_opts.find(*o)->second.set) ++set;
if(i->second.mandatory&&!set) {
std::cerr << _command_name <<
": At least one of the following arguments is mandatory.\n";
ok=false;
for(GroupData::Opts::const_iterator o=i->second.opts.begin();
o!=i->second.opts.end();++o)
showHelp(_opts.find(*o));
}
if(i->second.only_one&&set>1) {
std::cerr << _command_name <<
": At most one of the following arguments can be given.\n";
ok=false;
for(GroupData::Opts::const_iterator o=i->second.opts.begin();
o!=i->second.opts.end();++o)
showHelp(_opts.find(*o));
}
}
if(!ok) {
std::cerr << "\nType '" << _command_name <<
" --help' to obtain a short summary on the usage.\n\n";
_terminate(ArgParserException::INVALID_OPT);
}
}
ArgParser &ArgParser::parse()
{
for(int ar=1; ar<_argc; ++ar) {
std::string arg(_argv[ar]);
if (arg[0] != '-' || arg.size() == 1) {
_file_args.push_back(arg);
}
else {
Opts::iterator i = _opts.find(arg.substr(1));
if(i==_opts.end()) unknownOpt(arg);
else {
if(i->second.syn) i=_opts.find(i->second.help);
ParData &p(i->second);
if (p.type==BOOL) *p.bool_p=true;
else if (p.type==FUNC) p.func_p.p(p.func_p.data);
else if(++ar==_argc) requiresValue(arg, p.type);
else {
std::string val(_argv[ar]);
std::istringstream vals(val);
switch(p.type) {
case STRING:
*p.string_p=val;
break;
case INTEGER:
vals >> *p.int_p;
break;
case DOUBLE:
vals >> *p.double_p;
break;
default:
break;
}
if(p.type!=STRING&&(!vals||!vals.eof()))
requiresValue(arg, p.type);
}
p.set = true;
}
}
}
checkMandatories();
return *this;
}
}

View File

@@ -0,0 +1,440 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2010
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_ARG_PARSER_H
#define LEMON_ARG_PARSER_H
#include <vector>
#include <map>
#include <list>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <lemon/assert.h>
///\ingroup misc
///\file
///\brief A tool to parse command line arguments.
namespace lemon {
///Exception used by ArgParser
///Exception used by ArgParser.
///
class ArgParserException : public Exception {
public:
/// Reasons for failure
/// Reasons for failure.
///
enum Reason {
HELP, ///< <tt>--help</tt> option was given.
UNKNOWN_OPT, ///< Unknown option was given.
INVALID_OPT ///< Invalid combination of options.
};
private:
Reason _reason;
public:
///Constructor
ArgParserException(Reason r) throw() : _reason(r) {}
///Virtual destructor
virtual ~ArgParserException() throw() {}
///A short description of the exception
virtual const char* what() const throw() {
switch(_reason)
{
case HELP:
return "lemon::ArgParseException: ask for help";
break;
case UNKNOWN_OPT:
return "lemon::ArgParseException: unknown option";
break;
case INVALID_OPT:
return "lemon::ArgParseException: invalid combination of options";
break;
}
return "";
}
///Return the reason for the failure
Reason reason() const {return _reason; }
};
///Command line arguments parser
///\ingroup misc
///Command line arguments parser.
///
///For a complete example see the \ref arg_parser_demo.cc demo file.
class ArgParser {
static void _showHelp(void *p);
protected:
int _argc;
const char * const *_argv;
enum OptType { UNKNOWN=0, BOOL=1, STRING=2, DOUBLE=3, INTEGER=4, FUNC=5 };
class ParData {
public:
union {
bool *bool_p;
int *int_p;
double *double_p;
std::string *string_p;
struct {
void (*p)(void *);
void *data;
} func_p;
};
std::string help;
bool mandatory;
OptType type;
bool set;
bool ingroup;
bool has_syn;
bool syn;
bool self_delete;
ParData() : mandatory(false), type(UNKNOWN), set(false), ingroup(false),
has_syn(false), syn(false), self_delete(false) {}
};
typedef std::map<std::string,ParData> Opts;
Opts _opts;
class GroupData
{
public:
typedef std::list<std::string> Opts;
Opts opts;
bool only_one;
bool mandatory;
GroupData() :only_one(false), mandatory(false) {}
};
typedef std::map<std::string,GroupData> Groups;
Groups _groups;
struct OtherArg
{
std::string name;
std::string help;
OtherArg(std::string n, std::string h) :name(n), help(h) {}
};
std::vector<OtherArg> _others_help;
std::vector<std::string> _file_args;
std::string _command_name;
private:
//Bind a function to an option.
//\param name The name of the option. The leading '-' must be omitted.
//\param help A help string.
//\retval func The function to be called when the option is given. It
// must be of type "void f(void *)"
//\param data Data to be passed to \c func
ArgParser &funcOption(const std::string &name,
const std::string &help,
void (*func)(void *),void *data);
bool _exit_on_problems;
void _terminate(ArgParserException::Reason reason) const;
public:
///Constructor
ArgParser(int argc, const char * const *argv);
~ArgParser();
///\name Options
///
///@{
///Add a new integer type option
///Add a new integer type option.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param value A default value for the option.
///\param obl Indicate if the option is mandatory.
ArgParser &intOption(const std::string &name,
const std::string &help,
int value=0, bool obl=false);
///Add a new floating point type option
///Add a new floating point type option.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param value A default value for the option.
///\param obl Indicate if the option is mandatory.
ArgParser &doubleOption(const std::string &name,
const std::string &help,
double value=0, bool obl=false);
///Add a new bool type option
///Add a new bool type option.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param value A default value for the option.
///\param obl Indicate if the option is mandatory.
///\note A mandatory bool obtion is of very little use.
ArgParser &boolOption(const std::string &name,
const std::string &help,
bool value=false, bool obl=false);
///Add a new string type option
///Add a new string type option.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param value A default value for the option.
///\param obl Indicate if the option is mandatory.
ArgParser &stringOption(const std::string &name,
const std::string &help,
std::string value="", bool obl=false);
///Give help string for non-parsed arguments.
///With this function you can give help string for non-parsed arguments.
///The parameter \c name will be printed in the short usage line, while
///\c help gives a more detailed description.
ArgParser &other(const std::string &name,
const std::string &help="");
///@}
///\name Options with External Storage
///Using this functions, the value of the option will be directly written
///into a variable once the option appears in the command line.
///@{
///Add a new integer type option with a storage reference
///Add a new integer type option with a storage reference.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param obl Indicate if the option is mandatory.
///\retval ref The value of the argument will be written to this variable.
ArgParser &refOption(const std::string &name,
const std::string &help,
int &ref, bool obl=false);
///Add a new floating type option with a storage reference
///Add a new floating type option with a storage reference.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param obl Indicate if the option is mandatory.
///\retval ref The value of the argument will be written to this variable.
ArgParser &refOption(const std::string &name,
const std::string &help,
double &ref, bool obl=false);
///Add a new bool type option with a storage reference
///Add a new bool type option with a storage reference.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param obl Indicate if the option is mandatory.
///\retval ref The value of the argument will be written to this variable.
///\note A mandatory bool obtion is of very little use.
ArgParser &refOption(const std::string &name,
const std::string &help,
bool &ref, bool obl=false);
///Add a new string type option with a storage reference
///Add a new string type option with a storage reference.
///\param name The name of the option. The leading '-' must be omitted.
///\param help A help string.
///\param obl Indicate if the option is mandatory.
///\retval ref The value of the argument will be written to this variable.
ArgParser &refOption(const std::string &name,
const std::string &help,
std::string &ref, bool obl=false);
///@}
///\name Option Groups and Synonyms
///
///@{
///Bundle some options into a group
/// You can group some option by calling this function repeatedly for each
/// option to be grouped with the same groupname.
///\param group The group name.
///\param opt The option name.
ArgParser &optionGroup(const std::string &group,
const std::string &opt);
///Make the members of a group exclusive
///If you call this function for a group, than at most one of them can be
///given at the same time.
ArgParser &onlyOneGroup(const std::string &group);
///Make a group mandatory
///Using this function, at least one of the members of \c group
///must be given.
ArgParser &mandatoryGroup(const std::string &group);
///Create synonym to an option
///With this function you can create a synonym \c syn of the
///option \c opt.
ArgParser &synonym(const std::string &syn,
const std::string &opt);
///@}
private:
void show(std::ostream &os,Opts::const_iterator i) const;
void show(std::ostream &os,Groups::const_iterator i) const;
void showHelp(Opts::const_iterator i) const;
void showHelp(std::vector<OtherArg>::const_iterator i) const;
void unknownOpt(std::string arg) const;
void requiresValue(std::string arg, OptType t) const;
void checkMandatories() const;
void shortHelp() const;
void showHelp() const;
public:
///Start the parsing process
ArgParser &parse();
/// Synonym for parse()
ArgParser &run()
{
return parse();
}
///Give back the command name (the 0th argument)
const std::string &commandName() const { return _command_name; }
///Check if an opion has been given to the command.
bool given(std::string op) const
{
Opts::const_iterator i = _opts.find(op);
return i!=_opts.end()?i->second.set:false;
}
///Magic type for operator[]
///This is the type of the return value of ArgParser::operator[]().
///It automatically converts to \c int, \c double, \c bool or
///\c std::string if the type of the option matches, which is checked
///with an \ref LEMON_ASSERT "assertion" (i.e. it performs runtime
///type checking).
class RefType
{
const ArgParser &_parser;
std::string _name;
public:
///\e
RefType(const ArgParser &p,const std::string &n) :_parser(p),_name(n) {}
///\e
operator bool()
{
Opts::const_iterator i = _parser._opts.find(_name);
LEMON_ASSERT(i!=_parser._opts.end(),
std::string()+"Unkown option: '"+_name+"'");
LEMON_ASSERT(i->second.type==ArgParser::BOOL,
std::string()+"'"+_name+"' is a bool option");
return *(i->second.bool_p);
}
///\e
operator std::string()
{
Opts::const_iterator i = _parser._opts.find(_name);
LEMON_ASSERT(i!=_parser._opts.end(),
std::string()+"Unkown option: '"+_name+"'");
LEMON_ASSERT(i->second.type==ArgParser::STRING,
std::string()+"'"+_name+"' is a string option");
return *(i->second.string_p);
}
///\e
operator double()
{
Opts::const_iterator i = _parser._opts.find(_name);
LEMON_ASSERT(i!=_parser._opts.end(),
std::string()+"Unkown option: '"+_name+"'");
LEMON_ASSERT(i->second.type==ArgParser::DOUBLE ||
i->second.type==ArgParser::INTEGER,
std::string()+"'"+_name+"' is a floating point option");
return i->second.type==ArgParser::DOUBLE ?
*(i->second.double_p) : *(i->second.int_p);
}
///\e
operator int()
{
Opts::const_iterator i = _parser._opts.find(_name);
LEMON_ASSERT(i!=_parser._opts.end(),
std::string()+"Unkown option: '"+_name+"'");
LEMON_ASSERT(i->second.type==ArgParser::INTEGER,
std::string()+"'"+_name+"' is an integer option");
return *(i->second.int_p);
}
};
///Give back the value of an option
///Give back the value of an option.
///\sa RefType
RefType operator[](const std::string &n) const
{
return RefType(*this, n);
}
///Give back the non-option type arguments.
///Give back a reference to a vector consisting of the program arguments
///not starting with a '-' character.
const std::vector<std::string> &files() const { return _file_args; }
///Throw instead of exit in case of problems
void throwOnProblems()
{
_exit_on_problems=false;
}
};
}
#endif // LEMON_ARG_PARSER_H

View File

@@ -0,0 +1,214 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_ASSERT_H
#define LEMON_ASSERT_H
/// \ingroup exceptions
/// \file
/// \brief Extended assertion handling
#include <lemon/error.h>
namespace lemon {
inline void assert_fail_abort(const char *file, int line,
const char *function, const char* message,
const char *assertion)
{
std::cerr << file << ":" << line << ": ";
if (function)
std::cerr << function << ": ";
std::cerr << message;
if (assertion)
std::cerr << " (assertion '" << assertion << "' failed)";
std::cerr << std::endl;
std::abort();
}
namespace _assert_bits {
inline const char* cstringify(const std::string& str) {
return str.c_str();
}
inline const char* cstringify(const char* str) {
return str;
}
}
}
#endif // LEMON_ASSERT_H
#undef LEMON_ASSERT
#undef LEMON_DEBUG
#if (defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \
(defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) > 1
#error "LEMON assertion system is not set properly"
#endif
#if ((defined(LEMON_ASSERT_ABORT) ? 1 : 0) + \
(defined(LEMON_ASSERT_CUSTOM) ? 1 : 0) == 1 || \
defined(LEMON_ENABLE_ASSERTS)) && \
(defined(LEMON_DISABLE_ASSERTS) || \
defined(NDEBUG))
#error "LEMON assertion system is not set properly"
#endif
#if defined LEMON_ASSERT_ABORT
# undef LEMON_ASSERT_HANDLER
# define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
#elif defined LEMON_ASSERT_CUSTOM
# undef LEMON_ASSERT_HANDLER
# ifndef LEMON_CUSTOM_ASSERT_HANDLER
# error "LEMON_CUSTOM_ASSERT_HANDLER is not set"
# endif
# define LEMON_ASSERT_HANDLER LEMON_CUSTOM_ASSERT_HANDLER
#elif defined LEMON_DISABLE_ASSERTS
# undef LEMON_ASSERT_HANDLER
#elif defined NDEBUG
# undef LEMON_ASSERT_HANDLER
#else
# define LEMON_ASSERT_HANDLER ::lemon::assert_fail_abort
#endif
#ifndef LEMON_FUNCTION_NAME
# if defined __GNUC__
# define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__)
# elif defined _MSC_VER
# define LEMON_FUNCTION_NAME (__FUNCSIG__)
# elif __STDC_VERSION__ >= 199901L
# define LEMON_FUNCTION_NAME (__func__)
# else
# define LEMON_FUNCTION_NAME ("<unknown>")
# endif
#endif
#ifdef DOXYGEN
/// \ingroup exceptions
///
/// \brief Macro for assertion with customizable message
///
/// Macro for assertion with customizable message.
/// \param exp An expression that must be convertible to \c bool. If it is \c
/// false, then an assertion is raised. The concrete behaviour depends on the
/// settings of the assertion system.
/// \param msg A <tt>const char*</tt> parameter, which can be used to provide
/// information about the circumstances of the failed assertion.
///
/// The assertions are enabled in the default behaviour.
/// You can disable them with the following code:
/// \code
/// #define LEMON_DISABLE_ASSERTS
/// \endcode
/// or with compilation parameters:
/// \code
/// g++ -DLEMON_DISABLE_ASSERTS
/// make CXXFLAGS='-DLEMON_DISABLE_ASSERTS'
/// \endcode
/// The checking is also disabled when the standard macro \c NDEBUG is defined.
///
/// As a default behaviour the failed assertion prints a short log message to
/// the standard error and aborts the execution.
///
/// However, the following modes can be used in the assertion system:
/// - \c LEMON_ASSERT_ABORT The failed assertion prints a short log message to
/// the standard error and aborts the program. It is the default behaviour.
/// - \c LEMON_ASSERT_CUSTOM The user can define own assertion handler
/// function.
/// \code
/// void custom_assert_handler(const char* file, int line,
/// const char* function, const char* message,
/// const char* assertion);
/// \endcode
/// The name of the function should be defined as the \c
/// LEMON_CUSTOM_ASSERT_HANDLER macro name.
/// \code
/// #define LEMON_CUSTOM_ASSERT_HANDLER custom_assert_handler
/// \endcode
/// Whenever an assertion is occured, the custom assertion
/// handler is called with appropiate parameters.
///
/// The assertion mode can also be changed within one compilation unit.
/// If the macros are redefined with other settings and the
/// \ref lemon/assert.h "assert.h" file is reincluded, then the
/// behaviour is changed appropiately to the new settings.
# define LEMON_ASSERT(exp, msg) \
(static_cast<void> (!!(exp) ? 0 : ( \
LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
LEMON_FUNCTION_NAME, \
::lemon::_assert_bits::cstringify(msg), #exp), 0)))
/// \ingroup exceptions
///
/// \brief Macro for internal assertions
///
/// Macro for internal assertions, it is used in the library to check
/// the consistency of results of algorithms, several pre- and
/// postconditions and invariants. The checking is disabled by
/// default, but it can be turned on with the macro \c
/// LEMON_ENABLE_DEBUG.
/// \code
/// #define LEMON_ENABLE_DEBUG
/// \endcode
/// or with compilation parameters:
/// \code
/// g++ -DLEMON_ENABLE_DEBUG
/// make CXXFLAGS='-DLEMON_ENABLE_DEBUG'
/// \endcode
///
/// This macro works like the \c LEMON_ASSERT macro, therefore the
/// current behaviour depends on the settings of \c LEMON_ASSERT
/// macro.
///
/// \see LEMON_ASSERT
# define LEMON_DEBUG(exp, msg) \
(static_cast<void> (!!(exp) ? 0 : ( \
LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
LEMON_FUNCTION_NAME, \
::lemon::_assert_bits::cstringify(msg), #exp), 0)))
#else
# ifndef LEMON_ASSERT_HANDLER
# define LEMON_ASSERT(exp, msg) (static_cast<void>(0))
# define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
# else
# define LEMON_ASSERT(exp, msg) \
(static_cast<void> (!!(exp) ? 0 : ( \
LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
LEMON_FUNCTION_NAME, \
::lemon::_assert_bits::cstringify(msg), \
#exp), 0)))
# if defined LEMON_ENABLE_DEBUG
# define LEMON_DEBUG(exp, msg) \
(static_cast<void> (!!(exp) ? 0 : ( \
LEMON_ASSERT_HANDLER(__FILE__, __LINE__, \
LEMON_FUNCTION_NAME, \
::lemon::_assert_bits::cstringify(msg), \
#exp), 0)))
# else
# define LEMON_DEBUG(exp, msg) (static_cast<void>(0))
# endif
# endif
#endif

View File

@@ -0,0 +1,37 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
///\file
///\brief Some basic non-inline functions and static global data.
#include<lemon/tolerance.h>
#include<lemon/core.h>
#include<lemon/time_measure.h>
namespace lemon {
float Tolerance<float>::def_epsilon = static_cast<float>(1e-4);
double Tolerance<double>::def_epsilon = 1e-10;
long double Tolerance<long double>::def_epsilon = 1e-14;
#ifndef LEMON_ONLY_TEMPLATES
const Invalid INVALID = Invalid();
#endif
TimeStamp::Format TimeStamp::_format = TimeStamp::NORMAL;
} //namespace lemon

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,347 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BIN_HEAP_H
#define LEMON_BIN_HEAP_H
///\ingroup heaps
///\file
///\brief Binary heap implementation.
#include <vector>
#include <utility>
#include <functional>
namespace lemon {
/// \ingroup heaps
///
/// \brief Binary heap data structure.
///
/// This class implements the \e binary \e heap data structure.
/// It fully conforms to the \ref concepts::Heap "heap concept".
///
/// \tparam PR Type of the priorities of the items.
/// \tparam IM A read-writable item map with \c int values, used
/// internally to handle the cross references.
/// \tparam CMP A functor class for comparing the priorities.
/// The default is \c std::less<PR>.
#ifdef DOXYGEN
template <typename PR, typename IM, typename CMP>
#else
template <typename PR, typename IM, typename CMP = std::less<PR> >
#endif
class BinHeap {
public:
/// Type of the item-int map.
typedef IM ItemIntMap;
/// Type of the priorities.
typedef PR Prio;
/// Type of the items stored in the heap.
typedef typename ItemIntMap::Key Item;
/// Type of the item-priority pairs.
typedef std::pair<Item,Prio> Pair;
/// Functor type for comparing the priorities.
typedef CMP Compare;
/// \brief Type to represent the states of the items.
///
/// Each item has a state associated to it. It can be "in heap",
/// "pre-heap" or "post-heap". The latter two are indifferent from the
/// heap's point of view, but may be useful to the user.
///
/// The item-int map must be initialized in such way that it assigns
/// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
enum State {
IN_HEAP = 0, ///< = 0.
PRE_HEAP = -1, ///< = -1.
POST_HEAP = -2 ///< = -2.
};
private:
std::vector<Pair> _data;
Compare _comp;
ItemIntMap &_iim;
public:
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
explicit BinHeap(ItemIntMap &map) : _iim(map) {}
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
/// \param comp The function object used for comparing the priorities.
BinHeap(ItemIntMap &map, const Compare &comp)
: _iim(map), _comp(comp) {}
/// \brief The number of items stored in the heap.
///
/// This function returns the number of items stored in the heap.
int size() const { return _data.size(); }
/// \brief Check if the heap is empty.
///
/// This function returns \c true if the heap is empty.
bool empty() const { return _data.empty(); }
/// \brief Make the heap empty.
///
/// This functon makes the heap empty.
/// It does not change the cross reference map. If you want to reuse
/// a heap that is not surely empty, you should first clear it and
/// then you should set the cross reference map to \c PRE_HEAP
/// for each item.
void clear() {
_data.clear();
}
private:
static int parent(int i) { return (i-1)/2; }
static int secondChild(int i) { return 2*i+2; }
bool less(const Pair &p1, const Pair &p2) const {
return _comp(p1.second, p2.second);
}
int bubbleUp(int hole, Pair p) {
int par = parent(hole);
while( hole>0 && less(p,_data[par]) ) {
move(_data[par],hole);
hole = par;
par = parent(hole);
}
move(p, hole);
return hole;
}
int bubbleDown(int hole, Pair p, int length) {
int child = secondChild(hole);
while(child < length) {
if( less(_data[child-1], _data[child]) ) {
--child;
}
if( !less(_data[child], p) )
goto ok;
move(_data[child], hole);
hole = child;
child = secondChild(hole);
}
child--;
if( child<length && less(_data[child], p) ) {
move(_data[child], hole);
hole=child;
}
ok:
move(p, hole);
return hole;
}
void move(const Pair &p, int i) {
_data[i] = p;
_iim.set(p.first, i);
}
public:
/// \brief Insert a pair of item and priority into the heap.
///
/// This function inserts \c p.first to the heap with priority
/// \c p.second.
/// \param p The pair to insert.
/// \pre \c p.first must not be stored in the heap.
void push(const Pair &p) {
int n = _data.size();
_data.resize(n+1);
bubbleUp(n, p);
}
/// \brief Insert an item into the heap with the given priority.
///
/// This function inserts the given item into the heap with the
/// given priority.
/// \param i The item to insert.
/// \param p The priority of the item.
/// \pre \e i must not be stored in the heap.
void push(const Item &i, const Prio &p) { push(Pair(i,p)); }
/// \brief Return the item having minimum priority.
///
/// This function returns the item having minimum priority.
/// \pre The heap must be non-empty.
Item top() const {
return _data[0].first;
}
/// \brief The minimum priority.
///
/// This function returns the minimum priority.
/// \pre The heap must be non-empty.
Prio prio() const {
return _data[0].second;
}
/// \brief Remove the item having minimum priority.
///
/// This function removes the item having minimum priority.
/// \pre The heap must be non-empty.
void pop() {
int n = _data.size()-1;
_iim.set(_data[0].first, POST_HEAP);
if (n > 0) {
bubbleDown(0, _data[n], n);
}
_data.pop_back();
}
/// \brief Remove the given item from the heap.
///
/// This function removes the given item from the heap if it is
/// already stored.
/// \param i The item to delete.
/// \pre \e i must be in the heap.
void erase(const Item &i) {
int h = _iim[i];
int n = _data.size()-1;
_iim.set(_data[h].first, POST_HEAP);
if( h < n ) {
if ( bubbleUp(h, _data[n]) == h) {
bubbleDown(h, _data[n], n);
}
}
_data.pop_back();
}
/// \brief The priority of the given item.
///
/// This function returns the priority of the given item.
/// \param i The item.
/// \pre \e i must be in the heap.
Prio operator[](const Item &i) const {
int idx = _iim[i];
return _data[idx].second;
}
/// \brief Set the priority of an item or insert it, if it is
/// not stored in the heap.
///
/// This method sets the priority of the given item if it is
/// already stored in the heap. Otherwise it inserts the given
/// item into the heap with the given priority.
/// \param i The item.
/// \param p The priority.
void set(const Item &i, const Prio &p) {
int idx = _iim[i];
if( idx < 0 ) {
push(i,p);
}
else if( _comp(p, _data[idx].second) ) {
bubbleUp(idx, Pair(i,p));
}
else {
bubbleDown(idx, Pair(i,p), _data.size());
}
}
/// \brief Decrease the priority of an item to the given value.
///
/// This function decreases the priority of an item to the given value.
/// \param i The item.
/// \param p The priority.
/// \pre \e i must be stored in the heap with priority at least \e p.
void decrease(const Item &i, const Prio &p) {
int idx = _iim[i];
bubbleUp(idx, Pair(i,p));
}
/// \brief Increase the priority of an item to the given value.
///
/// This function increases the priority of an item to the given value.
/// \param i The item.
/// \param p The priority.
/// \pre \e i must be stored in the heap with priority at most \e p.
void increase(const Item &i, const Prio &p) {
int idx = _iim[i];
bubbleDown(idx, Pair(i,p), _data.size());
}
/// \brief Return the state of an item.
///
/// This method returns \c PRE_HEAP if the given item has never
/// been in the heap, \c IN_HEAP if it is in the heap at the moment,
/// and \c POST_HEAP otherwise.
/// In the latter case it is possible that the item will get back
/// to the heap again.
/// \param i The item.
State state(const Item &i) const {
int s = _iim[i];
if( s>=0 )
s=0;
return State(s);
}
/// \brief Set the state of an item in the heap.
///
/// This function sets the state of the given item in the heap.
/// It can be used to manually clear the heap when it is important
/// to achive better time complexity.
/// \param i The item.
/// \param st The state. It should not be \c IN_HEAP.
void state(const Item& i, State st) {
switch (st) {
case POST_HEAP:
case PRE_HEAP:
if (state(i) == IN_HEAP) {
erase(i);
}
_iim[i] = st;
break;
case IN_HEAP:
break;
}
}
/// \brief Replace an item in the heap.
///
/// This function replaces item \c i with item \c j.
/// Item \c i must be in the heap, while \c j must be out of the heap.
/// After calling this method, item \c i will be out of the
/// heap and \c j will be in the heap with the same prioriority
/// as item \c i had before.
void replace(const Item& i, const Item& j) {
int idx = _iim[i];
_iim.set(i, _iim[j]);
_iim.set(j, idx);
_data[idx].first = j;
}
}; // class BinHeap
} // namespace lemon
#endif // LEMON_BIN_HEAP_H

View File

@@ -0,0 +1,445 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2010
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BINOMIAL_HEAP_H
#define LEMON_BINOMIAL_HEAP_H
///\file
///\ingroup heaps
///\brief Binomial Heap implementation.
#include <vector>
#include <utility>
#include <functional>
#include <lemon/math.h>
#include <lemon/counter.h>
namespace lemon {
/// \ingroup heaps
///
///\brief Binomial heap data structure.
///
/// This class implements the \e binomial \e heap data structure.
/// It fully conforms to the \ref concepts::Heap "heap concept".
///
/// The methods \ref increase() and \ref erase() are not efficient
/// in a binomial heap. In case of many calls of these operations,
/// it is better to use other heap structure, e.g. \ref BinHeap
/// "binary heap".
///
/// \tparam PR Type of the priorities of the items.
/// \tparam IM A read-writable item map with \c int values, used
/// internally to handle the cross references.
/// \tparam CMP A functor class for comparing the priorities.
/// The default is \c std::less<PR>.
#ifdef DOXYGEN
template <typename PR, typename IM, typename CMP>
#else
template <typename PR, typename IM, typename CMP = std::less<PR> >
#endif
class BinomialHeap {
public:
/// Type of the item-int map.
typedef IM ItemIntMap;
/// Type of the priorities.
typedef PR Prio;
/// Type of the items stored in the heap.
typedef typename ItemIntMap::Key Item;
/// Functor type for comparing the priorities.
typedef CMP Compare;
/// \brief Type to represent the states of the items.
///
/// Each item has a state associated to it. It can be "in heap",
/// "pre-heap" or "post-heap". The latter two are indifferent from the
/// heap's point of view, but may be useful to the user.
///
/// The item-int map must be initialized in such way that it assigns
/// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
enum State {
IN_HEAP = 0, ///< = 0.
PRE_HEAP = -1, ///< = -1.
POST_HEAP = -2 ///< = -2.
};
private:
class Store;
std::vector<Store> _data;
int _min, _head;
ItemIntMap &_iim;
Compare _comp;
int _num_items;
public:
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
explicit BinomialHeap(ItemIntMap &map)
: _min(0), _head(-1), _iim(map), _num_items(0) {}
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
/// \param comp The function object used for comparing the priorities.
BinomialHeap(ItemIntMap &map, const Compare &comp)
: _min(0), _head(-1), _iim(map), _comp(comp), _num_items(0) {}
/// \brief The number of items stored in the heap.
///
/// This function returns the number of items stored in the heap.
int size() const { return _num_items; }
/// \brief Check if the heap is empty.
///
/// This function returns \c true if the heap is empty.
bool empty() const { return _num_items==0; }
/// \brief Make the heap empty.
///
/// This functon makes the heap empty.
/// It does not change the cross reference map. If you want to reuse
/// a heap that is not surely empty, you should first clear it and
/// then you should set the cross reference map to \c PRE_HEAP
/// for each item.
void clear() {
_data.clear(); _min=0; _num_items=0; _head=-1;
}
/// \brief Set the priority of an item or insert it, if it is
/// not stored in the heap.
///
/// This method sets the priority of the given item if it is
/// already stored in the heap. Otherwise it inserts the given
/// item into the heap with the given priority.
/// \param item The item.
/// \param value The priority.
void set (const Item& item, const Prio& value) {
int i=_iim[item];
if ( i >= 0 && _data[i].in ) {
if ( _comp(value, _data[i].prio) ) decrease(item, value);
if ( _comp(_data[i].prio, value) ) increase(item, value);
} else push(item, value);
}
/// \brief Insert an item into the heap with the given priority.
///
/// This function inserts the given item into the heap with the
/// given priority.
/// \param item The item to insert.
/// \param value The priority of the item.
/// \pre \e item must not be stored in the heap.
void push (const Item& item, const Prio& value) {
int i=_iim[item];
if ( i<0 ) {
int s=_data.size();
_iim.set( item,s );
Store st;
st.name=item;
st.prio=value;
_data.push_back(st);
i=s;
}
else {
_data[i].parent=_data[i].right_neighbor=_data[i].child=-1;
_data[i].degree=0;
_data[i].in=true;
_data[i].prio=value;
}
if( 0==_num_items ) {
_head=i;
_min=i;
} else {
merge(i);
if( _comp(_data[i].prio, _data[_min].prio) ) _min=i;
}
++_num_items;
}
/// \brief Return the item having minimum priority.
///
/// This function returns the item having minimum priority.
/// \pre The heap must be non-empty.
Item top() const { return _data[_min].name; }
/// \brief The minimum priority.
///
/// This function returns the minimum priority.
/// \pre The heap must be non-empty.
Prio prio() const { return _data[_min].prio; }
/// \brief The priority of the given item.
///
/// This function returns the priority of the given item.
/// \param item The item.
/// \pre \e item must be in the heap.
const Prio& operator[](const Item& item) const {
return _data[_iim[item]].prio;
}
/// \brief Remove the item having minimum priority.
///
/// This function removes the item having minimum priority.
/// \pre The heap must be non-empty.
void pop() {
_data[_min].in=false;
int head_child=-1;
if ( _data[_min].child!=-1 ) {
int child=_data[_min].child;
int neighb;
while( child!=-1 ) {
neighb=_data[child].right_neighbor;
_data[child].parent=-1;
_data[child].right_neighbor=head_child;
head_child=child;
child=neighb;
}
}
if ( _data[_head].right_neighbor==-1 ) {
// there was only one root
_head=head_child;
}
else {
// there were more roots
if( _head!=_min ) { unlace(_min); }
else { _head=_data[_head].right_neighbor; }
merge(head_child);
}
_min=findMin();
--_num_items;
}
/// \brief Remove the given item from the heap.
///
/// This function removes the given item from the heap if it is
/// already stored.
/// \param item The item to delete.
/// \pre \e item must be in the heap.
void erase (const Item& item) {
int i=_iim[item];
if ( i >= 0 && _data[i].in ) {
decrease( item, _data[_min].prio-1 );
pop();
}
}
/// \brief Decrease the priority of an item to the given value.
///
/// This function decreases the priority of an item to the given value.
/// \param item The item.
/// \param value The priority.
/// \pre \e item must be stored in the heap with priority at least \e value.
void decrease (Item item, const Prio& value) {
int i=_iim[item];
int p=_data[i].parent;
_data[i].prio=value;
while( p!=-1 && _comp(value, _data[p].prio) ) {
_data[i].name=_data[p].name;
_data[i].prio=_data[p].prio;
_data[p].name=item;
_data[p].prio=value;
_iim[_data[i].name]=i;
i=p;
p=_data[p].parent;
}
_iim[item]=i;
if ( _comp(value, _data[_min].prio) ) _min=i;
}
/// \brief Increase the priority of an item to the given value.
///
/// This function increases the priority of an item to the given value.
/// \param item The item.
/// \param value The priority.
/// \pre \e item must be stored in the heap with priority at most \e value.
void increase (Item item, const Prio& value) {
erase(item);
push(item, value);
}
/// \brief Return the state of an item.
///
/// This method returns \c PRE_HEAP if the given item has never
/// been in the heap, \c IN_HEAP if it is in the heap at the moment,
/// and \c POST_HEAP otherwise.
/// In the latter case it is possible that the item will get back
/// to the heap again.
/// \param item The item.
State state(const Item &item) const {
int i=_iim[item];
if( i>=0 ) {
if ( _data[i].in ) i=0;
else i=-2;
}
return State(i);
}
/// \brief Set the state of an item in the heap.
///
/// This function sets the state of the given item in the heap.
/// It can be used to manually clear the heap when it is important
/// to achive better time complexity.
/// \param i The item.
/// \param st The state. It should not be \c IN_HEAP.
void state(const Item& i, State st) {
switch (st) {
case POST_HEAP:
case PRE_HEAP:
if (state(i) == IN_HEAP) {
erase(i);
}
_iim[i] = st;
break;
case IN_HEAP:
break;
}
}
private:
// Find the minimum of the roots
int findMin() {
if( _head!=-1 ) {
int min_loc=_head, min_val=_data[_head].prio;
for( int x=_data[_head].right_neighbor; x!=-1;
x=_data[x].right_neighbor ) {
if( _comp( _data[x].prio,min_val ) ) {
min_val=_data[x].prio;
min_loc=x;
}
}
return min_loc;
}
else return -1;
}
// Merge the heap with another heap starting at the given position
void merge(int a) {
if( _head==-1 || a==-1 ) return;
if( _data[a].right_neighbor==-1 &&
_data[a].degree<=_data[_head].degree ) {
_data[a].right_neighbor=_head;
_head=a;
} else {
interleave(a);
}
if( _data[_head].right_neighbor==-1 ) return;
int x=_head;
int x_prev=-1, x_next=_data[x].right_neighbor;
while( x_next!=-1 ) {
if( _data[x].degree!=_data[x_next].degree ||
( _data[x_next].right_neighbor!=-1 &&
_data[_data[x_next].right_neighbor].degree==_data[x].degree ) ) {
x_prev=x;
x=x_next;
}
else {
if( _comp(_data[x_next].prio,_data[x].prio) ) {
if( x_prev==-1 ) {
_head=x_next;
} else {
_data[x_prev].right_neighbor=x_next;
}
fuse(x,x_next);
x=x_next;
}
else {
_data[x].right_neighbor=_data[x_next].right_neighbor;
fuse(x_next,x);
}
}
x_next=_data[x].right_neighbor;
}
}
// Interleave the elements of the given list into the list of the roots
void interleave(int a) {
int p=_head, q=a;
int curr=_data.size();
_data.push_back(Store());
while( p!=-1 || q!=-1 ) {
if( q==-1 || ( p!=-1 && _data[p].degree<_data[q].degree ) ) {
_data[curr].right_neighbor=p;
curr=p;
p=_data[p].right_neighbor;
}
else {
_data[curr].right_neighbor=q;
curr=q;
q=_data[q].right_neighbor;
}
}
_head=_data.back().right_neighbor;
_data.pop_back();
}
// Lace node a under node b
void fuse(int a, int b) {
_data[a].parent=b;
_data[a].right_neighbor=_data[b].child;
_data[b].child=a;
++_data[b].degree;
}
// Unlace node a (if it has siblings)
void unlace(int a) {
int neighb=_data[a].right_neighbor;
int other=_head;
while( _data[other].right_neighbor!=a )
other=_data[other].right_neighbor;
_data[other].right_neighbor=neighb;
}
private:
class Store {
friend class BinomialHeap;
Item name;
int parent;
int right_neighbor;
int child;
int degree;
bool in;
Prio prio;
Store() : parent(-1), right_neighbor(-1), child(-1), degree(0),
in(true) {}
};
};
} //namespace lemon
#endif //LEMON_BINOMIAL_HEAP_H

View File

@@ -0,0 +1,472 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_ALTERATION_NOTIFIER_H
#define LEMON_BITS_ALTERATION_NOTIFIER_H
#include <vector>
#include <list>
#include <lemon/core.h>
#include <lemon/bits/lock.h>
//\ingroup graphbits
//\file
//\brief Observer notifier for graph alteration observers.
namespace lemon {
// \ingroup graphbits
//
// \brief Notifier class to notify observes about alterations in
// a container.
//
// The simple graphs can be refered as two containers: a node container
// and an edge container. But they do not store values directly, they
// are just key continars for more value containers, which are the
// node and edge maps.
//
// The node and edge sets of the graphs can be changed as we add or erase
// nodes and edges in the graph. LEMON would like to handle easily
// that the node and edge maps should contain values for all nodes or
// edges. If we want to check on every indicing if the map contains
// the current indicing key that cause a drawback in the performance
// in the library. We use another solution: we notify all maps about
// an alteration in the graph, which cause only drawback on the
// alteration of the graph.
//
// This class provides an interface to a node or edge container.
// The first() and next() member functions make possible
// to iterate on the keys of the container.
// The id() function returns an integer id for each key.
// The maxId() function gives back an upper bound of the ids.
//
// For the proper functonality of this class, we should notify it
// about each alteration in the container. The alterations have four type:
// add(), erase(), build() and clear(). The add() and
// erase() signal that only one or few items added or erased to or
// from the graph. If all items are erased from the graph or if a new graph
// is built from an empty graph, then it can be signaled with the
// clear() and build() members. Important rule that if we erase items
// from graphs we should first signal the alteration and after that erase
// them from the container, on the other way on item addition we should
// first extend the container and just after that signal the alteration.
//
// The alteration can be observed with a class inherited from the
// ObserverBase nested class. The signals can be handled with
// overriding the virtual functions defined in the base class. The
// observer base can be attached to the notifier with the
// attach() member and can be detached with detach() function. The
// alteration handlers should not call any function which signals
// an other alteration in the same notifier and should not
// detach any observer from the notifier.
//
// Alteration observers try to be exception safe. If an add() or
// a clear() function throws an exception then the remaining
// observeres will not be notified and the fulfilled additions will
// be rolled back by calling the erase() or clear() functions.
// Hence erase() and clear() should not throw exception.
// Actullay, they can throw only \ref ImmediateDetach exception,
// which detach the observer from the notifier.
//
// There are some cases, when the alteration observing is not completly
// reliable. If we want to carry out the node degree in the graph
// as in the \ref InDegMap and we use the reverseArc(), then it cause
// unreliable functionality. Because the alteration observing signals
// only erasing and adding but not the reversing, it will stores bad
// degrees. Apart form that the subgraph adaptors cannot even signal
// the alterations because just a setting in the filter map can modify
// the graph and this cannot be watched in any way.
//
// \param _Container The container which is observed.
// \param _Item The item type which is obserbved.
template <typename _Container, typename _Item>
class AlterationNotifier {
public:
typedef True Notifier;
typedef _Container Container;
typedef _Item Item;
// \brief Exception which can be called from clear() and
// erase().
//
// From the clear() and erase() function only this
// exception is allowed to throw. The exception immediatly
// detaches the current observer from the notifier. Because the
// clear() and erase() should not throw other exceptions
// it can be used to invalidate the observer.
struct ImmediateDetach {};
// \brief ObserverBase is the base class for the observers.
//
// ObserverBase is the abstract base class for the observers.
// It will be notified about an item was inserted into or
// erased from the graph.
//
// The observer interface contains some pure virtual functions
// to override. The add() and erase() functions are
// to notify the oberver when one item is added or erased.
//
// The build() and clear() members are to notify the observer
// about the container is built from an empty container or
// is cleared to an empty container.
class ObserverBase {
protected:
typedef AlterationNotifier Notifier;
friend class AlterationNotifier;
// \brief Default constructor.
//
// Default constructor for ObserverBase.
ObserverBase() : _notifier(0) {}
// \brief Constructor which attach the observer into notifier.
//
// Constructor which attach the observer into notifier.
ObserverBase(AlterationNotifier& nf) {
attach(nf);
}
// \brief Constructor which attach the obserever to the same notifier.
//
// Constructor which attach the obserever to the same notifier as
// the other observer is attached to.
ObserverBase(const ObserverBase& copy) {
if (copy.attached()) {
attach(*copy.notifier());
}
}
// \brief Destructor
virtual ~ObserverBase() {
if (attached()) {
detach();
}
}
// \brief Attaches the observer into an AlterationNotifier.
//
// This member attaches the observer into an AlterationNotifier.
void attach(AlterationNotifier& nf) {
nf.attach(*this);
}
// \brief Detaches the observer into an AlterationNotifier.
//
// This member detaches the observer from an AlterationNotifier.
void detach() {
_notifier->detach(*this);
}
// \brief Gives back a pointer to the notifier which the map
// attached into.
//
// This function gives back a pointer to the notifier which the map
// attached into.
Notifier* notifier() const { return const_cast<Notifier*>(_notifier); }
// Gives back true when the observer is attached into a notifier.
bool attached() const { return _notifier != 0; }
private:
ObserverBase& operator=(const ObserverBase& copy);
protected:
Notifier* _notifier;
typename std::list<ObserverBase*>::iterator _index;
// \brief The member function to notificate the observer about an
// item is added to the container.
//
// The add() member function notificates the observer about an item
// is added to the container. It have to be overrided in the
// subclasses.
virtual void add(const Item&) = 0;
// \brief The member function to notificate the observer about
// more item is added to the container.
//
// The add() member function notificates the observer about more item
// is added to the container. It have to be overrided in the
// subclasses.
virtual void add(const std::vector<Item>& items) = 0;
// \brief The member function to notificate the observer about an
// item is erased from the container.
//
// The erase() member function notificates the observer about an
// item is erased from the container. It have to be overrided in
// the subclasses.
virtual void erase(const Item&) = 0;
// \brief The member function to notificate the observer about
// more item is erased from the container.
//
// The erase() member function notificates the observer about more item
// is erased from the container. It have to be overrided in the
// subclasses.
virtual void erase(const std::vector<Item>& items) = 0;
// \brief The member function to notificate the observer about the
// container is built.
//
// The build() member function notificates the observer about the
// container is built from an empty container. It have to be
// overrided in the subclasses.
virtual void build() = 0;
// \brief The member function to notificate the observer about all
// items are erased from the container.
//
// The clear() member function notificates the observer about all
// items are erased from the container. It have to be overrided in
// the subclasses.
virtual void clear() = 0;
};
protected:
const Container* container;
typedef std::list<ObserverBase*> Observers;
Observers _observers;
lemon::bits::Lock _lock;
public:
// \brief Default constructor.
//
// The default constructor of the AlterationNotifier.
// It creates an empty notifier.
AlterationNotifier()
: container(0) {}
// \brief Constructor.
//
// Constructor with the observed container parameter.
AlterationNotifier(const Container& _container)
: container(&_container) {}
// \brief Copy Constructor of the AlterationNotifier.
//
// Copy constructor of the AlterationNotifier.
// It creates only an empty notifier because the copiable
// notifier's observers have to be registered still into that notifier.
AlterationNotifier(const AlterationNotifier& _notifier)
: container(_notifier.container) {}
// \brief Destructor.
//
// Destructor of the AlterationNotifier.
~AlterationNotifier() {
typename Observers::iterator it;
for (it = _observers.begin(); it != _observers.end(); ++it) {
(*it)->_notifier = 0;
}
}
// \brief Sets the container.
//
// Sets the container.
void setContainer(const Container& _container) {
container = &_container;
}
protected:
AlterationNotifier& operator=(const AlterationNotifier&);
public:
// \brief First item in the container.
//
// Returns the first item in the container. It is
// for start the iteration on the container.
void first(Item& item) const {
container->first(item);
}
// \brief Next item in the container.
//
// Returns the next item in the container. It is
// for iterate on the container.
void next(Item& item) const {
container->next(item);
}
// \brief Returns the id of the item.
//
// Returns the id of the item provided by the container.
int id(const Item& item) const {
return container->id(item);
}
// \brief Returns the maximum id of the container.
//
// Returns the maximum id of the container.
int maxId() const {
return container->maxId(Item());
}
protected:
void attach(ObserverBase& observer) {
_lock.lock();
observer._index = _observers.insert(_observers.begin(), &observer);
observer._notifier = this;
_lock.unlock();
}
void detach(ObserverBase& observer) {
_lock.lock();
_observers.erase(observer._index);
observer._index = _observers.end();
observer._notifier = 0;
_lock.unlock();
}
public:
// \brief Notifies all the registed observers about an item added to
// the container.
//
// It notifies all the registed observers about an item added to
// the container.
void add(const Item& item) {
typename Observers::reverse_iterator it;
try {
for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
(*it)->add(item);
}
} catch (...) {
typename Observers::iterator jt;
for (jt = it.base(); jt != _observers.end(); ++jt) {
(*jt)->erase(item);
}
throw;
}
}
// \brief Notifies all the registed observers about more item added to
// the container.
//
// It notifies all the registed observers about more item added to
// the container.
void add(const std::vector<Item>& items) {
typename Observers::reverse_iterator it;
try {
for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
(*it)->add(items);
}
} catch (...) {
typename Observers::iterator jt;
for (jt = it.base(); jt != _observers.end(); ++jt) {
(*jt)->erase(items);
}
throw;
}
}
// \brief Notifies all the registed observers about an item erased from
// the container.
//
// It notifies all the registed observers about an item erased from
// the container.
void erase(const Item& item) throw() {
typename Observers::iterator it = _observers.begin();
while (it != _observers.end()) {
try {
(*it)->erase(item);
++it;
} catch (const ImmediateDetach&) {
(*it)->_index = _observers.end();
(*it)->_notifier = 0;
it = _observers.erase(it);
}
}
}
// \brief Notifies all the registed observers about more item erased
// from the container.
//
// It notifies all the registed observers about more item erased from
// the container.
void erase(const std::vector<Item>& items) {
typename Observers::iterator it = _observers.begin();
while (it != _observers.end()) {
try {
(*it)->erase(items);
++it;
} catch (const ImmediateDetach&) {
(*it)->_index = _observers.end();
(*it)->_notifier = 0;
it = _observers.erase(it);
}
}
}
// \brief Notifies all the registed observers about the container is
// built.
//
// Notifies all the registed observers about the container is built
// from an empty container.
void build() {
typename Observers::reverse_iterator it;
try {
for (it = _observers.rbegin(); it != _observers.rend(); ++it) {
(*it)->build();
}
} catch (...) {
typename Observers::iterator jt;
for (jt = it.base(); jt != _observers.end(); ++jt) {
(*jt)->clear();
}
throw;
}
}
// \brief Notifies all the registed observers about all items are
// erased.
//
// Notifies all the registed observers about all items are erased
// from the container.
void clear() {
typename Observers::iterator it = _observers.begin();
while (it != _observers.end()) {
try {
(*it)->clear();
++it;
} catch (const ImmediateDetach&) {
(*it)->_index = _observers.end();
(*it)->_notifier = 0;
it = _observers.erase(it);
}
}
}
};
}
#endif

View File

@@ -0,0 +1,351 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_ARRAY_MAP_H
#define LEMON_BITS_ARRAY_MAP_H
#include <memory>
#include <lemon/bits/traits.h>
#include <lemon/bits/alteration_notifier.h>
#include <lemon/concept_check.h>
#include <lemon/concepts/maps.h>
// \ingroup graphbits
// \file
// \brief Graph map based on the array storage.
namespace lemon {
// \ingroup graphbits
//
// \brief Graph map based on the array storage.
//
// The ArrayMap template class is graph map structure that automatically
// updates the map when a key is added to or erased from the graph.
// This map uses the allocators to implement the container functionality.
//
// The template parameters are the Graph, the current Item type and
// the Value type of the map.
template <typename _Graph, typename _Item, typename _Value>
class ArrayMap
: public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
public:
// The graph type.
typedef _Graph GraphType;
// The item type.
typedef _Item Item;
// The reference map tag.
typedef True ReferenceMapTag;
// The key type of the map.
typedef _Item Key;
// The value type of the map.
typedef _Value Value;
// The const reference type of the map.
typedef const _Value& ConstReference;
// The reference type of the map.
typedef _Value& Reference;
// The map type.
typedef ArrayMap Map;
// The notifier type.
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
private:
// The MapBase of the Map which imlements the core regisitry function.
typedef typename Notifier::ObserverBase Parent;
typedef std::allocator<Value> Allocator;
public:
// \brief Graph initialized map constructor.
//
// Graph initialized map constructor.
explicit ArrayMap(const GraphType& graph) {
Parent::attach(graph.notifier(Item()));
allocate_memory();
Notifier* nf = Parent::notifier();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);;
allocator.construct(&(values[id]), Value());
}
}
// \brief Constructor to use default value to initialize the map.
//
// It constructs a map and initialize all of the the map.
ArrayMap(const GraphType& graph, const Value& value) {
Parent::attach(graph.notifier(Item()));
allocate_memory();
Notifier* nf = Parent::notifier();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);;
allocator.construct(&(values[id]), value);
}
}
private:
// \brief Constructor to copy a map of the same map type.
//
// Constructor to copy a map of the same map type.
ArrayMap(const ArrayMap& copy) : Parent() {
if (copy.attached()) {
attach(*copy.notifier());
}
capacity = copy.capacity;
if (capacity == 0) return;
values = allocator.allocate(capacity);
Notifier* nf = Parent::notifier();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);;
allocator.construct(&(values[id]), copy.values[id]);
}
}
// \brief Assign operator.
//
// This operator assigns for each item in the map the
// value mapped to the same item in the copied map.
// The parameter map should be indiced with the same
// itemset because this assign operator does not change
// the container of the map.
ArrayMap& operator=(const ArrayMap& cmap) {
return operator=<ArrayMap>(cmap);
}
// \brief Template assign operator.
//
// The given parameter should conform to the ReadMap
// concecpt and could be indiced by the current item set of
// the NodeMap. In this case the value for each item
// is assigned by the value of the given ReadMap.
template <typename CMap>
ArrayMap& operator=(const CMap& cmap) {
checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
const typename Parent::Notifier* nf = Parent::notifier();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
set(it, cmap[it]);
}
return *this;
}
public:
// \brief The destructor of the map.
//
// The destructor of the map.
virtual ~ArrayMap() {
if (attached()) {
clear();
detach();
}
}
protected:
using Parent::attach;
using Parent::detach;
using Parent::attached;
public:
// \brief The subscript operator.
//
// The subscript operator. The map can be subscripted by the
// actual keys of the graph.
Value& operator[](const Key& key) {
int id = Parent::notifier()->id(key);
return values[id];
}
// \brief The const subscript operator.
//
// The const subscript operator. The map can be subscripted by the
// actual keys of the graph.
const Value& operator[](const Key& key) const {
int id = Parent::notifier()->id(key);
return values[id];
}
// \brief Setter function of the map.
//
// Setter function of the map. Equivalent with map[key] = val.
// This is a compatibility feature with the not dereferable maps.
void set(const Key& key, const Value& val) {
(*this)[key] = val;
}
protected:
// \brief Adds a new key to the map.
//
// It adds a new key to the map. It is called by the observer notifier
// and it overrides the add() member function of the observer base.
virtual void add(const Key& key) {
Notifier* nf = Parent::notifier();
int id = nf->id(key);
if (id >= capacity) {
int new_capacity = (capacity == 0 ? 1 : capacity);
while (new_capacity <= id) {
new_capacity <<= 1;
}
Value* new_values = allocator.allocate(new_capacity);
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int jd = nf->id(it);;
if (id != jd) {
allocator.construct(&(new_values[jd]), values[jd]);
allocator.destroy(&(values[jd]));
}
}
if (capacity != 0) allocator.deallocate(values, capacity);
values = new_values;
capacity = new_capacity;
}
allocator.construct(&(values[id]), Value());
}
// \brief Adds more new keys to the map.
//
// It adds more new keys to the map. It is called by the observer notifier
// and it overrides the add() member function of the observer base.
virtual void add(const std::vector<Key>& keys) {
Notifier* nf = Parent::notifier();
int max_id = -1;
for (int i = 0; i < int(keys.size()); ++i) {
int id = nf->id(keys[i]);
if (id > max_id) {
max_id = id;
}
}
if (max_id >= capacity) {
int new_capacity = (capacity == 0 ? 1 : capacity);
while (new_capacity <= max_id) {
new_capacity <<= 1;
}
Value* new_values = allocator.allocate(new_capacity);
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);
bool found = false;
for (int i = 0; i < int(keys.size()); ++i) {
int jd = nf->id(keys[i]);
if (id == jd) {
found = true;
break;
}
}
if (found) continue;
allocator.construct(&(new_values[id]), values[id]);
allocator.destroy(&(values[id]));
}
if (capacity != 0) allocator.deallocate(values, capacity);
values = new_values;
capacity = new_capacity;
}
for (int i = 0; i < int(keys.size()); ++i) {
int id = nf->id(keys[i]);
allocator.construct(&(values[id]), Value());
}
}
// \brief Erase a key from the map.
//
// Erase a key from the map. It is called by the observer notifier
// and it overrides the erase() member function of the observer base.
virtual void erase(const Key& key) {
int id = Parent::notifier()->id(key);
allocator.destroy(&(values[id]));
}
// \brief Erase more keys from the map.
//
// Erase more keys from the map. It is called by the observer notifier
// and it overrides the erase() member function of the observer base.
virtual void erase(const std::vector<Key>& keys) {
for (int i = 0; i < int(keys.size()); ++i) {
int id = Parent::notifier()->id(keys[i]);
allocator.destroy(&(values[id]));
}
}
// \brief Builds the map.
//
// It builds the map. It is called by the observer notifier
// and it overrides the build() member function of the observer base.
virtual void build() {
Notifier* nf = Parent::notifier();
allocate_memory();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);;
allocator.construct(&(values[id]), Value());
}
}
// \brief Clear the map.
//
// It erase all items from the map. It is called by the observer notifier
// and it overrides the clear() member function of the observer base.
virtual void clear() {
Notifier* nf = Parent::notifier();
if (capacity != 0) {
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
int id = nf->id(it);
allocator.destroy(&(values[id]));
}
allocator.deallocate(values, capacity);
capacity = 0;
}
}
private:
void allocate_memory() {
int max_id = Parent::notifier()->maxId();
if (max_id == -1) {
capacity = 0;
values = 0;
return;
}
capacity = 1;
while (capacity <= max_id) {
capacity <<= 1;
}
values = allocator.allocate(capacity);
}
int capacity;
Value* values;
Allocator allocator;
};
}
#endif

View File

@@ -0,0 +1,174 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BEZIER_H
#define LEMON_BEZIER_H
//\ingroup misc
//\file
//\brief Classes to compute with Bezier curves.
//
//Up to now this file is used internally by \ref graph_to_eps.h
#include<lemon/dim2.h>
namespace lemon {
namespace dim2 {
class BezierBase {
public:
typedef lemon::dim2::Point<double> Point;
protected:
static Point conv(Point x,Point y,double t) {return (1-t)*x+t*y;}
};
class Bezier1 : public BezierBase
{
public:
Point p1,p2;
Bezier1() {}
Bezier1(Point _p1, Point _p2) :p1(_p1), p2(_p2) {}
Point operator()(double t) const
{
// return conv(conv(p1,p2,t),conv(p2,p3,t),t);
return conv(p1,p2,t);
}
Bezier1 before(double t) const
{
return Bezier1(p1,conv(p1,p2,t));
}
Bezier1 after(double t) const
{
return Bezier1(conv(p1,p2,t),p2);
}
Bezier1 revert() const { return Bezier1(p2,p1);}
Bezier1 operator()(double a,double b) const { return before(b).after(a/b); }
Point grad() const { return p2-p1; }
Point norm() const { return rot90(p2-p1); }
Point grad(double) const { return grad(); }
Point norm(double t) const { return rot90(grad(t)); }
};
class Bezier2 : public BezierBase
{
public:
Point p1,p2,p3;
Bezier2() {}
Bezier2(Point _p1, Point _p2, Point _p3) :p1(_p1), p2(_p2), p3(_p3) {}
Bezier2(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,.5)), p3(b.p2) {}
Point operator()(double t) const
{
// return conv(conv(p1,p2,t),conv(p2,p3,t),t);
return ((1-t)*(1-t))*p1+(2*(1-t)*t)*p2+(t*t)*p3;
}
Bezier2 before(double t) const
{
Point q(conv(p1,p2,t));
Point r(conv(p2,p3,t));
return Bezier2(p1,q,conv(q,r,t));
}
Bezier2 after(double t) const
{
Point q(conv(p1,p2,t));
Point r(conv(p2,p3,t));
return Bezier2(conv(q,r,t),r,p3);
}
Bezier2 revert() const { return Bezier2(p3,p2,p1);}
Bezier2 operator()(double a,double b) const { return before(b).after(a/b); }
Bezier1 grad() const { return Bezier1(2.0*(p2-p1),2.0*(p3-p2)); }
Bezier1 norm() const { return Bezier1(2.0*rot90(p2-p1),2.0*rot90(p3-p2)); }
Point grad(double t) const { return grad()(t); }
Point norm(double t) const { return rot90(grad(t)); }
};
class Bezier3 : public BezierBase
{
public:
Point p1,p2,p3,p4;
Bezier3() {}
Bezier3(Point _p1, Point _p2, Point _p3, Point _p4)
: p1(_p1), p2(_p2), p3(_p3), p4(_p4) {}
Bezier3(const Bezier1 &b) : p1(b.p1), p2(conv(b.p1,b.p2,1.0/3.0)),
p3(conv(b.p1,b.p2,2.0/3.0)), p4(b.p2) {}
Bezier3(const Bezier2 &b) : p1(b.p1), p2(conv(b.p1,b.p2,2.0/3.0)),
p3(conv(b.p2,b.p3,1.0/3.0)), p4(b.p3) {}
Point operator()(double t) const
{
// return Bezier2(conv(p1,p2,t),conv(p2,p3,t),conv(p3,p4,t))(t);
return ((1-t)*(1-t)*(1-t))*p1+(3*t*(1-t)*(1-t))*p2+
(3*t*t*(1-t))*p3+(t*t*t)*p4;
}
Bezier3 before(double t) const
{
Point p(conv(p1,p2,t));
Point q(conv(p2,p3,t));
Point r(conv(p3,p4,t));
Point a(conv(p,q,t));
Point b(conv(q,r,t));
Point c(conv(a,b,t));
return Bezier3(p1,p,a,c);
}
Bezier3 after(double t) const
{
Point p(conv(p1,p2,t));
Point q(conv(p2,p3,t));
Point r(conv(p3,p4,t));
Point a(conv(p,q,t));
Point b(conv(q,r,t));
Point c(conv(a,b,t));
return Bezier3(c,b,r,p4);
}
Bezier3 revert() const { return Bezier3(p4,p3,p2,p1);}
Bezier3 operator()(double a,double b) const { return before(b).after(a/b); }
Bezier2 grad() const { return Bezier2(3.0*(p2-p1),3.0*(p3-p2),3.0*(p4-p3)); }
Bezier2 norm() const { return Bezier2(3.0*rot90(p2-p1),
3.0*rot90(p3-p2),
3.0*rot90(p4-p3)); }
Point grad(double t) const { return grad()(t); }
Point norm(double t) const { return rot90(grad(t)); }
template<class R,class F,class S,class D>
R recSplit(F &_f,const S &_s,D _d) const
{
const Point a=(p1+p2)/2;
const Point b=(p2+p3)/2;
const Point c=(p3+p4)/2;
const Point d=(a+b)/2;
const Point e=(b+c)/2;
// const Point f=(d+e)/2;
R f1=_f(Bezier3(p1,a,d,e),_d);
R f2=_f(Bezier3(e,d,c,p4),_d);
return _s(f1,f2);
}
};
} //END OF NAMESPACE dim2
} //END OF NAMESPACE lemon
#endif // LEMON_BEZIER_H

View File

@@ -0,0 +1,182 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_DEFAULT_MAP_H
#define LEMON_BITS_DEFAULT_MAP_H
#include <lemon/config.h>
#include <lemon/bits/array_map.h>
#include <lemon/bits/vector_map.h>
//#include <lemon/bits/debug_map.h>
//\ingroup graphbits
//\file
//\brief Graph maps that construct and destruct their elements dynamically.
namespace lemon {
//#ifndef LEMON_USE_DEBUG_MAP
template <typename _Graph, typename _Item, typename _Value>
struct DefaultMapSelector {
typedef ArrayMap<_Graph, _Item, _Value> Map;
};
// bool
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, bool> {
typedef VectorMap<_Graph, _Item, bool> Map;
};
// char
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, char> {
typedef VectorMap<_Graph, _Item, char> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed char> {
typedef VectorMap<_Graph, _Item, signed char> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned char> {
typedef VectorMap<_Graph, _Item, unsigned char> Map;
};
// int
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed int> {
typedef VectorMap<_Graph, _Item, signed int> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned int> {
typedef VectorMap<_Graph, _Item, unsigned int> Map;
};
// short
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed short> {
typedef VectorMap<_Graph, _Item, signed short> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned short> {
typedef VectorMap<_Graph, _Item, unsigned short> Map;
};
// long
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed long> {
typedef VectorMap<_Graph, _Item, signed long> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned long> {
typedef VectorMap<_Graph, _Item, unsigned long> Map;
};
#if defined LEMON_HAVE_LONG_LONG
// long long
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, signed long long> {
typedef VectorMap<_Graph, _Item, signed long long> Map;
};
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, unsigned long long> {
typedef VectorMap<_Graph, _Item, unsigned long long> Map;
};
#endif
// float
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, float> {
typedef VectorMap<_Graph, _Item, float> Map;
};
// double
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, double> {
typedef VectorMap<_Graph, _Item, double> Map;
};
// long double
template <typename _Graph, typename _Item>
struct DefaultMapSelector<_Graph, _Item, long double> {
typedef VectorMap<_Graph, _Item, long double> Map;
};
// pointer
template <typename _Graph, typename _Item, typename _Ptr>
struct DefaultMapSelector<_Graph, _Item, _Ptr*> {
typedef VectorMap<_Graph, _Item, _Ptr*> Map;
};
// #else
// template <typename _Graph, typename _Item, typename _Value>
// struct DefaultMapSelector {
// typedef DebugMap<_Graph, _Item, _Value> Map;
// };
// #endif
// DefaultMap class
template <typename _Graph, typename _Item, typename _Value>
class DefaultMap
: public DefaultMapSelector<_Graph, _Item, _Value>::Map {
typedef typename DefaultMapSelector<_Graph, _Item, _Value>::Map Parent;
public:
typedef DefaultMap<_Graph, _Item, _Value> Map;
typedef typename Parent::GraphType GraphType;
typedef typename Parent::Value Value;
explicit DefaultMap(const GraphType& graph) : Parent(graph) {}
DefaultMap(const GraphType& graph, const Value& value)
: Parent(graph, value) {}
DefaultMap& operator=(const DefaultMap& cmap) {
return operator=<DefaultMap>(cmap);
}
template <typename CMap>
DefaultMap& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
};
}
#endif

View File

@@ -0,0 +1,627 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_EDGE_SET_EXTENDER_H
#define LEMON_BITS_EDGE_SET_EXTENDER_H
#include <lemon/core.h>
#include <lemon/error.h>
#include <lemon/bits/default_map.h>
#include <lemon/bits/map_extender.h>
//\ingroup digraphbits
//\file
//\brief Extenders for the arc set types
namespace lemon {
// \ingroup digraphbits
//
// \brief Extender for the ArcSets
template <typename Base>
class ArcSetExtender : public Base {
typedef Base Parent;
public:
typedef ArcSetExtender Digraph;
// Base extensions
typedef typename Parent::Node Node;
typedef typename Parent::Arc Arc;
int maxId(Node) const {
return Parent::maxNodeId();
}
int maxId(Arc) const {
return Parent::maxArcId();
}
Node fromId(int id, Node) const {
return Parent::nodeFromId(id);
}
Arc fromId(int id, Arc) const {
return Parent::arcFromId(id);
}
Node oppositeNode(const Node &n, const Arc &e) const {
if (n == Parent::source(e))
return Parent::target(e);
else if(n==Parent::target(e))
return Parent::source(e);
else
return INVALID;
}
// Alteration notifier extensions
// The arc observer registry.
typedef AlterationNotifier<ArcSetExtender, Arc> ArcNotifier;
protected:
mutable ArcNotifier arc_notifier;
public:
using Parent::notifier;
// Gives back the arc alteration notifier.
ArcNotifier& notifier(Arc) const {
return arc_notifier;
}
// Iterable extensions
class NodeIt : public Node {
const Digraph* digraph;
public:
NodeIt() {}
NodeIt(Invalid i) : Node(i) { }
explicit NodeIt(const Digraph& _graph) : digraph(&_graph) {
_graph.first(static_cast<Node&>(*this));
}
NodeIt(const Digraph& _graph, const Node& node)
: Node(node), digraph(&_graph) {}
NodeIt& operator++() {
digraph->next(*this);
return *this;
}
};
class ArcIt : public Arc {
const Digraph* digraph;
public:
ArcIt() { }
ArcIt(Invalid i) : Arc(i) { }
explicit ArcIt(const Digraph& _graph) : digraph(&_graph) {
_graph.first(static_cast<Arc&>(*this));
}
ArcIt(const Digraph& _graph, const Arc& e) :
Arc(e), digraph(&_graph) { }
ArcIt& operator++() {
digraph->next(*this);
return *this;
}
};
class OutArcIt : public Arc {
const Digraph* digraph;
public:
OutArcIt() { }
OutArcIt(Invalid i) : Arc(i) { }
OutArcIt(const Digraph& _graph, const Node& node)
: digraph(&_graph) {
_graph.firstOut(*this, node);
}
OutArcIt(const Digraph& _graph, const Arc& arc)
: Arc(arc), digraph(&_graph) {}
OutArcIt& operator++() {
digraph->nextOut(*this);
return *this;
}
};
class InArcIt : public Arc {
const Digraph* digraph;
public:
InArcIt() { }
InArcIt(Invalid i) : Arc(i) { }
InArcIt(const Digraph& _graph, const Node& node)
: digraph(&_graph) {
_graph.firstIn(*this, node);
}
InArcIt(const Digraph& _graph, const Arc& arc) :
Arc(arc), digraph(&_graph) {}
InArcIt& operator++() {
digraph->nextIn(*this);
return *this;
}
};
// \brief Base node of the iterator
//
// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutArcIt &e) const {
return Parent::source(static_cast<const Arc&>(e));
}
// \brief Running node of the iterator
//
// Returns the running node (ie. the target in this case) of the
// iterator
Node runningNode(const OutArcIt &e) const {
return Parent::target(static_cast<const Arc&>(e));
}
// \brief Base node of the iterator
//
// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InArcIt &e) const {
return Parent::target(static_cast<const Arc&>(e));
}
// \brief Running node of the iterator
//
// Returns the running node (ie. the source in this case) of the
// iterator
Node runningNode(const InArcIt &e) const {
return Parent::source(static_cast<const Arc&>(e));
}
using Parent::first;
// Mappable extension
template <typename _Value>
class ArcMap
: public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
public:
explicit ArcMap(const Digraph& _g)
: Parent(_g) {}
ArcMap(const Digraph& _g, const _Value& _v)
: Parent(_g, _v) {}
ArcMap& operator=(const ArcMap& cmap) {
return operator=<ArcMap>(cmap);
}
template <typename CMap>
ArcMap& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
};
// Alteration extension
Arc addArc(const Node& from, const Node& to) {
Arc arc = Parent::addArc(from, to);
notifier(Arc()).add(arc);
return arc;
}
void clear() {
notifier(Arc()).clear();
Parent::clear();
}
void erase(const Arc& arc) {
notifier(Arc()).erase(arc);
Parent::erase(arc);
}
ArcSetExtender() {
arc_notifier.setContainer(*this);
}
~ArcSetExtender() {
arc_notifier.clear();
}
};
// \ingroup digraphbits
//
// \brief Extender for the EdgeSets
template <typename Base>
class EdgeSetExtender : public Base {
typedef Base Parent;
public:
typedef EdgeSetExtender Graph;
typedef True UndirectedTag;
typedef typename Parent::Node Node;
typedef typename Parent::Arc Arc;
typedef typename Parent::Edge Edge;
int maxId(Node) const {
return Parent::maxNodeId();
}
int maxId(Arc) const {
return Parent::maxArcId();
}
int maxId(Edge) const {
return Parent::maxEdgeId();
}
Node fromId(int id, Node) const {
return Parent::nodeFromId(id);
}
Arc fromId(int id, Arc) const {
return Parent::arcFromId(id);
}
Edge fromId(int id, Edge) const {
return Parent::edgeFromId(id);
}
Node oppositeNode(const Node &n, const Edge &e) const {
if( n == Parent::u(e))
return Parent::v(e);
else if( n == Parent::v(e))
return Parent::u(e);
else
return INVALID;
}
Arc oppositeArc(const Arc &e) const {
return Parent::direct(e, !Parent::direction(e));
}
using Parent::direct;
Arc direct(const Edge &e, const Node &s) const {
return Parent::direct(e, Parent::u(e) == s);
}
typedef AlterationNotifier<EdgeSetExtender, Arc> ArcNotifier;
typedef AlterationNotifier<EdgeSetExtender, Edge> EdgeNotifier;
protected:
mutable ArcNotifier arc_notifier;
mutable EdgeNotifier edge_notifier;
public:
using Parent::notifier;
ArcNotifier& notifier(Arc) const {
return arc_notifier;
}
EdgeNotifier& notifier(Edge) const {
return edge_notifier;
}
class NodeIt : public Node {
const Graph* graph;
public:
NodeIt() {}
NodeIt(Invalid i) : Node(i) { }
explicit NodeIt(const Graph& _graph) : graph(&_graph) {
_graph.first(static_cast<Node&>(*this));
}
NodeIt(const Graph& _graph, const Node& node)
: Node(node), graph(&_graph) {}
NodeIt& operator++() {
graph->next(*this);
return *this;
}
};
class ArcIt : public Arc {
const Graph* graph;
public:
ArcIt() { }
ArcIt(Invalid i) : Arc(i) { }
explicit ArcIt(const Graph& _graph) : graph(&_graph) {
_graph.first(static_cast<Arc&>(*this));
}
ArcIt(const Graph& _graph, const Arc& e) :
Arc(e), graph(&_graph) { }
ArcIt& operator++() {
graph->next(*this);
return *this;
}
};
class OutArcIt : public Arc {
const Graph* graph;
public:
OutArcIt() { }
OutArcIt(Invalid i) : Arc(i) { }
OutArcIt(const Graph& _graph, const Node& node)
: graph(&_graph) {
_graph.firstOut(*this, node);
}
OutArcIt(const Graph& _graph, const Arc& arc)
: Arc(arc), graph(&_graph) {}
OutArcIt& operator++() {
graph->nextOut(*this);
return *this;
}
};
class InArcIt : public Arc {
const Graph* graph;
public:
InArcIt() { }
InArcIt(Invalid i) : Arc(i) { }
InArcIt(const Graph& _graph, const Node& node)
: graph(&_graph) {
_graph.firstIn(*this, node);
}
InArcIt(const Graph& _graph, const Arc& arc) :
Arc(arc), graph(&_graph) {}
InArcIt& operator++() {
graph->nextIn(*this);
return *this;
}
};
class EdgeIt : public Parent::Edge {
const Graph* graph;
public:
EdgeIt() { }
EdgeIt(Invalid i) : Edge(i) { }
explicit EdgeIt(const Graph& _graph) : graph(&_graph) {
_graph.first(static_cast<Edge&>(*this));
}
EdgeIt(const Graph& _graph, const Edge& e) :
Edge(e), graph(&_graph) { }
EdgeIt& operator++() {
graph->next(*this);
return *this;
}
};
class IncEdgeIt : public Parent::Edge {
friend class EdgeSetExtender;
const Graph* graph;
bool direction;
public:
IncEdgeIt() { }
IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
IncEdgeIt(const Graph& _graph, const Node &n) : graph(&_graph) {
_graph.firstInc(*this, direction, n);
}
IncEdgeIt(const Graph& _graph, const Edge &ue, const Node &n)
: graph(&_graph), Edge(ue) {
direction = (_graph.source(ue) == n);
}
IncEdgeIt& operator++() {
graph->nextInc(*this, direction);
return *this;
}
};
// \brief Base node of the iterator
//
// Returns the base node (ie. the source in this case) of the iterator
Node baseNode(const OutArcIt &e) const {
return Parent::source(static_cast<const Arc&>(e));
}
// \brief Running node of the iterator
//
// Returns the running node (ie. the target in this case) of the
// iterator
Node runningNode(const OutArcIt &e) const {
return Parent::target(static_cast<const Arc&>(e));
}
// \brief Base node of the iterator
//
// Returns the base node (ie. the target in this case) of the iterator
Node baseNode(const InArcIt &e) const {
return Parent::target(static_cast<const Arc&>(e));
}
// \brief Running node of the iterator
//
// Returns the running node (ie. the source in this case) of the
// iterator
Node runningNode(const InArcIt &e) const {
return Parent::source(static_cast<const Arc&>(e));
}
// Base node of the iterator
//
// Returns the base node of the iterator
Node baseNode(const IncEdgeIt &e) const {
return e.direction ? this->u(e) : this->v(e);
}
// Running node of the iterator
//
// Returns the running node of the iterator
Node runningNode(const IncEdgeIt &e) const {
return e.direction ? this->v(e) : this->u(e);
}
template <typename _Value>
class ArcMap
: public MapExtender<DefaultMap<Graph, Arc, _Value> > {
typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
public:
explicit ArcMap(const Graph& _g)
: Parent(_g) {}
ArcMap(const Graph& _g, const _Value& _v)
: Parent(_g, _v) {}
ArcMap& operator=(const ArcMap& cmap) {
return operator=<ArcMap>(cmap);
}
template <typename CMap>
ArcMap& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
};
template <typename _Value>
class EdgeMap
: public MapExtender<DefaultMap<Graph, Edge, _Value> > {
typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
public:
explicit EdgeMap(const Graph& _g)
: Parent(_g) {}
EdgeMap(const Graph& _g, const _Value& _v)
: Parent(_g, _v) {}
EdgeMap& operator=(const EdgeMap& cmap) {
return operator=<EdgeMap>(cmap);
}
template <typename CMap>
EdgeMap& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
};
// Alteration extension
Edge addEdge(const Node& from, const Node& to) {
Edge edge = Parent::addEdge(from, to);
notifier(Edge()).add(edge);
std::vector<Arc> arcs;
arcs.push_back(Parent::direct(edge, true));
arcs.push_back(Parent::direct(edge, false));
notifier(Arc()).add(arcs);
return edge;
}
void clear() {
notifier(Arc()).clear();
notifier(Edge()).clear();
Parent::clear();
}
void erase(const Edge& edge) {
std::vector<Arc> arcs;
arcs.push_back(Parent::direct(edge, true));
arcs.push_back(Parent::direct(edge, false));
notifier(Arc()).erase(arcs);
notifier(Edge()).erase(edge);
Parent::erase(edge);
}
EdgeSetExtender() {
arc_notifier.setContainer(*this);
edge_notifier.setContainer(*this);
}
~EdgeSetExtender() {
edge_notifier.clear();
arc_notifier.clear();
}
};
}
#endif

View File

@@ -0,0 +1,131 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
// This file contains a modified version of the enable_if library from BOOST.
// See the appropriate copyright notice below.
// Boost enable_if library
// Copyright 2003 (c) The Trustees of Indiana University.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Authors: Jaakko Jarvi (jajarvi at osl.iu.edu)
// Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu)
#ifndef LEMON_BITS_ENABLE_IF_H
#define LEMON_BITS_ENABLE_IF_H
//\file
//\brief Miscellaneous basic utilities
namespace lemon
{
// Basic type for defining "tags". A "YES" condition for \c enable_if.
// Basic type for defining "tags". A "YES" condition for \c enable_if.
//
//\sa False
struct True {
//\e
static const bool value = true;
};
// Basic type for defining "tags". A "NO" condition for \c enable_if.
// Basic type for defining "tags". A "NO" condition for \c enable_if.
//
//\sa True
struct False {
//\e
static const bool value = false;
};
template <typename T>
struct Wrap {
const T &value;
Wrap(const T &t) : value(t) {}
};
/**************** dummy class to avoid ambiguity ****************/
template<int T> struct dummy { dummy(int) {} };
/**************** enable_if from BOOST ****************/
template <typename Type, typename T = void>
struct exists {
typedef T type;
};
template <bool B, class T = void>
struct enable_if_c {
typedef T type;
};
template <class T>
struct enable_if_c<false, T> {};
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T> {};
template <bool B, class T>
struct lazy_enable_if_c {
typedef typename T::type type;
};
template <class T>
struct lazy_enable_if_c<false, T> {};
template <class Cond, class T>
struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
template <bool B, class T = void>
struct disable_if_c {
typedef T type;
};
template <class T>
struct disable_if_c<true, T> {};
template <class Cond, class T = void>
struct disable_if : public disable_if_c<Cond::value, T> {};
template <bool B, class T>
struct lazy_disable_if_c {
typedef typename T::type type;
};
template <class T>
struct lazy_disable_if_c<true, T> {};
template <class Cond, class T>
struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
} // namespace lemon
#endif

View File

@@ -0,0 +1,401 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H
#include <lemon/core.h>
#include <lemon/error.h>
namespace lemon {
template <typename _Digraph>
class DigraphAdaptorExtender : public _Digraph {
typedef _Digraph Parent;
public:
typedef _Digraph Digraph;
typedef DigraphAdaptorExtender Adaptor;
// Base extensions
typedef typename Parent::Node Node;
typedef typename Parent::Arc Arc;
int maxId(Node) const {
return Parent::maxNodeId();
}
int maxId(Arc) const {
return Parent::maxArcId();
}
Node fromId(int id, Node) const {
return Parent::nodeFromId(id);
}
Arc fromId(int id, Arc) const {
return Parent::arcFromId(id);
}
Node oppositeNode(const Node &n, const Arc &e) const {
if (n == Parent::source(e))
return Parent::target(e);
else if(n==Parent::target(e))
return Parent::source(e);
else
return INVALID;
}
class NodeIt : public Node {
const Adaptor* _adaptor;
public:
NodeIt() {}
NodeIt(Invalid i) : Node(i) { }
explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
_adaptor->first(static_cast<Node&>(*this));
}
NodeIt(const Adaptor& adaptor, const Node& node)
: Node(node), _adaptor(&adaptor) {}
NodeIt& operator++() {
_adaptor->next(*this);
return *this;
}
};
class ArcIt : public Arc {
const Adaptor* _adaptor;
public:
ArcIt() { }
ArcIt(Invalid i) : Arc(i) { }
explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
_adaptor->first(static_cast<Arc&>(*this));
}
ArcIt(const Adaptor& adaptor, const Arc& e) :
Arc(e), _adaptor(&adaptor) { }
ArcIt& operator++() {
_adaptor->next(*this);
return *this;
}
};
class OutArcIt : public Arc {
const Adaptor* _adaptor;
public:
OutArcIt() { }
OutArcIt(Invalid i) : Arc(i) { }
OutArcIt(const Adaptor& adaptor, const Node& node)
: _adaptor(&adaptor) {
_adaptor->firstOut(*this, node);
}
OutArcIt(const Adaptor& adaptor, const Arc& arc)
: Arc(arc), _adaptor(&adaptor) {}
OutArcIt& operator++() {
_adaptor->nextOut(*this);
return *this;
}
};
class InArcIt : public Arc {
const Adaptor* _adaptor;
public:
InArcIt() { }
InArcIt(Invalid i) : Arc(i) { }
InArcIt(const Adaptor& adaptor, const Node& node)
: _adaptor(&adaptor) {
_adaptor->firstIn(*this, node);
}
InArcIt(const Adaptor& adaptor, const Arc& arc) :
Arc(arc), _adaptor(&adaptor) {}
InArcIt& operator++() {
_adaptor->nextIn(*this);
return *this;
}
};
Node baseNode(const OutArcIt &e) const {
return Parent::source(e);
}
Node runningNode(const OutArcIt &e) const {
return Parent::target(e);
}
Node baseNode(const InArcIt &e) const {
return Parent::target(e);
}
Node runningNode(const InArcIt &e) const {
return Parent::source(e);
}
};
template <typename _Graph>
class GraphAdaptorExtender : public _Graph {
typedef _Graph Parent;
public:
typedef _Graph Graph;
typedef GraphAdaptorExtender Adaptor;
typedef True UndirectedTag;
typedef typename Parent::Node Node;
typedef typename Parent::Arc Arc;
typedef typename Parent::Edge Edge;
// Graph extension
int maxId(Node) const {
return Parent::maxNodeId();
}
int maxId(Arc) const {
return Parent::maxArcId();
}
int maxId(Edge) const {
return Parent::maxEdgeId();
}
Node fromId(int id, Node) const {
return Parent::nodeFromId(id);
}
Arc fromId(int id, Arc) const {
return Parent::arcFromId(id);
}
Edge fromId(int id, Edge) const {
return Parent::edgeFromId(id);
}
Node oppositeNode(const Node &n, const Edge &e) const {
if( n == Parent::u(e))
return Parent::v(e);
else if( n == Parent::v(e))
return Parent::u(e);
else
return INVALID;
}
Arc oppositeArc(const Arc &a) const {
return Parent::direct(a, !Parent::direction(a));
}
using Parent::direct;
Arc direct(const Edge &e, const Node &s) const {
return Parent::direct(e, Parent::u(e) == s);
}
class NodeIt : public Node {
const Adaptor* _adaptor;
public:
NodeIt() {}
NodeIt(Invalid i) : Node(i) { }
explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
_adaptor->first(static_cast<Node&>(*this));
}
NodeIt(const Adaptor& adaptor, const Node& node)
: Node(node), _adaptor(&adaptor) {}
NodeIt& operator++() {
_adaptor->next(*this);
return *this;
}
};
class ArcIt : public Arc {
const Adaptor* _adaptor;
public:
ArcIt() { }
ArcIt(Invalid i) : Arc(i) { }
explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
_adaptor->first(static_cast<Arc&>(*this));
}
ArcIt(const Adaptor& adaptor, const Arc& e) :
Arc(e), _adaptor(&adaptor) { }
ArcIt& operator++() {
_adaptor->next(*this);
return *this;
}
};
class OutArcIt : public Arc {
const Adaptor* _adaptor;
public:
OutArcIt() { }
OutArcIt(Invalid i) : Arc(i) { }
OutArcIt(const Adaptor& adaptor, const Node& node)
: _adaptor(&adaptor) {
_adaptor->firstOut(*this, node);
}
OutArcIt(const Adaptor& adaptor, const Arc& arc)
: Arc(arc), _adaptor(&adaptor) {}
OutArcIt& operator++() {
_adaptor->nextOut(*this);
return *this;
}
};
class InArcIt : public Arc {
const Adaptor* _adaptor;
public:
InArcIt() { }
InArcIt(Invalid i) : Arc(i) { }
InArcIt(const Adaptor& adaptor, const Node& node)
: _adaptor(&adaptor) {
_adaptor->firstIn(*this, node);
}
InArcIt(const Adaptor& adaptor, const Arc& arc) :
Arc(arc), _adaptor(&adaptor) {}
InArcIt& operator++() {
_adaptor->nextIn(*this);
return *this;
}
};
class EdgeIt : public Parent::Edge {
const Adaptor* _adaptor;
public:
EdgeIt() { }
EdgeIt(Invalid i) : Edge(i) { }
explicit EdgeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
_adaptor->first(static_cast<Edge&>(*this));
}
EdgeIt(const Adaptor& adaptor, const Edge& e) :
Edge(e), _adaptor(&adaptor) { }
EdgeIt& operator++() {
_adaptor->next(*this);
return *this;
}
};
class IncEdgeIt : public Edge {
friend class GraphAdaptorExtender;
const Adaptor* _adaptor;
bool direction;
public:
IncEdgeIt() { }
IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
IncEdgeIt(const Adaptor& adaptor, const Node &n) : _adaptor(&adaptor) {
_adaptor->firstInc(static_cast<Edge&>(*this), direction, n);
}
IncEdgeIt(const Adaptor& adaptor, const Edge &e, const Node &n)
: _adaptor(&adaptor), Edge(e) {
direction = (_adaptor->u(e) == n);
}
IncEdgeIt& operator++() {
_adaptor->nextInc(*this, direction);
return *this;
}
};
Node baseNode(const OutArcIt &a) const {
return Parent::source(a);
}
Node runningNode(const OutArcIt &a) const {
return Parent::target(a);
}
Node baseNode(const InArcIt &a) const {
return Parent::target(a);
}
Node runningNode(const InArcIt &a) const {
return Parent::source(a);
}
Node baseNode(const IncEdgeIt &e) const {
return e.direction ? Parent::u(e) : Parent::v(e);
}
Node runningNode(const IncEdgeIt &e) const {
return e.direction ? Parent::v(e) : Parent::u(e);
}
};
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_LOCK_H
#define LEMON_BITS_LOCK_H
#include <lemon/config.h>
#if defined(LEMON_USE_PTHREAD)
#include <pthread.h>
#elif defined(LEMON_USE_WIN32_THREADS)
#include <lemon/bits/windows.h>
#endif
namespace lemon {
namespace bits {
#if defined(LEMON_USE_PTHREAD)
class Lock {
public:
Lock() {
pthread_mutex_init(&_lock, 0);
}
~Lock() {
pthread_mutex_destroy(&_lock);
}
void lock() {
pthread_mutex_lock(&_lock);
}
void unlock() {
pthread_mutex_unlock(&_lock);
}
private:
pthread_mutex_t _lock;
};
#elif defined(LEMON_USE_WIN32_THREADS)
class Lock : public WinLock {};
#else
class Lock {
public:
Lock() {}
~Lock() {}
void lock() {}
void unlock() {}
};
#endif
}
}
#endif

View File

@@ -0,0 +1,332 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_MAP_EXTENDER_H
#define LEMON_BITS_MAP_EXTENDER_H
#include <iterator>
#include <lemon/bits/traits.h>
#include <lemon/concept_check.h>
#include <lemon/concepts/maps.h>
//\file
//\brief Extenders for iterable maps.
namespace lemon {
// \ingroup graphbits
//
// \brief Extender for maps
template <typename _Map>
class MapExtender : public _Map {
typedef _Map Parent;
typedef typename Parent::GraphType GraphType;
public:
typedef MapExtender Map;
typedef typename Parent::Key Item;
typedef typename Parent::Key Key;
typedef typename Parent::Value Value;
typedef typename Parent::Reference Reference;
typedef typename Parent::ConstReference ConstReference;
typedef typename Parent::ReferenceMapTag ReferenceMapTag;
class MapIt;
class ConstMapIt;
friend class MapIt;
friend class ConstMapIt;
public:
MapExtender(const GraphType& graph)
: Parent(graph) {}
MapExtender(const GraphType& graph, const Value& value)
: Parent(graph, value) {}
private:
MapExtender& operator=(const MapExtender& cmap) {
return operator=<MapExtender>(cmap);
}
template <typename CMap>
MapExtender& operator=(const CMap& cmap) {
Parent::operator=(cmap);
return *this;
}
public:
class MapIt : public Item {
typedef Item Parent;
public:
typedef typename Map::Value Value;
MapIt() : map(NULL) {}
MapIt(Invalid i) : Parent(i), map(NULL) {}
explicit MapIt(Map& _map) : map(&_map) {
map->notifier()->first(*this);
}
MapIt(const Map& _map, const Item& item)
: Parent(item), map(&_map) {}
MapIt& operator++() {
map->notifier()->next(*this);
return *this;
}
typename MapTraits<Map>::ConstReturnValue operator*() const {
return (*map)[*this];
}
typename MapTraits<Map>::ReturnValue operator*() {
return (*map)[*this];
}
void set(const Value& value) {
map->set(*this, value);
}
protected:
Map* map;
};
class ConstMapIt : public Item {
typedef Item Parent;
public:
typedef typename Map::Value Value;
ConstMapIt() : map(NULL) {}
ConstMapIt(Invalid i) : Parent(i), map(NULL) {}
explicit ConstMapIt(Map& _map) : map(&_map) {
map->notifier()->first(*this);
}
ConstMapIt(const Map& _map, const Item& item)
: Parent(item), map(_map) {}
ConstMapIt& operator++() {
map->notifier()->next(*this);
return *this;
}
typename MapTraits<Map>::ConstReturnValue operator*() const {
return map[*this];
}
protected:
const Map* map;
};
class ItemIt : public Item {
typedef Item Parent;
public:
ItemIt() : map(NULL) {}
ItemIt(Invalid i) : Parent(i), map(NULL) {}
explicit ItemIt(Map& _map) : map(&_map) {
map->notifier()->first(*this);
}
ItemIt(const Map& _map, const Item& item)
: Parent(item), map(&_map) {}
ItemIt& operator++() {
map->notifier()->next(*this);
return *this;
}
protected:
const Map* map;
};
};
// \ingroup graphbits
//
// \brief Extender for maps which use a subset of the items.
template <typename _Graph, typename _Map>
class SubMapExtender : public _Map {
typedef _Map Parent;
typedef _Graph GraphType;
public:
typedef SubMapExtender Map;
typedef typename Parent::Key Item;
typedef typename Parent::Key Key;
typedef typename Parent::Value Value;
typedef typename Parent::Reference Reference;
typedef typename Parent::ConstReference ConstReference;
typedef typename Parent::ReferenceMapTag ReferenceMapTag;
class MapIt;
class ConstMapIt;
friend class MapIt;
friend class ConstMapIt;
public:
SubMapExtender(const GraphType& _graph)
: Parent(_graph), graph(_graph) {}
SubMapExtender(const GraphType& _graph, const Value& _value)
: Parent(_graph, _value), graph(_graph) {}
private:
SubMapExtender& operator=(const SubMapExtender& cmap) {
return operator=<MapExtender>(cmap);
}
template <typename CMap>
SubMapExtender& operator=(const CMap& cmap) {
checkConcept<concepts::ReadMap<Key, Value>, CMap>();
Item it;
for (graph.first(it); it != INVALID; graph.next(it)) {
Parent::set(it, cmap[it]);
}
return *this;
}
public:
class MapIt : public Item {
typedef Item Parent;
public:
typedef typename Map::Value Value;
MapIt() : map(NULL) {}
MapIt(Invalid i) : Parent(i), map(NULL) { }
explicit MapIt(Map& _map) : map(&_map) {
map->graph.first(*this);
}
MapIt(const Map& _map, const Item& item)
: Parent(item), map(&_map) {}
MapIt& operator++() {
map->graph.next(*this);
return *this;
}
typename MapTraits<Map>::ConstReturnValue operator*() const {
return (*map)[*this];
}
typename MapTraits<Map>::ReturnValue operator*() {
return (*map)[*this];
}
void set(const Value& value) {
map->set(*this, value);
}
protected:
Map* map;
};
class ConstMapIt : public Item {
typedef Item Parent;
public:
typedef typename Map::Value Value;
ConstMapIt() : map(NULL) {}
ConstMapIt(Invalid i) : Parent(i), map(NULL) { }
explicit ConstMapIt(Map& _map) : map(&_map) {
map->graph.first(*this);
}
ConstMapIt(const Map& _map, const Item& item)
: Parent(item), map(&_map) {}
ConstMapIt& operator++() {
map->graph.next(*this);
return *this;
}
typename MapTraits<Map>::ConstReturnValue operator*() const {
return (*map)[*this];
}
protected:
const Map* map;
};
class ItemIt : public Item {
typedef Item Parent;
public:
ItemIt() : map(NULL) {}
ItemIt(Invalid i) : Parent(i), map(NULL) { }
explicit ItemIt(Map& _map) : map(&_map) {
map->graph.first(*this);
}
ItemIt(const Map& _map, const Item& item)
: Parent(item), map(&_map) {}
ItemIt& operator++() {
map->graph.next(*this);
return *this;
}
protected:
const Map* map;
};
private:
const GraphType& graph;
};
}
#endif

View File

@@ -0,0 +1,177 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_PATH_DUMP_H
#define LEMON_BITS_PATH_DUMP_H
#include <lemon/core.h>
#include <lemon/concept_check.h>
namespace lemon {
template <typename _Digraph, typename _PredMap>
class PredMapPath {
public:
typedef True RevPathTag;
typedef _Digraph Digraph;
typedef typename Digraph::Arc Arc;
typedef _PredMap PredMap;
PredMapPath(const Digraph& _digraph, const PredMap& _predMap,
typename Digraph::Node _target)
: digraph(_digraph), predMap(_predMap), target(_target) {}
int length() const {
int len = 0;
typename Digraph::Node node = target;
typename Digraph::Arc arc;
while ((arc = predMap[node]) != INVALID) {
node = digraph.source(arc);
++len;
}
return len;
}
bool empty() const {
return predMap[target] == INVALID;
}
class RevArcIt {
public:
RevArcIt() {}
RevArcIt(Invalid) : path(0), current(INVALID) {}
RevArcIt(const PredMapPath& _path)
: path(&_path), current(_path.target) {
if (path->predMap[current] == INVALID) current = INVALID;
}
operator const typename Digraph::Arc() const {
return path->predMap[current];
}
RevArcIt& operator++() {
current = path->digraph.source(path->predMap[current]);
if (path->predMap[current] == INVALID) current = INVALID;
return *this;
}
bool operator==(const RevArcIt& e) const {
return current == e.current;
}
bool operator!=(const RevArcIt& e) const {
return current != e.current;
}
bool operator<(const RevArcIt& e) const {
return current < e.current;
}
private:
const PredMapPath* path;
typename Digraph::Node current;
};
private:
const Digraph& digraph;
const PredMap& predMap;
typename Digraph::Node target;
};
template <typename _Digraph, typename _PredMatrixMap>
class PredMatrixMapPath {
public:
typedef True RevPathTag;
typedef _Digraph Digraph;
typedef typename Digraph::Arc Arc;
typedef _PredMatrixMap PredMatrixMap;
PredMatrixMapPath(const Digraph& _digraph,
const PredMatrixMap& _predMatrixMap,
typename Digraph::Node _source,
typename Digraph::Node _target)
: digraph(_digraph), predMatrixMap(_predMatrixMap),
source(_source), target(_target) {}
int length() const {
int len = 0;
typename Digraph::Node node = target;
typename Digraph::Arc arc;
while ((arc = predMatrixMap(source, node)) != INVALID) {
node = digraph.source(arc);
++len;
}
return len;
}
bool empty() const {
return predMatrixMap(source, target) == INVALID;
}
class RevArcIt {
public:
RevArcIt() {}
RevArcIt(Invalid) : path(0), current(INVALID) {}
RevArcIt(const PredMatrixMapPath& _path)
: path(&_path), current(_path.target) {
if (path->predMatrixMap(path->source, current) == INVALID)
current = INVALID;
}
operator const typename Digraph::Arc() const {
return path->predMatrixMap(path->source, current);
}
RevArcIt& operator++() {
current =
path->digraph.source(path->predMatrixMap(path->source, current));
if (path->predMatrixMap(path->source, current) == INVALID)
current = INVALID;
return *this;
}
bool operator==(const RevArcIt& e) const {
return current == e.current;
}
bool operator!=(const RevArcIt& e) const {
return current != e.current;
}
bool operator<(const RevArcIt& e) const {
return current < e.current;
}
private:
const PredMatrixMapPath* path;
typename Digraph::Node current;
};
private:
const Digraph& digraph;
const PredMatrixMap& predMatrixMap;
typename Digraph::Node source;
typename Digraph::Node target;
};
}
#endif

View File

@@ -0,0 +1,194 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_SOLVER_BITS_H
#define LEMON_BITS_SOLVER_BITS_H
#include <vector>
namespace lemon {
namespace _solver_bits {
class VarIndex {
private:
struct ItemT {
int prev, next;
int index;
};
std::vector<ItemT> items;
int first_item, last_item, first_free_item;
std::vector<int> cross;
public:
VarIndex()
: first_item(-1), last_item(-1), first_free_item(-1) {
}
void clear() {
first_item = -1;
last_item = -1;
first_free_item = -1;
items.clear();
cross.clear();
}
int addIndex(int idx) {
int n;
if (first_free_item == -1) {
n = items.size();
items.push_back(ItemT());
} else {
n = first_free_item;
first_free_item = items[n].next;
if (first_free_item != -1) {
items[first_free_item].prev = -1;
}
}
items[n].index = idx;
if (static_cast<int>(cross.size()) <= idx) {
cross.resize(idx + 1, -1);
}
cross[idx] = n;
items[n].prev = last_item;
items[n].next = -1;
if (last_item != -1) {
items[last_item].next = n;
} else {
first_item = n;
}
last_item = n;
return n;
}
int addIndex(int idx, int n) {
while (n >= static_cast<int>(items.size())) {
items.push_back(ItemT());
items.back().prev = -1;
items.back().next = first_free_item;
if (first_free_item != -1) {
items[first_free_item].prev = items.size() - 1;
}
first_free_item = items.size() - 1;
}
if (items[n].next != -1) {
items[items[n].next].prev = items[n].prev;
}
if (items[n].prev != -1) {
items[items[n].prev].next = items[n].next;
} else {
first_free_item = items[n].next;
}
items[n].index = idx;
if (static_cast<int>(cross.size()) <= idx) {
cross.resize(idx + 1, -1);
}
cross[idx] = n;
items[n].prev = last_item;
items[n].next = -1;
if (last_item != -1) {
items[last_item].next = n;
} else {
first_item = n;
}
last_item = n;
return n;
}
void eraseIndex(int idx) {
int n = cross[idx];
if (items[n].prev != -1) {
items[items[n].prev].next = items[n].next;
} else {
first_item = items[n].next;
}
if (items[n].next != -1) {
items[items[n].next].prev = items[n].prev;
} else {
last_item = items[n].prev;
}
if (first_free_item != -1) {
items[first_free_item].prev = n;
}
items[n].next = first_free_item;
items[n].prev = -1;
first_free_item = n;
while (!cross.empty() && cross.back() == -1) {
cross.pop_back();
}
}
int maxIndex() const {
return cross.size() - 1;
}
void shiftIndices(int idx) {
for (int i = idx + 1; i < static_cast<int>(cross.size()); ++i) {
cross[i - 1] = cross[i];
if (cross[i] != -1) {
--items[cross[i]].index;
}
}
cross.back() = -1;
cross.pop_back();
while (!cross.empty() && cross.back() == -1) {
cross.pop_back();
}
}
void relocateIndex(int idx, int jdx) {
cross[idx] = cross[jdx];
items[cross[jdx]].index = idx;
cross[jdx] = -1;
while (!cross.empty() && cross.back() == -1) {
cross.pop_back();
}
}
int operator[](int idx) const {
return cross[idx];
}
int operator()(int fdx) const {
return items[fdx].index;
}
void firstItem(int& fdx) const {
fdx = first_item;
}
void nextItem(int& fdx) const {
fdx = items[fdx].next;
}
};
}
}
#endif

View File

@@ -0,0 +1,388 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_TRAITS_H
#define LEMON_BITS_TRAITS_H
//\file
//\brief Traits for graphs and maps
//
#include <lemon/bits/enable_if.h>
namespace lemon {
struct InvalidType {};
template <typename GR, typename _Item>
class ItemSetTraits {};
template <typename GR, typename Enable = void>
struct NodeNotifierIndicator {
typedef InvalidType Type;
};
template <typename GR>
struct NodeNotifierIndicator<
GR,
typename enable_if<typename GR::NodeNotifier::Notifier, void>::type
> {
typedef typename GR::NodeNotifier Type;
};
template <typename GR>
class ItemSetTraits<GR, typename GR::Node> {
public:
typedef GR Graph;
typedef GR Digraph;
typedef typename GR::Node Item;
typedef typename GR::NodeIt ItemIt;
typedef typename NodeNotifierIndicator<GR>::Type ItemNotifier;
template <typename V>
class Map : public GR::template NodeMap<V> {
typedef typename GR::template NodeMap<V> Parent;
public:
typedef typename GR::template NodeMap<V> Type;
typedef typename Parent::Value Value;
Map(const GR& _digraph) : Parent(_digraph) {}
Map(const GR& _digraph, const Value& _value)
: Parent(_digraph, _value) {}
};
};
template <typename GR, typename Enable = void>
struct ArcNotifierIndicator {
typedef InvalidType Type;
};
template <typename GR>
struct ArcNotifierIndicator<
GR,
typename enable_if<typename GR::ArcNotifier::Notifier, void>::type
> {
typedef typename GR::ArcNotifier Type;
};
template <typename GR>
class ItemSetTraits<GR, typename GR::Arc> {
public:
typedef GR Graph;
typedef GR Digraph;
typedef typename GR::Arc Item;
typedef typename GR::ArcIt ItemIt;
typedef typename ArcNotifierIndicator<GR>::Type ItemNotifier;
template <typename V>
class Map : public GR::template ArcMap<V> {
typedef typename GR::template ArcMap<V> Parent;
public:
typedef typename GR::template ArcMap<V> Type;
typedef typename Parent::Value Value;
Map(const GR& _digraph) : Parent(_digraph) {}
Map(const GR& _digraph, const Value& _value)
: Parent(_digraph, _value) {}
};
};
template <typename GR, typename Enable = void>
struct EdgeNotifierIndicator {
typedef InvalidType Type;
};
template <typename GR>
struct EdgeNotifierIndicator<
GR,
typename enable_if<typename GR::EdgeNotifier::Notifier, void>::type
> {
typedef typename GR::EdgeNotifier Type;
};
template <typename GR>
class ItemSetTraits<GR, typename GR::Edge> {
public:
typedef GR Graph;
typedef GR Digraph;
typedef typename GR::Edge Item;
typedef typename GR::EdgeIt ItemIt;
typedef typename EdgeNotifierIndicator<GR>::Type ItemNotifier;
template <typename V>
class Map : public GR::template EdgeMap<V> {
typedef typename GR::template EdgeMap<V> Parent;
public:
typedef typename GR::template EdgeMap<V> Type;
typedef typename Parent::Value Value;
Map(const GR& _digraph) : Parent(_digraph) {}
Map(const GR& _digraph, const Value& _value)
: Parent(_digraph, _value) {}
};
};
template <typename GR, typename Enable = void>
struct RedNodeNotifierIndicator {
typedef InvalidType Type;
};
template <typename GR>
struct RedNodeNotifierIndicator<
GR,
typename enable_if<typename GR::RedNodeNotifier::Notifier, void>::type
> {
typedef typename GR::RedNodeNotifier Type;
};
template <typename GR>
class ItemSetTraits<GR, typename GR::RedNode> {
public:
typedef GR BpGraph;
typedef GR Graph;
typedef GR Digraph;
typedef typename GR::RedNode Item;
typedef typename GR::RedNodeIt ItemIt;
typedef typename RedNodeNotifierIndicator<GR>::Type ItemNotifier;
template <typename V>
class Map : public GR::template RedNodeMap<V> {
typedef typename GR::template RedNodeMap<V> Parent;
public:
typedef typename GR::template RedNodeMap<V> Type;
typedef typename Parent::Value Value;
Map(const GR& _bpgraph) : Parent(_bpgraph) {}
Map(const GR& _bpgraph, const Value& _value)
: Parent(_bpgraph, _value) {}
};
};
template <typename GR, typename Enable = void>
struct BlueNodeNotifierIndicator {
typedef InvalidType Type;
};
template <typename GR>
struct BlueNodeNotifierIndicator<
GR,
typename enable_if<typename GR::BlueNodeNotifier::Notifier, void>::type
> {
typedef typename GR::BlueNodeNotifier Type;
};
template <typename GR>
class ItemSetTraits<GR, typename GR::BlueNode> {
public:
typedef GR BpGraph;
typedef GR Graph;
typedef GR Digraph;
typedef typename GR::BlueNode Item;
typedef typename GR::BlueNodeIt ItemIt;
typedef typename BlueNodeNotifierIndicator<GR>::Type ItemNotifier;
template <typename V>
class Map : public GR::template BlueNodeMap<V> {
typedef typename GR::template BlueNodeMap<V> Parent;
public:
typedef typename GR::template BlueNodeMap<V> Type;
typedef typename Parent::Value Value;
Map(const GR& _bpgraph) : Parent(_bpgraph) {}
Map(const GR& _bpgraph, const Value& _value)
: Parent(_bpgraph, _value) {}
};
};
template <typename Map, typename Enable = void>
struct MapTraits {
typedef False ReferenceMapTag;
typedef typename Map::Key Key;
typedef typename Map::Value Value;
typedef Value ConstReturnValue;
typedef Value ReturnValue;
};
template <typename Map>
struct MapTraits<
Map, typename enable_if<typename Map::ReferenceMapTag, void>::type >
{
typedef True ReferenceMapTag;
typedef typename Map::Key Key;
typedef typename Map::Value Value;
typedef typename Map::ConstReference ConstReturnValue;
typedef typename Map::Reference ReturnValue;
typedef typename Map::ConstReference ConstReference;
typedef typename Map::Reference Reference;
};
template <typename MatrixMap, typename Enable = void>
struct MatrixMapTraits {
typedef False ReferenceMapTag;
typedef typename MatrixMap::FirstKey FirstKey;
typedef typename MatrixMap::SecondKey SecondKey;
typedef typename MatrixMap::Value Value;
typedef Value ConstReturnValue;
typedef Value ReturnValue;
};
template <typename MatrixMap>
struct MatrixMapTraits<
MatrixMap, typename enable_if<typename MatrixMap::ReferenceMapTag,
void>::type >
{
typedef True ReferenceMapTag;
typedef typename MatrixMap::FirstKey FirstKey;
typedef typename MatrixMap::SecondKey SecondKey;
typedef typename MatrixMap::Value Value;
typedef typename MatrixMap::ConstReference ConstReturnValue;
typedef typename MatrixMap::Reference ReturnValue;
typedef typename MatrixMap::ConstReference ConstReference;
typedef typename MatrixMap::Reference Reference;
};
// Indicators for the tags
template <typename GR, typename Enable = void>
struct NodeNumTagIndicator {
static const bool value = false;
};
template <typename GR>
struct NodeNumTagIndicator<
GR,
typename enable_if<typename GR::NodeNumTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct ArcNumTagIndicator {
static const bool value = false;
};
template <typename GR>
struct ArcNumTagIndicator<
GR,
typename enable_if<typename GR::ArcNumTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct EdgeNumTagIndicator {
static const bool value = false;
};
template <typename GR>
struct EdgeNumTagIndicator<
GR,
typename enable_if<typename GR::EdgeNumTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct FindArcTagIndicator {
static const bool value = false;
};
template <typename GR>
struct FindArcTagIndicator<
GR,
typename enable_if<typename GR::FindArcTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct FindEdgeTagIndicator {
static const bool value = false;
};
template <typename GR>
struct FindEdgeTagIndicator<
GR,
typename enable_if<typename GR::FindEdgeTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct UndirectedTagIndicator {
static const bool value = false;
};
template <typename GR>
struct UndirectedTagIndicator<
GR,
typename enable_if<typename GR::UndirectedTag, void>::type
> {
static const bool value = true;
};
template <typename GR, typename Enable = void>
struct BuildTagIndicator {
static const bool value = false;
};
template <typename GR>
struct BuildTagIndicator<
GR,
typename enable_if<typename GR::BuildTag, void>::type
> {
static const bool value = true;
};
}
#endif

View File

@@ -0,0 +1,494 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_VARIANT_H
#define LEMON_BITS_VARIANT_H
#include <lemon/assert.h>
// \file
// \brief Variant types
namespace lemon {
namespace _variant_bits {
template <int left, int right>
struct CTMax {
static const int value = left < right ? right : left;
};
}
// \brief Simple Variant type for two types
//
// Simple Variant type for two types. The Variant type is a type-safe
// union. C++ has strong limitations for using unions, for
// example you cannot store a type with non-default constructor or
// destructor in a union. This class always knowns the current
// state of the variant and it cares for the proper construction
// and destruction.
template <typename _First, typename _Second>
class BiVariant {
public:
// \brief The \c First type.
typedef _First First;
// \brief The \c Second type.
typedef _Second Second;
// \brief Constructor
//
// This constructor initalizes to the default value of the \c First
// type.
BiVariant() {
flag = true;
new(reinterpret_cast<First*>(data)) First();
}
// \brief Constructor
//
// This constructor initalizes to the given value of the \c First
// type.
BiVariant(const First& f) {
flag = true;
new(reinterpret_cast<First*>(data)) First(f);
}
// \brief Constructor
//
// This constructor initalizes to the given value of the \c
// Second type.
BiVariant(const Second& s) {
flag = false;
new(reinterpret_cast<Second*>(data)) Second(s);
}
// \brief Copy constructor
//
// Copy constructor
BiVariant(const BiVariant& bivariant) {
flag = bivariant.flag;
if (flag) {
new(reinterpret_cast<First*>(data)) First(bivariant.first());
} else {
new(reinterpret_cast<Second*>(data)) Second(bivariant.second());
}
}
// \brief Destrcutor
//
// Destructor
~BiVariant() {
destroy();
}
// \brief Set to the default value of the \c First type.
//
// This function sets the variant to the default value of the \c
// First type.
BiVariant& setFirst() {
destroy();
flag = true;
new(reinterpret_cast<First*>(data)) First();
return *this;
}
// \brief Set to the given value of the \c First type.
//
// This function sets the variant to the given value of the \c
// First type.
BiVariant& setFirst(const First& f) {
destroy();
flag = true;
new(reinterpret_cast<First*>(data)) First(f);
return *this;
}
// \brief Set to the default value of the \c Second type.
//
// This function sets the variant to the default value of the \c
// Second type.
BiVariant& setSecond() {
destroy();
flag = false;
new(reinterpret_cast<Second*>(data)) Second();
return *this;
}
// \brief Set to the given value of the \c Second type.
//
// This function sets the variant to the given value of the \c
// Second type.
BiVariant& setSecond(const Second& s) {
destroy();
flag = false;
new(reinterpret_cast<Second*>(data)) Second(s);
return *this;
}
// \brief Operator form of the \c setFirst()
BiVariant& operator=(const First& f) {
return setFirst(f);
}
// \brief Operator form of the \c setSecond()
BiVariant& operator=(const Second& s) {
return setSecond(s);
}
// \brief Assign operator
BiVariant& operator=(const BiVariant& bivariant) {
if (this == &bivariant) return *this;
destroy();
flag = bivariant.flag;
if (flag) {
new(reinterpret_cast<First*>(data)) First(bivariant.first());
} else {
new(reinterpret_cast<Second*>(data)) Second(bivariant.second());
}
return *this;
}
// \brief Reference to the value
//
// Reference to the value of the \c First type.
// \pre The BiVariant should store value of \c First type.
First& first() {
LEMON_DEBUG(flag, "Variant wrong state");
return *reinterpret_cast<First*>(data);
}
// \brief Const reference to the value
//
// Const reference to the value of the \c First type.
// \pre The BiVariant should store value of \c First type.
const First& first() const {
LEMON_DEBUG(flag, "Variant wrong state");
return *reinterpret_cast<const First*>(data);
}
// \brief Operator form of the \c first()
operator First&() { return first(); }
// \brief Operator form of the const \c first()
operator const First&() const { return first(); }
// \brief Reference to the value
//
// Reference to the value of the \c Second type.
// \pre The BiVariant should store value of \c Second type.
Second& second() {
LEMON_DEBUG(!flag, "Variant wrong state");
return *reinterpret_cast<Second*>(data);
}
// \brief Const reference to the value
//
// Const reference to the value of the \c Second type.
// \pre The BiVariant should store value of \c Second type.
const Second& second() const {
LEMON_DEBUG(!flag, "Variant wrong state");
return *reinterpret_cast<const Second*>(data);
}
// \brief Operator form of the \c second()
operator Second&() { return second(); }
// \brief Operator form of the const \c second()
operator const Second&() const { return second(); }
// \brief %True when the variant is in the first state
//
// %True when the variant stores value of the \c First type.
bool firstState() const { return flag; }
// \brief %True when the variant is in the second state
//
// %True when the variant stores value of the \c Second type.
bool secondState() const { return !flag; }
private:
void destroy() {
if (flag) {
reinterpret_cast<First*>(data)->~First();
} else {
reinterpret_cast<Second*>(data)->~Second();
}
}
char data[_variant_bits::CTMax<sizeof(First), sizeof(Second)>::value];
bool flag;
};
namespace _variant_bits {
template <int _idx, typename _TypeMap>
struct Memory {
typedef typename _TypeMap::template Map<_idx>::Type Current;
static void destroy(int index, char* place) {
if (index == _idx) {
reinterpret_cast<Current*>(place)->~Current();
} else {
Memory<_idx - 1, _TypeMap>::destroy(index, place);
}
}
static void copy(int index, char* to, const char* from) {
if (index == _idx) {
new (reinterpret_cast<Current*>(to))
Current(reinterpret_cast<const Current*>(from));
} else {
Memory<_idx - 1, _TypeMap>::copy(index, to, from);
}
}
};
template <typename _TypeMap>
struct Memory<-1, _TypeMap> {
static void destroy(int, char*) {
LEMON_DEBUG(false, "Variant wrong index.");
}
static void copy(int, char*, const char*) {
LEMON_DEBUG(false, "Variant wrong index.");
}
};
template <int _idx, typename _TypeMap>
struct Size {
static const int value =
CTMax<sizeof(typename _TypeMap::template Map<_idx>::Type),
Size<_idx - 1, _TypeMap>::value>::value;
};
template <typename _TypeMap>
struct Size<0, _TypeMap> {
static const int value =
sizeof(typename _TypeMap::template Map<0>::Type);
};
}
// \brief Variant type
//
// Simple Variant type. The Variant type is a type-safe union.
// C++ has strong limitations for using unions, for example you
// cannot store type with non-default constructor or destructor in
// a union. This class always knowns the current state of the
// variant and it cares for the proper construction and
// destruction.
//
// \param _num The number of the types which can be stored in the
// variant type.
// \param _TypeMap This class describes the types of the Variant. The
// _TypeMap::Map<index>::Type should be a valid type for each index
// in the range {0, 1, ..., _num - 1}. The \c VariantTypeMap is helper
// class to define such type mappings up to 10 types.
//
// And the usage of the class:
//\code
// typedef Variant<3, VariantTypeMap<int, std::string, double> > MyVariant;
// MyVariant var;
// var.set<0>(12);
// std::cout << var.get<0>() << std::endl;
// var.set<1>("alpha");
// std::cout << var.get<1>() << std::endl;
// var.set<2>(0.75);
// std::cout << var.get<2>() << std::endl;
//\endcode
//
// The result of course:
//\code
// 12
// alpha
// 0.75
//\endcode
template <int _num, typename _TypeMap>
class Variant {
public:
static const int num = _num;
typedef _TypeMap TypeMap;
// \brief Constructor
//
// This constructor initalizes to the default value of the \c type
// with 0 index.
Variant() {
flag = 0;
new(reinterpret_cast<typename TypeMap::template Map<0>::Type*>(data))
typename TypeMap::template Map<0>::Type();
}
// \brief Copy constructor
//
// Copy constructor
Variant(const Variant& variant) {
flag = variant.flag;
_variant_bits::Memory<num - 1, TypeMap>::copy(flag, data, variant.data);
}
// \brief Assign operator
//
// Assign operator
Variant& operator=(const Variant& variant) {
if (this == &variant) return *this;
_variant_bits::Memory<num - 1, TypeMap>::
destroy(flag, data);
flag = variant.flag;
_variant_bits::Memory<num - 1, TypeMap>::
copy(flag, data, variant.data);
return *this;
}
// \brief Destrcutor
//
// Destructor
~Variant() {
_variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
}
// \brief Set to the default value of the type with \c _idx index.
//
// This function sets the variant to the default value of the
// type with \c _idx index.
template <int _idx>
Variant& set() {
_variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
flag = _idx;
new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data))
typename TypeMap::template Map<_idx>::Type();
return *this;
}
// \brief Set to the given value of the type with \c _idx index.
//
// This function sets the variant to the given value of the type
// with \c _idx index.
template <int _idx>
Variant& set(const typename _TypeMap::template Map<_idx>::Type& init) {
_variant_bits::Memory<num - 1, TypeMap>::destroy(flag, data);
flag = _idx;
new(reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>(data))
typename TypeMap::template Map<_idx>::Type(init);
return *this;
}
// \brief Gets the current value of the type with \c _idx index.
//
// Gets the current value of the type with \c _idx index.
template <int _idx>
const typename TypeMap::template Map<_idx>::Type& get() const {
LEMON_DEBUG(_idx == flag, "Variant wrong index");
return *reinterpret_cast<const typename TypeMap::
template Map<_idx>::Type*>(data);
}
// \brief Gets the current value of the type with \c _idx index.
//
// Gets the current value of the type with \c _idx index.
template <int _idx>
typename _TypeMap::template Map<_idx>::Type& get() {
LEMON_DEBUG(_idx == flag, "Variant wrong index");
return *reinterpret_cast<typename TypeMap::template Map<_idx>::Type*>
(data);
}
// \brief Returns the current state of the variant.
//
// Returns the current state of the variant.
int state() const {
return flag;
}
private:
char data[_variant_bits::Size<num - 1, TypeMap>::value];
int flag;
};
namespace _variant_bits {
template <int _index, typename _List>
struct Get {
typedef typename Get<_index - 1, typename _List::Next>::Type Type;
};
template <typename _List>
struct Get<0, _List> {
typedef typename _List::Type Type;
};
struct List {};
template <typename _Type, typename _List>
struct Insert {
typedef _List Next;
typedef _Type Type;
};
template <int _idx, typename _T0, typename _T1, typename _T2,
typename _T3, typename _T4, typename _T5, typename _T6,
typename _T7, typename _T8, typename _T9>
struct Mapper {
typedef List L10;
typedef Insert<_T9, L10> L9;
typedef Insert<_T8, L9> L8;
typedef Insert<_T7, L8> L7;
typedef Insert<_T6, L7> L6;
typedef Insert<_T5, L6> L5;
typedef Insert<_T4, L5> L4;
typedef Insert<_T3, L4> L3;
typedef Insert<_T2, L3> L2;
typedef Insert<_T1, L2> L1;
typedef Insert<_T0, L1> L0;
typedef typename Get<_idx, L0>::Type Type;
};
}
// \brief Helper class for Variant
//
// Helper class to define type mappings for Variant. This class
// converts the template parameters to be mappable by integer.
// \see Variant
template <
typename _T0,
typename _T1 = void, typename _T2 = void, typename _T3 = void,
typename _T4 = void, typename _T5 = void, typename _T6 = void,
typename _T7 = void, typename _T8 = void, typename _T9 = void>
struct VariantTypeMap {
template <int _idx>
struct Map {
typedef typename _variant_bits::
Mapper<_idx, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9>::Type
Type;
};
};
}
#endif

View File

@@ -0,0 +1,244 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2009
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_VECTOR_MAP_H
#define LEMON_BITS_VECTOR_MAP_H
#include <vector>
#include <algorithm>
#include <lemon/core.h>
#include <lemon/bits/alteration_notifier.h>
#include <lemon/concept_check.h>
#include <lemon/concepts/maps.h>
//\ingroup graphbits
//
//\file
//\brief Vector based graph maps.
namespace lemon {
// \ingroup graphbits
//
// \brief Graph map based on the std::vector storage.
//
// The VectorMap template class is graph map structure that automatically
// updates the map when a key is added to or erased from the graph.
// This map type uses std::vector to store the values.
//
// \tparam _Graph The graph this map is attached to.
// \tparam _Item The item type of the graph items.
// \tparam _Value The value type of the map.
template <typename _Graph, typename _Item, typename _Value>
class VectorMap
: public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
private:
// The container type of the map.
typedef std::vector<_Value> Container;
public:
// The graph type of the map.
typedef _Graph GraphType;
// The item type of the map.
typedef _Item Item;
// The reference map tag.
typedef True ReferenceMapTag;
// The key type of the map.
typedef _Item Key;
// The value type of the map.
typedef _Value Value;
// The notifier type.
typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
// The map type.
typedef VectorMap Map;
// The reference type of the map;
typedef typename Container::reference Reference;
// The const reference type of the map;
typedef typename Container::const_reference ConstReference;
private:
// The base class of the map.
typedef typename Notifier::ObserverBase Parent;
public:
// \brief Constructor to attach the new map into the notifier.
//
// It constructs a map and attachs it into the notifier.
// It adds all the items of the graph to the map.
VectorMap(const GraphType& graph) {
Parent::attach(graph.notifier(Item()));
container.resize(Parent::notifier()->maxId() + 1);
}
// \brief Constructor uses given value to initialize the map.
//
// It constructs a map uses a given value to initialize the map.
// It adds all the items of the graph to the map.
VectorMap(const GraphType& graph, const Value& value) {
Parent::attach(graph.notifier(Item()));
container.resize(Parent::notifier()->maxId() + 1, value);
}
private:
// \brief Copy constructor
//
// Copy constructor.
VectorMap(const VectorMap& _copy) : Parent() {
if (_copy.attached()) {
Parent::attach(*_copy.notifier());
container = _copy.container;
}
}
// \brief Assign operator.
//
// This operator assigns for each item in the map the
// value mapped to the same item in the copied map.
// The parameter map should be indiced with the same
// itemset because this assign operator does not change
// the container of the map.
VectorMap& operator=(const VectorMap& cmap) {
return operator=<VectorMap>(cmap);
}
// \brief Template assign operator.
//
// The given parameter should conform to the ReadMap
// concecpt and could be indiced by the current item set of
// the NodeMap. In this case the value for each item
// is assigned by the value of the given ReadMap.
template <typename CMap>
VectorMap& operator=(const CMap& cmap) {
checkConcept<concepts::ReadMap<Key, _Value>, CMap>();
const typename Parent::Notifier* nf = Parent::notifier();
Item it;
for (nf->first(it); it != INVALID; nf->next(it)) {
set(it, cmap[it]);
}
return *this;
}
public:
// \brief The subcript operator.
//
// The subscript operator. The map can be subscripted by the
// actual items of the graph.
Reference operator[](const Key& key) {
return container[Parent::notifier()->id(key)];
}
// \brief The const subcript operator.
//
// The const subscript operator. The map can be subscripted by the
// actual items of the graph.
ConstReference operator[](const Key& key) const {
return container[Parent::notifier()->id(key)];
}
// \brief The setter function of the map.
//
// It the same as operator[](key) = value expression.
void set(const Key& key, const Value& value) {
(*this)[key] = value;
}
protected:
// \brief Adds a new key to the map.
//
// It adds a new key to the map. It is called by the observer notifier
// and it overrides the add() member function of the observer base.
virtual void add(const Key& key) {
int id = Parent::notifier()->id(key);
if (id >= int(container.size())) {
container.resize(id + 1);
}
}
// \brief Adds more new keys to the map.
//
// It adds more new keys to the map. It is called by the observer notifier
// and it overrides the add() member function of the observer base.
virtual void add(const std::vector<Key>& keys) {
int max = container.size() - 1;
for (int i = 0; i < int(keys.size()); ++i) {
int id = Parent::notifier()->id(keys[i]);
if (id >= max) {
max = id;
}
}
container.resize(max + 1);
}
// \brief Erase a key from the map.
//
// Erase a key from the map. It is called by the observer notifier
// and it overrides the erase() member function of the observer base.
virtual void erase(const Key& key) {
container[Parent::notifier()->id(key)] = Value();
}
// \brief Erase more keys from the map.
//
// It erases more keys from the map. It is called by the observer notifier
// and it overrides the erase() member function of the observer base.
virtual void erase(const std::vector<Key>& keys) {
for (int i = 0; i < int(keys.size()); ++i) {
container[Parent::notifier()->id(keys[i])] = Value();
}
}
// \brief Build the map.
//
// It builds the map. It is called by the observer notifier
// and it overrides the build() member function of the observer base.
virtual void build() {
int size = Parent::notifier()->maxId() + 1;
container.reserve(size);
container.resize(size);
}
// \brief Clear the map.
//
// It erases all items from the map. It is called by the observer notifier
// and it overrides the clear() member function of the observer base.
virtual void clear() {
container.clear();
}
private:
Container container;
};
}
#endif

View File

@@ -0,0 +1,166 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
///\file
///\brief Some basic non-inline functions and static global data.
#include<lemon/bits/windows.h>
#ifdef WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifdef UNICODE
#undef UNICODE
#endif
#include <windows.h>
#ifdef LOCALE_INVARIANT
#define MY_LOCALE LOCALE_INVARIANT
#else
#define MY_LOCALE LOCALE_NEUTRAL
#endif
#else
#include <unistd.h>
#include <ctime>
#ifndef WIN32
#include <sys/times.h>
#endif
#include <sys/time.h>
#endif
#include <cmath>
#include <sstream>
namespace lemon {
namespace bits {
void getWinProcTimes(double &rtime,
double &utime, double &stime,
double &cutime, double &cstime)
{
#ifdef WIN32
static const double ch = 4294967296.0e-7;
static const double cl = 1.0e-7;
FILETIME system;
GetSystemTimeAsFileTime(&system);
rtime = ch * system.dwHighDateTime + cl * system.dwLowDateTime;
FILETIME create, exit, kernel, user;
if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
cutime = 0;
cstime = 0;
} else {
rtime = 0;
utime = 0;
stime = 0;
cutime = 0;
cstime = 0;
}
#else
timeval tv;
gettimeofday(&tv, 0);
rtime=tv.tv_sec+double(tv.tv_usec)/1e6;
tms ts;
double tck=sysconf(_SC_CLK_TCK);
times(&ts);
utime=ts.tms_utime/tck;
stime=ts.tms_stime/tck;
cutime=ts.tms_cutime/tck;
cstime=ts.tms_cstime/tck;
#endif
}
std::string getWinFormattedDate()
{
std::ostringstream os;
#ifdef WIN32
SYSTEMTIME time;
GetSystemTime(&time);
char buf1[11], buf2[9], buf3[5];
if (GetDateFormat(MY_LOCALE, 0, &time,
("ddd MMM dd"), buf1, 11) &&
GetTimeFormat(MY_LOCALE, 0, &time,
("HH':'mm':'ss"), buf2, 9) &&
GetDateFormat(MY_LOCALE, 0, &time,
("yyyy"), buf3, 5)) {
os << buf1 << ' ' << buf2 << ' ' << buf3;
}
else os << "unknown";
#else
timeval tv;
gettimeofday(&tv, 0);
char cbuf[26];
ctime_r(&tv.tv_sec,cbuf);
os << cbuf;
#endif
return os.str();
}
int getWinRndSeed()
{
#ifdef WIN32
FILETIME time;
GetSystemTimeAsFileTime(&time);
return GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime;
#else
timeval tv;
gettimeofday(&tv, 0);
return getpid() + tv.tv_sec + tv.tv_usec;
#endif
}
WinLock::WinLock() {
#ifdef WIN32
CRITICAL_SECTION *lock = new CRITICAL_SECTION;
InitializeCriticalSection(lock);
_repr = lock;
#else
_repr = 0; //Just to avoid 'unused variable' warning with clang
#endif
}
WinLock::~WinLock() {
#ifdef WIN32
CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
DeleteCriticalSection(lock);
delete lock;
#endif
}
void WinLock::lock() {
#ifdef WIN32
CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
EnterCriticalSection(lock);
#endif
}
void WinLock::unlock() {
#ifdef WIN32
CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
LeaveCriticalSection(lock);
#endif
}
}
}

View File

@@ -0,0 +1,44 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2013
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BITS_WINDOWS_H
#define LEMON_BITS_WINDOWS_H
#include <string>
namespace lemon {
namespace bits {
void getWinProcTimes(double &rtime,
double &utime, double &stime,
double &cutime, double &cstime);
std::string getWinFormattedDate();
int getWinRndSeed();
class WinLock {
public:
WinLock();
~WinLock();
void lock();
void unlock();
private:
void *_repr;
};
}
}
#endif

View File

@@ -0,0 +1,594 @@
/* -*- mode: C++; indent-tabs-mode: nil; -*-
*
* This file is a part of LEMON, a generic C++ optimization library.
*
* Copyright (C) 2003-2010
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
* (Egervary Research Group on Combinatorial Optimization, EGRES).
*
* Permission to use, modify and distribute this software is granted
* provided that this copyright notice appears in all copies. For
* precise terms see the accompanying LICENSE file.
*
* This software is provided "AS IS" with no warranty of any kind,
* express or implied, and with no claim as to its suitability for any
* purpose.
*
*/
#ifndef LEMON_BUCKET_HEAP_H
#define LEMON_BUCKET_HEAP_H
///\ingroup heaps
///\file
///\brief Bucket heap implementation.
#include <vector>
#include <utility>
#include <functional>
namespace lemon {
namespace _bucket_heap_bits {
template <bool MIN>
struct DirectionTraits {
static bool less(int left, int right) {
return left < right;
}
static void increase(int& value) {
++value;
}
};
template <>
struct DirectionTraits<false> {
static bool less(int left, int right) {
return left > right;
}
static void increase(int& value) {
--value;
}
};
}
/// \ingroup heaps
///
/// \brief Bucket heap data structure.
///
/// This class implements the \e bucket \e heap data structure.
/// It practically conforms to the \ref concepts::Heap "heap concept",
/// but it has some limitations.
///
/// The bucket heap is a very simple structure. It can store only
/// \c int priorities and it maintains a list of items for each priority
/// in the range <tt>[0..C)</tt>. So it should only be used when the
/// priorities are small. It is not intended to use as a Dijkstra heap.
///
/// \tparam IM A read-writable item map with \c int values, used
/// internally to handle the cross references.
/// \tparam MIN Indicate if the heap is a \e min-heap or a \e max-heap.
/// The default is \e min-heap. If this parameter is set to \c false,
/// then the comparison is reversed, so the top(), prio() and pop()
/// functions deal with the item having maximum priority instead of the
/// minimum.
///
/// \sa SimpleBucketHeap
template <typename IM, bool MIN = true>
class BucketHeap {
public:
/// Type of the item-int map.
typedef IM ItemIntMap;
/// Type of the priorities.
typedef int Prio;
/// Type of the items stored in the heap.
typedef typename ItemIntMap::Key Item;
/// Type of the item-priority pairs.
typedef std::pair<Item,Prio> Pair;
private:
typedef _bucket_heap_bits::DirectionTraits<MIN> Direction;
public:
/// \brief Type to represent the states of the items.
///
/// Each item has a state associated to it. It can be "in heap",
/// "pre-heap" or "post-heap". The latter two are indifferent from the
/// heap's point of view, but may be useful to the user.
///
/// The item-int map must be initialized in such way that it assigns
/// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
enum State {
IN_HEAP = 0, ///< = 0.
PRE_HEAP = -1, ///< = -1.
POST_HEAP = -2 ///< = -2.
};
public:
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
explicit BucketHeap(ItemIntMap &map) : _iim(map), _minimum(0) {}
/// \brief The number of items stored in the heap.
///
/// This function returns the number of items stored in the heap.
int size() const { return _data.size(); }
/// \brief Check if the heap is empty.
///
/// This function returns \c true if the heap is empty.
bool empty() const { return _data.empty(); }
/// \brief Make the heap empty.
///
/// This functon makes the heap empty.
/// It does not change the cross reference map. If you want to reuse
/// a heap that is not surely empty, you should first clear it and
/// then you should set the cross reference map to \c PRE_HEAP
/// for each item.
void clear() {
_data.clear(); _first.clear(); _minimum = 0;
}
private:
void relocateLast(int idx) {
if (idx + 1 < int(_data.size())) {
_data[idx] = _data.back();
if (_data[idx].prev != -1) {
_data[_data[idx].prev].next = idx;
} else {
_first[_data[idx].value] = idx;
}
if (_data[idx].next != -1) {
_data[_data[idx].next].prev = idx;
}
_iim[_data[idx].item] = idx;
}
_data.pop_back();
}
void unlace(int idx) {
if (_data[idx].prev != -1) {
_data[_data[idx].prev].next = _data[idx].next;
} else {
_first[_data[idx].value] = _data[idx].next;
}
if (_data[idx].next != -1) {
_data[_data[idx].next].prev = _data[idx].prev;
}
}
void lace(int idx) {
if (int(_first.size()) <= _data[idx].value) {
_first.resize(_data[idx].value + 1, -1);
}
_data[idx].next = _first[_data[idx].value];
if (_data[idx].next != -1) {
_data[_data[idx].next].prev = idx;
}
_first[_data[idx].value] = idx;
_data[idx].prev = -1;
}
public:
/// \brief Insert a pair of item and priority into the heap.
///
/// This function inserts \c p.first to the heap with priority
/// \c p.second.
/// \param p The pair to insert.
/// \pre \c p.first must not be stored in the heap.
void push(const Pair& p) {
push(p.first, p.second);
}
/// \brief Insert an item into the heap with the given priority.
///
/// This function inserts the given item into the heap with the
/// given priority.
/// \param i The item to insert.
/// \param p The priority of the item.
/// \pre \e i must not be stored in the heap.
void push(const Item &i, const Prio &p) {
int idx = _data.size();
_iim[i] = idx;
_data.push_back(BucketItem(i, p));
lace(idx);
if (Direction::less(p, _minimum)) {
_minimum = p;
}
}
/// \brief Return the item having minimum priority.
///
/// This function returns the item having minimum priority.
/// \pre The heap must be non-empty.
Item top() const {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
return _data[_first[_minimum]].item;
}
/// \brief The minimum priority.
///
/// This function returns the minimum priority.
/// \pre The heap must be non-empty.
Prio prio() const {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
return _minimum;
}
/// \brief Remove the item having minimum priority.
///
/// This function removes the item having minimum priority.
/// \pre The heap must be non-empty.
void pop() {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
int idx = _first[_minimum];
_iim[_data[idx].item] = -2;
unlace(idx);
relocateLast(idx);
}
/// \brief Remove the given item from the heap.
///
/// This function removes the given item from the heap if it is
/// already stored.
/// \param i The item to delete.
/// \pre \e i must be in the heap.
void erase(const Item &i) {
int idx = _iim[i];
_iim[_data[idx].item] = -2;
unlace(idx);
relocateLast(idx);
}
/// \brief The priority of the given item.
///
/// This function returns the priority of the given item.
/// \param i The item.
/// \pre \e i must be in the heap.
Prio operator[](const Item &i) const {
int idx = _iim[i];
return _data[idx].value;
}
/// \brief Set the priority of an item or insert it, if it is
/// not stored in the heap.
///
/// This method sets the priority of the given item if it is
/// already stored in the heap. Otherwise it inserts the given
/// item into the heap with the given priority.
/// \param i The item.
/// \param p The priority.
void set(const Item &i, const Prio &p) {
int idx = _iim[i];
if (idx < 0) {
push(i, p);
} else if (Direction::less(p, _data[idx].value)) {
decrease(i, p);
} else {
increase(i, p);
}
}
/// \brief Decrease the priority of an item to the given value.
///
/// This function decreases the priority of an item to the given value.
/// \param i The item.
/// \param p The priority.
/// \pre \e i must be stored in the heap with priority at least \e p.
void decrease(const Item &i, const Prio &p) {
int idx = _iim[i];
unlace(idx);
_data[idx].value = p;
if (Direction::less(p, _minimum)) {
_minimum = p;
}
lace(idx);
}
/// \brief Increase the priority of an item to the given value.
///
/// This function increases the priority of an item to the given value.
/// \param i The item.
/// \param p The priority.
/// \pre \e i must be stored in the heap with priority at most \e p.
void increase(const Item &i, const Prio &p) {
int idx = _iim[i];
unlace(idx);
_data[idx].value = p;
lace(idx);
}
/// \brief Return the state of an item.
///
/// This method returns \c PRE_HEAP if the given item has never
/// been in the heap, \c IN_HEAP if it is in the heap at the moment,
/// and \c POST_HEAP otherwise.
/// In the latter case it is possible that the item will get back
/// to the heap again.
/// \param i The item.
State state(const Item &i) const {
int idx = _iim[i];
if (idx >= 0) idx = 0;
return State(idx);
}
/// \brief Set the state of an item in the heap.
///
/// This function sets the state of the given item in the heap.
/// It can be used to manually clear the heap when it is important
/// to achive better time complexity.
/// \param i The item.
/// \param st The state. It should not be \c IN_HEAP.
void state(const Item& i, State st) {
switch (st) {
case POST_HEAP:
case PRE_HEAP:
if (state(i) == IN_HEAP) {
erase(i);
}
_iim[i] = st;
break;
case IN_HEAP:
break;
}
}
private:
struct BucketItem {
BucketItem(const Item& _item, int _value)
: item(_item), value(_value) {}
Item item;
int value;
int prev, next;
};
ItemIntMap& _iim;
std::vector<int> _first;
std::vector<BucketItem> _data;
mutable int _minimum;
}; // class BucketHeap
/// \ingroup heaps
///
/// \brief Simplified bucket heap data structure.
///
/// This class implements a simplified \e bucket \e heap data
/// structure. It does not provide some functionality, but it is
/// faster and simpler than BucketHeap. The main difference is
/// that BucketHeap stores a doubly-linked list for each key while
/// this class stores only simply-linked lists. It supports erasing
/// only for the item having minimum priority and it does not support
/// key increasing and decreasing.
///
/// Note that this implementation does not conform to the
/// \ref concepts::Heap "heap concept" due to the lack of some
/// functionality.
///
/// \tparam IM A read-writable item map with \c int values, used
/// internally to handle the cross references.
/// \tparam MIN Indicate if the heap is a \e min-heap or a \e max-heap.
/// The default is \e min-heap. If this parameter is set to \c false,
/// then the comparison is reversed, so the top(), prio() and pop()
/// functions deal with the item having maximum priority instead of the
/// minimum.
///
/// \sa BucketHeap
template <typename IM, bool MIN = true >
class SimpleBucketHeap {
public:
/// Type of the item-int map.
typedef IM ItemIntMap;
/// Type of the priorities.
typedef int Prio;
/// Type of the items stored in the heap.
typedef typename ItemIntMap::Key Item;
/// Type of the item-priority pairs.
typedef std::pair<Item,Prio> Pair;
private:
typedef _bucket_heap_bits::DirectionTraits<MIN> Direction;
public:
/// \brief Type to represent the states of the items.
///
/// Each item has a state associated to it. It can be "in heap",
/// "pre-heap" or "post-heap". The latter two are indifferent from the
/// heap's point of view, but may be useful to the user.
///
/// The item-int map must be initialized in such way that it assigns
/// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap.
enum State {
IN_HEAP = 0, ///< = 0.
PRE_HEAP = -1, ///< = -1.
POST_HEAP = -2 ///< = -2.
};
public:
/// \brief Constructor.
///
/// Constructor.
/// \param map A map that assigns \c int values to the items.
/// It is used internally to handle the cross references.
/// The assigned value must be \c PRE_HEAP (<tt>-1</tt>) for each item.
explicit SimpleBucketHeap(ItemIntMap &map)
: _iim(map), _free(-1), _num(0), _minimum(0) {}
/// \brief The number of items stored in the heap.
///
/// This function returns the number of items stored in the heap.
int size() const { return _num; }
/// \brief Check if the heap is empty.
///
/// This function returns \c true if the heap is empty.
bool empty() const { return _num == 0; }
/// \brief Make the heap empty.
///
/// This functon makes the heap empty.
/// It does not change the cross reference map. If you want to reuse
/// a heap that is not surely empty, you should first clear it and
/// then you should set the cross reference map to \c PRE_HEAP
/// for each item.
void clear() {
_data.clear(); _first.clear(); _free = -1; _num = 0; _minimum = 0;
}
/// \brief Insert a pair of item and priority into the heap.
///
/// This function inserts \c p.first to the heap with priority
/// \c p.second.
/// \param p The pair to insert.
/// \pre \c p.first must not be stored in the heap.
void push(const Pair& p) {
push(p.first, p.second);
}
/// \brief Insert an item into the heap with the given priority.
///
/// This function inserts the given item into the heap with the
/// given priority.
/// \param i The item to insert.
/// \param p The priority of the item.
/// \pre \e i must not be stored in the heap.
void push(const Item &i, const Prio &p) {
int idx;
if (_free == -1) {
idx = _data.size();
_data.push_back(BucketItem(i));
} else {
idx = _free;
_free = _data[idx].next;
_data[idx].item = i;
}
_iim[i] = idx;
if (p >= int(_first.size())) _first.resize(p + 1, -1);
_data[idx].next = _first[p];
_first[p] = idx;
if (Direction::less(p, _minimum)) {
_minimum = p;
}
++_num;
}
/// \brief Return the item having minimum priority.
///
/// This function returns the item having minimum priority.
/// \pre The heap must be non-empty.
Item top() const {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
return _data[_first[_minimum]].item;
}
/// \brief The minimum priority.
///
/// This function returns the minimum priority.
/// \pre The heap must be non-empty.
Prio prio() const {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
return _minimum;
}
/// \brief Remove the item having minimum priority.
///
/// This function removes the item having minimum priority.
/// \pre The heap must be non-empty.
void pop() {
while (_first[_minimum] == -1) {
Direction::increase(_minimum);
}
int idx = _first[_minimum];
_iim[_data[idx].item] = -2;
_first[_minimum] = _data[idx].next;
_data[idx].next = _free;
_free = idx;
--_num;
}
/// \brief The priority of the given item.
///
/// This function returns the priority of the given item.
/// \param i The item.
/// \pre \e i must be in the heap.
/// \warning This operator is not a constant time function because
/// it scans the whole data structure to find the proper value.
Prio operator[](const Item &i) const {
for (int k = 0; k < int(_first.size()); ++k) {
int idx = _first[k];
while (idx != -1) {
if (_data[idx].item == i) {
return k;
}
idx = _data[idx].next;
}
}
return -1;
}
/// \brief Return the state of an item.
///
/// This method returns \c PRE_HEAP if the given item has never
/// been in the heap, \c IN_HEAP if it is in the heap at the moment,
/// and \c POST_HEAP otherwise.
/// In the latter case it is possible that the item will get back
/// to the heap again.
/// \param i The item.
State state(const Item &i) const {
int idx = _iim[i];
if (idx >= 0) idx = 0;
return State(idx);
}
private:
struct BucketItem {
BucketItem(const Item& _item)
: item(_item) {}
Item item;
int next;
};
ItemIntMap& _iim;
std::vector<int> _first;
std::vector<BucketItem> _data;
int _free, _num;
mutable int _minimum;
}; // class SimpleBucketHeap
}
#endif

Some files were not shown because too many files have changed in this diff Show More