1
1

Compare commits

...

2350 Commits

Author SHA1 Message Date
Julian Eisel
ac5cbf8c0e Fix mistakes with background drawing 2017-02-09 13:51:39 +01:00
Julian Eisel
d1fb6819d5 Create and pass a uiLayout to cells
Played with a more complex and more efficient version, but that made
things pretty complicated. Now this is a simple, but less optimized, solution.
2017-02-09 05:09:10 +01:00
Julian Eisel
5caeb054ee Support drawing some background color alternating per row 2017-02-09 02:56:27 +01:00
Julian Eisel
2f43ab5935 Draw tables row by row, not column by column 2017-02-08 00:04:09 +01:00
Julian Eisel
4e3cfaeb16 Unit tests for uiTable API (and fix bugs found using it :) 2017-02-07 00:45:33 +01:00
Julian Eisel
1807c09986 Cleanup: Add assert, remove unused variable 2017-02-05 17:25:12 +01:00
Julian Eisel
1a7eeb4fef Initial implementation of a uiTable API
This adds an initial (and already working), generic API for defining, handling and drawing of table UIs.

It supports two types of tables:
* Vertical flow: Rows are all in a vertical stack.
* Horizontal flow: Rows are stacked vertically, until some threshold height is reached. The table is then split into another vertical stack that is drawn next to the former one. Such drawing could be used for the file browser in non-thumbnail mode.

A table is built out of - guess what - rows and columns. The API allows defining new collumns (identified by an id-name) and inserting new rows at any point. When drawing, we draw a cell for each column/row combination, using a custom cell-drawing callback.
The uiTable API will probably get some support for drawing buttons (uiBut) into custom layouts (uiLayout).

The API is written with big data sets in mind. In future we may get a spreadsheet view where data like all vertices of a mesh is displayed. That would result in thousands of rows, the uiTable API should be ready for this.
2017-02-05 16:43:56 +01:00
Dalai Felinto
99cfad6a01 Convert MBC_ API to Mesh (instead of derived mesh) and move it to mesh_render
This includes a few fixes in the MBC_ api.

The idea here is for this to be the only interface the render engines
will deal with for the meshes.

If we need to expose special options for sculpting engine we refactor
this accordingly. But for now we are shaping this in a per-case base.

Note:
* We still need to hook up to the depsgraph to force clear/update of
batch_cache when mesh changes

(I'm waiting for Sergey Sharybin's depsgraph update for this though)

* Also ideally we could/should use BMesh directly instead of
DerivedMesh, but this will do for now.

Note 2:
In the end I renamed the `BKE_mesh_render` functions to `static
mesh_render`. We can re-expose them as BKE_* later once we need it.

Reviewers: merwin

Subscribers: fclem

Differential Revision: https://developer.blender.org/D2476
2017-01-25 10:01:48 +01:00
5be2a62ca3 Merge branch 'master' into blender2.8 2017-01-24 14:56:56 +01:00
b6ccba9241 Fix typo in comment 2017-01-24 14:56:35 +01:00
f286e7e017 Depsgraph: Make it more clear and explicit compile fail when required features are not found 2017-01-24 12:57:33 +01:00
769d189ff1 Depsgraph: Remove legacy code from new depsgraph
Now we have no remaining WITH_LEGACY_DEPSGRAPH in the code.
2017-01-24 12:55:37 +01:00
610af632a9 Depsgraph: Remove command line argument to use new depsgraph 2017-01-24 12:54:21 +01:00
a2d609331b Depsgraph: Remove more legacy code from viewport 2017-01-24 12:52:20 +01:00
218b06eb83 Depsgraph: Remove legacy updateDepgraph callbacks from modifiers 2017-01-24 12:49:23 +01:00
55e6d5428d Depsgraph: Remove legacy implementation of depsgraph 2017-01-24 12:47:23 +01:00
f20b8ae5aa Depsgraph: Remove legacy calls from scene update routines 2017-01-24 12:42:56 +01:00
46d6992907 Depsgraph: Remove special exception in update logging 2017-01-24 12:34:28 +01:00
9e40027110 Depsgraph: Remove special version of pose builder 2017-01-24 12:34:24 +01:00
23122ca889 Depsgraph: Remove legacy depsgraph code from viewport 2017-01-24 12:34:18 +01:00
991bda6959 Depsgraph: Remove legacy depsgraph code from transform 2017-01-24 12:34:14 +01:00
d4c5e366ea Install deps: Bump OpenSubdiv version to 3.1.1
Required to have some crash fixes.
2017-01-24 11:49:45 +01:00
520afa2962 GPencil: Fix unreported animation data missing when change palette name
When a palette was renamed, the animation data was not changed.

This fix is related to commit 196520fe7d
2017-01-24 09:15:41 +01:00
e5d8c2a67f Use new manual URL 2017-01-23 19:10:37 -05:00
d5c7d22bc2 Update script generating/uploading py API doc to new addresses (docs.blender.org). 2017-01-23 21:10:56 +01:00
08ca32093a Merge branch 'master' into blender2.8 2017-01-23 18:11:42 +01:00
39577403d3 Fix compilation error with legacy depsgraph disabled 2017-01-23 18:08:41 +01:00
bc096e1eb8 Cycles: Split ShaderData object and shader flags
We started to run out of bits there, so now we separate flags
which came from __object_flags and which are either runtime or
coming from __shader_flags.

Rule now is: SD_OBJECT_* flags are to be tested against new
object_flags field of ShaderData, all the rest flags are to
be tested against flags field of ShaderData.

There should be no user-visible changes, and time difference
should be minimal. In fact, from tests here can only see hardly
measurable difference and sometimes the new code is somewhat
faster (all within a noise floor, so hard to tell for sure).

Reviewers: brecht, dingto, juicyfruit, lukasstockner97, maiself

Differential Revision: https://developer.blender.org/D2428
2017-01-23 12:56:55 +01:00
b9311b5e5a Cycles: Make object flag names more obvious that hey are object and not shader 2017-01-23 12:14:17 +01:00
2ae39ff6b1 Fix strict compiler warning in the gflags code 2017-01-23 11:52:41 +01:00
7b8810b01a Silence strict compiler warnings
Similar thing to other areas where we mix Blender's char with OpenGL API.
2017-01-23 11:46:02 +01:00
77982e159c Cycles: Fix typo in the panel name
No user visible changes, it was a typo in the name of the class.

Spotted by povmaniac in IRC, thanks!
2017-01-23 10:35:15 +01:00
2268f41418 Cycles: Update current Cycles version 2017-01-23 10:25:59 +01:00
Julian Eisel
1814241526 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/space_action/action_draw.c
2017-01-22 21:16:00 +01:00
ce8889175a Fix T50491: Cycles UI breaks when pushing F8.
Cycles add-on did not actually support reloading correctly.

When you want to correctly reload sub-modules (i.e. modules of an add-on
which is a package), you need to use importlib, a mere import will do
nothing with already loaded modules (RNA classes are sort of
pre-registered when they are evaluated, through the meta-class system).
2017-01-22 12:42:14 +01:00
d2382f782e Fix T49527: Blender stalls when changing armature ghosting range with stepsize = 0
A big thanks to Steffen Mortensen (stifan) for finding the root cause of this bug!
2017-01-22 02:55:10 +13:00
82187a58f5 Fix own mistake in rB051526da6279, confusing off_t with ptrdiff_t. 2017-01-20 21:57:48 +01:00
475d536f72 Fix minor glitches in GP code.
Reported by coverity scan.
2017-01-20 18:46:06 +01:00
a97ec403c2 Fix/cleanup stupid check on array of char being non-NULL pointer...
Reported by coverity scan.
2017-01-20 18:43:42 +01:00
21e1282265 Fix float buffer of tracking image accessed outside of check that it has been correctly allocated.
Reported by coverity scan.
2017-01-20 18:41:56 +01:00
43268c1997 Cycles: Use more const qualifiers to avoid possible issues 2017-01-20 17:54:17 +01:00
a1c21e0b50 Cycles: Cleanup, split one gigantic function into two smaller ones 2017-01-20 17:52:48 +01:00
094d916c60 Fix compilation error with strict flags 2017-01-20 17:47:09 +01:00
cdaed4d360 Fix compilation error with strict flags and gcc-6 2017-01-20 17:43:13 +01:00
051526da62 Cleanup/fix some BLI_string_utf8 not using size_t/off_t as expected. 2017-01-20 16:51:05 +01:00
2666a222f6 Cleanup/fix last remnant usages of int instead of size_t for string length in BLI_string_utils. 2017-01-20 16:51:05 +01:00
404e59c842 D1873: Customize style for animation motion paths
New options to define the style of the animation paths in order to get
better visibility in complex scenes.

Now is possible define the color, thickness and several options relative
to the style of the lines used to draw motion path.
2017-01-20 16:49:14 +01:00
1ad04c7d65 Cycles: Store time in BVH nodes
This way we can stop traversing BVH node early on.

Gives about 2-2.5x times render time improvement with 3 BVH steps.
Hopefully this gives no measurable performance loss for scenes with
single BVH step.

Traversal is currently only implemented for QBVH, meaning old CPUs
and GPU do not benefit from this change.
2017-01-20 12:46:18 +01:00
c4890cd354 Cycles: Add option to split triangle motion primitives by time steps
Similar to the previous commit, the statistics goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0                46                    260
    1                27                    373
    2                18                    598
    3                15                    826

Scene used for the tests is the agent's body from one of the barber
shop scenes (no textures or anything, just a diffuse material).

Once again this is limited to regular (non-spatial split) BVH,
Support of spatial split to this feature will come later.
2017-01-20 12:46:18 +01:00
5298853e95 Cycles: Add option to split curve motion primitives by time steps
The idea is to create several smaller BVH nodes for each of the motion
curve primitives. This acts as a forced spatial split for the single
primitive.

This gives up render time speedup of motion blurred hair in the cost
of extra memory usage. The numbers goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0               258                    191
    1               123                    278
    2                69                    453
    3                43                    627

Scene used for the tests is the agent's hair from one of the barber
shop scenes.

Currently it's only limited to scenes without spatial split enabled,
since the spatial split builder requires some changes to work properly
with motion steps coordinates.
2017-01-20 12:46:18 +01:00
d50d370755 Cycles: Add utility function to calculate curve boundbox from given 4 keys
Also fixed some issues with motion keys calculation:

- Clamp lower and upper limits of curves so we can safely call those
  functions for the very first and very last curve segment.
- Fixed wrong indexing for the curve radius array.
- Fixed wrong motion attribute offset calculation.
2017-01-20 12:46:18 +01:00
6f900c383a Cycles: Cleanup, trailing whitespace 2017-01-20 12:46:18 +01:00
26cdc64a7f Cycles: Split motion triangle file once again, avoids annoying forward declarations 2017-01-20 12:46:17 +01:00
14d343a8f9 Cycles: Move motion triangle intersection functions to own file
Mimics how regular triangles are working and makes it more clear where
the stuff is located in the kernel.

Needed to have some forward declarations because of the current placement
of things in the kernel.
2017-01-20 12:46:17 +01:00
ebc695ef2c Cycles: Cleanup, better variable name 2017-01-20 12:46:17 +01:00
20eb1fe3c1 Cycles: Add utility function to fetch motion keys while on CPU side 2017-01-20 12:46:17 +01:00
938ec3a743 Cycles: Cleanup, comments 2017-01-20 12:46:16 +01:00
461214508c Cycles: Add utility function to fetch motion triangle when on CPU side 2017-01-20 12:46:15 +01:00
811e6c2d32 Cycles: Cleanup, delete trailing whitespace 2017-01-20 12:46:15 +01:00
254fbcdd7b Cycles: Fix compilation error on with older GCC
Hopefully it works on all platforms now.
2017-01-20 11:55:48 +01:00
ff1b850081 Fix T50460. Greying out issue with Cycles culling options. 2017-01-20 10:58:03 +01:00
05ff32bd25 Fix compile error (-Werror=float-conversion). 2017-01-20 10:50:55 +01:00
2e3fda2d95 DopeSheet: Show group colours behind keyframes too
Following @AlonDan's feature request and @hjalti's screenshot yesterday,
I've decided to implement support for this to make it easier to scan which
keyframes correspond with which set of controls, especially when faced with
a large wall of keyframes.

In retrospect, I should've done this a long time ago!
2017-01-20 18:40:26 +13:00
831cfcfb3d API: Do not show "Created using Sphinx" in the footer
I talked to Campbell and he said there is no need for this
2017-01-19 16:16:04 -05:00
c91bdaf55b Build dir should be set after the sanity checks
Error here is that if do not have 2012 it switch to 2015 but not change the build dir
2017-01-19 16:00:52 -05:00
2a2ae9c3fa BMesh: remove BM_face_create_ngon_vcloud
Instead, add BM_verts_sort_radial_plane
and use regular creation API.
2017-01-20 06:09:37 +11:00
53e7a4a83c Correct asserts, un-hiding when selected is ok 2017-01-20 06:00:55 +11:00
d6cf28c5e1 Cycles: Expose diffuse and glossy depth to Light Path node
Was a bit confusing to have transparent and translucent depth
exposed but no diffuse or glossy.

Reviewers: brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D2399
2017-01-19 15:09:58 +01:00
afdd756e56 Cycles: Don't use fast math for the host code
This is important for the reliable behavior or isnan/isfinite/min/max
functions to work with nan and non-finite values. Some of the issues
with fast math are possible to work around, but didn't find a way to
have reliable min/max implementation yet.
2017-01-19 14:51:11 +01:00
78b94902f8 Cycles: Add fast-math safe isnan and isfinite
Currently unused, but might become really handy in the future.
2017-01-19 14:51:11 +01:00
6d36e033ba Cycles: Remove using namespace hell
Please NEVER EVER use such a statement, it's only causing HUGE
issues. What is even worse: it's not always possible to immediately
see that the hell is coming from such a statement.

There is still some statements in the existing code, will leave
those for a later cleanup.
2017-01-19 14:51:11 +01:00
446ed355a5 GPencil: Add option to create blank frame in active layer only
Now it is possible to select if the blank frame is created in active
layer only or in all layers.
2017-01-19 13:05:23 +01:00
666cb5ddd9 Cleanup: naming, comments assert for hide+selected 2017-01-19 22:59:41 +11:00
e2d02fee30 BMesh: improve hide-flush internal logic
- flushing hidden state ran when it didn't need to.
- flushing checks didn't early exit when first visible element found.
- low level BM_*_hide API calls like this can use skip iterators
  can loop over struct members directly.

No user-visible changes.
2017-01-19 22:50:56 +11:00
8aa8165e85 OpenGL: convert legacy calls in transform.c
Took pieces from D2316 and D2359, changed a few more things.

- use new immediate mode
- use new matrix stack
- remove state push/pop

Part of T49043 and T49450
2017-01-19 00:46:20 -05:00
b76dbf5e65 UI: Fix capitalization inconsistency 2017-01-18 19:38:55 -05:00
4a19112277 Cycles: Fix amount of rendered samples not being shown while rendering the last tile on CPU 2017-01-19 00:48:09 +01:00
1455023e64 Fix T49807: Inset faces edge rail bug 2017-01-19 10:37:04 +11:00
11187e8628 Fix face-creation with existing hidden geometry
- face-create-extend option could add hidden verts and edges into
  the selection history (invalid state).
- faces could be created that included existing hidden edges
  that remained hidden (invalid state too).
- newly created faces could copy hidden flag from surrounding faces,
  giving very confusing results (looks as if face creation failed).

Surprising nobody noticed these years old bugs!
2017-01-19 09:17:36 +11:00
fd4728c85a BMesh: Use angle_signed_on_axis_v3v3v3_v3 2017-01-19 07:59:32 +11:00
a48d3417b5 Fix strict compiler warning message 2017-01-18 15:56:40 +01:00
b059a71655 GPencil: Avoid variable shadowing 2017-01-18 15:56:04 +01:00
6d868d9f48 Reproject Strokes - To Surface/Geometry
Experimental option for the Reproject Strokes operator to project strokes on to
geometry, instead of only doing this in a planar (i.e. parallel to viewplane) way.

The current implementation is quite rough, and may need to be improved before it
is really ready for use. Potential issues:
* Loss of precision (i.e. stairstepping artifacts) from the 3D -> 2D -> 3D conversion
  as we don't have float version of one of the projection funcs
* Jagged depth if there are gaps, since it will default back to the 3d-cursor plane
  if no geometry was found (instead of doing some fancy interpolation scheme)
* I'm not sure if it's that useful for adapting GP strokes to deforming geometry yet...
2017-01-19 03:20:44 +13:00
00edc600b0 Fix: Make it possible to erase strokes (on other layers) even if the active layer doesn't have any frames 2017-01-19 03:06:43 +13:00
7452af0f86 Fix: Avoid creating redundant frames when erasing
Now the eraser checks if there's an active frame with some strokes in it
before creating a new frame. There's no point in creating a new frame if
there are no strokes in the active frame (if one exists).

This still doesn't help much if there were strokes but they weren't touched though...
2017-01-19 03:06:43 +13:00
a93881d704 GPencil: Pressing 'B' while in 'Continuous Drawing' mode will create a blank frame
This is a hardcoded keymapping that just calls the "Add Blank Frame" operator
introduced in the previous commit.
2017-01-19 03:06:42 +13:00
259447300f GPencil: "Add Blank Frame" operator (D+B)
This operator adds a new frame with nothing in it on the current frame.
If there is already a frame there, all existing frames are shifted one frame later.

Quite often when animating, you may want a quick way to get a blank frame,
ready to start drawing something new. Or maybe you just need a quick way to
add a "placeholder" frame so that a suddenly-appearing element does not show
up before its time.
2017-01-19 03:06:41 +13:00
86b6006ef8 GPencil: Cleanup - move include line to correct scope 2017-01-18 13:00:09 +01:00
196520fe7d GPencil: Fix unreported error in animation after rename items
If the layers or the colors were renamed, the animation data was wrong
because the data path was not updated.

I also have fixed a possible stroke color name update if the name was duplicated moving
the rename function call after checking unique name.
2017-01-18 12:29:02 +01:00
d216313732 Cleanup: Strict compiler flags
Also seems the new file forced trailing whitespace, which goes against

  https://wiki.blender.org/index.php/Dev:Doc/Code_Style#Trailing_Space
2017-01-18 12:20:53 +01:00
e138cdeeb6 Transform manipulator: Allow first clicking Shift before selecting axis
Avoids possible jumps when one is trying to do some really preciese tweak.

Quite striaghtforward change for mouse input initialization: take Shift
state into account. However, this will interfere with the axis exclusion
which is currently also uses Shift (the feature to move something in a
plane which doesn't have selected axis). This is probably not so commonly
used feature (nobody in the studio even knew of it) and the only downside
now would be that such a constrainted movement will become accurate by
default. That's easy to deal from user side by just unholding Shift key.

Reviewers: brecht, mont29, Severin

Differential Revision: https://developer.blender.org/D2418
2017-01-18 12:18:54 +01:00
8d4b31ce03 GP Interpolation: "Remove Breakdowns" operator
To make it faster to try different interpolation curves, there's a new operator
"Remove Breakdowns" which will delete all breakdowns sandwiched by normal
keyframes (i.e. all the ones that the previous run of the Interpolation op created)
2017-01-18 19:42:00 +13:00
65ec429d11 GP Interpolate Sequence: Tool settings for controlling the shape of interpolation
This commit introduces the ability to use the Robert Penner easing equations
or a Custom Curve to control the way that the "Interpolate Sequence" operator
interpolates between keyframes. Previously, it was only possible to get linear
interpolation between the gp frames.

Workflow:
1) Place current frame between a pair of GP keyframes
2) Open the "Interpolate" panel in the Toolshelf
3) Choose the interpolation type (under "Sequence Options")
4) Adjust settings (e.g. if you're using "Custom Curve", use the curvemap widget
   to define the way that the interpolation proceeds)
5) Click "Sequence" to interpolate
6) Play back/scrub the animation to see if you've got the result you want
7) If you need to make some tweaks, undo, or delete the generated keyframes,
   then repeat the process again from step 4 until you've got the desired result.
2017-01-18 19:41:59 +13:00
224ae23443 GP Interpolate: Move settings from "gp_sculpt" to a new toolsettings struct - "gp_interpolate"
The "gp_sculpt" settings should be strictly for stroke sculpting, and not abused by
other tools. (Similarly, if other general GP tools need one-off options, those should
go into the normal toolsettings->gpencil_flag)

Furthermore, this paves the way for introducing new settings for controlling the way
that GP interpolation takes place (e.g. with easing equations, or a custom curvemap)
2017-01-18 19:41:58 +13:00
4903a83235 GP Interpolate Code Cleanup (Second Round)
* Reduce scope of variables
* Simplify a lot of the active_gpl->actframe->...->framenum stuff
* Missed some error messages
2017-01-18 19:41:58 +13:00
fd119a3723 Code Cleanup for GP Interpolation ops (first pass)
* Reshuffled some blocks of code for better ease of navigation/flow in the file
* Improved some tooltips
* Removed "Helper" tag from some functions that serve bigger roles
* Fixed some errant formatting
2017-01-18 19:41:57 +13:00
cd8cde1a6a Code Cleanup: Move GPencil Interpolation operators into their own file
The interpolation operators (and their associated code) occupied a significant
portion of gpencil_edit.c (which was getting a bit heavy). So, it's best to split
these out into a separate file to make things easier to handle, in preparation
for some further dev work.
2017-01-18 19:41:57 +13:00
3216831c76 T50457 Remove temporary solution for animation types and put in definitve position
After revert the commit rB4b99958ca12642, the line added at the end of the enum is not necessary anymore because it is replaced by the corresponding element in the list in the right position.
2017-01-17 20:01:59 +01:00
3df30c34c3 Revert "Remove particle expander"
This reverts commit 4b99958ca1.
2017-01-17 19:46:05 +01:00
61b52f6d90 Fix previous commit because there are some code using this define, but really it is not used in editors. This is a temporary fix to broken editors, but this entry must be removed or moved to the right place when particles are in place again. 2017-01-17 15:53:31 +01:00
276e36a59f Remove unused definition. This enum must be synchronized with the registration ANIM_init_channel_typeinfo_data function in anim_channels_define.c
If the list is not equal, weird things start to happend in animation editors.
2017-01-17 13:33:37 +01:00
af9f6fd57e Add 'Layer Weight' node to Blender internal node items 2017-01-17 12:02:05 +03:00
d7b2093db3 Return correct alpha for environment map in GLSL 2017-01-17 11:52:02 +03:00
43872f59b9 Merge branch 'master' into blender2.8 2017-01-16 21:03:12 +01:00
e0303d0297 Cleanup/refactor: move BKE_deform_flip_side_name & co to BLI_string_utils
Functions like that do not have anything to do in BKE really, even less
when actually more used for bones than vgroups!
2017-01-16 20:36:23 +01:00
7ce833af5b Cleanup/refactor: get rid of fixed name limit in BKE_deform_flip_side_name & co.
Those were forcing to use vgroup name define in bones area, or even
mixing with maxbonename... ugly, and totally avoidable.
2017-01-16 20:36:23 +01:00
b997988323 Cleanup/refactor: Add new BLI_string_util.
Things like `BLI_uniquename` had nothing, but really nothing to do in
BLI_path_util files!

Also, got rid of length limitation in `BLI_uniquename_cb`, we can use
alloca here to avoid overhead of malloc while keeping free size (within
reasonable limits of course).
2017-01-16 20:36:23 +01:00
3748defefe Cleanup: remove unused & unimplemented BLI_newname. 2017-01-16 20:36:22 +01:00
702bc5ba26 Fix T50393: Flip names working just on one side when both are selected.
Just store bones that could not get renamed to desired flipped name on the
first try into a temp list, and try to rename them a second time.

This is rather simple solution, will induce 'over numbering' in case you
flip a bone to another unselected bone's name (since number will be
incremented in both rename attempts), but think this is acceptable minor
glitch, for a corner case situation that does not have any good
resolution anyway.

Also, set `strip_numbers` option of `BKE_deform_flip_side_name` to
false, otherwise chains of bones with same names would get their numbers
completely messed up after name flipping.

Based on work by @dfelinto in D2456 (https://developer.blender.org/D2456), thanks.
2017-01-16 20:36:22 +01:00
92fbcbb4bf Cycles: Cleanup, spelling 2017-01-16 17:55:41 +01:00
d3e4eecaa5 Cycles: Cleanup, avoid shadowing 2017-01-16 17:54:39 +01:00
af9e99763c OpenGL: convert anim_channel_defines.c to new imm mode
This is part of T49043

fixed up some color/rect calls

fixed up ANIM_channel_draw()

Reviewers: krash, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2377
2017-01-16 00:18:28 -05:00
7d55761c5d OpenGL: fix immRect usage & convert more glRect calls
part of T49043
2017-01-15 23:48:46 -05:00
4e2c6ad8ee Updating outliner_draw_struct_marks to retained mode
Had to add a few utility functions to replace existing functions. Let me know if these are duplicates.

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2434
2017-01-15 19:30:05 -05:00
0a446d7276 Add 3d to 2d plane mapping functions to math lib
This adds two functions to project 3d coordinates onto a 3d plane,
to get 2d coordinates, essentially eliminating the plane's normal axis
from the coordinates.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2460
2017-01-14 00:34:51 -02:00
646aa40cf7 Fix missing user when opening text from ID UI widget.
Own mistake in recent fix for Text data-block usercount (rBa9163f7d2).

Reported by @sergey over IRC, thanks.
2017-01-13 18:12:56 +01:00
e5a665fe24 Cycles: Fix wrong transparent shadows for motion blur hair
This was a missing bit from b53ce9a.
2017-01-13 16:14:57 +01:00
14f6e27f6a Cycles: Cleanup, style 2017-01-13 15:24:56 +01:00
807b1a262f Cycles: Simplify some code in Curve BVH reference fill
makes code slightly shorter and uses idea of const qualifiers.
2017-01-13 10:59:34 +01:00
3160472a66 Cycles: Avoid shadowing in BVH code
Run into some nasty bugs while trying various things here.

Wouldn't mind enabling -Wshadow for Cycles actually..
2017-01-13 10:53:01 +01:00
bd6bd62753 Fix small spelling error 2017-01-12 23:36:08 -05:00
d464fb0996 Dynamic Paint: recursively search for island border edges.
It is quite likely in a triangulated mesh that the actual island edge
belongs to a different triangle than the current pixel; for example
consider corners of a triangulated axis aligned rectangle face that
have the additional edge: a pixel there will have to be assigned to
one of the triangles, but one of the edges of the original rectangle
can only be accessed through the other triangle.

Thus for robust operation it is necessary to do a recursive search.
The search is limited by requiring that it only goes through edges
that bring it closer to the target point, and also by depth as a
safeguard.

Differential Revision: https://developer.blender.org/D2409
2017-01-12 21:28:15 +03:00
c937c3af46 Dynamic Paint: provide margin of error for linking neighbors across seams.
The code requires the pixel on the other side of the seam to be assigned
precisely to the expected triangle. This can cause false negatives around
vertices, where a pixel is likely to touch multiple triangles and thus
cannot be said to unambiguously belong to any one of them, so check
distance to the intended triangle and accept the result if it's close.
2017-01-12 21:28:15 +03:00
99ca90e808 Dynamic Paint: improve UV island border handling in effects.
1. Forcibly symmetrize the neighbor relations, so that if A is neighbor
   of B, B is neighbor of A. The existing code is guaranteed to violate
   this if texture resolution is different between the sides of a seam.

2. In texture mode dynamic paint adds a 1 pixel wide border around the
   islands. These pixels aren't really part of the dynamic paint domain
   and thus by design can't have symmetrical neighbor relations. This
   means they can't be treated by effects like normal pixels.
   The simplest way to handle it in a consistent way is to exclude
   them from effects, but add an additional pass that recomputes them
   as average of their non-border neighbors, located on both sides of
   the seam.
2017-01-12 21:28:14 +03:00
720e564882 Cycles: Allow up to 4 motion curve primitives per BVH node
This avoids intersection AABB of different curve primitives
which makes it less ray-to-primitive intersections.

This gives about 30% speedup of hair rendering in the barber
shop scenes here. There is still some work to be done on those
files to solve major speed issues on certain frames.
2017-01-12 18:23:23 +01:00
b53ce9a1d0 Cycles: Prepare BVH traversal code to work with multiple curve primitives per node 2017-01-12 18:20:19 +01:00
f12f906dd9 Cycles: Correct assert() for cases when there are multiple curves per BVH node 2017-01-12 17:38:27 +01:00
76a4cf1941 Cycles: Use separate limit for motion primitives for BVH node limits
This way we can have different limits for regular and motion curves
which we'll do in one of the upcoming commits in order to gain some
percents of speedup.

The reasoning here is that motion curves are usually intersecting
lots of others bounding boxes, which makes it inefficient to have
single primitive in the leaf node.
2017-01-12 16:54:08 +01:00
0421ae056d Cycles: Change confusing logic of max leaf size check
Maximal number of elements is supposed to be inclusive. That is what
it was always meant in this file and what @brecht considered still
the case in 6974b69c61.

In fact, the commit message to that change mentions that we allowed
up to 2 curve primitives per leaf while in fact it was doing up to 1
curve primitive.

Making it real 2 primitives at a max gives about 5% slowdown for the
koro.blend scene. This is a reason why BVHParams.max_curve_leaf_size
was changed to 1 by this change.
2017-01-12 16:33:08 +01:00
d9cd9ff322 Cycles: Cleanup, space prior to semicolon
We don't have that in Blender style, no reason to violate it here.
2017-01-12 15:31:25 +01:00
985c121c0b Cycles: Cleanup, make curve functions private
Not only they don't really follow naming convention (we don't use
camel case) but also was not necessary to keep them in the global
symbol table.
2017-01-12 15:28:19 +01:00
83d18a2a91 Cycles: Make it more clear message why curve motion attribute was removed 2017-01-12 15:22:41 +01:00
53fa389802 Cycles: Use dedicated debug passes for traversed nodes and intersection tests
This way it's more clear whether some issue is caused by lots of geometry in
the node or by lots of "transparent" BVH nodes.
2017-01-12 13:44:35 +01:00
8daf02f134 Cycles: Remove more duplicated code in debug passes logic 2017-01-12 13:33:53 +01:00
789fdab825 Cycles: Fix wrong scaling of traversed instances debug pass 2017-01-12 13:32:13 +01:00
618b3480c8 Cycles: Cleanup, remove duplicated code 2017-01-12 13:31:35 +01:00
7eb4c850d3 Merge branch 'master' into blender2.8 2017-01-12 12:59:45 +01:00
d1131227c5 Cycles: Cleanup, indentation within preprocessor 2017-01-12 12:54:24 +01:00
511dbe56db Cycles: Cleanup, use switch() instead of if-else chain
About to add extra debug passes, which will be more clear to use switch().
2017-01-12 12:45:37 +01:00
554024e08e Cycles: move hair particle settings to scene context
Since the beginning of times hair settings in cycles were global for
the whole scene but were located in the particle context. This causes
quite some trickery to get shots set up for the movies here in the
studio by forcing artists to create dummy particle system to change
settings of hair on the shot.

While ideally this settings should be properly become per-particle
system for the time being it will save sweat and blood to move the
settings to scene context.

Reviewers: brecht

Subscribers: jtheninja, eyecandy, venomgfx, Blendify

Differential Revision: https://developer.blender.org/D2287
2017-01-12 10:48:17 +01:00
67f68295be Cycles tests: Rework output messages
Made them closer to how GTest shows the output, so reading test logs
is easier now (at least feels more uniform).

Additionally now we know how much time tests are taking so can tweak
samples/resolution to reduce render time of slow tests.

It is now also possible to enable colored messages using magic
CYCLESTEST_COLOR environment variable. This makes it even easier to
visually grep failed/passed tests using `ctest -R cycles -V`.
2017-01-12 09:47:54 +01:00
65c8937f7e Add Add Modifiers tab to the NLA & VSE editors
This is a follow up to rBca935ab

Differential Revision: https://developer.blender.org/D2442
2017-01-12 01:03:23 -05:00
Julian Eisel
092cbcd1d2 Fix T50056: Dyntopo brush size shortcut broken using constant detail setting. 2017-01-11 23:16:02 +01:00
Julian Eisel
c4f60319d1 UI: Try limiting 'x' icon to search buttons
Reusing PROP_TEXTEDIT_UPDATE instead of adding a new property flag just for search strings. Currently it's only used for search strings anyway so seems fine for now.

Fixes T50336.
2017-01-11 22:15:50 +01:00
c910beaa21 Split interp_weights_face_v3 into specific functions for tris and quads
This splits `interp_weights_face_v3` into `interp_weights_tri_v3` and
`interp_weights_quad_v3`, in order to properly handle three sided polygons
without needing a useless extra index in your weight array. This also
improves clarity and consistency with other math_geom functions, thus
reducing potential future errors.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2461
2017-01-11 17:55:13 -02:00
0507b3e4c4 Viewport SSAO: Fix normals not normalized 2017-01-11 18:47:06 +01:00
394fa07d41 Cycles: Fix wrong motion blur when combining deformation motion blur with autosplit
The issue was that we used to compare number of vertices for mesh after the auto
smooth was applied (at the center of the shutter time) with number of vertices
prior to the auto smooth applied. This caused false-positive consideration of a
mesh as changing topology.

Now we do autosplit as early as possible and do it from blender side, so Cycles
does not need to re-implement splitting on it's side.
2017-01-11 16:32:57 +01:00
38b0141554 Cycles: Pass explicit subdivision type to object_to_mesh
This allows us to do some extra logic checks there based on particular
subdivision type.

Additionally avoids implicit cast of enum to bool.
2017-01-11 16:23:54 +01:00
2b66a17e50 Copy autosmooth mesh settings BKE_mesh_new_from_object
This way render engine can first apply all modifiers on the
new mesh and then optionally perform autosmooth face splitting
on it.
2017-01-11 16:04:39 +01:00
8576efc98a RNA: Expose autosmooth face splitting
This way render engine can request mesh to be auto-split and not
worry about implementing this functionality on it's own.

Please note that this split is to be performed prior to tessellation.
2017-01-11 15:59:32 +01:00
7bbb2292dc Cycles: Cleanup, whitespace around operator 2017-01-11 15:16:22 +01:00
e068d09a4b Cycles: Improve logging of cases when motion blur is disabled
Next logical step is to expose this somehow to the interface.
2017-01-11 14:34:56 +01:00
Dalai Felinto
77dcf0fbc5 Merge remote-tracking branch 'origin/master' into blender2.8 2017-01-11 09:44:25 +01:00
Dalai Felinto
80865bd583 Fix building with INPUT_NDOF after warning cleanup
Reported by Clément Foucault
2017-01-11 09:43:40 +01:00
e041bf7579 Cleanup: Use more meaningful constants other than 0 2017-01-11 00:27:53 +01:00
1dbaf0dbcc Add mid_v3_v3_array function and remove redundant functions
Other than implementing a `mid_v3_v3_array` function, this removes
`cent_tri_v3` and `cent_quad_v3` in favor of `mid_v3_v3v3v3` and
`mid_v3_v3v3v3v3` respectively.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2459
2017-01-10 19:58:34 -02:00
Dalai Felinto
9533eb4908 Fix warnings (mostly unused arguments) 2017-01-10 18:36:00 +01:00
da026249ab UI Layout: fix some cases mixing fixed and expandable sizes
When layout has only small buttons (buttons with icon and without label)
its size should be fixed. Code was modified to be able to add a new UI_ITEM_MIN
flag which indicates that the layout has only small fixed-width buttons.

Patch by @raa, with minor style edits by @mont29.

Reviewers: Severin, mont29

Reviewed By: mont29

Tags: #bf_blender, #user_interface

Differential Revision: https://developer.blender.org/D2423
2017-01-10 16:24:22 +01:00
Dalai Felinto
5ed5ed59c3 Fix T49861: Interlace stereo drawing
This does not address stapling shader in 2.8, though the solution can be
similar (own shader, not polutting interlace shader).

part of T49043

Reviewers: merwin

Differential Revision: https://developer.blender.org/D2440
2017-01-09 17:58:13 +01:00
d5cf90f59f Cleanup: Strict CLang warning in Smoke module 2017-01-09 13:12:43 +01:00
bb88c7af81 Cleanup: Indentation 2017-01-09 13:11:42 +01:00
1b75cd5aa8 Cleanup: Don't use C++ comments style in C code 2017-01-09 12:35:08 +01:00
378afc9830 Fix for T50373: lattices should not be able to get subsurf modifiers
Reviewers: mont29

Reviewed By: mont29

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2449
2017-01-09 12:24:34 +01:00
9c756162ae Fix T50385: Deadlock in BKE_libblock_remap_locked.
Am pretty sure node update should not touch to Main database like that,
but for now let's allow it, I guess the hack is needed for things like
Sverchok. ;)
2017-01-09 10:43:23 +01:00
e713009e9b Fix: Audio plays back incorrectly after rendering to a video file
D2365
2017-01-06 18:18:20 +01:00
62604c5c20 Make button span the full width of the properties editor 2017-01-05 15:41:14 -05:00
b2159b94bc Remove instances of old vector icons
I checked and this makes consistent with other area of blender.
See https://developer.blender.org/rBf86eccb1ca2388ae203df2a59285a2f2fb9b6aa8#131061
2017-01-04 23:24:43 -05:00
Julian Eisel
e42e1769b3 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/gpencil/drawgpencil.c
2017-01-05 00:31:15 +01:00
Julian Eisel
82b9e1e312 Show 'Manipulate Center Points' in weight paint mode
If the active object is in weight paint mode, but some armatures in pose mode, 'manipulate center points' still affects the transformation. See bd2034a749.

Also removed redundant check, we basically did the same check for paint modes twice.
2017-01-05 00:14:25 +01:00
b86042f21a Dynamic Paint: Fix random pixel flooding by absolute brush with spread.
If a very low wetness absolute alpha brush is used with spread and
drying effects enabled, some pixels will rapidly accumulate paint.
This happens because paint drying code applies a minimal wetness
threshold that causes the paint to instantly dry out.

Specifically, every frame the brush adds paint at the specified
absolute alpha and wetness set to the minimal threshold, spread
drops it below threshold, and finally drying moves all paint to
the dry layer. This drastically accelerates the rate of flow of
paint into the affected pixels.

Fortunately, the reason paint spread actually ends up decreasing
wetness turns out to be a simple floating point precision problem,
which can be easily fixed by restructuring the affected expression.
2017-01-04 19:44:29 +03:00
a9163f7d22 Fix (IRC reported) bad handling of Text data-block user count.
Reported on IRC by dfelinto, thanks.

Root of the issue was that opening a new text file would create
datablock with one user, when Text editor is actually a 'user one' user.

This was leaving Text datablocks in inconsitent user count, and
generating asserts in BKE_library area.

Also changed a weird piece of code related to that extra user thing in
main remapping func.
2017-01-04 14:07:38 +01:00
351a9d084f Fix T50369: Objects can't be deleted from scene when using "link group objects to scene"
Main issue here was that in old usercount system 'user_real' did simply
not allow that kind of thing to work. With new pait of 'USER_EXTRA'
tags, it becomes possible to handle the case correctly, by merely refining
checks about indirectly use objects whene removing them from a scene.

Incidently, found another related bug, 'link group objects to scene' was not
incrementing objects' usercount - bad, very very bad!
2017-01-04 10:28:59 +01:00
Dalai Felinto
c0c48cdacc Fix T50350: Quick Explode time frame problem
The settings.frame_start rna was clamping frame start to frame end when frame start was bigger than frame end.
The fix is simply to set frame end first
2017-01-04 10:13:28 +01:00
3a1b1100af Revert "Remove double menu entries"
This reverts commit e2d7efc950.
2017-01-03 10:34:05 -05:00
ff0221f5d8 Fix implicit size_t to int conversion.
Seems like it was erroring on some buildbots...
2017-01-03 15:30:59 +01:00
65582e75e3 Fix: NLA "Strip Time" setting cannot be edited
This is a hacky fix for a regression introduced sometime after 2.76.
The "Strip Time" setting on NLA Strips could not be edited without the
value immediately jumping back to the current FCurve value (or 0.0 if no
keyframes existed); even enabling autokey wouldn't let you key the property.

Until we have proper overrides (that only lose their values on frame change),
it's best that this setting is editable, even if it does mean it you have to
manually change the frame to see the updated values.
2017-01-03 11:42:50 +13:00
Dalai Felinto
329879239e Merge remote-tracking branch 'origin/master' into blender2.8
I'm deliberately ignoring/reverting rB070f22c4 which in turns means T49861 is happening on 2.8
2017-01-02 11:47:26 +01:00
8f1f3a0d46 GPencil: Per-layer option to always show onion skinning
Sometimes it can be useful to be able to keep onion skins visible in the
OpenGL renders and/or when doing animation playback. In particular, there
are two use cases where this is quite useful:
 1) For creating a cheap motion-blur effect, especially when the before/after
    values are also animated.
 2) If you've animated a shot with onion skinning enabled, the poses may end
    up looking odd if the ghosts are not shown (as you may have been accounting
    for the ghosts when making the compositions).

This option can be found as the small "camera" toggle between the "Use Onion Skinning"
and "Use Custom Colors" options.
2017-01-02 23:32:13 +13:00
3c74071634 Fix: Passed wrong last argument to function 2017-01-02 23:32:13 +13:00
Dalai Felinto
d78f51a4c2 Merge remote-tracking branch 'origin/master' into blender2.8 2017-01-02 11:31:03 +01:00
Dalai Felinto
070f22c440 Fix T49861: Interlace stereo is broken in 2.78
This is a regression introduced in rB5bd9e832

It looks more like a hack than a proper fix, but the shader logic
changed a lot for blender2.8, so I would rather do the elegant fix
there, while leaving master working.

If we ever do a 2.78b (or 2.79) this should get in.
2017-01-02 11:30:17 +01:00
13174df534 API: Fix rst syntax 2017-01-02 00:33:15 -05:00
42e4b0955c API: Fix redirect in bgl page 2017-01-02 00:24:40 -05:00
143d9373e4 API: Update to modern sphinx syntax 2017-01-01 23:54:55 -05:00
32c65faeb9 Cleanup: redundant assignment in rect resize 2017-01-02 13:56:19 +11:00
911544c70c API: Fix double slashes in URLs 2017-01-01 19:53:16 -05:00
7924c84c44 Fix T50305: When adding new ID with same name as existing, Blender could generate invalid utf-8 ID name.
`check_for_dupid()` would roughly truncate existing name, without doing any utf-8 validation.
2017-01-01 02:27:03 +01:00
adadfaad88 Fix (unreported) fully broken 'sanitize utf-8' helper.
That code was a joke, letting some invalid utf8 bytes pass, returning
wrong offset for some invalid sequences, not to mention length and
pointer easily going out of sync, NULL final byte being 'forgotten' by
memcpy, etc. etc.

The miracle here is that we could survive using this for so long!
Probably because we do not use utf-8 sanitizing enough in Blender,
actually... :/
2017-01-01 02:15:42 +01:00
acbb84b021 Add BLI_string_utf8 specific test.
This test should ensure we correctly detect all invalid utf-8 sequences in a given string.

DISCLAIMER:
Do not run this with current code - you'll either laugh or cry, nearly *all* checks fail!

Based on utf-8 decoder stress-test (https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt)
by Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2016-12-31 16:10:20 +01:00
fb20cbe04c Fix missing particlemode context mode, after recent particle-removal revert.
This caused the particle mode tools panel to appear in object mode, where it
misses some contextual data and spews python exceptions.
2016-12-30 12:13:21 +01:00
f874aeef70 Merge branch 'master' into blender2.8
Please **DO NOT** add changes from master when it's totally uneeded!

Changes to BLI_ area most certainly shall *always* be done in master,
there is absolutely no point in adding more diff between the two
branches than needed, will only makes merging more cumbersome!

Conflicts:
	CMakeLists.txt
	source/blender/blenlib/intern/math_vector_inline.c
2016-12-29 20:05:22 +01:00
bf7d7bc323 Add new operator, ED_OT_undo_redo, to allow py tools to trigger that action.
Patch D2430 by @raa, thanks.
2016-12-29 12:38:20 +01:00
934b3f3682 Fix T50334: Also select indirectly imported objects when linking/appending.
Since we create a base and instantiate them, they become directly
linked, so makes sense to also select them if requested.
2016-12-29 12:17:23 +01:00
7ba2356a53 Freestyle: fix typo in console message.
Patch D2270 by Anthony Edlin (@krash), thanks.
2016-12-29 10:34:59 +01:00
6bd245bb53 Edits to user prefs NDOF UI
Small changes:

- Remove "NDOF" from each setting
- Change tooltip for deadzone
- Unrelated typo in cmake comment

Reviewers: merwin, Severin

Reviewed By: merwin, Severin

Tags: #bf_blender, #user_interface

Differential Revision: https://developer.blender.org/D2319
2016-12-29 01:09:11 -05:00
3d243eb710 Fix T49848: bevel of spiral gets bigger and bigger widths.
This is the same issue as was fixed with T39486: the adjustment pass
that tries to equalize different widths at either end of an edge
sometimes causes the widths to get bigger and bigger.
The previous fix was to let "clamp_overlap" do double duty as a way
to limit this behavior. But clearly this is undiscoverable, as the
current bug report shows.  So I put in an "auto-limiting" mode that
detects when adjustments are going crazy and then acts as if
clamp_overlap were set.
The reason we can't always act as if clamp_overlap is set is that
certain models (e.g., Bent_test in regression tests) look bad if
that is enabled.
2016-12-28 13:55:19 -05:00
6ecab6dd8e Revert particle system and point cache removal in blender2.8 branch.
This reverts commit 5aa19be912 and b4a721af69.

Due to postponement of particle system rewrite it was decided to put particle code
back into the 2.8 branch for the time being.
2016-12-28 17:30:58 +01:00
2412e67ef8 UI: Make icon-only buttons for enum items with empty label.
Patch D2420 by @raa, thanks.
2016-12-28 15:07:18 +01:00
a522469940 Various UI message and API doc tweaks and fixes.
Mostly from patch D2256 by Aaron Carlisle (@Blendify), thanks!
2016-12-28 14:37:08 +01:00
11ae06b0b7 Update manual links in 'add object' py template.
Patch D2328 by @blendify, thanks.
2016-12-28 14:25:31 +01:00
45d0231a24 Minor UI message fix.
Based on D2436 by @blendify, thanks.
2016-12-28 14:17:15 +01:00
cabd2dceca Tweak error message when external image editor launching fails.
Include idea that Blender may fail to launch it even if path is correct,
in some cases (dear Windows...).

Based on idea from @lijenstina and @blendify (D2349), thanks.
2016-12-28 14:11:47 +01:00
b1c6ddb107 Also apply similar fixes to .keyframe_delete()
- T49816
2016-12-29 01:12:25 +13:00
3cbe95f683 Fix T49816: Keyframing NLA Strip influence from Python set keyframes in the wrong place 2016-12-29 01:12:24 +13:00
c5338fd162 Fix T50184: Grease Pencil Layer synchronization between Dope Sheet and Properties panel 2016-12-29 01:12:23 +13:00
7f262acb92 Fix T49479: Freestyle inconsistent line drawing with large geometry dimension.
Ray-plane intersection routine GeomUtils::intersectRayPlane() was used with an
unnormalized direction vector as input.
2016-12-28 18:09:35 +09:00
6559ab2d51 3D View roll & orbit were scaling view-quat length
Over time roll and orbit would scale the quaternion
which is documented as unit length.

In practice any errors would be subtle,
but better normalize as other operators do.
2016-12-28 18:10:34 +11:00
d5edaac42d Comments: mul_project_m4_v3_zfac 2016-12-28 15:49:39 +11:00
d874b40a55 Fix T50240: Rendering crashes when synced to JACK Transport
Disabling synchronization while rendering.
Using G.is_rendering as suggested by bastien. ;-)
2016-12-27 20:47:01 +01:00
752a783fa4 Fix T50305: Blender truncates a long multibyte character object's name to an invalid utf-8 string.
Add logic in RNA to ensure we pass valid utf8 string to BKE ID new functions...
2016-12-27 16:39:19 +01:00
c1e3041051 Comments: hints for perspective functions
Note which GL functions these are equivalent to.
2016-12-27 15:30:11 +11:00
41ec1adb03 Correct bad cast, unused var warning 2016-12-27 15:29:55 +11:00
3a9c490531 [MSVC] Fix test for C++11 support for vc2015/2017 based on D2432 by Ulysse Martin (youle) 2016-12-24 10:37:10 -07:00
Dalai Felinto
605263177b Merge remote-tracking branch 'origin/master' into blender2.8 2016-12-23 15:36:16 +01:00
b47c912f4b Fix (unreported) crash in 'Match movie length operator' in case of lost video texture file 2016-12-23 16:51:26 +03:00
d0335796a8 Readfile: Resurrect do_versions_after_liblink.
Basic idea is to store fileversion in Library datablock, and split again
Main by libraries after lib linking, do_versions_after_liblink on
those separated Mains, and merge again.

This allows to still have correct versions for each data-block in that
second do_versions step.

Note that this is not used currently in master (might be soon, though),
but is needed for 2.8 work.
2016-12-23 12:54:51 +01:00
8db2f72997 Fix (unreported) --threads option no more respected by main task scheduler.
Main scheduler would be created way before `-t` argument would be
parsed, since it was on forth pass! Moved it to first pass of argparse,
that kind of stuff should be initialized asap on startup.
2016-12-22 22:00:48 +01:00
Julian Eisel
5e31e07230 Fix wrong return type in blenderplayer stubs 2016-12-22 02:35:34 +01:00
5fb85ef2c2 Fix strict compiler warning in generated C++ RNA 2016-12-20 12:29:41 +01:00
544f6113f8 OpensSubdiv: Cleanup, unused argument 2016-12-20 12:29:41 +01:00
1c34a7f4eb Libmv: Fix missing virtual destructor in frame access sub-class
This is undefined behavior in C++ and Clang was complaining a lot
about this.
2016-12-20 12:29:41 +01:00
4d5cd638ff String drawing function for the "simdebug" utilities.
Simple string drawing API for debug drawing, in addition to basic primitives.
2016-12-20 11:02:40 +01:00
76c4f0ec6c Fix parameter error (changes by Mike Erwin) 2016-12-19 22:36:56 +01:00
bd42987399 Fix (unreported) linked datablocks going through do_versions several times.
When linking data-blocks from same library in several steps, the already
linked data-blocks of same lib would go again through versionning code...

Note: only fixed for libraries, I can't imagine how this could happen
with local data...
2016-12-19 16:31:06 +01:00
e30d94bb3b Cleanup: rename paramenter to right name 2016-12-19 12:28:51 +01:00
3af98b4c04 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/CMakeLists.txt
	source/blender/editors/gpencil/drawgpencil.c
	source/blender/editors/physics/physics_ops.c
2016-12-17 13:07:00 +01:00
6c3d8fbeb3 Cleanup: trackball logic
Used SQRT2 and SQRT1_2 to calculate the same value,
harmless but a little confusing, set once and check instead.
2016-12-17 19:14:02 +11:00
2e15618f49 Fix T50216: Missing checks caused data transfer segfault
Data transfer was not checking if the required geometry existed, thus
causing a segfault when it didn't. This adds the required checks, and
reports errors if geometry is missing.

This also replaces instances of the words "polygon" and "loop" in error
messages with "face" and "corner" respectively, to be consistent with
the rest of the existing UI.

Reviewed By: mont29

Differential Revision: http://developer.blender.org/D2410
2016-12-16 23:53:08 -02:00
535298eea5 Fix T50264: Stroke is not painted when append Grease Pencil block
When append a datablock the default brushes were not created and only
were created when draw new strokes. Now the default brushes are created
when draw strokes if necessary.
2016-12-16 22:56:43 +01:00
Julian Eisel
4df75e536a Make Shift+LMB on transform manipulator configurable
It's now possible to change the shortcut that enables planar transformation with the transform manipulators (shift+LMB on axis).

This actually fixes the workaround added in rB20681f49801fd. Thing is that we needed to allow using the manipulators, even if a modifier key is held so things like snapping work right away. That's why normal LMB behavior uses KM_ANY. However, event handling would always execute the KM_ANY keymap handler because it's iterated over first. Simply solved this by registering the KM_SHIFT keymap item first, so it has priority over the KM_ANY one.
2016-12-16 02:49:53 +01:00
Julian Eisel
524ab96245 Fix drawing enum property with icon only flag
Enum properties with icon only flag should use minimum/fixed width in expanded layouts (alignment=UI_LAYOUT_ALIGN_EXPAND).

Differential Revision: https://developer.blender.org/D2415 by @raa (only made some really minor corrections)
2016-12-15 23:43:17 +01:00
e2d7efc950 Remove double menu entries
These were already present in the "Select" menu.
2016-12-15 22:12:29 +01:00
bd3de93557 Gtest: Fix/workaround MSVC complains about use of struct with alignment 2016-12-15 17:53:57 +01:00
26bb0ee464 Fix Playerstubs tm 2016-12-15 15:47:00 +01:00
12e1732f72 Layer Weight node support for Blender Internal Render 2016-12-15 15:03:28 +03:00
665110a414 Proper fix for strict compiler warning 2016-12-15 11:51:53 +01:00
14d17cd27a Revert "Cleanup: Remove unused variable"
This reverts commit 743165eb48.

Didn't see it is used in debug mode, sorry
2016-12-15 11:50:25 +01:00
743165eb48 Cleanup: Remove unused variable 2016-12-15 11:49:44 +01:00
Karsten Weiss
820709c14d Fix STR_String Capitalize on non Win32
Harmless since its not used, but good to fix.
2016-12-15 12:58:19 +11:00
741c4082d8 BGE: Fix T50098: Crash when useding ImageMirror
The crash was caused by a missing m_sync initialisation in the second
ImageRender constructor.
2016-12-14 20:07:51 +01:00
84a283d18c Fix World Space Shading option influence on Fresnel node for BI + cleanup 2016-12-14 19:48:01 +03:00
525673b37b Cycles: Fix uninitialized variable issue after recent changes 2016-12-14 17:31:11 +01:00
4f03d3290c Fresnel node support for Blender Internal Render 2016-12-14 18:02:38 +03:00
91bbffd379 Cycles: Move object culling helper to own files
This is a stand-alone logic, which becomes quite comprehensive now.
2016-12-14 13:01:33 +01:00
6967216485 Cycles: Fix indendation 2016-12-14 12:47:28 +01:00
c4d6fd3ec0 Cycles: Consider GGX/Beckmann/Ashikhmin of 0 roughness a singular ray
This matches behavior of Multiscatter GGX and could become handy later on
when/if we decide it would be beneficial to replace on closure with another.

Reviewers: lukasstockner97, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2413
2016-12-14 11:04:02 +01:00
72d18c195e Cycles: Tweak curve segment (un)pack to handle more curve segments
There was 16 bits reserved for primitive type, while we only need 4.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2401
2016-12-14 10:59:45 +01:00
d210755f85 Usual UI messages/i18n fixes/tweaks. 2016-12-14 10:56:21 +01:00
fbcd51aef8 Fix T50243: libmv_panography_test is broken
There was fully wrong logic in comparison: was actually accessing memory
past the array boundary. Run test manually and the figure seems correct
to me now.

Spotted by @LazyDodo, thanks!
2016-12-14 10:46:20 +01:00
1bfe359802 OpenGL fixes
- mixing of old & new APIs
- vertex format mismatch
2016-12-14 02:43:26 -05:00
1e21b8dc1b OpenGL: another way to set uniform theme color 2016-12-13 16:45:59 -05:00
0fa887ae35 OpenGL: finish area action zone todo
Replace outlined circle (24 vertices) with a point sprite (1 vertex).

Replace one todo with another todo.
2016-12-13 15:43:13 -05:00
3b98b44223 small fix for previous commit 2016-12-13 15:03:58 -05:00
fe59296361 OpenGL: new immediate mode in area.c
D2361 by @punya, part of T49043
2016-12-13 14:51:39 -05:00
c21a5139e1 Small cleanup: Remove unused code
This code has not been used for a long time if not ever.
Most of the code was removed in rB1d3609262704f88c9e30b2cebdb236110b25cdc9
however, this was forgoten.
2016-12-13 20:15:53 +01:00
Julian Eisel
c1267bb800 UI: Externally open file and path from context menu
Adds two buttons to context (RMB) menu of path buttons:
* "Open File Externally" to open a file in an external app (only visible if path contains a filename)
* "Open Location Externally" to open a path in an external file browser

The functionallity for this was already there, just hidden behind Shift/Alt click of file_browse button (folder icon next to path button).
2016-12-13 17:01:59 +01:00
ec2fd74f47 Fix strict warnings on Windows 2016-12-13 16:46:04 +01:00
8bae72d04a Fix strict compiler error when building without bullet 2016-12-13 10:18:02 +01:00
Karsten Weiss
9446b6809a Libmv: Fix typo in assert message 2016-12-13 10:16:20 +01:00
Karsten Weiss
356dacea90 Libmv: Fix copy-paste mistake in camera intrinsic parameters 2016-12-13 10:15:40 +01:00
9be6d5ff18 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/depsgraph.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/makesrna/intern/rna_particle.c
2016-12-12 16:17:57 +01:00
5f852a4324 Cleanup: bad (harmless) usage of PARM_PYFUNC_OPTIONAL in new ID.make_local RNA definition.
PARM_PYFUNC_OPTIONAL is only useful in definition of callbacks for
registrable types...
2016-12-12 15:56:00 +01:00
7415b9ffa3 Fix (unreported) some RNA func definitions setting flags of other func parameters!
Both found cases where luckily harmless, though...
2016-12-12 15:54:16 +01:00
440d104279 Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.

To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.

This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).

And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).

Reviewers: sergey, Severin

Subscribers: dfelinto, brecht

Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:46:06 +01:00
62703850ad Cleanup: Get rid of unused BKE_rigidbody_relink_constraint().
Also use proper ID_NEW_REMAP macro in BKE_rigidbody_world_groups_relink()!
2016-12-12 15:05:19 +01:00
b708dce34f Cleanup: Rename BKE_libblock_relink, and move it to BKE_library_remap.h
Was a waaaaayyyyy to much generic name for such a specific func, renamed
to much more descriptive BKE_libblock_relink_to_newid().

In near future (few weeks, to limit as much as possible silent mismatch
in branches), will rename BKE_libblock_relink_ex to BKE_libblock_relink,
this is the real generic data-block relinking func!
2016-12-12 14:58:10 +01:00
efadc8051e Cleanup: Get rid of ntreeSwitchID(_ex) functions, use generic BKE_libblock_relink_ex instead. 2016-12-12 14:31:50 +01:00
968e01d407 Cycles: Cleanup, variable names
Use underscore again and also solve confusing part then in BVH smae
thing is called prim_addr but in intersection funcitons it was called
triAddr.
2016-12-12 12:10:37 +01:00
b21938f3d4 Cycles: Cleanup, variables names
Use underscore instead of camel case.
2016-12-12 10:19:49 +01:00
2bb7a135ae Added --debug-io flag to command line 2016-12-09 17:21:11 +01:00
5a8b5a0377 Land D2339 by bliblu bli 2016-12-09 08:28:04 -07:00
1846a78849 Depsgraph: Add missing relation for cast modifier
When control object is used we need to known our own transformation as well.
2016-12-09 13:40:12 +01:00
3bd94b9f45 Depsgraph: Bone parent should also include armature transform relation
It is required to have world-space bone position, which consists of armature
object transform and local bone transform.
2016-12-09 13:05:39 +01:00
Julian Eisel
54528079e3 Correction to previous commit
Accidentally included some changes from workspaces branch.
2016-12-08 23:27:56 +01:00
Julian Eisel
35c18e4871 Move screen drawing functions into new screen_draw.c 2016-12-08 23:17:45 +01:00
dd58390d71 Fix emissive volumes generates unexpected fireflies around intersections
Discard the whole volume stack on the last bounce (but keep
world volume if present).

Volumes are expected to be closed manifol meshes, meaning if
ray entered the volume there should be an intersection event
of ray exisintg the volume. Case when ray hit nothing and
there are still non-world volumes in the stack can happen in
either of cases.

1. Mesh is not closed manifold.

Such configurations are not really supported anyway and should
not be used.

Previous code would have consider the infinite length of the
ray to sample across, so render result wasn't really correct
anyway.

2. Exit intersection is more far away than the camera far
   clip distance.

This case also will behave differently now, but previously it
wasn't really correct either, so it's not like we're breaking
something which was working as expected.

3. We missed exit event due to intersection precision issues.

This is exact the case which this patch fixes and avoid
fireflies.

4. Volume has Camera only visibility (all the rest visibility
is set to off)

This is what could be considered a regression but could be
solved quite easily by checking volume stack's objects flags
and keep entries which doesn't have Volume Scatter visibility
(or even better: ensure Volume Scatter visibility for objects
with volume closure),

Fixes T46108: Cycles - Overlapping emissive volumes generates unexpected bright hotspots around the intersection
Also fixes fireflies appearing on the edges of cube with
emissive volue.

Reviewers: juicyfruit, brecht

Reviewed By: brecht

Maniphest Tasks: T46108

Differential Revision: https://developer.blender.org/D2212
2016-12-08 17:35:43 +01:00
Julian Eisel
0a26904a75 Fix T49872: 3D cursor places with camera shift in ortographic mode 2016-12-08 12:41:27 +01:00
Julian Eisel
d5708fdad6 Fix expanding enum property in sub-layout of pie menus
//ui_item_enum_expand// function replaces all pie menu's sub-layouts with radial layout. It should replace only root layout.

To reproduce the issue paste the code in Blender's text editor and press Run Script button.
```
import bpy

class VIEW3D_PIE_template(bpy.types.Menu):
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout.menu_pie()
        layout.column().prop(
            context.scene.render.image_settings, "color_mode", expand=True)

def register():
    bpy.utils.register_class(VIEW3D_PIE_template)

def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)

if __name__ == "__main__":
    register()
    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")
```

Differential Revision: https://developer.blender.org/D2394 by @raa
2016-12-08 12:21:57 +01:00
62a2ed97ba Fix crash when opening a Blender file containing Alembic data.
Was also affecting object linking.
2016-12-07 23:04:27 +01:00
a63108efb1 Fix install_deps.sh failing to build ffmpeg 3.
--disable-libfaac is no more ffmpeg build option.
2016-12-07 17:17:31 +01:00
fc4a51e3fa Fix (unreported) Sequencer Drop effect: wrong initial offset in second input buffer.
Reading rest of the code, it's obvious we want to start à YOFF lines
from start of rect2i, so we have to also multiply by number of
components.

Also did some minor cleanup.
2016-12-07 14:53:57 +01:00
8f29503b52 Fix T49893: Crash in Video Sequence Editor with 'drop' effect.
Code was not accounting for possibilities that width or height of given
buffers may be smaller than XOFF/YOFF...

Note that I seriously doubt that drop code actually works (as in, gives
expected results) when applied to tiles like it seems to be done
currently, but this is much more complex (and involved) topic.
2016-12-07 14:23:46 +01:00
2002167a96 Remove unused include statement 2016-12-07 11:39:12 +01:00
bfe34789d1 Use proper defaults for Hue/Saturation node 2016-12-07 11:27:27 +01:00
4b69b6d316 Cycles :Cleanup, indentation 2016-12-06 15:37:29 +01:00
0371ef16ee Depsgraph: Only re-schedule objects which are on visible layers
Otherwise it's possible to cause infinite update loop in Cycles viewport.

Gets a bit messy logic, need to revisit this..
2016-12-06 14:48:48 +01:00
1b9cae9d04 Fix T50122: SEGFAULT: OCIO configuration typo leads to segfault 2016-12-06 14:19:17 +01:00
1de79c8960 Fix T50003, Bevel makes non-manifold mesh.
Problem was setting prev/next faces for edges around
a vertex on valence-2 vertices.
2016-12-06 07:43:47 -05:00
8ce6de3bdd Fix T50020: adding a background image does not set image user data. 2016-12-06 00:04:15 +01:00
fe0520e2c8 UI: add a message to indicate when using a modifier that wasn't
compiled.

This adds a short message to the smoke, remesh and boolean modifiers' UI
when trying to use them when their compilation was turned off. This was
already implemented for the fluid and ocean simulation modifiers.

This also makes the 'quick fluid' and 'quick smoke' operator abort and
report when trying to use them when unavailable.
2016-12-05 23:33:21 +01:00
7471f09f2b Depsgraph: Use HIGH priority for scheduled tasks
This kind of keeps threads "warmer" and should in theory give better
cache coherency bringing some %% of speedup. It was already tested
few months ago and it gave few % speedup in barber shop, but was
reverted due to some bone popping. The popping is now fixed so it
should be fine to use new scheduling policy.
2016-12-05 16:31:34 +01:00
69e8e34d96 Depsgraph: avoid more transitive relations for rigid body simulation 2016-12-05 16:30:30 +01:00
d1d7217692 Depsgraph: Rigid body simulation doesn't need explicit time relation
It'll be dependent on time via Time Source -> Rebuild RB World chain.
2016-12-05 16:03:10 +01:00
2cb5dffc8d Depsgraph: Avoid transitive relation from local transform to final
There is always an uber eval node on the way. so we can avoid creating
some relations here in order to speed up both construction time and
evaluation.
2016-12-05 15:59:31 +01:00
60dae91db8 Fix depsgraph: hair collision is actually enabled, so add the relations. 2016-12-05 13:36:30 +03:00
95b224dab2 Fix compilation error on recent Debian desktop
Something funny happened here, there were missing symbols from png
library to math functions.
2016-12-05 11:35:26 +01:00
47c6047873 3D cursor & mini axis for modern viewport
Shuffle existing code, hook it up to the new (& old) viewport.

Also the 3D mouse rotation guide for NEW viewport only. Minor feature not worth enabling for legacy 3D view.
2016-12-05 02:50:28 -05:00
6ab42eb0bd OpenGL: delete bl_debug_draw
Eliminating this chunk of legacy GL as part of T49043.

We can introduce some sort of "debug plate" to fill this need in the future.
2016-12-04 20:34:44 -05:00
5de33c3b64 cleanup: C99 for view3d_draw
Mostly for clarity & to declare things close to where they are used.

I'm getting ready to do substantial work in these files.
2016-12-04 20:11:12 -05:00
b18f83bcf4 Fix T50141: Nabla zero division on texture force field
This sets forces to zero, when Nabla is zero and a grayscale texture is
used or texture mode is Gradient or Curl.

Nabla equal to zero was causing a zero division, and forces ended up
being set to `nan`.

Reviewed By: mont29

Differential Revision: http://developer.blender.org/D2393
2016-12-04 18:01:46 -02:00
dfca1e1460 CMake: disable QuickTime with macOS SDK 10.12+, no longer supported by Apple. 2016-12-04 20:26:37 +01:00
1791697d43 Fix macOS 10.9 build when using OIIO without FFmpeg. 2016-12-04 20:26:37 +01:00
7d443ed86d Docs: Show 'Other Options' last in --help
Own error when changing order,
moving experimental features last made some sense,
but causes them to be listed twice.

Reorder and comment to avoid it happening again.
2016-12-04 21:55:17 +11:00
d9d7b5b4d0 Cleanup: simplify bitmap line drawing
- Expand overly dense & confusing delta assignments.
- Replace bit shift with multiply.

Also link to 'clipped' version of this function
which may be useful to add later.
2016-12-04 15:15:25 +11:00
923eae25d1 [msvc] Changes for new oiio/ffmpeg versions. 2016-12-03 17:38:20 -07:00
ae04d0fcb6 CMake: update for macOS 10.9 libs with ffmpeg 3.2.1 and webp support. 2016-12-03 15:30:47 +01:00
1a01ef4ae9 Fix macOS build with openimageio 1.7.8 and openexr.
These macros conflict and are no longer needed with C99 or C++ anyway.
2016-12-03 15:19:49 +01:00
a2ebc5268f Cycles: Refactor Progress system to provide better estimates
The Progress system in Cycles had two limitations so far:
 - It just counted tiles, but ignored their size. For example, when rendering a 600x500 image with 512x512 tiles, the right 88x500 tile would count for 50% of the progress, although it only covers 15% of the image.
 - Scene update time was incorrectly counted as rendering time - therefore, the remaining time started very long and gradually decreased.

This patch fixes both problems:
First of all, the Progress now has a function to ignore time spans, and that is used to ignore scene update time.
The larger change is the tile size: Instead of counting samples per tile, so that the final value is num_samples*num_tiles, the code now counts every sample for every pixel, so that the final value is num_samples*num_pixels.

Along with that, some unused variables were removed from the Progress and Session classes.

Reviewers: brecht, sergey, #cycles

Subscribers: brecht, candreacchio, sergey

Differential Revision: https://developer.blender.org/D2214
2016-12-03 05:02:21 +01:00
35d490b3f1 OCIO: Implement exposure/gamma for fallback implementation
Quite handy for debugging.

Unfortunately, this doesn't support viewport tweaks yet since those
require GLSL for colorspace conversion. Maybe this will be implemented
as well one day in the future..
2016-12-02 16:57:00 +01:00
31fbf2b74a Cycles: Implement AVX2 path for curve intersection functions
Gives little performance improvement on Linux and gives up to 2%
speedup on koro.blend on Windows.

Inspired by Maxym Dmytrychenko, thanks!
2016-12-02 12:23:38 +01:00
acc1f8fbed Cycles: Add AVX intrinsics helpers
They are defined for MSVC but seems to be missing in GCC and CLang-3.8.

Maybe some further tweaks to policy when to define those functions is
needed, but should be fine for now.
2016-12-02 12:23:38 +01:00
0c958b9f8e Fix T50062: Mask - Clicking in ActivePoint Parent makes Blender crash.
Mask primitive adding code was not initializing correctly id_type of
points' parents.
2016-12-02 10:47:18 +01:00
0ac2be7030 Cycles: Disable AVX2 crash workarounds
I can no longer reproduce crash with neither of the files where
the crash was originally visible. This is something where other
changes (light threshold, sampling) had an effect and made code
to work as it is supposed to. Could have been optimizator issue
or something like that.

Let's see if we hit same issue again.
2016-12-02 10:17:05 +01:00
a4c6558481 Fix (unreported) memleak in ImBuf mipmap code in some cases.
`IMB_remakemipmap` may 'shrink' the mipmap list without actually freeing
anything, so we need to check all possible levels in `imb_freemipmapImBuf`
to avoid memory leaks, not only those currently used.
2016-12-02 09:44:41 +01:00
7458a022aa OpenGL: cleanup function parameters & state
glDepthMask takes GLenum
glLineWidth & PointSize take float
glCullFace has no effect when GL_CULL_FACE disabled
2016-12-01 18:18:07 -05:00
Julian Eisel
52ec962516 UI: Previews for screen layouts
Basically all this does is drawing layout previews into the opened layout search menu.
https://youtu.be/RHYWtZP7pyA

The previews are drawn using offscreen rendering so they can't use multi-threading (yet!). But that shouldn't be an issue since only a handful of previews are drawn at the same time. Normally we only need to redraw the preview if a screen layout was changed. Would be nice if PreviewImage could store if it supports threaded rendering.
Previews are saved in files, might be useful if you later want to support appending layouts.
Adds a new file screen_draw.c.
2016-12-01 17:19:58 +01:00
4ff4dbc0ab Immediate mode replacement for compositor node backdrop elements.
Part of T49043.
2016-12-01 17:08:29 +01:00
0e1cf858a0 install_deps.sh: Update official (default) lib versions of py/oiio/osl/osd/ffmpeg. 2016-12-01 16:31:34 +01:00
7fe7835d13 Fix (unreported) looptri array not being recalculated in ccgDM and emDM
In ccgDM and emDM, looptri array recalculation was being handled
directly by `*DM_getLoopTriArray` (`getLoopTriArray` callback), while
`*DM_recalcLoopTri` (`recalcLoopTri` callback) was doing nothing.

This results in the array not being recalculated when other functions
that depend on the array data called the recalc function.

This moves all the recalculation code to `*DM_recalcLoopTri` and makes
`*DM_getLoopTriArray` call that.

This commit also makes a minor change to the `getNumLoopTri` function,
so that it returns the correct number without having to recalculate the
looptri array.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2375
2016-12-01 12:41:56 -02:00
69a75b0169 GPencil: Include various new operators into the 3D View menus too
Quite a few of the operators added for 2.78 were not included in the menus
2016-12-02 03:13:47 +13:00
bdceea9475 GPencil Sculpt: Numpad keys now work when doing sculpt sessions (i.e. when the operator is run using wait_for_input=True)
This just brings it in line with the drawing operator
2016-12-02 03:13:47 +13:00
d258865995 Compiler warning fix 2016-12-02 03:13:46 +13:00
87cacd3893 Buildbot: Disable glibc211 slaves 2016-12-01 15:05:53 +01:00
f812b05922 Fix T50116: Light threshold broke branched path tracer
In fact, the issue was caused by light threshold being too high for
certain scenes. Lowered it down to 0.01.
2016-12-01 14:27:10 +01:00
9d50175b6c Cycles: Fix correlation issues in certain cases
There were two cases where correlation issues were obvious:

- File from T38710 was giving issues in 2.78a again
- File from T50116 was having totally different shadow between
  sample 1 and sample 32.

Use some more simplified version of CMJ hash which seems to give
nice randomized value which solves the correlation.

This commit will break all unit test files, but it's a bug fix
so perhaps OK to commit this.

This also fixes T41143: Sobol gives nonuniform noise

Proper science paper about hash function is coming.

Reviewers: brecht

Reviewed By: brecht

Subscribers: lukasstockner97

Differential Revision: https://developer.blender.org/D2385
2016-12-01 14:19:15 +01:00
87cd56b012 Fix T50075: Assert during debug render of hair_geom_transmission.blend 2016-12-01 12:11:11 +01:00
ff2a74906a Merge branch 'master' into blender2.8 2016-12-01 10:29:46 +01:00
58877d6d08 Alembic: quiet compilation warnings on Windows.
Most of them are harmless implicit conversions (e.g. Alembic deals with
doubles for storing time information when Blender uses both ints and
floats/doubles) or class/struct mismatch on forward declarations.
2016-12-01 08:32:15 +01:00
05b181fbc5 Fix T46795 : Reset GWLP_USERDATA to NULL at window destruction so any future events will not try to reference this deleted class. 2016-11-30 18:26:25 -07:00
df63195d2a Cleanup id->newid usage, initial work.
This aims at always ensuring that ID.newid (and relevant LIB_TAG_NEW)
stay in clean (i.e. cleared) state by default.

To achieve this, instead of clearing after all id copy call (would be
horribly noisy, and bad for performances), we try to completely remove
the setting of id->newid by default when copying a new ID.

This implies that areas actually needing that info (mainly, object editing
area (make single user...) and make local area) have to ensure they set
it themselves as needed.

This is far from simple change, many complex code paths to consider, so
will need some serious testing. :/
2016-11-30 15:27:59 +01:00
2f6f75613f OCIO: Cleanup style
Was a ground work for some more improvements here, but got dragged
to some other studio maintenance job here.

The plan would be to enable exposure/gamma control for fallback mode
which will definitely be really handy for development and might be
handy for cases when OCIO config can not be read.
2016-11-30 12:54:14 +01:00
2ac8c9b42e Alembic: slight cleanup, reorder mesh code a bit. 2016-11-30 09:35:53 +01:00
66a3671904 Fix T49813: crash after changing Alembic cache topology.
Crash is due by mismatching loops and faces counts between the Alembic
data and the Blender derivedmesh which does not appear so
straightforward to fix (the crash happens deep in the derivedmesh code).

So for now, try to detect if the topology has changed and if so, both
only read vertices (vertex colors and UVs won't be read, as tied to face
loops) and add a warning message in the modifier's UI to let the user
know.
2016-11-30 09:20:45 +01:00
Julian Eisel
514db9f014 UI: Remove 'x' icon from paths and lists 2016-11-29 23:41:20 +01:00
bd5ae46c19 Fix compilation error with latest OIIO 1.7.8
There are some changes in OIIO includes so now need to do some
things differently.
2016-11-29 12:40:38 +01:00
1ec5edcc96 Fix T50094: Crash when viewport rendering point density texture
The idea is simple: cache PD resolution from cache_point_density() RNA
function because that one is supposed to be called while database is
locked for original synchronization.

Ideally we would also pass array size to the sampling function, but
it turned out to be quite problematic because API only accepts int type
and passing size_t might cause some weird behavior.
2016-11-29 11:39:14 +01:00
7ea2dedd59 Cycles: Pass extra array size argument to builtin image pixels functions
This is a way to avoid possible memory corruption when render threads works
in parallel with UI thread.

Not guarantees complete safe, but makes things easier to check anyway.
2016-11-29 11:03:11 +01:00
cc1a64be36 Math lib: Fix use function of wrong dimension
Seems to be a typo in recent commit e1e49fd.
2016-11-29 10:31:54 +01:00
3b467b35a8 Fix T50029: BVHTree.FromPolygons memory leak 2016-11-29 19:32:41 +11:00
73c1c92c0e Fix C++11 building on MSVC 2015
Newest 2017 not yet supported because i don't know its version symbol...
2016-11-29 02:35:46 -05:00
a76f1a7449 Default to C++11 for all compilers (2.8)
This fixes multiple problems on latest Mac OS + Xcode. Hopefully does not cause any on other platforms.

The Xcode detection logic could use further cleanup. It's checking several old versions that are unsupported for Blender 2.8+ development.
2016-11-29 01:01:38 -05:00
8d4421b0fc DerivedMeshes clean up their draw-batch caches
No more "Not freed memory blocks"!

This code was almost ready 1 month ago, waiting for other pieces to fall into place.
2016-11-29 00:26:21 -05:00
9f35495a26 Gawain: batch mode uses buffer ID funcs
The _discard functions now free their resources! These were waiting on thread-safe ID management, which we now have.
2016-11-29 00:12:50 -05:00
4af42f06c3 Gawain: immediate mode uses buffer ID funcs
These functions are called very infrequently.
2016-11-29 00:08:07 -05:00
328a47fa2c Gawain: manage GL buffer IDs in a thread-safe way
Needed because deps graph can destroy objects from any thread. We ran into the same problem & solved it in GPU_buffers.

Implemented in C++11 since it provides the needed machinery. The interface is in C like the rest of Gawain.
2016-11-29 00:03:54 -05:00
9bea39c474 [msvc] remove /opt all together and revert to the default behavior /opt:ref for release builds, /opt:noref for debug builds. 2016-11-28 19:55:07 -07:00
dd34b7a71c Comment: explain viewport & render pixel-size
It wasn't all that clear why both pixel-sizes are needed.
2016-11-29 13:18:04 +11:00
e369b85e2f Replacing UI_view2d_scrollsers_draw() to immedaite mode
Part of T49043

Reviewers: krash, merwin

Reviewed By: krash, merwin

Differential Revision: https://developer.blender.org/D2364
2016-11-28 20:14:15 -05:00
c6d6f39153 Moved UI_view2_multi_grid_draw() to Gawain
Part of T49043, to replace gl immediate calls with Gawain

Reviewers: krash, merwin

Reviewed By: krash, merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2363
2016-11-28 20:11:13 -05:00
6278adc3ca [msvc] change linker options from /opt:noref to /opt:ref, saves about 20% off the executable size
Nobody appears to know why this option was on (and just on for just x64 at that)
2016-11-28 13:22:36 -07:00
Julian Eisel
e0307113a5 UI: Add 'x' icon to text buttons to clear content
This is useful e.g. for search buttons to quickly clear the filter string. We might want to make this optional for python scripts.
2016-11-28 19:03:31 +01:00
df687837f8 [msvc2017] remove eigen vector workaround for msvc2017. 2016-11-28 10:12:21 -07:00
3340acd46b Fix T50065: Audaspace: some values of the lower limit of Factory.limit causes the factory not to play
Backport of upstream audaspace bugfix (ddd9a4d).
2016-11-28 17:23:44 +01:00
96ed2b0ce0 Remove sensor-size to int conversion
Currently harmless since the value is always set at its default (32).
Even so, it's confusing since its used with floats after.
2016-11-28 17:36:37 +11:00
Julian Eisel
2821da5b70 Enable multi-selection editing by default (Alt-key behavior)
This means editing a property will now always affect all selected objects, bones or sequencer strips. Support for this was added in rBdfbb876d4660 but you had to hold the Alt-key to use it. The old behavior of only editing the active object will not be kept like decided in the 2.8 workflow meeting (reports comming). If you only want to edit the active object, you have to deselect others.

There are still a couple of issues to be resolved (listed below), but having it enabled by default helps testing and getting used to it and should motivate us to fix them ;)
To be fixed:
* Give users hint when edits are applied to all objects/bones/strips ("Applying to x objects") - there are ideas but we need to finalize and implement them
* Make it work better in corner cases (material editing, modifier property editing, etc)

Note: Values usually override the initial value of the object/bones/strips, except of number buttons where it depends if you enter the value (absolute override) or drag the value (add value change). This behavior is consistent with multi-button editing.
2016-11-27 16:28:56 +01:00
841f3e4972 A number of other minor RNA fixes and precautionary safeguards against further crashes here 2016-11-28 02:33:49 +13:00
452028c77c GPencil RNA API: "set_active" option for layer.new() and palette.new() is now true/enabled by default
To bring the API more into line with the UI (and the general expected behaviour of
Blender when it comes to adding stuff), newly created layers and palettes will be
made the active ones by default. It's possible to override this behaviour still
(e.g. in cases where you're auto-generating a large number of them), but otherwise,
this change will help prevent errors like T50123.
2016-11-28 02:33:48 +13:00
e2d223461e Fix T50123 - GreasePencil: Modifying name of new color in new palette via bpy segfaults
When there were no prior palettes, creating a new one didn't automatically make it active.
This caused problems when trying to rename the color, as the RNA code assumed that if there's
a color, it must come from the active palette.

This commit partially fixes the problem by ensuring that if there are no palettes, the first
one will always be made active.
2016-11-28 02:33:48 +13:00
d20f5b7de0 Typo fix 2016-11-28 02:33:47 +13:00
ce3cae81f6 [msvc2015] Fix cmake warnings regarding backslashes in path of the run-time libraries 2016-11-26 17:00:25 -07:00
d464a7c441 fix T50118: Added missing assignment of Bone Roll 2016-11-26 18:48:50 +01:00
265e5def76 Fix T50104, Race condition in SVMShaderManager::device_update_shader 2016-11-25 12:03:04 -07:00
bcd0d8584f Math Lib: avoid temp array for rotate_m4
No need to have temp array storage, avoid 2x loops.
2016-11-25 21:00:32 +11:00
e1e49fd1a8 Math Lib: rotate matrix cleanup
- Remove 'rotate_m2', unlike 'rotate_m4' it created a new matrix
  duplicating 'angle_to_mat2' - now used instead.
  (better avoid matching functions having different behavior).

- Add 'axis_angle_to_mat4_single',
  convenience wrapper for 'axis_angle_to_mat3_single'.

- Replace 'unit_m4(), rotate_m4()' with a single call to 'axis_angle_to_mat4_single'.
2016-11-25 16:39:34 +11:00
d30a0239a2 Fix Torus default UV's offset outside 0-1 bounds
When major/minor segments didn't fit evenly into 4,
the UV's would move outside the UV bounds.
2016-11-25 14:29:34 +11:00
4f4e0ecdcf Remove eekadoodle workaround for add torus
This is no longer needed since moving to MPoly/MLoop data structure.

Also use 3x3 matrix for transforming instead of quaternion
(slightly better performance).
2016-11-25 14:26:25 +11:00
729affe7c9 Cycles: Avoid divisions by zero in volume sampling code
Was giving huge artifacts in the barber shop file here in the studio,

Maybe not fully optimal solution, but committing it for now to have
closer look later.
2016-11-24 16:39:02 +01:00
Martijn Berger
4d3d2d0299 Remove unused vector icons from RNA 2016-11-24 13:43:29 +01:00
403f00e558 Fix prefs UI when built w/o Cycles 2016-11-24 11:14:45 +11:00
def365e252 Fix T50100: Cycles SeparateRGBNode Red socket defined wrong
Spotted by David (bocs), thanks!
2016-11-23 11:33:09 +01:00
f2b57c3532 Depsgraph: Fix matrix_world driver source
Reported by Dalai in IRC, thanks!
2016-11-23 11:09:05 +01:00
a537e7b426 Cycles: Fix strict compilation warnings 2016-11-23 10:59:54 +01:00
411836d97c Fix Cycles device backwards compatibility error if device type is unavailable. 2016-11-23 00:04:06 +01:00
57141ea30e Fix spelling in Cycles distance culling description. 2016-11-23 00:04:06 +01:00
99c5c8befc Fix T49718: Wrong "Make Duplicates Real" behavior with "Keep Hierarchy"
All objects were being parented to a single instance of each parent
object, instead of their respective instances, when using dupliverts or
dupligroups.

Behavior was caused by the `persistent_id[0]` (vertex/face id) being
ignored when computing `parent_gh` hash, which caused all instances to
have the same hash, and thus only the first one was included.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2370
2016-11-22 14:59:59 -02:00
9aa8d1bc45 Cycles: Fix strict compilation warnings
Should be no functional changes.
2016-11-22 16:39:03 +01:00
67b1979c91 Install_deps: fix warning message not showing up in case build fails.
Kinda stupid, but big nice warning about need to try clean build if
something fails was only showing in case install_deps completed
successfully... :P
2016-11-22 16:06:05 +01:00
751573ce6f Fix T50034: Blender changes processor affinity unauthorized 2016-11-22 16:03:16 +01:00
Julian Eisel
a796a84a43 Use const for color array arguments 2016-11-22 14:51:34 +01:00
Julian Eisel
60ce602380 Fix missing conversion of uchar color to float
Decided to just pass float [4] args, so no type conversion is needed at all.
2016-11-22 14:40:57 +01:00
cb694d6595 GLog: Workaround compilation error on Hurd
There is syscall headers but no SYS_Write syscall.
2016-11-22 12:43:59 +01:00
4818b3c97e Cycles: Fix re-definition of some functions on x32 arch 2016-11-22 12:34:45 +01:00
1be717d007 Fix (unreported) crash when drawing armatures' poses in some cases.
Was affecting armatures' pose drawing code, could try to draw with
non-updated pose, which may contain NULL bone pointers (e.g. after some
data-block management tool execution, like make local, remapping, etc.).
2016-11-22 12:24:03 +01:00
edc10f5529 Cycles: Another attempt to fix compilation on 32bit Linux 2016-11-22 12:11:08 +01:00
af444e913f Cycles: Attempt to fix 32bit buildbot builds after recent commit 2016-11-22 12:06:16 +01:00
272412f9c0 Cycles: Implement texture size limit simplify option
Main intention is to give some quick way to control scene's memory
usage by clamping textures which are too big. This is really handy
on the early production stages when you first create really nice
looking hi-res textures and only when it all works and approved
start investing time on optimizing your scene.

This is a new option in Scene Simplify panel and it acts as
following: when texture size is bigger than the given value it'll
be scaled down by half for until it fits into given limit.

There are various possible improvements, such as:

- Use threaded scaling using our own task manager.

  This is actually one of the main reasons why image resize is
  manually-implemented instead of using OIIO's resize. Other
  reason here is that API seems limited to construct 3D texture
  description easily.

- Vectorization of uchar4/float4/half4 textures.

- Use something smarter than box filter.

  Was playing with some other filters, but not sure they are
  really better: they kind of causes more fuzzy edges.

Even with such a TODOs in the code the option is already quite
useful.

Reviewers: brecht

Reviewed By: brecht

Subscribers: jtheninja, Blendify, gregzaal, venomgfx

Differential Revision: https://developer.blender.org/D2362
2016-11-22 12:00:09 +01:00
927a168b07 GPU: Consider latest Gallium driver an official ATI/AMD
This will make triple buffer used by default for such configuration.

Ideally we would switch to triple buffer on all platforms, but let's
do it in 2.8 branch and don't open can of worms in master now.

This should solve issues like T49945.
2016-11-22 11:38:27 +01:00
bd8cbf5c07 Glog: Fix compilation error on ppc64el
This was fixed in upstream already. Time to re-bundle?
2016-11-21 21:04:48 +01:00
dd51ec592f CLEW: Workaround compilation error on ppc64el
Something was conflicting here, causing C++ to consider bool as
a __vector(4) bool.
2016-11-21 21:03:34 +01:00
94d8e6fc6c Partly revert own rBb97c567c1df1e, clear_proxy is actually safe.
This is very confusing, in fact, and rna tooltip was wrong,
BKE_object_make_local_ex actually ensures we never have several proxies
of same object, since it always clears proxy when it has to copy object
to make it local...

What that RNA function is probably missing, though, is same logic as in
BKE_library_make_local to actually remap proxy from old linked object to
new local one.
2016-11-21 20:57:02 +01:00
b97c567c1d Fix two very bad issues in new ID.make_local RNA function.
I) `clear_proxy` parameter was not assigned to parm in RNA define code,
so 'pyfunc optional' flag was set to `new_id` parameter of `user_remap`
func - super ugly!

II) `clear_proxy` parameter itself, when set to False, would allow to
leave .blend file in invalid state (more than one proxy of same object),
this should never, ever be allowed in RNA API imho. Left the PAI
untouched for now, just disabled any effect from this parameter (hence
always clearing proxy when copying).
2016-11-21 15:25:33 +01:00
2a78635dea Cleanup: get rid of unused BKE_constraints_relink().
Libquery/generic ID remapping code handles this now.
2016-11-21 15:25:33 +01:00
25c534f20a Fix T49981: New Depsgraph - When camera is on inactive layer, it does not evaluate constraints 2016-11-21 14:37:23 +01:00
af7343ae22 Cycles: Attempt to fix compilation error on ppc64el
There is some define conflict between system headers and clew,
so delay include of clew.h as much as possible.]

This is something which needed to be done in the code before
the refactor, hopefully such change will still work.
2016-11-21 13:32:41 +01:00
5eab3b079f Depsgraph: Fix infinite viewport object update in CYcles render mode
The issue was caused by wrong object re-tag needed to have proper dependnecies
update for OpenSubdiv.
2016-11-21 12:00:09 +01:00
b3c8ee891a Depsgraph: use more explicit parenthesis 2016-11-21 11:05:56 +01:00
83b1f24140 Fix Xcode link error, missing definitions in RNA C++ API that other compilers ignored. 2016-11-20 18:12:12 +01:00
b86c6aa6be Cycles: Don't shadow loop variable 2016-11-20 11:46:43 -05:00
f68ef05a56 Cycles: add basic backwards compatibility for device selection, move to System tab.
For the multi-GPU case users still have to reconfigure the devices they want to use.

Based on patch from Lukas Stockner.

Differential Revision: https://developer.blender.org/D2347
2016-11-20 15:45:22 +01:00
aea4ed00d5 Cycles: refactor culling code into utility class. 2016-11-20 15:25:47 +01:00
e8641d4474 Cycles: distance culling for objects.
This can be used together with camera culling to keep nearby objects visible in
reflections, using a minimum distance within which objects are visible. It is
also useful to cull small objects far from the camera.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2332
2016-11-20 15:01:11 +01:00
2c26a7b71e Cleanup: harmless mistake in rangetree 2016-11-20 09:11:26 +11:00
53a1b48321 GHOST/X11: Incorrect WM_STATE access
This worked by accident because of struct padding,
treat state as a CARD32 as documented.

Matches wine-x11 usage.
2016-11-20 09:03:51 +11:00
dd82d70bc5 Fix T50081: Grease pencil parented rotation problem
When the parent object matrix change after the layer was parented, the
inverse matrix for strokes must be updated when editing strokes or the
transformations will be wrong.
2016-11-19 22:41:37 +01:00
8c93178c96 Fix T50078: Vertex Groups not copied over when making proxy.
Reviewers: mont29

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2368
2016-11-19 19:18:10 +01:00
559bd75766 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/editors/space_view3d/drawobject.c
2016-11-19 16:28:39 +01:00
Martijn Berger
5cbc7b6ed2 bgl do not bind parts of OpenGL that are not exposed in core profiles 2016-11-19 15:07:01 +01:00
369872a2c5 Fix T49991: reloading librairies doesn't update node groups.
We need to check node tree links are still valid, after we remapped
some NodeGroup.

Note: In fact, we have to run that for *all* ID types, since nodes may
use any kind of data-block (in theory)... :/
2016-11-19 12:31:40 +01:00
fa6a62fac2 Fix NodeGroup generic verify function crashing if node's ID pointer is NULL.
Another nice crasher - in this case, we just want to nuke all sockets...

Related to T49991.
2016-11-19 12:18:32 +01:00
bd6a9fd734 Fix (unreported) nodeRemoveAllSockets() not clearing inputs/outputs sockets lists.
Nice crasher (though seems to not be much used so far)!

Related to T49991.
2016-11-19 12:16:14 +01:00
5a6534a5bb Fix forward-compat Nodes write code being executed also for undo steps writing.
Forward compatibility code should never, ever be run during undo saving.

Note: related to T49991 (but does not fix it either, crash now happens
when doing a real file save...).
2016-11-18 22:44:05 +01:00
884693b42a Fix Node space ID remap callback not handling node trees.
Yep. Kinda ridiculous, but forgot to handle the very node trees
data-blocks in that editor!

Related (but not fixing) to T49991.
2016-11-18 22:44:05 +01:00
b6c0edcb09 Fix T50071: Radience HDR fomat does not support alpha at all. 2016-11-18 22:44:05 +01:00
b8710e1468 Fix UV layer bug in object_utils.object_data_add()
Adding a torus in edit-mode, with 'Generate UVs'
for example would either create another UV layer with the default name or
switch to the default UV layer name if it exists.

Now use the existing UV layer if present.
2016-11-19 06:57:55 +11:00
40990d52d1 Add Torus: avoid excessive attr access 2016-11-19 06:57:13 +11:00
39be226e93 BMesh: invalid return from BM_mesh_validate
Returned value was always false, even for valid meshes,
note that this is a debug-only function.

Also set internal-tag cleared.
2016-11-19 06:31:17 +11:00
a90644ed19 Minor debug-report tweak to autosave code.
Print in cosole a warning when we skip autosave due to runnning modal op.

Related to T49974.
2016-11-18 18:47:29 +01:00
Dalai Felinto
0f8e5f4fb4 Cycles: Different noise seed for stereoscopic rendering (Fix #T50024)
Patch by Sergey Sharybin.
2016-11-18 18:23:52 +01:00
ba7c11aa05 Depsgraph: Fix residue of debug-only code 2016-11-18 17:48:01 +01:00
Martijn Berger
53267d2579 convert icon_draw_texture to gawain imm mode replacements 2016-11-18 16:04:25 +01:00
27de0c40c5 Fix T50035: Minor interface bug: UV/ImageEditor - Paint Mode - Fill Brush
Patch by @LucaRood, added some cleanup of DRAW/FILL conditions in this
code too...
2016-11-18 15:49:41 +01:00
f6083b7bcd Fix (unreported) bad handling of brush's fill threshold value.
'1' threshold value would only allow to access a third of the basic
'color space' (from black to white, from 0.0 to 1.0 component values),
when you expect it to access the whole range.

Unfortunately, this needs a subversion bump to allow already defined
brushes to keep exact same behavior!

Also, did not change default value (0.2) for new brushes, think here
keeping current one makes more sense.

Thanks to @LucaRood for confirming the issue.
2016-11-18 15:32:50 +01:00
8f0dc3cef6 Fix T50052: bpy.utils.unregister_module doesn't unregister classes of submodules in reload scenario.
reload case would clear TypeMap before unregistering addons, which made
all calls to unregister_module() to do absolutely nothing.
2016-11-18 15:15:46 +01:00
Julian Eisel
3fb11061ba Fix T50063: Editing driver's expression eliminates "Zero" number
Disables trimming of trailing zeros in case button contains an expression.
2016-11-18 13:38:46 +01:00
Dalai Felinto
fffb1a4cfb Implement multi-view stereo support for image empties
Empty images were implemented to expand (and eventually replace)
the background images functionalities. If we are ever to drop
background images "image empties" should support stereo/multi-view as well.
2016-11-18 12:38:18 +01:00
841c4deed7 Fix potential NULL dereference in mesh sequence cache modifier.
Reported by coverity.
2016-11-18 12:03:12 +01:00
b859fef670 Fix copy/paste typo in new depsgraph object geometry builder (found by coverity). 2016-11-18 11:55:28 +01:00
e0bea34c51 fix problem from D2360
I was too eager to get patch in after a last-minute change. My bad!
2016-11-18 00:40:40 -05:00
43ed3079e2 Moved UI_view2d_grid_draw() to immediate functions
Part of T49043

Reviewers: krash, merwin

Reviewed By: krash, merwin

Differential Revision: https://developer.blender.org/D2360
2016-11-17 22:49:22 -05:00
2de882e8cb OpenGL: textview port to immediate mode -> T49043
Updated the GL calls to the new immediate mode.
I left some glcolor calls which I'm not sure wether thats right?
Part of T49043

warm regards,
Sebastian Witt

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2305
2016-11-17 22:05:49 -05:00
fe73b8c29c use new enum types in glutil & imm_util 2016-11-17 16:10:53 -05:00
d915e89ec8 delete deprecated fdrawXORcirc function
Only one place used it, and that place was dead code already.
2016-11-17 15:03:55 -05:00
feccadd81b mark certain glutil functions as deprecated
These will be removed before we ship 2.8
2016-11-17 14:44:15 -05:00
03a395766a BMesh: avoid using temp array for face-area 2016-11-18 06:10:53 +11:00
46739f1e5c BMesh: minor cleanup
Comment & don't use dummy pointer.
2016-11-18 06:10:53 +11:00
a1a8343281 Cleanup: redundant index loop for monkey-create
Also rename face vars (the faces aren't temp),
and quiet old-style-definition warning.
2016-11-18 06:10:53 +11:00
d294509dd8 Depsgrpah: Fix missing animation update in movie clips 2016-11-17 16:37:25 +01:00
4dbd61cc64 Depsgraph: Move scene builder function to own file
This way it's much easier to grasp what the graph actually contains.
2016-11-17 15:44:32 +01:00
1f8762bb8e Fix T50060: New depsgraph does not update mask animation 2016-11-17 15:29:22 +01:00
0a08d8c892 Depsgraph: Use utility macro to iterate over linked list
This will be compiled into same exact code, just saves us from
doing annoying type casts all over the place.
2016-11-17 15:11:55 +01:00
0c322c3000 Depsgraph: Move rig builder functions to own files
Those routines are rather big and started to be annoying to have
one big file.

Should be no functional changes.
2016-11-17 14:41:16 +01:00
16e2c0ef3c [MSVC] Preliminary VS2017 support. 2016-11-16 20:13:58 -07:00
60409841a4 Fix T50001: auto tile size addon broken after Cycles GPU device changes.
Adds a get_num_gpu_devices() utility function for the addon to use.
2016-11-17 02:17:56 +01:00
86f435d6c8 Gawain: small note for future Vulkan work 2016-11-16 18:25:36 -05:00
Martijn Berger
b757e8298a Convert console_draw.c to Gawain
Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2276
2016-11-16 22:56:39 +01:00
b1f700dad3 Gawain: use PRIM_ and INDEX_ enums instead of GLenum
For a few reasons:
- separate enum sets for separate concepts
- debug with symbolic names instead of 0x4e72
- prepare for a Vulkan future
2016-11-16 16:03:15 -05:00
e400f4a53e Fix T50051: Avoid crash when render grease pencil from VSE
The renderpasses for grease pencil are not necessary when render from
sequencer.

This fix solves the GPF but we need to rethink the complete render
process for grease pencil and integrate better in the render and
composition workflow.

Thanks to Dalai Felinto por helping in the debug and fixing of the
problem.
2016-11-16 21:33:47 +01:00
36ac979ee0 Gawain: use COMP_ instead of GL_ internally
Because GLenum could be ANYTHING. We use our own enum type for components.
2016-11-16 15:18:06 -05:00
7aa82e7ed2 Gawain: re-enable strict error checking in release builds
Makes it easier for new volunteers to catch errors early.
2016-11-16 12:14:55 -05:00
472e2c5acf Blender 2.8: Added immVertex2s() and immAttrib2s()
Just as mentioned in title. Need new functions for calls found in `transform.c`

T49043

Reviewers: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2358
2016-11-16 11:53:41 -05:00
Dalai Felinto
2bcb1b208a Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-16 17:04:21 +01:00
2a2eb0c463 Cycles: Fix different noise pattern from fix in T49838:
No need to hash subframe == 0.
2016-11-16 15:32:00 +01:00
209bc9977c Fix T50046: Segmentation fault due to out-of-range VertexGroup.weight() call.
`get_vert_def_nr()` was not checking vert index in bmesh case (aka Edit mode).
2016-11-16 12:42:17 +01:00
Martijn Berger
f86eccb1ca Remove unused vector icons
it seems to me the icons are unused:

  - VICO_VIEW3D_VEC
  - VICO_EDIT_VEC
  - VICO_EDITMODE_VEC_DEHLT
  - VICO_EDITMODE_VEC_HLT
  - VICO_DISCLOSURE_TRI_RIGHT_VEC
  - VICO_DISCLOSURE_TRI_DOWN_VEC
  - VICO_MOVE_UP_VEC
  - VICO_MOVE_DOWN_VEC
  - VICO_X_VEC

Since their code contains immediate mode GL calls and they seem to be unused i thought we could remove them.

Reviewers: mont29

Reviewed By: mont29

Subscribers: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2356
2016-11-16 12:25:14 +01:00
930f999f6e Part of T49043: Convert drawsimdebug.c to use the new Gawain API.
This conversion is pretty straightforward.

The code for debug drawing is not great, but it does the job.
Rewriting it is for another day, if it becomes more widely used.
2016-11-16 12:18:12 +01:00
15b2a64d0a Add stdlib.h include to fix missing 'abort' prototype. 2016-11-16 11:31:35 +01:00
e17b92f535 Fix custom props not being handled correctly by manual/pyref UI menu entries. 2016-11-16 11:09:14 +01:00
4722fc5dd0 Disable possibility to flip bone names of linked armatures
Linked data should not be modified in such a way.

Reported by Nathan here in the studio, reviewed by Bastien, thanks!
2016-11-16 10:39:41 +01:00
eb9e9f7f1a Cleanup: Remove unused function 2016-11-16 10:10:07 +01:00
3b06c42616 Blender2.8 convert UI_view2d_constant_grid_draw to new immediate mode
Convert UI_view2d_constant_grid_draw to new immediate mode.

Part of T49043.

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2298
2016-11-15 18:59:24 -05:00
edddd2c6f5 Use new immediate mode for ED_region_grid_draw
Convert ED_region_grid_draw to new immediate mode.

Part of T49043

Reviewers: merwin

Reviewed By: merwin

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2289
2016-11-15 18:37:03 -05:00
8b2905952e Fix T50026: "Only Insert Needed" doesn't work when using Trackball rotation
The rotation case here only covered rotation by the "Rotate" tool, but skipped
the "Trackball" tool.
2016-11-16 11:14:38 +13:00
6397319659 Fix T50023: Inverse Kinematics angle limits defaulting to 10313.2403124°
Regression from 2.77a. The units for the min/max limits were changed in RNA
but the pose channels were still being initialised with in degrees.
2016-11-16 11:10:19 +13:00
0de157a320 FIX T49899: Add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to classes that use eigen's data types , to force aligned on 16 byte boundaries. 2016-11-15 13:21:01 -07:00
2653758adc blender 2.8: OpenGL immediate mode: anim_draw
Reviewers: merwin

Reviewed By: merwin

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2353
2016-11-15 12:19:47 -05:00
b78ddd43a5 start using COMP_* instead of GL_* in viewport
Gawain can accept either enum, but its own COMP_ values are recommended.
2016-11-15 11:49:00 -05:00
44b691dc65 RNA Main API: set remove's do_unlink default value to true.
On second and third thoughts, this should have been done that way since
the begining, cases were you just delete a few data-blocks without any
serious knowledge of their usages are much, much more frequent than
cases where you are deleting thousands of data-blocks and are sure they
are not used anywhere anymore...

Own fault, but really frustrated that this topic was only raised the day
after 2.78a was released. :(
2016-11-15 17:12:18 +01:00
f2690673ba Get rid of 'drivers unlinking' code in BKE_libblock_free_data()
This has nothing to do here (freeing is not unlinking/remapping!), and
was actually redoing something already taken care of by
`BKE_libblock_relink_ex()` call in `BKE_libblock_free_ex()`.

Also, gives some noticeable speedup when removing datablocks with
do_unlink=True, about 5 to 10% quicker e.g. when deleting all objects
from a py console, in a big production file...
2016-11-15 16:39:48 +01:00
af0e6b31a5 Depsgraph: Fix frash with iTaSC solver
This commit reverts part of a fix for T33275, but things are:

- I can not reproduce the original issue at all, so doesn't seem to
  cause any regressions.

- It is really bad idea to do delayed initialization in the threaded
  environment, it's a straight way to some nasty issues.

- We can't do things like this anyway because we go more granular,
  meaning such a delayed initialization will fail in the case of
  having several IK solvers (unless they properly accommodate to
  changed bone head).

- Verified the fix with various files from Mango project and all of
  them seems to work nice with new depednency graph now (old depsgraph
  has some flickering, but it's not related on DEG itself, but on
  an environment with lots of proxies and threaded evaluation and it
  is not a new behavior).
2016-11-15 16:18:59 +01:00
9019f8ca95 Revert "Proxy: Construct pchan hash when syncing armature proxy"
This reverts commit 9b5a32cbfb.

Apparently it is possible to have other thread mocking around with the hash.

Needs deeper investigation, for the time being reverting to prevent crashes.
2016-11-15 16:13:24 +01:00
cb117f283b Fix menu inconsistencies
This commit fixes two issues:

- UV/Image editor uvs menu did not match the 3D View's which was changed in rB2b240b043078
- Circle select tool was missing in particle edit mode

Reviewers: Severin
Differential Revision: https://developer.blender.org/D2329
2016-11-15 16:07:32 +01:00
a828818d59 Cleanup: More explicit parentheses 2016-11-15 16:01:21 +01:00
625db1d86e Avoid interface ID remapping when freeing the whole database
This makes heavy scenes to be freed almost instantly (so now
quadbot scene takes only 0.06sec to free),
2016-11-15 15:56:40 +01:00
85e51b0638 Avoid driver target remapping when freeing the whole database
Added BKE_libblock_free_data_ex() which takes special do_id_user
argument which basically indicates whether main database was already
taken care about not having "dead" pointers.

Gives about 40% speedup of main database free with quadbot scene
(3.4sec vs. 5.4 sec on quite powerful desktop).
2016-11-15 15:56:40 +01:00
Julian Eisel
0cd1b5ef85 Fix T50022: "Mirror" in Dopesheet Crashes Blender
Just fixing crash itself. Actually operator shouldn't run in most editors (not in dopesheet either I guess), but don't want to spend time on that right now.
2016-11-15 15:30:33 +01:00
Dalai Felinto
69470e36d6 Implement grouped undo option for operators
This option makes an operator to not push a task to the undo stack if the previous stored elemen is the same operator or part of the same undo group.

The main usage is for animation, so you can change frames to inspect the
poses, and revert the previous pose without having to roll back tons of
"change frame" operator, or even see the undo stack full.

This complements rB13ee9b8e
Design with help by Sergey Sharybin.

Reviewers: sergey, mont29

Reviewed By: mont29, sergey

Subscribers: pyc0d3r, hjalti, Severin, lowercase, brecht, monio, aligorith, hadrien, jbakker

Differential Revision: https://developer.blender.org/D2330
2016-11-15 14:25:10 +01:00
445274fc4f Depsgraph: Fix typo in previous optimization commit
Was a residue from another experiment, caused infinite loop when
reporting dependency cycles.
2016-11-15 14:22:17 +01:00
a284d04093 Atomics: Add some extra utility functions
Also fixed semantic of fetch-and-add in assembler implementation,
it seemed to not match the naming.
2016-11-15 13:41:08 +01:00
4ee08e9533 Atomics: Make naming more obvious about which value is being returned 2016-11-15 12:16:26 +01:00
093b6c9e6e blender 2.8: OpenGL immediate mode: action_draw
Updated action_draw to use imm mode.

Reviewers: merwin

Subscribers: LazyDodo

Differential Revision: https://developer.blender.org/D2351
2016-11-14 23:02:57 -05:00
46b5cdaa4d BMesh: remove redundant link-list manipulation
No need to track previous edge in vert-separate cleanup
2016-11-15 12:39:59 +11:00
665aa6a2a0 blender 2.8: Opengl: UI_draw_roundbox
all is in the title too..

Reviewers: merwin

Reviewed By: merwin

Subscribers: Blendify, Severin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2337
2016-11-14 20:27:54 -05:00
c418ef48cb BMesh: match BM_vert_find_first_loop with iterator logic
Use changes from previous commit for BM_vert_find_first_loop.
2016-11-15 07:55:55 +11:00
d9597ce3ba BMesh: avoid extra calls per faces-of-vert iterator
- `bmesh_radial_faceloop_find_first` & `bmesh_disk_faceedge_find_first`
  can be replaced with a single call to a new function:
  `bmesh_disk_faceloop_find_first`

- `bmesh_disk_faceedge_find_first` called `bmesh_radial_facevert_check`
  which isn't needed, since either the current or next loop in the
  cycle is attached to the edge we're looking for.
2016-11-15 07:39:39 +11:00
a3b61f0639 BMesh: use const for BM_vert_face_check 2016-11-15 07:30:18 +11:00
e6ad6ff082 BMesh: minor improvement to BM_vert_face_check
No need to perform edge-of-vert then loop-of-edge check.

Any vertex that has an edge with a face will be connected to a face.
2016-11-15 06:57:11 +11:00
77ba1ed5db BMesh: fix edge-rotate with w/ flipped faces
Edge-rotate would randomly flip one of the faces to match the other.

Also maintain active-face when rotating the edge.
2016-11-15 04:01:35 +11:00
d3919c22b0 BMesh: fix edge-rotation selection state bug
Failed edge rotation could leave unselected edge between selected faces,
also report warning when edges fail to be rotated.
2016-11-15 03:26:19 +11:00
6a2b95e1ca BMesh: replace iterator with BM_face_vert_share_loop 2016-11-15 02:44:57 +11:00
dc0a9e6535 BMesh: remove redundant argument 2016-11-15 02:44:57 +11:00
b047d79871 Cycles: De-duplicate image loading functions
The code was templated already, so don't see big reason to have
3 versions of templated functions. It was giving some extra code
to maintain and in fact already had divergency for support of huge
image resolution (missing size_t cast in byte image loading).

There should be no changes visible by artists.
2016-11-14 14:03:17 +01:00
7a4a2ed5f4 intsall_deps / OSL use c++11 ABI when install_deps is asking for c++11 2016-11-14 09:59:30 +01:00
8859aa3828 OpenGL: use packed normals for fancy wireframes
Consumes much less memory (1/3 for both normals = 32 bytes less per edge). Same visual result.

We can pack normals for other draw modes to get similar savings.

Part of T49165
2016-11-13 20:27:50 -06:00
ffc26fc5a8 Gawain: add support for 10_10_10 vertex format
Most useful for packed normals, which take 1/3 the space of float32 normals.

2-bit alpha|w component is ignored for now.

Batch API can use these now, will add support to immediate mode API if desired.

Enabling on Windows first. Will enable on all platforms after we switch Blender to core profile.
2016-11-13 20:18:51 -06:00
fc9fa07c0e BMesh: BM_face_exists no longer uses return arg
Just return the face or NULL, like BM_edge_exists(),
Also for BM_face_exists_overlap & bm_face_exists_tri_from_loop_vert.
No functional changes.

Old code did some partial overlap checks where this made some sense,
but it's since been removed.
2016-11-14 04:33:35 +11:00
1b1d6ce131 Fix T50013: Blender 2.78a Link/Append Crash.
Object freeing may in some kind access its obdata (in case it has some
caches e.g.), since here obdata may have already been freed, let's set
object's data pointer to NULL (probably not ideal solution, but we don't
care much, those form archipelagos of unused linked datablocks,
we nuke'em all anyway).

Also fix stupid mistake in one of own recent commits (using ID we just
freed, tsst...).
2016-11-13 15:49:41 +01:00
7e8bf9dbd6 Fix T50007: blender offline python documentation in zipped HTML files, not shown correctly.
Stupid mistake, os.scandir is not recursive... Patch by @brecht, thanks.
2016-11-13 12:06:26 +01:00
cc8132b0c8 Fix T49997: don't flip texture users menu in texture properties. 2016-11-13 02:29:10 +01:00
1dbe26f76c OpenGL: simplify debug, use only newer features
Drop SciTech support & workarounds for WinCE and OpenGL ES.

AMD_debug_output is still in the code but disabled. Once I verify the newer extensions are available on all the GPU + OS combos we support we can delete this disabled code.
2016-11-12 17:18:13 -06:00
43703fa4bf Fix T50008: camera DOF Distance picking from W key menu not working. 2016-11-12 22:31:24 +01:00
447fc7c4ce fix T50004: Removed check for empty mesh and adjusted the vertex import function to accept meshes without vertices as well 2016-11-12 22:20:07 +01:00
4151f12713 Fix Make Vertex Parent operator missing from vertex/curve/lattice menus.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2346
2016-11-12 19:01:13 +01:00
111e2f5aba Fix T49904: Cycles standalone missing default generated texture coordinates. 2016-11-12 17:33:07 +01:00
b5a58507f2 Fix Cycles OSL compilation based on modified time not working. 2016-11-12 17:33:07 +01:00
69288737ca Fix Cycles standalone not finding CPU device after recent changes. 2016-11-12 17:33:07 +01:00
478e59a04e Fix T49985: cycles standalone XML missing distant lights. 2016-11-12 17:33:07 +01:00
188ecee642 Fix T49985: cycles standalone using wrong socket names for XML reading. 2016-11-12 17:33:07 +01:00
Julian Eisel
627141082b Sculpt UI: Make DynTopo constant detail a resolution value
This should make it easier to sculpt in high resolutions, downside is that the new way to calculate maximum edge length is a bit less intuitive. Maximum edge length used to be calculated as blender_unit * percentage_value, now it's blender_unit / value.

Reused old DNA struct member, but had to bump subversion to ensure correct compatibility conversion. Also changed default value slightly (would have had to set to 3.333... otherwise).

Was Requested by @monio (see https://rightclickselect.com/p/sculpting/zpbbbc/dyntopo-better-scale-input-in-constant-detail-mode) and I think it's worth testing.
2016-11-12 16:53:38 +01:00
e00c3ab13f BMesh: update comments, ifdef'd code 2016-11-13 01:39:40 +11:00
eb880f280d Gawain: strict error checking in debug builds
Not release builds. Fix 66d7f01ecc to match what I meant to do.
2016-11-11 23:53:58 -06:00
8fd510f4b8 Gawain: new enum type for vertex attrib components
Motivations:
1) GLenum is too broad; tightly-defined enum just for this is safer.
2) enable a Vulkan future

New code should use these instead of GL_FLOAT etc. When all existing code has been updated to use new enum, we can drop compatibility with GLenum values.

Early work towards 10_10_10 format, more to come soon.
2016-11-11 19:39:56 -06:00
7fd2efa507 BMesh: Minor improvement to face-join
Pass in loops instead of edge & faces.
Nearly all callers have the loop-pairs to pass in.
2016-11-12 10:30:32 +11:00
dad0c31ceb Fix renaming error in last commit 2016-11-12 10:30:28 +11:00
8b01a6e0f1 BKE_library_make_local(): some minor improvements.
Do not set 'real user' to groups every time we run the first clearing loop.

And do fully clear properly LIB_TAG_DOIT (this is not yet enforced in
existing code, but would love to get to that stage in future, so let's
do it at least with new code!).
2016-11-11 23:17:52 +01:00
2dbcb75ed5 Minor naming cleanup. 2016-11-11 23:17:52 +01:00
f6ab97c1ae Enhance BKE_library_make_local() to make it much quicker in complex cases.
Basic idea is to split first loop in two, and run checks before making
anything actually local, to detect data-blocks that we can directly make
local (because we are sure they are only used by already/future local
datablocks).

This allows to avoid a lot of overhead in later 'cleanup' steps of this
function, here with barbershop shot it's four times quicker (from 190s to 48s).

We are still far from the instantaneous results of MakeLocal in 2.77,
but in that version main characters lose their connection to their
armature and remain static after makelocal, so guess new code is still
better. ;)

There are probably more optimizations possible here, but would rather
polish this area of code once we get rid of proxies, those really
make it a nightmare to work on.
2016-11-11 23:17:52 +01:00
f1ad2ab85f Minor optimization to BKE_library_tag_unused_linked_data(). 2016-11-11 23:17:52 +01:00
8e4066b9d3 Switch to unsafe but quick freeing of archipelagos of linked data.
This *should* work, but do not hesitate to revert in case it creates new
crashes in append or makelocal processes.
2016-11-11 23:17:52 +01:00
674c3bf894 Fix T49996: VSE opengl render crash with grease pencil if current frame is empty
If the opengl render with grease pencil is run from VSE with the current
frame outside visible frames, the render pass is wrong and the render
must be canceled because nothing to render. Related to #T49975
2016-11-11 22:27:10 +01:00
cdeaec3b0d GPencil: Create brush set when create new datablock or layer
Before this commit, the brush set was created with the first stroke
drawing, but if the user creates the datablock or the layer manually
(not drawing) the brush list was empty.

This commit complement the python fix by Sergey:
https://developer.blender.org/rB89c1f9db37cc1becdd437fcfdb1877306cc2b329
2016-11-11 20:04:58 +01:00
ed957768a0 Fix crash happening in some cases with MakeLocal operator.
Culprit here was once more proxies. Think what was happening here was:
1) Both proxy and proxified armatures' PoseChannels were cleared
   (needed after remapping due to Bone pointers being stored in pchans).
2) Proxy PoseChannels got rebuilt in `BKE_pose_rebuild_ex()`, which ends,
   in proxy cases, by actually replacing rebuilt pchans by those from
   the proxified object... which has not yet been rebuilt.

Fixed the issue by merely adding bone pointer to data copied from
original pchan into new 'from proxy' one... Sounds much, much safer and
sanier anyway, that way we can be sure bone pointer is actually pointing
to a bone of the object's armature (this is supposed to be the same
Armature datablock between proxy and proxified objects, but that may not
be always true especially during makelocal process).
2016-11-11 18:11:30 +01:00
7d33d4439f Fix T49994: Setting dupligroup which uses indirect relation will crash
Did similar trick to old dependency graph: tag invisible relations for update.

Might need some re-consideration, see the comment.

This should solve our issues with powerlib addon here in the studio.
2016-11-11 16:16:27 +01:00
2a838c71d9 Depsgraph: Add missing NULL pointer check 2016-11-11 15:28:34 +01:00
24d89a1f77 Depsgraph: Fix missing DONE flag in relations builder
Was causing relations be build twice in certain cases.
2016-11-11 15:20:17 +01:00
7dda3cf830 Fix T49993: Indirectly used taper/bevel crashes new dependency graph
New dependency graph expects strict separation between nodes and relations builder,
meaning, if we try to create relation with an object which is not in the graph yet
we'll have an error in depsgraph.

Now, so far object nodes were created from bases of the current scene, which caused
missing objects in graph in certain cases.

Didn't find better approach than to simply ensure object nodes exists when we know
they'll be used by relation builder.
2016-11-11 14:52:05 +01:00
b1743cda5a Depsgraph: Fix typo in text on curve relation builder 2016-11-11 14:41:02 +01:00
653541ea78 Depsgraph: Fix missing ID node tag
Might have caused nodes created multiple times for the same object.
2016-11-11 14:26:11 +01:00
915c74a33b Depsgraph: Add some data builder logic to corresponding function 2016-11-11 14:24:47 +01:00
89c1f9db37 Grease Pencil: Fix python errors opening N panel -> GP with empty VSE
Solves errors, but not sure interface is indeed what users will expect.

Will ask GP team to check on this.
2016-11-11 14:04:04 +01:00
9eeca9e7cd Depsgraph: cleanup, no functional changes 2016-11-11 13:54:02 +01:00
48971da4c8 Depsgraph: Fix wrong relation names 2016-11-11 11:42:43 +01:00
4710fa700c Depsgraph: Fix wrong relations in array modifier 2016-11-11 11:41:33 +01:00
a1aa3a8b75 Cycles: Add comments to endif directives
`kernel_path.h` and `kernel_path_branched.h` have a lot of conditional code and
it was kind of hard to tell what code belonged to which directive. Should be
easier to read now.
2016-11-10 19:50:23 -05:00
Julian Eisel
82ba89b042 Fix T49961: Blender 2.8 Crashes on saving an image
Caused by 4811b2d356 which caused the event handler hack that is used to fire up the file browser from other operators to fail. Basically the context from before the file browser is opened gets stored and used later for executing the actual file read/write operation (in this case, saving image). This context storage is cleared when exiting an editor since 4811b2d356, which is technically correct, but causes usage of NULLed context data in this case, because the file browser is exited before the file read/write operation is executed.

For now I solved this by moving the fileselect handler to list of normal handlers, instead of modal ones. 4811b2d356 only touches list of modal handlers so we avoid the crash. Ideally we'd completely refactor how the file browser opening works to get rid of these event handler hacks.

Note that I wouldn't be suprised if this causes other regressions, but I couldn't find one so worth a try.
2016-11-10 20:34:35 +01:00
80aae2b6fe Consider Numpad Enter in pose slide operators
It was annoying to only have regular Enter confirming input there.
2016-11-10 17:19:23 +01:00
e316636fa8 Fix BKE_library_make_local() trying to also make local proxified objects.
Proxified objects can never be local, we can totally ignore them here.

This 'fixes' the asserts related to usercount when trying to remap poselib
of localized proxified objects (not sure what exactly was going on wrong here,
but proxies are a giant can of worms for sane data-blocks handling anyway :/).
2016-11-10 17:09:16 +01:00
f0d53ac109 Depsgraph: Fix another issue which seems to be a bug
Similar to a previous commit.

Doing separately for an easy of bisect.
2016-11-10 15:49:33 +01:00
aef66a6be0 Depsgraph: Fix wrong relation from IK solver to pole target
Copy paste error...

How to avoid those?
2016-11-10 15:46:22 +01:00
Dalai Felinto
0b9b8ab2dd Fix Grease Pencil render in VSE crashes when no strips (#T49975)
Solution as suggested by Sergey Sharybin. Initial debugging by
Antonio Vazquez.
2016-11-10 12:24:54 +01:00
Martijn Berger
63b38848a2 buidlbot, msbuild is slightly different in that is wants to build debug anyway even if we told cmake we want release 2016-11-10 11:00:04 +01:00
Martijn Berger
1977440770 buidlbot, msbuild is slightly different in that is wants to build debug anyway even if we told cmake we want release 2016-11-10 10:55:49 +01:00
2138fdb785 Added bpy.types.ID.make_local() that can make a single ID block local.
This new `bpy.types.ID.make_local(clear_proxies=True)` allows Python
code to press the "Make Local" button on any ID block. I chose
`clear_proxies=True` as the default, since it's the default behaviour
of `id_make_local()` (defined in `library.c`).

The caller does need to take care of ensuring that linked-in objects
don't refer to local data, and that proxies aren't broken.

Reviewers: sergey, mont29

Reviewed By: mont29

Subscribers: dfelinto

Differential Revision: https://developer.blender.org/D2346
2016-11-10 10:49:57 +01:00
Martijn Berger
8b8e04cae6 let cmake handle calling msbuild for windows buildbots 2016-11-10 10:48:54 +01:00
afc8a4f9e2 Fix UI message. 2016-11-09 19:27:43 +01:00
47759b14ab BMesh: face-join, remove redundant face assignment
Keep ifdef'd out for holes, this isn't needed currently.
2016-11-10 03:21:42 +11:00
4d9562a3ae Depsgraph: Fix crash deleting bones in armature edit mode
For the new dependency graph we have to rebuild graph when
bones "topology" are changing.
2016-11-09 17:00:31 +01:00
18be39ff17 Fix some assert when making local (due to infamous PITA ShapeKey ID). 2016-11-09 16:42:28 +01:00
e72caa513a BMesh: Cleanup, remove hole ifdef 2016-11-10 01:08:12 +11:00
Dalai Felinto
69655a1103 Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-09 14:36:59 +01:00
49a3eaa3dc BMesh: face-flip, no need for temporary edge-array
Reverse loops in-place.
2016-11-10 00:08:26 +11:00
a0ae6d7116 OpenGL: manage built-in shaders better
As our library of built-in shaders grows, it's important to create, access, and discard them efficiently.

Lookup via GPU_shader_get_builtin is now constant time instead of linear (# of built-in shaders). This is called very often with our new immediate mode.

Creation and discard are unified.

Adding a new shader requires fewer steps.

365 lines shorter  :D
2016-11-08 22:53:59 -06:00
e9689e1a20 Fix: setting an audio callback before audio device initialization. 2016-11-09 00:06:49 +01:00
4d0f7c320c Depsgraph: Use atomics to tag ID when evaluating driver
This is required since new dependency graph evaluates drivers in threads
so it was possible to have some partially written ID tag there.
2016-11-08 17:54:14 +01:00
2b726b054e blender 2.8: OpenGL immediate mode: node_draw_preview_background
all is in the title.

Reviewers: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2336
2016-11-08 11:12:29 -05:00
682bcb2995 Atomics: Add 32 bit version of fetch and AND/OR 2016-11-08 17:12:04 +01:00
12bce04b2f Blender 2.8: OpenGL: new immediate mode for paint_image.c
This one is for the straight line (white with width 2.0 over a black with width 4.0) drawn when you use the gradient tool.

To test: Image editor, create / open an image, choose image paint mode and on the tool shelf: choose the Fill brush and enable "Use Gradient" for it. Then click and drag on the image.

From what I checked, calls to glLineWidth are not being removed yet, so I kept them.

Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2312
2016-11-08 11:08:16 -05:00
f90b480f95 OpenGL: wm_operators.c uses new immediate mode
D2311 by @ianwill

This is the radial control that appears when we change the size of a brush in sculpt and vertex and texture painting modes, by pressing "f".

Also includes a new built-in shader that can be useful in other places.

Part of T49043
2016-11-08 10:55:23 -05:00
4e80bd2d6d Blender 2.8: OpenGL: new immediate mode API for screendump.c
It's the screencast cursor, tested here, compared to original, seems to be working fine.

Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2306
2016-11-08 10:10:55 -05:00
4f28dac872 BMesh: remove edge search when flipping faces
Replace search with direct lookup.
2016-11-09 00:18:32 +11:00
0085001eb0 Fix memory leak when Blender is build without Bullet and files with RB is opened 2016-11-08 11:54:04 +01:00
a2d78d7a46 Fix T49838: Noise randomization for frame should be done per interframes as well
Add subframe to the animated seed hash calculation.

Should be no difference for the regular files, only for cases when scene is
rendered from sequencer with a speed effect, which is not really a common thing.
2016-11-08 11:16:37 +01:00
93ace71bd7 Cycles: Only use new light sample threshold for new files
This is a late follow-up commit to the light sample threshold changes which
caused difference in rendering all existing .blend files which is not something
we are happy about: it is fine to use new optimized defaults for new files, but
existing ones should always be rendering in the same way as they used to be.

Sorry for the inconveniece, but such thing should have been done to begin with.
If this setting was modified it will not be reset to zero.

Now all render tests should be passing again.

P.S. Also really annoying to bump subversion for such reasons, but currently we
don't have better way to achieve what we want.
2016-11-08 10:58:09 +01:00
508e2f0d69 Fix T49937: Blender is crashing because of Lamp Data Node
Lamp Data node requires shadow sample array which is only enabled when
Shadows are enabled in the shading settings.

This commit prevents crash but might not give expected render results
in such a configuration.
2016-11-08 10:40:21 +01:00
66d7f01ecc Gawain: less error checking in release builds
Gawain does very strict runtime checking to help us catch coding errors. Final release should disable most of these checks, so I'm disabling now for all non-debug builds.

When writing Blender code that uses Gawain, always make debug builds and test there! "make lite debug" is my favorite.
2016-11-08 05:28:40 +01:00
de101fe9a8 OpenGL: mesh edit mode uses edge overlays
Legacy GL uses GL_LINES, modern GL uses the good stuff.

Edit mode still has a long way to go...
2016-11-08 05:22:17 +01:00
0b83680d85 OpenGL: support for edge overlays
Has some obvious opportunities for improvement. This is my second attempt. First attempt used MLoopTri and sort of worked...
2016-11-08 05:06:09 +01:00
f19f9be1b9 BMesh: remove redundant edge-split loop initialize
Would always set both first1 and first2.
2016-11-08 07:13:20 +11:00
9912792564 Forgot this in last commit. (Brick GLSL). 2016-11-07 20:59:09 +01:00
28639a22bc Fix Brick Texture GLSL, broken after Mortar Smooth addition. 2016-11-07 20:55:36 +01:00
535914aa46 BMesh: remove redundant array size
Correct unhelpful comment & some comment edits.

Rename 'disk_is_flagged' -> 'bm_vert_is_manifold_flagged',
since the check is quite specific.
2016-11-08 06:54:20 +11:00
7a98c43f9d BMesh: minor improvement to edge-split assignment 2016-11-08 06:49:22 +11:00
016aca7427 OpenGL: fade other objects during edit mode
Right now this only affects other objects in wireframe. The idea is to do something similar for other draw modes, and keep focus on the edit object.

As seen at #bcon16
2016-11-07 20:32:27 +01:00
a3277ae384 OpenGL: simple mesh edit mode for new viewport
Very very simple. Needs a lot of work to reach "legacy viewport" capabilities.
2016-11-07 20:24:03 +01:00
5abf1a4e9d OpenGL: enable fancy wireframes
Most of this was already in place, just enabling & adding comments.

One fix was needed to make batch uniforms stick between multiple draws.

Added comments to selection outline; no functional changes there.
2016-11-07 20:07:31 +01:00
1cd754ad31 OpenGL: simple batch of all mesh triangles
Can be used for drawing basic surfaces, hit testing, depth pre-pass, ...
2016-11-07 20:07:31 +01:00
c1ba58c44d Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/addon/properties.py
2016-11-07 15:46:27 +01:00
e74e622776 Fix compilation error when CUDA toolkit is not installed
After CUDA dynload changes having CUDA toolkit became required
in order to compile Cycles. This only happened due to wrong
default value to the option.
2016-11-07 14:47:10 +01:00
6f3f27c0cc Buildbot: Update copy of buildbot master configuration 2016-11-07 14:29:11 +01:00
c9efcc5e4a Cycles: Remove device settings from performance tab
This was included in the commit by accident, it doesn't belong there.
2016-11-07 13:22:53 +01:00
1d01a1a269 Depsgraph: Disable timing profile 2016-11-07 12:50:45 +01:00
Martijn Berger
f51f215bc3 fix building depsgraph after recent changes 2016-11-07 12:32:00 +01:00
37947ed552 Depsgraph: Do not rely on indirectly included cstring
Also add comment why exactly cstring is needed.
2016-11-07 12:09:42 +01:00
9b5a32cbfb Proxy: Construct pchan hash when syncing armature proxy
This makes bone lookup much faster (by avoiding liner string lookup)
and speeds up depsgraph construction time on file open.
2016-11-07 11:04:49 +01:00
21350b73df Despgraph: Optimize cycles detection algorithm
The idea is simple: when falling back to one of the nodes which was partially
handled we "resume" checking outgoing relations from the index which we stopped.

This gives about 15-20% depsgraph construction time save.
2016-11-07 11:04:49 +01:00
4c30a9ee42 Depsgraph: Speedup initial rig build time
We don't need to sort bone channels, it's all taken care about
by the depsgraph itself.

Gives up to 30% initial rig construction time speedup.
2016-11-07 11:04:49 +01:00
65a1fd975c Depsgraph: Move key implementation from header to dedicated file 2016-11-07 11:04:49 +01:00
109be7ed39 Depsgraph: Move class implementation from header to implementation files
This is more proper way to go:

- Avoids re-compilation of all dependent files when implementation changes
  without changed API,

- Linker should have much simpler time now de-duplicating and getting rid
  of redundant implementations.
2016-11-07 11:04:49 +01:00
287197c4e3 Depsgraph: Fully switch from string to const char*
This brings up to 10-20% depsgraph build time improvement in the layout
files from the studio repository.
2016-11-07 11:04:49 +01:00
c9eca0c6c9 Depsgraph: Add extra name tag for operation nodes
The idea here is to address issue that name on it's own is not
always unique: for example, when adding driver operations the
name used for nodes is the RNA path (and multiple drivers can
write to different array indices of the path). Basically, now
it's possible to pass extra integer value to distinguish
operations in such cases.

So now we've already switched from sprintf() to construct unique
operation name to pass RNA path and array index.

There should be no functional changes yet, but this work is
required for further work about replacing string with const
char*.
2016-11-07 11:04:49 +01:00
d872aeaf51 Depsgraph: Cleanup, operation has name, not description
Hopefully should make things more clear here.
2016-11-07 11:04:49 +01:00
9331930345 Depsgraph: Remove unused function
A residue from times where we thought to do partial graph updates,
which we are not committing any time soon.
2016-11-07 11:04:49 +01:00
f8d9a56aa1 Depsgraph: Use const char for component API 2016-11-07 11:04:49 +01:00
4ef45ba775 Depsgraph: Remove some includes which seems unused 2016-11-07 11:04:49 +01:00
bbd4b96fe9 Depsgraph: Use const char instead of string in part of drivers construction 2016-11-07 11:04:49 +01:00
a7f53bc512 Depsgraph: Switch away form string to const char* for node names
There is no real reason to have nodes storing heap-allocated name
and description. Doing this increases amount of allocations during
dependency graph building, which usually means somewhat slowness.

We're temporarily loosing some eyecandy in the graphviz visualizer,
but those we can bring back as a part of graphiz dump (which happens
much less often than depsgraph build).

This will happen in multiple commits for the ease of bisect in the
future just in case this causes any regression. This commit contains
ID creation API changes.
2016-11-07 11:04:49 +01:00
f64548daa6 Depsgraph: Remove prototype of unused and non-implemented method 2016-11-07 11:04:49 +01:00
c8c7414c3f Expose Bullet rotational spring settings in the UI.
Bullet spring constraint already supports rotational springs, but
they are not exposed in blender UI, likely due to a simple oversight.
Supporting them is as simple as adding a few DNA/RNA properties
with appropriate UI and passing them on to Bullet.

Reviewers: sergof

Reviewed By: sergof

Differential Revision: https://developer.blender.org/D2331
2016-11-07 12:59:12 +03:00
dd921238d9 Cycles: Refactor Device selection to allow individual GPU compute device selection
Previously, it was only possible to choose a single GPU or all of that type (CUDA or OpenCL).
Now, a toggle button is displayed for every device.
These settings are tied to the PCI Bus ID of the devices, so they're consistent across hardware addition and removal (but not when swapping/moving cards).

From the code perspective, the more important change is that now, the compute device properties are stored in the Addon preferences of the Cycles addon, instead of directly in the User Preferences.
This allows for a cleaner implementation, removing the Cycles C API functions that were called by the RNA code to specify the enum items.

Note that this change is neither backwards- nor forwards-compatible, but since it's only a User Preference no existing files are broken.

Reviewers: #cycles, brecht

Reviewed By: #cycles, brecht

Subscribers: brecht, juicyfruit, mib2berlin, Blendify

Differential Revision: https://developer.blender.org/D2338
2016-11-07 03:19:29 +01:00
f89fbf580e Cycles: Fix T49952: Bad MIS sampling of backgrounds with single bright pixels
With this fix, using a MIS map resolution equal to the image size for closest imterpolation or twice the size for linear interpolation gets rid of all fireflies.
Previously, a much higher resolution was needed to get acceptable noise levels.
2016-11-06 20:34:50 +01:00
818af9c331 MSVC Runtime copy : Remove erroneously left in diagnostic message from CMakeLists.txt 2016-11-05 14:04:23 -06:00
93dbd81796 Gawain: manage batch API's current shader program + uniform funcs
Typical pattern:
Batch_set_program
Batch_Uniform(s)
Batch_draw
2016-11-05 21:03:26 +01:00
2b1d3318f4 [msvc2015] Add support for copying the vc runtime.
There's more dll's hanging out in the ucrt folder, but  I just grabbed the ones blender requested (not sure if that's a wise idea, but it seems to work)

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

Differential Revision: https://developer.blender.org/D2335
2016-11-05 13:58:50 -06:00
5b26c36008 OpenGL: edge overlay shaders
As seen at #bcon16. These were produced quickly and probably need further work.

SIMPLE variant draws triangle mesh edges. Based on this research:
http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/4884/pdf/imm4884.pdf
http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf

Non-SIMPLE variant can adjust thickness per edge. This can be used to draw only some edges, or accentuate some edges. Given the right inputs this is a general n-gon perimeter shader.

Part of T49165
2016-11-05 19:26:13 +01:00
a85f68e9c7 OpenGL: further wireframe shaders
As seen at #bcon16

Geometry shader version is automatically used on modern GL runtimes. Legacy version is used on pre-3.2 systems (Mac, Mesa compat profile). They have the same inputs and visual result.

TODO: specialized versions that are less flexible -- draw ALL edges or draw JUST silhouette edges.

Part of T49165
2016-11-05 18:56:57 +01:00
Martijn Berger
521b981575 change default for quicktime suport for macOS to off 2016-11-05 14:23:00 +01:00
Martijn Berger
c02cce7b75 cycles, cuDeviceComputeCapability is deprecated as of cuda 5.0 2016-11-04 14:49:54 +01:00
f0ac661aa8 Fix T49905: Segfault when copying object data of linked object.
We have to clear `newid` of all datablocks, not only object ones.

Note that this whole stuff is still using some kind of older, primitive
'ID remapping', would like to see whether we can replace it with new,
more generic one, but that's for another day.
2016-11-04 09:55:46 +01:00
17fb504bcf Fix (unreported) asserts in make_object_duplilist_real().
Code would try to add multiple time the same key in `parent_gh` (for this
ghash a lot of dupliobjects may generate same key).

Was making the tool unusable in debug builds.

Also optimise things a bit by avoiding creating parent_gh when only
`use_base_parent` is set.
2016-11-04 08:34:01 +01:00
4e5d251ccb Fix T49918: Make duplicates real crash on clicking operator toggles.
handle_mutex may be NULL here...
2016-11-04 08:11:40 +01:00
4a68ff150f Fix T49903: Blender crashes -> Append Group incl. Object using boolean modifier
New code dealing with getting rid of lib-only cycles of data-blocks
could add several time the same datablock to the list of candidates. Now
this is avoided, and pointers are further cleaned up as double-safety
measure.
2016-11-03 21:10:10 +01:00
e27d9facdf install_deps cleanup: some Debian stuff was still present in the 'generic compile-only' part of the script. 2016-11-03 20:08:04 +01:00
dd6fa94dcc Add 'Set From Faces' tool to custom split normals.
Feature request during bconf, makes sense to have it even as an hack for
now, since this is probably one of the most common use cases. This should
be redone in bmesh once we have proper custom noramls handling in edit mode...
2016-11-03 13:26:18 +01:00
b6980ade90 Depsgraph: Add code for timing despgraph builder 2016-11-03 13:25:07 +01:00
27c559f059 Cycles: Fix missing underscore in geom_object.h 2016-11-03 12:38:00 +01:00
647255db93 Fix T49826: NEW-DEPSGRAPH - Texture is not updated after changing its space color
The issue was caused by image ID nodes not being in the depsgraph.

Now, tricky part: we only add nodes but do not add relations yet. Reasoning:

- It's currently important to only call editor's ID update callback to solve
  the issue, without need to flush changes somewhere deeper.

- Adding relations might cause some unwanted updates, so will leave that for
  a later investigation.
2016-11-03 11:31:49 +01:00
fc1b35e44c Depsgraph: Fix wrong comparison of ID type vs. node type 2016-11-03 11:19:42 +01:00
534f11f71e Fix T49857: Blender crashes after adding texture node to compositing tree 2016-11-03 10:25:31 +01:00
f800794b97 Cycles: Fix OpenCL build error caused by light termination commit 2016-11-03 03:15:39 +01:00
9847ad977a Cycles: Fix T49901: OpenCL build error after recent light texture coordinate commit
Basically, the problem here was that the transform that's used to bring texture coordinates
to world space is either fetched while setting up the shader (with Object Motion is enabled) or
fetched when needed (otherwise). That helps to save ShaderData memory on OpenCL when Object Motion isn't needed.

Now, if OM is enabled, the Lamp transform can just be stored inside the ShaderData as well. The original commit just assumed it is.
However, when it's not (on OpenCL by default, for example), there is no easy way to fetch it when needed, since the ShaderData doesn't
store the Lamp index.

So, for now the lamps just don't support local texture coordinates anymore when Object Motion is disabled.
To fix and support this properly, one of the following could be done:
- Just always pre-fetch the transform. Downside: Memory Usage increases when not using OM on OpenCL
- Add a variable to ShaderData that stores the Lamp ID to allow fetching it when needed
- Store the Lamp ID inside prim or object. Problem: Cycles currently checks these for whether an object was hit - these checks would need to be changed.
- Enable OM whenever a Texture Coordinate's Normal output is used. Downside: Might not actually be needed.
2016-11-03 03:08:14 +01:00
643c5a24d5 Depsgraph: Fix race condition writing drivers to array property
Animation system has separate fcurves for each of array elements and
dependency graph creates separate nodes for each of fcurve, This is
needed to keep granularity of updates, but causes issues because
animation system will actually write the whole array to property when
modifying single value (this is a limitation of RNA API).

Worked around by adding operation relation between array drivers
so we never write same array form multiple threads.
2016-11-02 18:08:33 +01:00
c5510df268 tests: Update hash for OBJ
Was a recent update of UV precision.
2016-11-02 15:35:18 +01:00
c9ffb6fc91 Libmv: Update tests to make tests pass after recent Ceres update
Just a precision issue, difference is around 1e-7. Should be fine to
simply update expected value.
2016-11-02 15:32:11 +01:00
15f2a51232 Solve threading conflict when calculating smooth normals
It was possible to have synchronization issues whe naccumulating smooth
normal to a vertex, causing shading artifacts during playback.

Bug found by Dalai, thanks!
2016-11-02 15:10:40 +01:00
dac5438562 COLLADA: Removed obsolete Export select option 'Both' which created invalid data (duplicate transformation information for nodes) 2016-11-02 14:11:46 +01:00
630c0559f9 Depsgraph: Fix some errors printed to the console
They were not real issues, it's just some areas of code tried to create
relations between non-existing nodes without checking whether such
relations are really needed.

Now it should be easier to see real bugs printed.

Hopefully should be no regressions here.
2016-11-02 12:23:00 +01:00
Dalai Felinto
c25c3bb6cb Fix UI for smoke cache
(this was probably broken since we got rid of point cache in 2.8)
2016-11-02 11:09:27 +01:00
Dalai Felinto
a41bbd3053 Merge remote-tracking branch 'origin/master' into blender2.8 2016-11-02 10:59:52 +01:00
Martijn Berger
4fdf68271c Cycles standalone, compile fix UINT_MAX is not defined in device_cuda.cpp 2016-11-02 10:56:16 +01:00
83ebf501cd CMake: Make ld.gold linker optional
Some platforms are having hard time using this linker so added an option
to not use it. The options is an advanced one and enabled by default so
should not cause any changes for current users.
2016-11-02 10:42:15 +01:00
97a8cd6883 CMake: Fix use of some option which was never defined
This way it seems more logical to me.
2016-11-02 10:32:46 +01:00
f94a460397 [msvc/make.bat] Detect spaces in the build path and error out. 2016-11-01 15:30:12 -06:00
Dalai Felinto
13ee9b8ebe Change frame for animations should not bein the UNDO stack
Request from Hjalti Hjalmarsson for the animation work.

Basically a common part of the workflow of animation is to change the pose, scrub back and forth a few times and roll back the changes when unsatisfied.
However if you go back and forth too many times the UNDO stack would be full, and it would not be possible to bring back the previous pose.

I'm leaving clip_editor change frames as it is for now. But we can
probably change the behaviour there as well.
2016-11-01 22:11:16 +01:00
4e95a9069e Add 'copy array' for rna buttons
ctrl-alt-c/v allows to copy/paste whole RNA array, e.g. location, rotation, etc., from UI buttons.

Request from Andy at the studio.
2016-11-01 14:59:12 +01:00
1ee43c5aef Fix T49856: Blender 2.78 crashes after loading data from a blendfile
Issue here was that py API code was keeping references (pointers) to the
liniked data-blocks, which can actually be duplicated and then deleted
during the 'make local' process...

Would have like to find a better way than passing optional GHash to get
the oldid->newid mapping, but could not think of a better idea.
2016-11-01 13:39:31 +01:00
bf1e9bc613 Ceres: Update to the latest actual version
Brings all the fixes and improvements done in upstream within the last 13 months.
2016-11-01 11:29:33 +01:00
fb6f42dc4f OpenGL: draw NLA strip curves with new imm mode
Part of T49043.
2016-10-31 17:42:11 +01:00
cf8f6d1dbc Added 'delete unlocked vertex groups' option. 2016-10-31 15:31:47 +01:00
aad46dd175 BMesh: radial loop (internal API symmetry)
Radial append/remove had swapped args and *slightly* different behavior.
- bmesh_radial_append(edge, loop)
- bmesh_radial_loop_remove(loop, edge)

Match logic for append/remove,
Logic for the one case where the edge needs to be left untouched
has been moved to: `bmesh_radial_loop_unlink`.
2016-10-31 23:05:20 +11:00
6488ce7f33 BMesh: simplify vert & edge removal 2016-10-31 22:07:23 +11:00
60682c37dd BMesh: remove redundant walker member & assignment 2016-10-31 17:24:15 +11:00
04aa454075 Cycles: Deduplicate AO calculation
No functional changes.
2016-10-31 00:40:59 +01:00
Julian Eisel
2257e6899a UI: Don't show empty panel right-click menu 2016-10-31 00:08:13 +01:00
2e9dd1200f Cycles: Fix OpenCL compilation with the new brick texture 2016-10-30 16:25:35 +01:00
5050572e89 Cycles: Style Fix: Light sampling threshold description 2016-10-30 13:51:49 +01:00
b6d35e1fa7 Viewport smoke: add support to render the volume using a color ramp.
This is yet another debug option that allows to render an arbitrary
simulation field by using a color ramp to inspect its voxel values.
Note that when using this, fire rendering is turned off.

Reviewers: plasmasolutions, gottfried

Differential Revision: https://developer.blender.org/D1733
2016-10-30 12:29:05 +01:00
4e68f48227 Cycles: Initialize the RNG state from the kernel instead of the host
This allows to save a memory copy, which will be particularly useful for network rendering.

Reviewers: sergey, brecht, dingto, juicyfruit, maiself

Differential Revision: https://developer.blender.org/D2323
2016-10-30 11:51:20 +01:00
26bf230920 Cycles: Add optional probabilistic termination of light samples based on their expected contribution
In scenes with many lights, some of them might have a very small contribution to some pixels, but the shadow rays are traced anyways.
To avoid that, this patch adds probabilistic termination to light samples - if the contribution before checking for shadowing is below a user-defined threshold, the sample will be discarded with probability (1 - (contribution / threshold)) and otherwise kept, but weighted more to remain unbiased.
This is the same approach that's also used in path termination based on length.

Note that the rendering remains unbiased with this option, it just adds a bit of noise - but if the setting is used moderately, the speedup gained easily outweighs the additional noise.

Reviewers: #cycles

Subscribers: sergey, brecht

Differential Revision: https://developer.blender.org/D2217
2016-10-30 11:31:28 +01:00
ce785868a5 Fix compile errors for when WITH_ALEMBIC is OFF. 2016-10-30 03:42:46 +01:00
b2974d7ab7 Cycles: Add smoothing option to the Brick Texture
This option allows to create a smoother transition between Bricks and Mortar - 0 applies no smoothing, and 1 smooths across the whole mortar width.
Mainly useful for displacement textures.

The new default value for the smoothing option is 0.1 to give some smoothing that helps with antialiasing, but existing nodes are loaded with smoothing 0 to preserve compatibility.

Reviewers: sergey, dingto, juicyfruit, brecht

Reviewed By: brecht

Subscribers: Blendify, nutel

Differential Revision: https://developer.blender.org/D2230
2016-10-30 02:16:22 +02:00
5aa6a2ec06 Fix T49846: OpenCL rendering compilation failure 2016-10-29 20:06:52 +02:00
1272ee455e Cycles: Implement texture coordinates for Point, Spot and Area Lamps
When using the Normal output of the Texture Coordinate node on Point and Spot lamps, the coordinates now depend on the rotation of the lamp.
On Area lamps, the Parametric output of the Geometry node now returns UV coordinates on the area lamp.

Credit for the Area lamp part goes to Stefan Werner (from D1995).
2016-10-29 19:24:08 +02:00
d3b0977a35 Fix T49878: Alembic crash with long object name
Crash comes from writing to char array (ID::name) out its bound and thus
overriding memory in the ID struct.
2016-10-29 16:22:33 +02:00
753edafcb7 Alembic: store a pointer to the object reader in the cache modifiers and
constraints.

This avoids traversing the archive everytime object data is needed and
gives an overall consistent ~2x speedup here with files containing
between 136 and 500 Alembic objects. Also this somewhat nicely de-
duplicates code between data creation (upon import) and data streaming
(modifiers and constraints).

The only worying part is what happens when a CacheFile is deleted and/or
has its path changed. For now, we traverse the whole scene and for each
object using the CacheFile we free the pointer and NULL-ify it (see
BKE_cachefile_clean), but at some point this should be re-considered and
make use of the dependency graph.
2016-10-29 12:23:09 +02:00
0c13792437 Alembic export: fix frame range values being reset at every update, draw
call.
2016-10-29 11:04:51 +02:00
1556a28108 OpenGL: draw filebrowser dropshadow with new imm mode
Part of T49043.
2016-10-28 20:46:10 +02:00
8a1b38f071 Cleanup: avoid using G.main. 2016-10-28 18:26:34 +02:00
216dec7eb1 Alembic Export: set start and end frame to that of the scene for
convenience.

Users will most likely export an entire animation rather than a single
frame, so it can save a few clicks.
2016-10-28 18:21:43 +02:00
65c481e145 CacheFile: fix missing depsgraph update. 2016-10-28 18:08:31 +02:00
194a33ff00 CacheFile: only enable scale property slider if we are editing the cache
through a constraint.

It doesn't make sense and is a bit confusing to have this property
enabled in the modifier context.
2016-10-28 18:08:30 +02:00
Nathan Letwory
03b8531cea Compile fix for Windows.
__inline instead of inline is needed.
2016-10-28 11:54:01 +03:00
216a3a3826 Fix T49743: Adding torus in edit mode local mode shows error
The 'local' layers were not correctly set when redoing 'add object'
addons using object_utils.py helper (we always want to restore layers
from view in local view, even if we set 'real' layers from operator
afterwards).
2016-10-27 13:23:29 +02:00
5f0933f07a Fix T49829: Removal of custom icon previews during add-on unregister crashes Blender.
Issue was happening when removal of custom icons was done while they
were still being rendered by preview job.

Now add a 'deffered deletion' system, to prevent main thread to delete
preview image until loading thread is done with them.

Note that ideally, calling `ED_preview_kill_jobs()` on custom icon
removal would have been simpler, but we don't have easy access to
context here...
2016-10-27 13:06:14 +02:00
f11298692b Cycles: More workarounds for weird crashes on AVX2
Oh man, is it a compiler bug? Is it something we do stupid?

For now more crap to prevent crashes. During the conference will talk to
Maxyn about how can we troubleshoot such weird issues.
2016-10-27 12:51:03 +02:00
7e380ad4c0 Cycles: Another attempt to fix crashes on AVX2 processors
Basically don't use rcp() in areas which seems to be critical after
second look. Also disabled some multiplication operators, not sure
yet why they might be a problem.

Tomorrow will be setting up a full test with all cases which were
buggy in our farm to see if this fix is complete.
2016-10-26 22:14:41 +02:00
de22e55291 Cycles: Fix compilation error of AVX2 kernel without SSE math 2016-10-26 20:49:33 +02:00
Dalai Felinto
a25d3d7de2 Viewport: Set outline color for mesh based on active/select state
(also, fix warning regarding const float being written)

You only see the color if you use the "modern" viewport option
(otherwise I believe Blender is drawing the old on top of the new outline).

That said, in the "modern" viewport we have unfreed mem. To be
investigated separately.
2016-10-26 13:57:22 +00:00
35f152358b Cycles: Completely disable transform SSE for now
Was causing issues on another frame.

On a tight schedule, disabling for now so artists are happy.

Still looking into root of the issue!
2016-10-26 15:23:58 +02:00
7c7d23691f Cycles: Fix crashes after recent optimization commits
There is some precision issues for big magnitude coordinates which started
to give weird behavior of release builds. Some weird memory usage in BVH
which is tricky to nail down because only happens in release builds and GDB
reports all variables as optimized out when trying to use RelWithDebInfo.

There are two things in this commit:

- Attempt to make vectorized code closer to original one, hoping that it'll
  eliminate precision issue.
  This seems to work for transform_point().
- Similar trick did not work for transform_direction() even tho absolute
  error here is much smaller. For now disabled that function, need a more
  careful look here.
2016-10-26 14:30:25 +02:00
72921a1e43 RangeTree API rewrite
Rewrite the current range-tree API used by dyn-topo undo
to avoid inefficiencies from stdc++'s set use.

- every call to `take_any` (called for all verts & faces)
  removed and added to the set.
- further range adjustment also took 2x btree edits.

This patch inlines a btree which is modified in-place,
so common resizing operations don't need to perform a remove & insert.
Ranges are stored in a list so `take_any` can access the first item
without a btree lookup.

Since range-tree isn't a bottleneck in sculpting, this only gives minor speedups.
Measured approx ~15% overall faster calculation for sculpting,
although this number time doesn't include GPU updates and depends on how
much edits fragment the range-tree.
2016-10-26 23:33:41 +11:00
44522a5b98 BLI_bitmap_draw_2d: optimize polygon filling
Existing method was fine for basic polygons but didn't scale well
because its was checking all coordinates for every y-pixel.

Heres an optimized version.
Basic logic remains the same this just maintains an ordered list of intersections,
tracking in-out points, to avoid re-computing every row,
this means sorting is only done once when out of order segments are found,
the segments only need to be re-ordered if they cross each other.

Speedup isn't linear, test with full-screen complex lasso gave 11x speedup.
2016-10-26 23:24:58 +11:00
8125271ddb Cleanup: rename functions in BLI_bitmap_draw_2d 2016-10-26 23:24:19 +11:00
3e36cbb3de Cleanup: move bitmap drawing into its own module
Bitmap drawing is out-of-scope for a general math API,
move to BLI_bitmap_draw_2d.
2016-10-26 20:11:09 +11:00
2783d5df61 OpenGL: follow up on mesh wire TODOs
- depth test on (affects scene depth for now)
- color variations
- object outline  does not need GL_BLEND with latest shader
2016-10-26 04:18:19 -04:00
a394f4e545 OpenGL: edge shader discards fragments of unused edges
Discarded edges should not update depth buffer or blend with color buffer.

Geometry shader version will make this obsolete.
2016-10-26 03:57:14 -04:00
a1f137767f BMesh: edge-net split, edge selection error
In practice I couldn't make this cause a bug,
however it's a logical regression in fix for T48716.

Thanks to Francesc Juhe for finding.
2016-10-26 14:18:44 +11:00
222ba0247f fix edge shader input 2016-10-25 19:38:22 -04:00
456d145d07 OpenGL: new mesh draw routines for new viewport
Totally WIP.

Started with copies of legacy routines, modified to use the new shaders & batch cache. Not all features are implemented; this is why we keep legacy viewport around during development!
2016-10-25 19:34:17 -04:00
bc71c2bf08 [msvc] make.bat - create a build.log in the build directory 2016-10-25 11:49:08 -06:00
f523fb43f9 Cycles: Fix for fix (tm)
Sorry guys, for some reason read the expression back-to-front
and did wrong fix :S
2016-10-25 18:29:13 +02:00
5c4113a3e4 Cycles: Fix typo in previous commit for BVH improvements 2016-10-25 18:06:38 +02:00
a39ab9cfde Fix T49815: Blender always reverts to RGBA when using Save As Image.
`BKE_imformat_defaults()` was doing some weird black magic based on
imbuf's channels, instead of merely copying imbuf's planes here...
2016-10-25 17:59:45 +02:00
cf9a6b416c API: Fix Links
Self-explanatory. to find broken links run `sphinx-build -b linkcheck sphinx-in sphinx-out`

Reviewers: mont29

Tags: #bf_blender, #python, #infrastructure:_websites

Differential Revision: https://developer.blender.org/D2297
2016-10-25 17:34:01 +02:00
42a91f7ad8 Partial fix for T49836: Camera DOF properties not updating via graph editor
Do this for the new dependency graph: was missing handle of OB_UPDATE_TIME in tag update.

Hopefully it's all correct still.

Old dependency graph needs work, but i'm tempting to call it unsupported and move on
to 2.8 branch.
2016-10-25 16:53:13 +02:00
c54381488b Cycles: Enable SSE math optimization for AVX kernels
This gives about 5% speedup for AVX processors.

Benefit of such optimization on other microarchitectures is still
under investigation.
2016-10-25 16:10:47 +02:00
8c761ff838 Cycles: Use new SSE version of offset calculation for all QBVH flavors
Gives up to ~1% speedup again.

While it seems to be small, still nice since the code now is actually more
clean that it used to be before.
2016-10-25 15:27:50 +02:00
f7cf2f659a Cycles: Move QBVH near/far offset calculation to an utility function
Just preparing for new optimization to be used in all traversal implementation.

Should be no measurable difference.
2016-10-25 15:08:33 +02:00
064caae7b2 Cycles: BVH-related SSE optimization
Several ideas here:

- Optimize calculation of near_{x,y,z} in a way that does not require
  3 if() statements per update, which avoids negative effect of wrong
  branch prediction.

- Optimization of direction clamping for BVH.

- Optimization of point/direction transform.

Brings ~1.5% speedup again depending on a scene (unfortunately, this
speedup can't be sum across all previous commits because speedup of
each of the changes varies from scene to scene, but it still seems to
be nice solid speedup of few percent on Linux and bigger speedup was
reported on Windows).

Once again ,thanks Maxym for inspiration!

Still TODO: We have multiple places where we need to calculate near
x,y,z indices in BVH, for now it's only done for main BVH traversal.
Will try to move this calculation to an utility function and see if
that can be easily re-used across all the BVH flavors.
2016-10-25 14:47:34 +02:00
81c9e0d295 Cycles: Avoid branching in SSE version of intersection pre-calculation
Similar to the previous commit, avoid negative effect of bad branch prediction.

Gives measurable performance up to ~2% in tests here.

Once again, thanks to Maxym Dmytrychenko!
2016-10-25 14:18:32 +02:00
af411d918e Cycles: Implement SSE-optimized path of util_max_axis()
The idea here is to avoid if statements which could cause wrong
branch prediction.

Gives a bit of measurable speedup up to ~1%. Still nice :)

Inspired by Maxym Dmytrychenko, thanks!
2016-10-25 13:54:17 +02:00
Dalai Felinto
821fa24876 Viewport: fix depth not being cleared in ortho mode 2016-10-25 11:18:56 +00:00
Dalai Felinto
b4f849b9c6 Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-25 11:18:41 +00:00
392551bd95 OpenGL: mesh batch cache (WIP)
Gawain batches are built on demand while drawing, then kept in this per-DerivedMesh cache.

A mesh's batches try to share vertex buffers as much as possible.

Not sure if this file is the best home for this code, but functions in this file are the only users of the cache. So maybe.

Big part of T49165
2016-10-25 05:31:25 -04:00
d8d42e1702 make View3D depth debug code optional
Quick hack to optionally disable depth buffer debugging at compile time.

Will this be useful for users or just during development?
2016-10-25 04:46:07 -04:00
bc566e9393 OpenGL: 3D View background & depth buffer details
Surveying buffer usage & clears for new viewport. Not yet perfect, but closer. Committing from Mac so I can test this on Windows.

Using new matrix API (T49450) for gradient background.
2016-10-25 04:39:55 -04:00
3e71006448 CMake: Followup to previous commit, try to ensure -ldl is always last
Seems CMake will rearrange and copy libraries which are passed to the linker
when some of the libraries is listed twice (for example, -lz from png libraries
and -l for blender itself). This was causing libopenimageio to be added somewhere
at the end of linking flags without -ldl followed after which was causing linking
issues.
2016-10-25 10:22:03 +02:00
d2fe875f8c Fix possible compilation error with OIIO enabled
OIIO library has plugin API which uses dlopen()/dlclose() so need to
link OIO libraries against dl library.
2016-10-25 09:28:25 +02:00
94e14a2c43 OpenGL: new built-in shaders for mesh edges 2016-10-25 03:19:10 -04:00
c5072941c3 OpenGL: clean up glActiveTexture usage
Removed some of my earlier glActiveTexture calls. After reviewing the
code I now trust that GL_TEXTURE0 is active by default. Fewer GL calls,
same results.

Fixed some misuse of glActiveTexture & glUniformi, mostly my fault.
Caught by --debug-gpu on Windows. Don't know why this appeared to be
working previously!

Plus some easy cleanup nearby.
2016-10-25 01:02:41 -04:00
Dalai Felinto
4d11b2fb91 Viewport: original gradient background
Last but not least, fix the original 3d view background based on
@merwin's comment.
2016-10-24 19:40:37 +00:00
Dalai Felinto
1458f0136d Viewport: move the background to the "modern" viewport
This also leaves room for the gradient background Mike Erwin wants to
implement.
2016-10-24 19:05:49 +00:00
Dalai Felinto
744718f635 immediate mode: background
There is a problem here, which is that we can't use immediate mode here
until we rely on `GPU_material_bind`.

(cc: @merwin)
2016-10-24 17:26:27 +00:00
10a25b655a Cycles: Add AVX2 path to subsurface triangle intersection
Similar to regular triangle intersection case. Gives about 3% speedup rendering
SSS object on my desktop,

Question: how to avoid such a code duplication in a nice way without speed loss?
2016-10-24 16:56:41 +02:00
Dalai Felinto
a3b69c8131 Viewport: fix depth filled before solid plates 2016-10-24 12:58:23 +00:00
da8f5d6eac Cycles: Don't use guarded vector for statically initialized data
This will confuse hell of a guarded allocators because it is possible
to have allocation happened prior to Blender's guarded allocator is
fully initialized.

This was causing crashes and assert failures when running blender
with fully guarded memory allocator.
2016-10-24 14:18:22 +02:00
14a55bc059 Cycles: Fix shadowing variable which also causes use of uninitialized variable
Was causing wrong aperture for panorama cameras.

Seems to be a regression in 371d357.
2016-10-24 14:04:31 +02:00
cde18cf3b3 Cycles: Fix static initialization order fiasco
Initialization order of global stats and node types was not strictly
defined and it was possible to have node types initialized first and
stats after that. This will zero out memory which was allocated from
the statistics causing assert failure when de-initializing node types.
2016-10-24 13:47:39 +02:00
963aa7e270 Cycles: Fix uninitialized variable from the previous commit 2016-10-24 12:54:24 +02:00
80a6e5beb5 Cycles: Remove explicit std:: from types where possible
We have our own abstraction level on top of the STL's implementation.
This commit will guarantee our tweaks are used for all cases.
2016-10-24 12:31:11 +02:00
48997d2e40 Cycles: Cleanup, style 2016-10-24 12:26:12 +02:00
3f29259676 Fix T49818: Crash when rendering with motion blur
It was possible to have non-initialized unaligned BVH split
to be used when regular BVH split SAH was inf. Now we ensure
that unaligned splitter is only used when it's really initialized.

It's a regression and should be in 2.78a.
2016-10-24 11:47:32 +02:00
1e1811357d Cycles: Cleanup, spaces 2016-10-24 11:47:32 +02:00
6388d0c4a0 OpenGL: triple buffer tweaks
Works great on Mac now. Will test on Windows & Linux (Mesa) tomorrow. Related to T49505

Main fix is glActiveTexture and immUniform1i.

TEXTURE_2D vs TEXTURE_RECTANGLE is now a compile-time option. Both are available starting in GL 3.1 so there's no need for a run-time check.

Removed glClears that I don't think are necessary.

Prevent TEXTURE_2D from creating extra mipmap levels. We only need level 0.

Some minor cleanup: booleans and variable declarations.
2016-10-24 05:06:45 -04:00
0b749d57ee Fix unlikely uninitialized pointer usage.
Reported by Coverity.
2016-10-24 10:25:58 +02:00
89a3b17853 Fix T49827L Crash linking material while in Material viewport shading mode
Material linking might and does change the way how drawObject is calculated
but does not tag drawObject for recalculation in any way.

Now use dependency graph to tag draw object for reclaculation. Currently do
this using OB_RECALC_DATA taq since tagging is not very granular yet. In the
future we can introduce ore granular tagging in the new dependency graph
easily.

Simple and safe for 2.78a.
2016-10-24 10:13:22 +02:00
c013280eec Fix mistake in BKE_mesh_new_from_object handling of materials in MetaBall case.
Typo, spoted by Coverity scan.

To be backported to 2.78a.
2016-10-24 10:06:00 +02:00
1abdb0c2ee OpenGL: add NormalMatrix & inverse to new API
Part of T49450
2016-10-23 23:37:53 -04:00
2cb45c9938 a place to cache draw data in DerivedMesh
DerivedMesh owns this cache and cleans up as part of DM cleanup. DM has no idea what is stored in this cache. Loose coupling FTW
2016-10-23 23:22:16 -04:00
e53ab2b9ec Gawain: fixups & progress for batch API 2016-10-23 23:16:54 -04:00
Julian Eisel
dabbe6eb22 Fix memory leak when using depth-only shader 2016-10-24 00:03:55 +02:00
1d13950ae5 API doc: enable 'split index' option. 2016-10-23 17:48:31 +02:00
Quentin Wenger
e0a34e963f Displace modifier: add global/local space option for X/Y/Z/XYZ directions.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2309
2016-10-23 14:35:46 +02:00
35fde5ff7d System info: make it more resiliant to errors.
Using context manager for output file itself, and whole try/except block
to at least catch and print error in file.

Also some minor tweaks to previous 'list add-ons' commit.
2016-10-23 13:12:58 +02:00
5d2620e9c2 System info: also report enabled add-ons.
Based on idea & patch by @lijenstina over IRC (iirc :/ ).
2016-10-23 13:05:47 +02:00
672e906d49 Add a built-in sphinx extension to allow cross-linking to the blender manual.
This works by downloading the objects.inv file (https://www.blender.org/manual/objects.inv)
and using it to resolve links with blender-manual: before them.
2016-10-23 11:15:52 +02:00
Hristo Gueorguiev
8905c5c874 Cycles: OpenCL 3d textures support.
Note that volume rendering is not supported yet, this is a step towards that.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2299
2016-10-22 23:49:29 +02:00
371d3570e0 Fix Cycles address space OpenCL error after recent fix. 2016-10-22 23:36:30 +02:00
5765deecd4 GPencil: New option to lock strokes to axis
Now, the strokes can be locked to a plane set in the cursor location.
This option allow the artist to rotate the view and draw keeping the
strokes flat over the surface. This option is similar to surface option
but doesn't need a object.

The option is only valid for 3D view and strokes in CURSOR mode.
2016-10-22 16:44:39 +02:00
9d0ac94d52 Fix T49750: Cycles wrong ray differentials for perspective and stereo cameras. 2016-10-22 16:37:26 +02:00
b5d527ff6c Fix T49656: Crash when starting playback while using JACK audio with A/V sync
When ED_screen_animation_play is called from wm_event_do_handlers,ScrArea *sa = CTX_wm_area(C); is NULL in ED_screen_animation_timer.
Informing the audio system in CTX_data_main_set, that a new Main has been set.
2016-10-22 15:00:32 +02:00
132478d4b8 Fix T49657: Audio backend "Jack" should be named "JACK". 2016-10-22 14:20:47 +02:00
d5ee031f76 Fix T49764: Audio strips crackle when animating the volume
- Implemented linear interpolation for volume changes in the software
mixer.
- Using this in the software device.
2016-10-22 13:39:55 +02:00
Julian Eisel
46257e01a7 Fix compiling with blenderplayer (once again...) 2016-10-22 00:30:28 +02:00
Dalai Felinto
5ff586610a Viewport: use depth shader to debug the depth
At the moment this already shows that the depth is the same after the solid plates and in the very end of drawing, while they should be different. Later on we can adapt this to show different buffers we want to debug.

I am using near=0.1, far=2.0 for my tests. I decided not to make a doversion for near/far because this is for debugging only
2016-10-21 20:51:12 +00:00
Dalai Felinto
deb77c0e74 Viewport: create a shader to show depth images linearized 2016-10-21 20:51:10 +00:00
Dalai Felinto
4c3624a7a0 Viewport: add missing alpha for stereo 2016-10-21 20:51:05 +00:00
Dalai Felinto
af20ca51a1 Viewport: Bring camera, speaker, rigid body shape and bounding box 2016-10-21 20:50:36 +00:00
cdcddddd96 OpenGL: disable GL_CULL_FACE state only when needed
The active camera has a solid "up" triangle instead of the usual outline. We want to see both sides of this triangle. Disable face culling only when drawing the active camera, not for every camera.
2016-10-21 16:25:17 -04:00
fd4caafc53 Fix T49789: Compositor mix node interpolation bug 2016-10-21 17:58:37 +02:00
b51874437d Fix T49804: Display grid Scale/Subdivision are sometimes disabled in View3D when they should not.
Not really possible to precisely detect all cases in which they should or
should not be active, but at least now it won't show as disabled when it
actually has some effects.
2016-10-21 16:06:53 +02:00
Dalai Felinto
01872d7f5d Fix build for gameengine 2016-10-21 12:50:04 +00:00
Dalai Felinto
dd23e52817 Merge remote-tracking branch 'origin/master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/versioning_defaults.c
2016-10-21 12:22:50 +00:00
f7ce482385 Cycles: Fix another OpenCL logging issue
Previously an error message would be printed whenever the OpenCL build produced output.
However, some frameworks seem to print extra information even if the build succeeded, so now the actual returned error is checked as well.
When --debug-cycles is activated, the build output will always be printed, otherwise it only gets printed if there was an error.
2016-10-21 02:49:00 +02:00
224d70c978 OpenGL: draw lamp objects with new imm mode
Previous commit in blender2.8 branch had some... unintended
consequences. This one should be better.

Part of T49043. Also uses new matrix API (T49450)
2016-10-20 16:55:40 -04:00
4ea6917468 OpenGL: box & circle outline functions that work with 3D position (z=0)
New immediate mode API is strict about attribute formats. These new functions make existing code easier to port.

Supports T49043
2016-10-20 14:33:32 -04:00
c6abbb40ad Gawain: closer integration of immediate mode & matrix APIs
- any shader program can use matrix state (not only built-in shaders)
- you can mix matrix & begin/end calls, and the bound shader will use the latest matrix state

Part of T49450 & T49043
2016-10-20 14:29:59 -04:00
a92d20a0a4 OpenGL: dirty bit for GPU matrix API
Have matrices changed since the most recent bind?

Part of T49450
2016-10-20 14:18:34 -04:00
0c4d949eff Alembic: only export custom data (UVs, VCols) once, on the first frame.
This would cause Alembic to throw an exception and fail exporting
animations because it was trying to recreate and overwrite the
attributes for each frame.
2016-10-20 19:43:22 +02:00
32c2cba4ef Fix T49797: Exception from scene update handler might leak external engine descriptors
This was causing memory leaks in Cycles.

Some more detailed information in the comment in the code.

Seems to be safe and nice enough for 2.78a.
2016-10-20 13:33:47 +02:00
Dalai Felinto
225edf4e66 immediate mode: outliner background
I tried using immRecti instead, but it didn't work. The current approach
should be more efficient anyways (since GL_TRIANGLE_FAN wouldn't work
here).
2016-10-20 01:44:49 +00:00
Dalai Felinto
33d99bdfe6 immediate mode: ed_util.c
note: I switched one of the glVertex2iv into glVertex2fv to use the same attrib_id
2016-10-19 23:59:22 +00:00
christian brinkmann
2cd6a89d07 Python API: add full_path parameter for bpy.ops.ui.copy_data_path_button.
Also use the operator as part of the UI keymap now, to deduplicate code and let
users configure a custom shortcut.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2303
2016-10-20 00:31:08 +02:00
789ea7397f Fix T49793 : Fix enabling SSE2 globally for msvc.
When feeding msvc both /arch:sse2 and /arch:sse it's not smart enough to pick the best option, just goes with the last option
2016-10-19 10:06:45 -06:00
417847c161 Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks.
This is not a simple fix, but imho still needs to be backported to 2.78a...
2016-10-19 14:32:08 +02:00
9941bc3041 OpenGL: draw empties with new imm mode
Part of T49043
2016-10-19 04:01:15 -04:00
625f1a1c30 OpenGL: draw cameras using new matrix API
Also removed some extra push/pops.
Ref T49450
2016-10-18 20:57:36 -04:00
05117d71a3 OpenGL: draw cameras with new immediate mode
Mostly the same as before. Except:
- avoid drawing same lines multiple times
- helper functions take "bool filled" argument instead of GLenum
- drawcamera_volume draws its own near & far planes
2016-10-18 20:27:24 -04:00
54a0ff3ab5 Gawain: yet another way to set uniform color 2016-10-18 20:22:22 -04:00
e9268abf4a fix narrow text entry fields
widget_draw_text was calculating wrong display length when field is too narrow to show entire input string. Gawain assert caught this 11 function calls away!

Thanks to @ianwill for reporting.
2016-10-18 17:34:29 -04:00
117af2356a skip drawing of gpencil strokes with overall thickness <= zero
Fixes an assert in drawing code.

Might need further work to support variable-thickness strokes (from pressure-sensitive stylus). This all is due for geometry shader overhaul anyway.
2016-10-18 13:12:40 -04:00
46a069822a draw gpencil dots smooth
Some strokes are just single dots. Draw these smooth / antialiased.
2016-10-18 13:07:35 -04:00
827ad4125c OpenGL: new built-in shader for smooth round 3D points 2016-10-18 13:03:30 -04:00
82f842c27f [msvc] Minor cleanup in blenkernel.
this patch resolves the following warnings;

```
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	764
Warning	C4098	'attach_stabilization_baseline_data': 'void' function returning a value		blenkernel\intern\tracking_stabilize.c	139
Warning	C4028	formal parameter 3 different from declaration		blenkernel\intern\cachefile.c	148
Warning	C4028	formal parameter 3 different from declaration		blenkernel\intern\paint.c	413
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\editderivedmesh.c	591
Warning	C4028	formal parameter 3 different from declaration		blenkernel\intern\library_remap.c	709
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	754
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	758
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	759
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	763
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	764
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	765
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	769
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\ocean.c	770
Warning	C4028	formal parameter 1 different from declaration		blenkernel\intern\DerivedMesh.c	3458
```

It's mostly things where the signature in the .h and the actual implementation in the .c do not match.  And a bunch functions who do not match the TaskRunFunction declaration cause they leave out the __restrict keyword.

Reviewers: brecht, juicyfruit, sergey

Reviewed By: sergey

Subscribers: Blendify

Differential Revision: https://developer.blender.org/D2268
2016-10-18 09:51:33 -06:00
3541f7c47d [windows] Create A Blender Desktop Shortcut in the msi installer , fixes T49522 2016-10-18 09:23:45 -06:00
7500f6c9d9 Fix: Append 'Object proxy' hack checking for local/linked usages before those flags were set!
Dummy mistake, to be backported to 2.78a.
2016-10-18 14:17:10 +02:00
ab4c921e82 Clarified warning in EnumProperty
Blender doesn't necessarily crash when Python doesn't keep references to
the returned strings. As a result, someone that implements this incorrectly
could be lulled into a false sense of correctness by Blender not crashing.
2016-10-18 11:24:33 +02:00
70ff63e63f OpenGL: tweak image shaders & code that uses them
- rename image shaders to describe exactly what they do
- rename inputs to match other built-in shaders
- set & use active texture unit
- no need to enable/disable textures with GLSL
- pull vertex format setup out of loops
2016-10-18 00:08:34 -04:00
0c6939f5f5 minor cleanup & deprecation 2016-10-17 23:48:12 -04:00
8327795f8d OpenGL: draw image empties with new API
This extensive rewrite caches the image texture in VRAM. Can handle images up to OpenGL limits (8K or 16K).

Part of T49043 & T49450
2016-10-17 23:28:51 -04:00
Dalai Felinto
cccd3eb5a8 Fixup for doversion (rB8d573aa0 and rBa7e74791) 2016-10-17 19:45:34 +00:00
Dalai Felinto
6a0292cc19 Fix for gpu_shader_2D_texture_2D_frag.glsl
Report and patch by Willian Padovani Germano (ianwill)
2016-10-17 19:24:08 +00:00
Julian Eisel
4811b2d356 Proper fix for crash when joining areas that doesn't break manipulators
Turns out CTX_wm_region returns mostly NULL in wm_manipulatormaps_handled_modal_update. Now propertly unsetting area/region data of handlers when deleting area/region.
2016-10-17 19:28:09 +02:00
5e92a0faad Fix T49722: Appending Bug (Groups).
One day we'll have to reconsider why some many 'real' ID usages are not
refcounting... :(

To be backported to 2.78a.
2016-10-17 15:00:31 +02:00
c2d0832c6e UV Editor: Add filter option to control what is visible when Draw Other Objects is enabled
Previously the editor will always try to only show UV faces with the same exact active
image or image texture, which is quite difficult to control on a production shaders, where
each material can have multiple objects assigned.

The idea of this commit is to bring option which allows to easily control what to display
when "Draw Other Objects" is enabled, so currently we can have old behavior ("Same Image")
or tell editor to show everything ("All"). In the future we can extend it with such filters
as "Same Material" and things like that.

Hopefully this will help @eyecandy's workflow of texturing.
2016-10-17 14:28:16 +02:00
7f19c4fdf9 Fix T49738: Hair Add Brush doesn't work
the issue was caused by wrong default value for brush particle count
which was clamped on display from 0 to 1. This is technically a regression
but how to port this to 2.78a?
2016-10-17 12:38:54 +02:00
cd843409d3 Fix T49630: Cycles: Swapped shader and bake kernels
The problem here was, as the title says, that the two kernels were swapped.
Since shader evaluation is only used for building the samling map when World MIS is enabled, rendering without it would still work fine, although baking also was broken.
2016-10-17 12:28:01 +02:00
d5dd12e56c Cycles: Improve OpenCL kernel compilation logging
The previous refactor changed the code to use a separate logging mechanism to support multithreaded compilation.
However, since that's not supported by any frameworks yes, it just resulted in bad logging behaviour.
So, this commit changes the logging to go diectly to stdout/stderr once again by default.
2016-10-17 11:51:18 +02:00
e7fddc0772 OpenGL: disable checks for NPOT texture support
Non-power-of-two textures are always allowed. Keeping the disabled checks in the code in case we support OpenGL ES in the future. Even then it should be a compile-time check, not at run-time.
2016-10-17 02:36:51 -04:00
42677fa937 Gawain: tweak tracking of unassigned attributes (no API change)
Hoping for a small performance win.
2016-10-16 23:50:18 -04:00
ca369e6f0c OpenGL: draw object centers nicer
Shaders + new immediate mode = very nice dots.

Part of T49043
2016-10-16 18:49:48 -04:00
61ca73ea10 OpenGL: new built-in shader for smooth round 3D points w/ outline 2016-10-16 18:43:24 -04:00
36d2365ac3 OpenGL: new immUniformThemeColorShadeAlpha function
Plus some naming cleanup.

Supports T49043
2016-10-16 17:48:35 -04:00
9cdf4afb76 Gawain: new immUniform4fv function 2016-10-16 17:48:35 -04:00
f7414b7412 fix IS_VIEWPORT_LEGACY macro 2016-10-16 17:48:35 -04:00
Julian Eisel
d1a35b7a08 Fix outliner items sometimes not opening
Own mistake in 9a9a663f40. Guessed there is a case where we have to rebuild the tree but everything seemed fine... It didn't work in display modes like "Data-Blocks".
2016-10-16 22:23:50 +02:00
2a6ec00b9b Fix T49746: crash loading user preferences with missing operators. 2016-10-16 21:24:42 +02:00
Julian Eisel
2a53e0975c More fixes for keyframe theme options
Couple of issues here:
* Missing initialization for 3D view keyframe options for "Reset to Default Theme"
* Alpha values not reset correctly on "Reset to Default Theme"
* Alpha values of timeline keyframe options not reset correctly for old files
Also corrected old version patches even though they're overridden later, to avoid more issues in case people copy this code.

Corrections to d7af7a1e04 and 8d573aa0ec
2016-10-16 21:08:34 +02:00
Julian Eisel
fa39ec9e46 More fixes for keyframe theme options
Couple of issues here:
* Missing initialization for 3D view keyframe options for "Reset to Default Theme"
* Alpha values not reset correctly on "Reset to Default Theme"
* Alpha values of timeline keyframe options not reset correctly for old files
Also corrected old version patches even though they're overridden later, to avoid more issues in case people copy this code.

Corrections to d7af7a1e04 and 8d573aa0ec
2016-10-16 20:47:44 +02:00
Julian Eisel
196654ad08 Fix crash when joining areas (caused by manipulators)
Manipulator code tried to access the removed region from handler->op_region. Use context region now.
2016-10-16 19:31:57 +02:00
Julian Eisel
69713aa2da Cleanup: Quiet warnings, use RAD2DEG macro 2016-10-16 17:28:12 +02:00
Chase Willden
ad393e1e75 Fix assert in the wrong place, should be moved earlier to do anything.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2304
2016-10-16 16:02:31 +02:00
Julian Eisel
b557ceb2c1 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_outliner/outliner_select.c
2016-10-16 15:33:00 +02:00
Julian Eisel
d59079c5e1 Cleanup: Unused parameters in Outliner
These were only passed to own recursion calls.
2016-10-16 15:19:18 +02:00
Julian Eisel
b659cb8dbc Fix missing outliner redraw when adding VSE strip
Needed for outliner "Sequence" display mode.
2016-10-16 14:39:06 +02:00
Julian Eisel
9a9a663f40 Outliner: Rework element selection behavior
* LMB now replaces selection instead of adding to it. Shift+LMB adds to selection (or removes if already selected). This is usual selection behavior Blender.
* Outliner selection isn't completely separate from object/sequencer-strip/render-layer/... selection anymore, when selecting an outliner item we now always try to select (and activate) the object it belongs to. Previously you had to click the name or icon of an item to select the object (or whatever) and on empty space within the row to set outliner selection.
* Collapsed items may show click-able icons for their children (nothing new). Clicking on such an icon will also select the hidden item it represents now, you'll notice after opening the parent. This valid from a technical POV, I'm not sure if this is wanted from user POV though. Changing would be easy, feedback welcome!
* Code cleanup.

Part of T37430.
2016-10-16 14:29:38 +02:00
Julian Eisel
f929045c2c Outliner: Avoid rebuilding tree when mouse-hover highlight changes 2016-10-16 14:10:30 +02:00
3999910b19 OpenGL: add GLSL #version 330, drop 140 and 150
GL 3.3 is the new minimum. Compatibility profile for now, core profile eventually. During development, GL 3.0 (on Mesa) and 2.1 (on Mac) will still work.

Part of T49012
2016-10-16 03:18:17 -04:00
1deab69e0a BLF/OpenGL: more text drawing optimization
Make color values compact. Set color once per primitive. Use new immSkipAttrib to avoid useless color copies.

All of this should make text drawing less CPU hungry.
2016-10-16 02:08:16 -04:00
741965615d Gawain: new immSkipAttrib function
Now you can explicitly skip a vertex attribute -- you don't give it a value and it won't get a copy of the previous vert's value. Useful for flat interpolated per-primitive values.

This is an advanced feature. Expect garbage in the empty spaces, and copies of garbage if you rely on the attrib copy behavior after skipping.
2016-10-16 01:58:26 -04:00
a4fe823416 BLF/OpenGL: accurate vertex count for drawing
We still need to BeginAtMost instead of simple Begin, since some glyphs could be clipped & not drawn.
2016-10-15 20:04:25 -04:00
a8dc3f4596 BLF: make blurry text an optional (disabled) feature
While trying to simplify text drawing, noticed no Blender code uses the blur feature. Hopefully scripts don't use it!
2016-10-15 19:40:41 -04:00
878938f203 OpenGL: remove some unused legacy matrix calls
Part of T49450
2016-10-15 19:08:19 -04:00
3996fbc564 OpenGL: bump Windows to GL 3.3 compat profile
Part of T49012
2016-10-15 14:41:29 -04:00
cf5750a85e Gawain: improve immediate mode performance
This was already fast on Apple, but @Severin and @dfelinto noticed slowdowns in user prefs, which is text heavy.

The problem was immBeginAtMost not being smart about VBO write flushing. immBeginAtMost can use all of its allocated range or only a subrange. The previous code was forcing back-to-back draw calls and buffer writes to serialize. This commit lets OpenGL know that our VBO writes never overlap, so there's no need to wait.

Should be much faster now!
2016-10-15 14:41:29 -04:00
Julian Eisel
5e428b3b3f Fix unitialized variable use
Own mistake in ae8e845470.
Patch by @efi0ng, thanks!
2016-10-15 18:59:31 +02:00
fcff984338 Merge branch 'master' into blender2.8 2016-10-15 10:05:03 +02:00
9632ca0a13 OpenGL: draw node sockets more efficiently
1 or 2 draw calls per node instead of 1 per socket (inputs + outputs).
Rearranged draw order so we set uniforms less frequently.
Some style & dead code cleanup.

Part of T49043
2016-10-15 02:49:00 -04:00
2df27995f9 OpenGL: new built-in point shader, clean up other shader names
Smooth round point with outline (uniform color) and fill (varying color).

Updated shader naming scheme: a shader that doesn't deal with color does not have to say "no color". Vertex shaders do not have to say "uniform color" since their frag counterpart actually has the uniform. Each name should describe what that shader *does*, not what it *doesn't do*.
2016-10-15 02:30:59 -04:00
48db35468f blender 2.8: OpenGL: node_circle_draw use now immediate mode
I use your new point shader to draw the node's soket

Reviewers: Severin, merwin

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2286
2016-10-15 00:14:28 -04:00
29b47924dd OpenGL: bump Linux to GL 3.3 compat profile
fall back to 3.0 if needed (during development)

Part of T49012
2016-10-14 23:42:45 -04:00
4f4c7808e4 fix pointer type warning
thanks, gcc
2016-10-14 22:40:55 -04:00
Julian Eisel
325b21c1d5 Outliner: Fix missing indentation for search-match highlight
Own mistake in ae8e845470.
2016-10-15 02:08:38 +02:00
4736f19000 BLF: early exit when drawing empty strings
Avoids all kinds of setup & preparations to draw nothing.
2016-10-14 20:00:31 -04:00
3f0c0ed87d BLF: fix crash on text input fields
Some strings have known length, others are NULL terminated (len = INT_MAX in this case).

Now font drawing knows to treat INT_MAX special.
2016-10-14 20:00:31 -04:00
Julian Eisel
9904d73d9a Outliner: Draw highlights over entire row
Previously, highlights (mouse hover, selection, search-match) didn't affect background of restriction icons, now the entire line gets highlighted.
2016-10-15 01:38:44 +02:00
Julian Eisel
ae8e845470 Outliner: Element mouse hover feedback
Some little UI polish to get familiar with outliner code (but also because it's a useful feature). Committing to blender2.8 branch but can also port to master (2.7) if wanted.

This basically causes the mouse hovered element to be highlighted. Contrast of the highlight should be fine, even with a non-default theme. Also did some minor cleanup.
2016-10-15 01:03:25 +02:00
Scott Wu
7fec7eee20 Cycles: use near clipping distance in panorama camera.
Reviewed By: sergey, brecht, dfelinto

Differential Revision: https://developer.blender.org/D1952
2016-10-15 00:26:59 +02:00
Dalai Felinto
ee54a6f130 viewport: draw non-mesh objects for a starter
This starts to decouple non-mesh objects and the legacy draw pipeline.
It shows how we can mix e.g., Cycles and lamps and empties.
2016-10-14 19:00:59 +00:00
Dalai Felinto
608e2402ef viewport: move border drawing code to new file 2016-10-14 19:00:45 +00:00
Dalai Felinto
4a10eb38a3 immediate mode: convert render border code and move to new drawing
routine
2016-10-14 19:00:32 +00:00
Dalai Felinto
e1e97bbb98 Immediate mode: use new util functions, and border draw functions
Part of T49043

Reviewers: merwin
2016-10-14 18:58:58 +00:00
Dalai Felinto
11653f85ff Immediate mode: new util functions (imm_cpack and imm_draw_line_box) 2016-10-14 18:57:38 +00:00
34dc660a76 OpenGL: draw text with fewer draw calls
Was one draw call per glyph,  now one per line.

Still room for improvement here.
2016-10-14 14:41:36 -04:00
dd350c0b37 GPencil: Avoid assert error if the immEnd is called with only one point for lines
This function will be replace by geometry shader, but we need this fix until the shader will be ready. The problem is similar to T49614.
2016-10-14 19:24:27 +02:00
05c727bb00 Prevent crash after OpenGL rendering animation to images. 2016-10-14 18:46:28 +02:00
6855ba4034 Fix T49614: Grease Pencil GPF error if stroke thickness change too much between stroke points
The problem was the function tried to draw a line with one point only. This fix will be replaced by new geometry shaders, but we need while this change is not ready.
2016-10-14 18:35:01 +02:00
8e80d2741d Fix T49571: 2d stabilize keys not visible in the Graph Editor and Dope Sheet 2016-10-14 17:22:57 +02:00
0ddb8d9b13 Cycles: Disable optimization of operator / for float3
This was giving some speedup but made intersection tests to fail
from watertight point of view.

Needs deeper investigation, but need to quickly get it fixed for
the studio.
2016-10-14 13:53:26 +02:00
3055ae5092 Fix T49657: Audio backend "Jack" should be named "JACK". 2016-10-14 13:22:22 +02:00
f23db59e48 GPencil: Display stroke filling while drawing
Before this change, the stroke was filled only after complete the stroke drawing. For artist is better to get a feedback of the area he is filling while drawing, so this commit draws the filling area while drawing.

The triangulation of the stroke is recalculated every time the function is called because using a cache is not useful because the points information is changing all the time while the stroke is being drawing.
2016-10-14 12:06:30 +02:00
49c2dbc5db Fix T49601: Material menu length problem.
Regression from rB69b66d549bcc8, was supposed to be non-functionnal
change, so not sure why search menu was reduced here? For now, restore
to 2.77 width.
2016-10-14 10:29:51 +02:00
Dalai Felinto
58f0af965c viewport: fix rv3d->viewport mem free issue 2016-10-14 05:17:55 +00:00
87a7149831 BPY Docs: Correct spelling (Addon --> Add-on)
Differential Revision: https://developer.blender.org/D2293
2016-10-14 01:25:05 +02:00
dc60fdd671 Fix T49646: Switching from large to small image can get stuck zoom at max zoom distance.
Allow for zooming in at max zoom distance.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D2291
2016-10-14 01:07:18 +02:00
Dalai Felinto
3cecf39069 immediate mode: starting using new immUniformThemeColorBlendShade and more conversion 2016-10-13 20:08:52 +00:00
Dalai Felinto
05cf74622f more theme color functions: UI_GetThemeColorBlendShade4fv, immUniformThemeColorBlendShade 2016-10-13 20:08:51 +00:00
945f8e3f93 Gawain: vertex format now uses fixed allocations (CPU perf++)
API stays exactly the same.

Attribute names can still be of variable length, as long as the average length does not exceed AVG_VERTEX_ATTRIB_NAME_LEN. Since this includes unused attributes (length = 0) the current avg of 5 might even be too high.
2016-10-13 15:15:40 -04:00
Dalai Felinto
dfa5b32c8c Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-13 16:42:54 +00:00
625b504b23 Fix T49534: 2.78 Wrong texture scaling in material viewport
Seems to be a bug in original implementation of a830280: code was always
using tangent space instead of UV map because it had the same name. Now
prefer UVMap over tangent because this is how Cycles works. At least it's
closer to.

Not sure it the save+reload issue is still relevant after this fix, that
needs to be double-checked.

Thanks @dfelinto for looking into the report and simplifying the case.

Should be included into 2.78a.
2016-10-13 18:35:11 +02:00
Dalai Felinto
ecbedce81e viewport: barebones to handle viewport compositing in gpu_viewport.c 2016-10-13 16:26:29 +00:00
14d0549295 Gawain: fix build when TRUST_NO_ONE is disabled 2016-10-13 12:24:01 -04:00
02a1f15416 Fix OLD pre-git links in the API, add missing factory-startup option to blender executions.
Reviewers: mont29

Reviewed By: mont29

Tags: #bf_blender, #python, #infrastructure:_websites

Differential Revision: https://developer.blender.org/D2290
2016-10-13 17:53:30 +02:00
Julian Eisel
916e631fc9 Fix compiling with Blenderplayer 2016-10-13 17:17:17 +02:00
78817ae95c Prevent problems when appending scene with referenced proxy
Such a "referenced proxy" could be a proxy that is used in a constraint on
another object. Brings back part of 1cdc54dc7d but without the
memory leak.
2016-10-13 17:06:24 +02:00
6027550e83 Usual UI/i18n tweaks & fixes. 2016-10-13 16:20:51 +02:00
Dalai Felinto
3579350481 immediate mode: small cleanup on timeline
(no need to unbind/rebind the same program)
2016-10-13 14:18:47 +00:00
6917de6919 Fix: Grease Pencil palettes were missing a RNA path callback 2016-10-14 01:19:30 +13:00
5c651554e2 Proxy appending: re-establish link to proxies when they are made local
This allows appending of an entire scene from another blend file into this one,
even when that blend file contains proxified armatures.

This replaces the approach from commit 1cdc54dc7d.

Thanks @sergey for the help.
2016-10-13 14:10:46 +02:00
918e6cf4c9 Fix T49635: column_flow Layout - last column is too small.
Column flow layout was abuse ui_item_fit in a weird way, which was
broken for last column items.

Now rather use own code, which basically spread available width as
equally as possible between all columns.
2016-10-13 10:23:24 +02:00
786c0966ec Cleanup: UI layout: remove unsed and confusing parameter.
Things are complicated enough like that, no need to add useless noise on
top of it!
2016-10-13 10:23:24 +02:00
6f220c1c55 inform immediate mode when switching OpenGL context
Longstanding to-do is now to-done.

Heinous bug reported by @dfelinto pushed me to fix this.
2016-10-13 00:38:29 -04:00
71656ac222 Gawain: fix immediate mode for multiple GL contexts
New functions activate & deactivate immediate mode. Call these when switching context and the internal VAO will be handled properly. VAOs are one of the few things *not* shared between OpenGL contexts.
2016-10-13 00:38:29 -04:00
Dalai Felinto
d5b75256e0 Fix for crash on dopesheet drawing with immediate mode (rB7a552612c) 2016-10-13 04:23:58 +00:00
Dalai Felinto
c565f7b5fd viewport: bring the manipulators 2016-10-13 02:50:42 +00:00
Dalai Felinto
165bdfb672 Fix timeline break after recent immediate mode change (rBf6e7e46f) 2016-10-13 02:19:04 +00:00
Dalai Felinto
b5c539f9fa gawain: assert for immBeginAtMost(..., 0) 2016-10-13 02:16:55 +00:00
Dalai Felinto
84ed9d9829 Draw depth even when in wire mode (for OB_RENDER)
Note: this is not working at the moment, but the logic is sound.
Since we will still change the drawing code a lot I think the commit is valid.
2016-10-13 00:36:58 +00:00
Dalai Felinto
69b1b95356 immediate mode: use new ThemeColor functions 2016-10-13 00:36:56 +00:00
Dalai Felinto
e79f302f16 gawain/immediate mode: new util functions for color uniforms 2016-10-13 00:36:52 +00:00
Dalai Felinto
8d573aa0ec wrong alpha set for timeline theme (fixup for rBf329ebe3) 2016-10-13 00:28:07 +00:00
Dalai Felinto
f6e7e46fac Immediate mode: timeline (keyframes and range)
Part of T49043
2016-10-12 22:36:54 +00:00
2d03edb458 Fix T49631: radial control operators not using DPI properly. 2016-10-12 20:21:39 +02:00
7f5441b916 Fix T49640: Cycles constant folding incorrect for texture coordinates. 2016-10-12 18:42:38 +02:00
21e65d7457 Fix build error with WITH_CYCLES_NATIVE_ONLY and recent AVX2 changes. 2016-10-12 17:35:03 +02:00
5f16382195 Fix T49636: material draw mode crash with displacement and missing group input node. 2016-10-12 16:52:42 +02:00
a54242503e FFmpeg: Fix off by one error in number of detected frames in matroska container
Seems to be rounding error. Hopefully new code handles the error fixed back in
SVN revision 28901 and still have proper frame number for Hjalti.

What could possibly go wrong here..
2016-10-12 16:17:43 +02:00
22cdf44101 Cycles: Use const reference for register variables in non-OpenCL code
This is something tested by @LazyDodo and suggested by Maxym to make
MSVC happier.
2016-10-12 14:48:59 +02:00
e588106d45 Cycles: Use more SSE intrinsics for float3 type
This gives about 5% speedup on AVX2 kernels (other kernels still
have SSE disabled for math operations) and this solves the slowdown
of koro scene mention in the previous commit.

The title says it all actually. This commit also contains
changes to pass float3 as const reference in affected functions.

This should make MSVC happier without breaking OpenCL because it's
only done in areas which are ifdef-ed for non-OpenCL.

Another patch based on inspiration from Maxym Dmytrychenko, thanks!
2016-10-12 14:43:00 +02:00
42aeb608e7 Cycles: Implement AVX2 version of triangle_intersect
This commit basically vectorizes existing code using AVX2 instructions
(without modifying algorithm itself). This gives quite nice speedups:

  BMW:        -8%
  Classroom:  -5%
  Cat:        -5%
  Koro:       +1%
  Barcelona:  -8%

That's on Linux machine, reported performance improvement on Windows
goes up to 20%.

Not currently sure why Koro is somewhat slower because it mainly uses
curve intersection tests, could be a time noise? Or osmething with the
cache utilization perhaps? In any case speedup in other scenes makes
me thinking that current state is acceptable for initial implementation.

This is again inspired by Maxym Dmytrychenko.
2016-10-12 14:11:55 +02:00
6a4ec3ca43 Cycles: Add new avxf vectorized data type
Based on existing ssef data type and to my knowledge it's also what happens in
Embree nowadays.

Inspired by Maxym Dmytrychenko and required for the upcoming triangle
intersection commit.

Hopefully the copyright message is correct.
2016-10-12 13:54:13 +02:00
fa62a989b4 Cycles: Enable SSE options of math module for AVX2 kernels
Currently this does not give measurable difference, but is required
ground work for some upcoming further optimization of AVX2 kernels.
2016-10-12 12:54:31 +02:00
87d08a5dc1 Cycles: Get rid of ifdef-ed noinline policy 2016-10-12 12:15:24 +02:00
cc95172667 Cycles: Fix use of uninitialized variable in SSS
When ray hits curve segment with SSS shader it was possible to have
uninitialized hit_P variable used for sampling.

Seems that was a reason of our headache of difference between AVX2
and SSE4 render results here, so now we can revert all the nasty
ifdef-ed inline policies.
2016-10-12 12:12:28 +02:00
edd9d89673 Cycles: Cleanup, style 2016-10-12 11:54:33 +02:00
acbbcdfbb8 Fix T49622: Grease pencil not rendering out of VSE 2016-10-12 10:01:30 +02:00
683656681c BLF/OpenGL: use new matrix API when drawing text
First test of matrix API. This will eventually use the 2D part of this API, but the 3D part is ready now.

Part of T49450
2016-10-11 21:21:02 -04:00
06d4aca879 OpenGL: matrix fixes & compatibility
Was multiplying matrices backward, so concatenation was broken. Fixed!

Also a way to mix legacy matrix stacks with the new library. Just during the transition! Anything within SUPPORT_LEGACY_MATRIX will go away after we switch to core profile.

Part of T49450
2016-10-11 21:16:26 -04:00
dc95c31372 Fix T49502: file browser on OS X not highlighting external drives. 2016-10-12 00:07:52 +02:00
c330f37135 quiet GPU matrix debug printing
Will be needed soon but turn it off by default.
Part of T49450
2016-10-11 14:44:12 -04:00
53d82c3e8d BLF/OpenGL: draw text with new immediate mode
Part of T49043
2016-10-11 14:36:16 -04:00
06215c71c0 Fix T49629: Graph editor normalize function doesn't work on f-curves with a constant key value
Technically it is a regression in behavior and should be 2.78a.
2016-10-11 17:08:00 +02:00
17603b9f01 Fix objects added via py being on the wrong layer when viewport is decoupled from scene 2016-10-11 15:35:14 +02:00
5322ff3b48 Make console message more clear for --scene argument 2016-10-11 14:48:15 +02:00
2fe7e70e92 install_deps: make c++11 building mandatory on blender2.8 branch. 2016-10-11 12:19:04 +02:00
0c43567a5a Merge branch 'master' into blender2.8 2016-10-11 12:09:59 +02:00
4370f8ffbd Fix T49623: Immediately crash trying to render attached file in Cycles
Original fix in this area was not really complete (but was the safest at
the release time). Now all the crazy configurations of slots going out
of sync should be handled here.
2016-10-11 11:55:11 +02:00
3e460b68d9 install_deps.sh: remove libglewmx from deb for now, the package is broken in deb testing... 2016-10-10 19:29:55 +02:00
611a9b1bda install_deps.sh: first attempt to support cxx11.
For now, we merely add an option that sets CXXFLAGS envvar with
'--std=c++11' option.

There is no check done to ensure compatibility with the system
libraries, mainly because:
  - It is all but trivial to get this information in a generic and
    reliable way.
  - Currently even cutting edge distributions may still distribute some c++98
    libraries.
  - With recent stdlibc++, both ABIs are supported together, which means
    that incompatibilities are rather unlikely.

To summarize: if your system is recent and built with gcc-5.1 or more,
you should not experience too much troubles with c++11.
2016-10-10 19:29:55 +02:00
587a16352a Gawain: add immRect utility functions (replaces legacy glRect)
Caller is responsible for setting up vertex format, binding a shader program, and setting the color *before* calling immRect.
2016-10-10 12:31:38 -04:00
cf449d377b OpenGL animation: Fix stupid mistake form previous commit
Flagging of pool to cancel was done in the wrong place, making last
frames missing in the final video.
2016-10-10 15:52:10 +02:00
f36543c5f5 Fix viewport camera gets out of sync in certain cases
It was possible to have two viewports opened and start using Ctrl-0
to make different objects an active camera for the viewport. This
worked fine for viewports which had decoupled camera from the scene,
but if viewport was locked to scene camera it was possible to run into
situation when two different viewports are locked to scene camera but
had different v3d->camera pointers.
2016-10-10 15:05:05 +02:00
54dad5c49f OpenGL render: Fix missing file output after pressing Esc
Apparently, the whole G.is_break is not used by OpenGL render, meaning
this flag will not be clear before running the operator. This was
causing missing file output after pressing Esc once for the rest of
Blender session.
2016-10-10 12:51:01 +02:00
6371f8ff8a Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_view3d/view3d_draw.c
2016-10-10 12:41:32 +02:00
ecbad54df9 blender 2.8; OpenGL. ui_panel_category_draw_tab with immediate API
Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2281
2016-10-10 01:41:31 -04:00
109192b360 OpenGL: remove GLSL support query (it's always supported) 2016-10-10 01:28:30 -04:00
ba5e2270f9 remove call to GLSL support query (it's always supported)
Reworked logic in the one place that still called this. Deleted the "GLSL not supported" fallback.

(equivalent to rB78abbdf26451 on blender2.8 branch)
2016-10-10 01:28:02 -04:00
33ef28068a BGE: remove calls to GLSL support query (it's always supported)
Reworked logic in the few places that still called this. Deleted the "GLSL not supported" fallbacks.

Also removed some nearby checks for ARB_multitexture and OpenGL 1.1. Blender 2.77 removed checks like this, but game engine still has some.
2016-10-10 01:19:10 -04:00
22f59b81d7 OpenGL: remove GLSL support query (it's always supported) 2016-10-10 01:13:03 -04:00
78abbdf264 remove call to GLSL support query (it's always supported)
Reworked logic in the one place that still called this. Deleted the "GLSL not supported" fallback.
2016-10-10 01:11:03 -04:00
5fc9bed8b3 BGE: remove calls to GLSL support query (it's always supported)
Reworked logic in the few places that still called this. Deleted the "GLSL not supported" fallbacks.

Also removed some nearby checks for ARB_multitexture and OpenGL 1.1. Blender 2.77 removed checks like this, but game engine still has some.
2016-10-10 01:08:49 -04:00
7a60f889d3 OpenGL: plug new matrix system into shaders (WIP)
Built-in shaders now use uniforms instead of legacy built-in matrices. So far I only hooked this up for new immediate mode.

We use the same matrix naming convention as OpenGL, but without the gl_ prefix, e.g. gl_ModelView becomes ModelView.

Right now it can skip the new matrix stack and use the legacy built-in matrices app-side. This will help us transition gradually from glMatrix functions to gpuMatrix functions.

Still some work to do in gpuBindMatrices. See TODO comments in gpu_matrix.c for specifics.
2016-10-09 23:03:35 -04:00
e636529e33 OpenGL: Draw dividers in space_file with the new immediate mode
Thanks to @merwin for the review

Part of T49043
2016-10-09 18:20:52 +02:00
99db1b8d95 fix shaders for picky GLSL compilers
@zeauro reported this issue:
texture2DRect needs the ARB_texture_rectangle extension.
But isn't that an OpenGL 2.1 feature and should be part of GLSL 1.2+?

This should fix it, and future shaders should do something similar.
2016-10-09 10:53:03 -04:00
9ea71bc674 Cycles: Split device_opencl.cpp into multiple files for easier maintenance
There are no user-visible changes, just some internal restructuring.

Differential Revision: https://developer.blender.org/D2231
2016-10-09 15:49:50 +02:00
1fad269d07 Fix T49609: Point density textures: vertex colors are not properly averaged in BI
Nice to have in 2.78a, though not a regression.
2016-10-09 13:17:09 +02:00
4cb60b14e0 CMake changes for new macOS target 10.9 / libc++ libraries.
Differential Revision: https://developer.blender.org/D2283
2016-10-09 01:54:29 +02:00
a2471d2b37 Gawain: validate inputs to add_attrib
Should help prevent errors when building vertex formats.
2016-10-08 16:58:06 -04:00
c275870673 Ammend to rB00dc0666b3fe: forgot to fix boid->ground of first particle.
This code is confusing, such dirty details should not sneak out of
particles' own private code. :(
2016-10-08 19:13:50 +02:00
00dc0666b3 Fix T49608: runtime-only particle's boid->ground Object pointer was left dangling to invalid value in read code... 2016-10-08 15:20:43 +02:00
74e0f900c5 Fix a few compile errors with C++11 on macOS. 2016-10-08 15:03:53 +02:00
0fe7446a30 BLI_task: fix case were some pool could work in more threads than allowed.
We were checking for number of tasks from given pool already active, and
then atomically increasing it if allowed - this is not correct, number
could be increased by another thread between check and atomic op!

Atomic primitives are nice, but you must be very careful with *how* you
use them... Now we atomically increase counter, check result, and if we
end up over max value, abort and decrease counter again.

Spotted by Sergey, thanks!
2016-10-08 14:51:33 +02:00
187d8f473a OpenGL: fix smooth point fringe
Smooth edge was fading to transparent black instead of transparent color. My bad.
2016-10-08 03:34:05 -04:00
7a552612c3 OpenGL: draw f-curve points and handles with new imm mode
Got rid of GLU and some matrix manipulation. Everything is shader driven now, drawn with point sprites.

Still plenty to do in this file...

Part of T49042 and T49043
2016-10-08 03:27:02 -04:00
25e4dc45e5 OpenGL: shaders for smooth round points
Solid color with an optional outline.

size (diameter) and outlineWidth are in pixels.
2016-10-08 03:11:53 -04:00
b071ac315c Gawain: allow immBeginAtMost, immEnd with no vertices
The whole point of BeginAtMost is to avoid counting before drawing. Sometimes the uncounted count is zero, and that's ok!
2016-10-07 23:50:52 -04:00
2a76da9ec2 draw region emboss with new immediate mode
Simple convert of drawing emboss lines to new immediate mode.

Part of T49043

Reviewers: merwin

Reviewed By: merwin

Subscribers: dfelinto

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D2271
2016-10-07 23:46:52 -04:00
a398cdedfa Gawain: code cleanup & inline docs
Made function categories more clear & added more notes about how to use this API.

immEndVertex is no longer part of the public API.

Minor cleanup & organizing of recent additions.
2016-10-07 18:51:42 -04:00
b613d25354 Blender 2.8: OpenGL: replace old GL with the new immediate API in UI_draw_roundbox_gl_mode
I change UI_draw_roundbox_gl_mode to use immediate API.
The rest of the change is the call to the function.
I also make some change in UI_ThemeColor4(int colorid) for eg to make convenience to use.
I would really like to know if it's the good way to do, if yes I will make all the change in the node_daw.c after, else say me what's wrong and how to deal with color else.

Reviewers: merwin, dfelinto, Severin

Reviewed By: merwin

Subscribers: fablefox, Severin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2274
2016-10-07 15:03:21 -04:00
0a2a006775 Collision: skip expensive BVH update if the collider doesn't move.
Since the collision modifier cannot be disabled, it causes a constant
hit on the viewport animation playback FPS. Most of this overhead can
be automatically removed in the case when the collider is static.

The updates are only skipped when the collider was stationary during
the preceding update as well, so the state is stored in a field.
Knowing that the collider is static can also be used to disable similar
BVH updates for substeps in the actual cloth simulation code.

Differential Revision: https://developer.blender.org/D2277
2016-10-07 21:47:00 +03:00
5c23b863f8 fix grid floor drawing assert
@dfelinto reported crash when setting grid subdivisions too low.

Code was setting color twice and Gawain was catching this. Fix is to only set regular grid color when we have regular grid lines to draw.  Then emphasized grid lines are free to set their own color further down.
2016-10-07 13:00:23 -04:00
2dccf5a6e8 Cycles: Fix OpenCL split kernel compilation after recent CUDA 8 performance fix 2016-10-07 18:50:43 +02:00
8e586c594f OpenGL render: Limit number of scheduled frames for write
Previously if the rendering is much faster than saving (for example,
when transcoding stuff via VSE) it was possible to have 100s of frames
in memory.

This isn't ideal because of limited amount of RAM, so need to have
some sort of limit. This is exactly what is implemented in this commit.
2016-10-07 17:46:13 +02:00
ae2471b850 OpenGL render: Fix non-deterministic order of frame writes for movies
By the design of task scheduler it was possible that tasks from somewhere
in the middle of scheduled list will be handled first.

For example, one thread might be iterating over the scheduled list and
ignore tasks because there is other thread is working on task from the
same pool. However, if that other thread finishes task before iteration
is over current thread will pick up task from somewhere in in the middle
of the list.

This isn't a problem in general case, but for movie rendering we do need
to have strict order of frames.
2016-10-07 17:12:27 +02:00
Julian Eisel
6e358a1d06 Custom Manipulators Core Backend
This commit lands the core backend of the Custom Manipulators project onto the blender2.8 branch. It is a generic backend for managinig interactive on-screen controls that can be integrated into any 2D or 3D edito. It's also already integrated into the window-manager and editor code where needed.

NOTE: The changes here should not be visible for users at all. It's really just a back-end patch. Neither does this include any RNA or Python integration.

Of course, there's still lots of work ahead for custom manipulators, but this is a big milestone. WIP code that actually uses this backend can be found in the 'custom-manipulators' branch (previously called 'wiggly-widgets').

The work here isn't completely my own, all the initial work was done by @Antony Riakiotakis (psy-fi) and - although it has changed a lot since them - it's still the same in essence. He definitely deserves a big credit! Some changes in this patch were also done by @Campbell Barton (campbellbarton). Thank you guys!

Merge accepted by @brecht and @merwin.
Patch: https://developer.blender.org/D2232
Code documentation: https://wiki.blender.org/index.php/Dev:2.8/Source/Custom_Manipulator
Main task: https://developer.blender.org/T47343
More info: https://code.blender.org/2015/09/the-custom-manipulator-project-widget-project/
2016-10-07 16:59:55 +02:00
09b9e462b9 OpenGL: Don't write frames when rendering was canceled 2016-10-07 16:51:19 +02:00
c67a8acc72 Cleanup: Use more clear name for where allocation is coming from 2016-10-07 16:06:24 +02:00
33297db9de OpenGL: Do not schedule new frames for write if error happens
Also do not attempt to write any already scheduled frames.
2016-10-07 16:05:51 +02:00
Julian Eisel
53d1dbbe5c Merge branch 'master' into blender2.8 2016-10-07 15:14:49 +02:00
90f5e61b72 Proxied → Proxified 2016-10-07 13:33:43 +02:00
1cdc54dc7d Re-establish link to proxies when they are made local after appending.
This allows appending of an entire scene from another blend file into
this one, even when that blend file contains proxified armatures.

Since the proxified object needs to be linked (not local), this will
only work when the "Localize all" checkbox is disabled. The appended
proxy object should also not be referenced from anything in a library
(for example in a constraint). Referencing it from the appended data
should be fine.

Fixes T49495.
2016-10-07 13:08:50 +02:00
4639664b3c Merge branch 'master' into blender2.8 2016-10-07 11:50:17 +02:00
0f88a3546c Datablock management: remove 'proxy_from' pointer from 'is ID used' checks.
Pretty much same reason as for the 'from' pointer of shapekeys - runtime
data creating loops and 'ghost' dependencies between datablocks.

We need to handle them in cases like remapping, but whall not take them
into account to check dependencies between datablocks... :/
2016-10-07 10:20:40 +02:00
e7981a3e93 Fix T49595: bpy - negative skin_vertices radius crashes Blender
This is unsigned value (negative radius does not have much sense anyway!).
2016-10-07 10:19:22 +02:00
107b585a41 OpenGL/gpencil: delete unused utility functions
Part of T49043  -- done with this file!
2016-10-07 03:17:23 -04:00
9d40c3dc32 OpenGL: draw gpencil fill with new imm mode
Part of T49043
2016-10-07 03:04:34 -04:00
1865bcd3cf OpenGL: draw 2D gpencil strokes with new imm mode
Part of T49043
2016-10-07 00:56:28 -04:00
1f6d704008 OpenGL: draw 3D gpencil strokes with new imm mode
Part of T49043
2016-10-07 00:06:20 -04:00
0fbe35c674 OpenGL: fix shader input typo 2016-10-07 00:00:12 -04:00
70a16298ea gpencil: disable / remove some legacy drawing
Want to avoid updating code we no longer use anyway.

Comments for areas to investigate or deadlines for deletion.

also some minor bool cleanup

Part of T49165
2016-10-06 22:05:28 -04:00
Julian Eisel
fc77787f6f Avoid possible compatibility issues with tmp viewport flags
We can't prevent users from using this branch, so I'd say it's reasonable to be a bit careful about what we store to files. In this concrete case we were storing a bit-flag for temporary use (only during early viewport transition) in a bit-field that's saved in files. Doing so would mean we either can't reuse this bit later or we risk breaking files (admittedly, likely in a pretty minor way). Moved the bit-flag to a new bit-field which can be removed later.
2016-10-07 03:56:32 +02:00
Dalai Felinto
49beb714c5 Viewport: support for external render engines (e.g., Cycles) with depth
(it is still a rough approach, but you can already see Cycles with Floor (when using board render or full render)
2016-10-07 01:47:30 +00:00
Dalai Felinto
4539c2b173 Viewport: floor cleanup 2016-10-07 01:47:30 +00:00
Dalai Felinto
82d069c232 Viewport: draw floor routine should not use GL_ALWAYS for depth
(talked with merwin about that, and he agrees on it, we are not supposed to write to the scene depth buffer
but we should read its depth)
2016-10-07 01:47:30 +00:00
Julian Eisel
490a938c8b Move panel for new viewport up
Makes it easier to enable it and avoids jumping of the panel when activating/deactivating it (because some panels disappear then). Also changed how panel title is drawn to make it behave like other panels.
2016-10-07 03:22:48 +02:00
Julian Eisel
1997b0f03c Use theme color for clearing viewport background
We'll obviously do more fancy stuff here later, but we don't have to look at pure blackness either ;)
2016-10-07 03:11:08 +02:00
1b4b4dfd0c OpenGL/GPencil: draw stroke-in-progress with new imm mode
We should revisit this later and use geometry shader to draw one continuous tapered stroke.

Part of T49043
2016-10-06 20:51:31 -04:00
fe654a93c7 Gawain: allow strips of 1 line, fans of 1 triangle
My initial tests were stricter than necessary, and blocked some valid uses. Fixed!
2016-10-06 20:51:31 -04:00
e01b1eac84 cleanup: C99, const, blank lines 2016-10-06 20:51:30 -04:00
Julian Eisel
553b4faac8 Merge branch 'master' into blender2.8 2016-10-07 00:22:21 +02:00
ffc46668c4 OpenGL: modernize gp_draw_strokes_edit
Single draw call per stroke!

Part of T49043
2016-10-06 17:41:23 -04:00
Julian Eisel
ec6b593072 Fix wrong separator line width after drawing vec icon
Was visible in Dynamic Context Menu add-on.
2016-10-06 22:45:12 +02:00
Dalai Felinto
ea89b4a918 Viewport: bring grid over to the new viewport
We will keep the old system working as long as we can. At the moment even the visibility flags we are getting from the old system. That will continue like this until we have decided on the new UI
2016-10-06 20:35:41 +00:00
Dalai Felinto
6b88f3118f Viewport: Starting to port over the principles of the draw flux into placeholder functions
A lot of the work still have to done on space_view3d.c for initialize the data and buffers properly, but it is a start
2016-10-06 20:35:40 +00:00
198e3a35c8 OpenGL: another built-in shader for 2D points
GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR
2016-10-06 16:32:02 -04:00
b859557115 GPencil: Fix interpolate stroke keymap conflict with sculpt
The initial idea was to use Ctrl+E to interpolate stroke because this is
similar to Pose breakdown, but the Ctrl+E keymap is used to inverse
grease pencil sculpt effect.

The new keymap is Ctrl+Alt+E in order to fix the conflict
2016-10-06 22:21:10 +02:00
86e439e311 OpenGL: convert gp_draw_stroke_point to new immediate mode
and constify some static utility functions

Note: 2D shader will ignore position's z value, but making pos a vec3 lets us unify code in this function.
2016-10-06 14:40:47 -04:00
edcce96d97 OpenGL: more built-in GPU_SHADERs for points
No new GLSL shaders were needed! Just combined existing vertex & fragment shaders in new ways.
2016-10-06 14:20:33 -04:00
360cb87007 OpenGL: modernize more volumetric gpencil drawing
Main goal is to get rid of GLU.

Part of T49042, touches on T49043 and T49450
2016-10-06 12:45:04 -04:00
e86bd78745 Gawain: more ways to set uniform color 2016-10-06 09:37:04 -04:00
5a0f397eaa Fix T49523: very slow normal map tangent computation for rendering in 2.78. 2016-10-06 03:12:04 +02:00
1731e94d0c draw gpencil erase cursor with new imm mode
Part of T49043 and T49450.
2016-10-05 14:05:55 -04:00
e874f3cdc5 draw gpencil sculpt cursor with new imm mode
Part of T49043 and T49450.
2016-10-05 13:45:28 -04:00
c462500618 Gawain: more ways to set uniform color 2016-10-05 13:12:18 -04:00
3caa830c11 Fix T49501: Animations imported via alembic render with wrong or no motion blur 2016-10-05 12:37:09 +02:00
Dalai Felinto
5e8c4ae75b Barebones for viewport code apart from 2.7x drawing code
A new option (set in the properties region) allows the user to pick the
"new viewport" for the rendering  (in the UI: Modern Viewport).

For now we have a semi-blank file (view3d_draw.c) that can starts to take
over the drawing pipeline.

I can't guarantee we will be able to keep both drawing systems working
through the entire 2.8 development, but it should do for now.

also, we can use branches for some of the viewport development, but it's
better to keep things in 2.8 whenever we can, so people can test it.
2016-10-04 22:02:05 +00:00
4f1f949877 [msvc] make.bat, no need to set the cuda path at all, cmake will figure it out on it's own. 2016-10-04 13:30:38 -06:00
cd320dbfba [msvc] make.bat remove mixed cuda 7.5/8.0 build for release since all kernels can now be properly build with 8.0 2016-10-04 11:51:04 -06:00
b7046b42ab Cleanup: Update links to online py API doc, and remove old commented stuff. 2016-10-04 16:45:29 +02:00
e5c3284467 Fix T49553: Blender 2.78 crashes when File->Data Previews ->Refresh Datablock Previews
New recursive iteration over IDs in BKE_library_foreach_ID_link() was
broken by the infamous nodetree case. We cannot really recusively call
this function in that case, so better to deffer handling of
non-datablock NodeTrees as if real IDs here.

Also fixed initial ID not being stored as handled, in rare cases this
could also lead to infinite looping.

To be backported to 2.78a.
2016-10-04 15:05:56 +02:00
3a4c1db14b fix Linux build
My mistake. Breakage reported by @mont29
2016-10-04 01:31:24 -04:00
79b8242fd1 Gawain: fix bug in immUniformColor4ubv
Reported by @kgeogeo
2016-10-04 01:24:33 -04:00
Dalai Felinto
ae44e24fed Merge remote-tracking branch 'origin/master' into blender2.8 2016-10-03 20:54:22 +00:00
b4f9766ed1 Cycles CUDA: make CUDA 8.0 the officially supported version for all platforms. 2016-10-03 22:15:26 +02:00
a3abb020e3 Fix Cycles CUDA performance on CUDA 8.0.
Mostly this is making inlining match CUDA 7.5 in a few performance critical
places. The end result is that performance is now better than before, possibly
due to less register spilling or other CUDA 8.0 compiler improvements.

On benchmarks scenes, there are 3% to 35% render time reductions. Stack memory
usage is reduced a little too.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D2269
2016-10-03 22:15:25 +02:00
49ad4215ba Fix fluid sim build error with MSVC. 2016-10-03 22:15:24 +02:00
55aadccbde Merge branch 'master' into blender2.8 2016-10-03 20:48:00 +02:00
Julian Eisel
103fbb3afc Fix memory leak caused by unknown opeartor of keymap item 2016-10-03 18:09:22 +02:00
b9e82b5bfb Fix T49548: Entering Cycles Rendered Viewport Unlinks Material from Objects.
We *always* want to increase mat user count when from Object (and not
Data), because in that case we are moving mat from object to temp
generated mesh, material can never be 'borrowed' in that case.

To be backported to 2.78a
2016-10-03 17:38:14 +02:00
Julian Eisel
853d232928 Fix missing operator-type registration
Removed in a7dbc0704f, but only should've removed default keymap entry.
2016-10-03 16:34:51 +02:00
Julian Eisel
e8c8db4833 Fix T49506: Remove unused File Browser theme settings
If I didn't miss anything these are indeed not used. Old themes should still work (will only print info on redundant theme defines into console), but updated non-contrib themes already.
2016-10-03 13:47:00 +02:00
c5e10394b4 Fix missing new eyedropper keymap entry in keyconfig_utils.py
Missing from rBe9bcdcdbbd91d9.
2016-10-03 12:29:18 +02:00
3ee5ce155c [Windows/Cycles/Clang] Fix compilation error with clang-cl on windows 2016-10-02 14:01:23 -06:00
72473a61b0 Fix compile errors with Alembic. 2016-10-02 20:52:25 +02:00
c50ccc8476 Merge branch 'master' into blender2.8 2016-10-02 18:53:01 +02:00
3f9b69287d Fluids: improve multithreaded CPU usage.
Fixes for clamp-omp, fewer shared variables, fix some cases of threads writing
to the same memory location. Issue found by Jens Verwiebe, who reports 30%
speedup with 16 core CPU, when using this with a recent clang-omp version.
2016-10-02 16:38:14 +02:00
ba30b852f3 OpenGL: draw volumetric gpencil with point sprites
Transition away from GLU and legacy matrix stack. Using point sprites eliminated the need for most of the matrix math!

Depends on decent support of large aliased points. NVIDIA is good at this, must test limits on AMD & Intel systems.

Still needs proper scaling based on view zoom.

Part of T49042, touches on T49043 and T49450.
2016-10-01 18:11:58 -04:00
b8e3d81f31 OpenGL: fix point sprites
Apparently GL_POINT_SPRITE is important to GL 3.2+ compatibility profile, not just to GL 2.1 as thought.

We'll remove this during the core profile transition.
2016-10-01 17:34:41 -04:00
875d63ccb5 OpenGL: one more point shader
Added a built-in shader for points that vary both size and color.
2016-10-01 17:32:29 -04:00
641e586b15 Fix T49520: broken vertex colors in the game engine. 2016-10-01 22:41:46 +02:00
fd2bffd22e [Fix unreported bug] Snap align with normal was not working in derivade mesh
The `use_snapp_align_rotation` option was using only the first vertex
2016-10-01 16:50:34 -03:00
11e93c5f2b [msvc] make.bat - Fix:msbuild platform wasn't set when the architecture was auto detected. 2016-10-01 11:22:09 -06:00
ad23ee761b Fix T49502: file browser on OS X not highlighting system folders and bookmarks. 2016-10-01 19:15:57 +02:00
4a423862e9 [MSVC] Make.bat updates.
- Explicitly specify the platform for msbuild, to facilitate builds with just the Visual C++ Build Tools installed.
- When vs2013 is not found, try looking for 2015 as a fallback
- Clear up any batch variables that might have been set from previous runs
2016-10-01 10:22:28 -06:00
15e756c584 Fix wrong Cycles GLSL pointiness, still not supported but should be neutral 0.5. 2016-10-01 14:47:05 +02:00
40eedd5df9 Cycles: implement partial constant folding for exponentiation.
This is also an important mathematical operation that can be folded
if it is known that one argument is a certain constant. For colors
the operation is provided as a Gamma node.

The SVM Gamma node needs a small fix to make it follow the 0 ^ 0 == 1
rule, same as the Power node, or the Gamma node itself in OSL mode.

Reviewers: #cycles

Differential Revision: https://developer.blender.org/D2263
2016-10-01 14:37:03 +03:00
5753a1462f OpenGL: new built-in shaders for drawing points
Both of these draw round points with jaggy edges, but treat color & size differently.
2016-09-30 20:44:22 -04:00
Sebastian Witt
95fa303efd Add default UV coordinates for torus primitive.
Fixes T47489.

Reviewed By: brecht
2016-10-01 01:56:16 +02:00
20c6d5e3cb Fix MSVC compiler warning due to using */* to start comment. 2016-10-01 01:55:34 +02:00
d1b21d1278 OpenGL: add support for programmable point size
And enable point sprites always. Fragment shaders can use gl_PointCoord now.
2016-09-30 19:51:04 -04:00
82648a8f91 OpenGL: make platform requirements explicit
At context startup, make sure our assumptions about the OpenGL version are true. Should match since we set up the contexts... but this is what asserts are for, to check "should"s!

Part of T49012
2016-09-30 19:10:30 -04:00
70a40ff65a Cleanup: Naming in EditNormals modifier 2016-09-30 12:15:18 +02:00
6a4ca1e5c0 Normal edit modifier: Fix relation builder for the new dependency graph 2016-09-30 11:13:28 +02:00
eb9521ae04 Depsgraph: Report proper error when modifier fails to create relation link 2016-09-30 11:05:01 +02:00
5845d52bf3 CUEW: Use latest upstream version
Fixes typo in README :)

Thanks to @jesterKing!
2016-09-30 10:36:11 +02:00
85d543b4ac Fix T49489: Pose marker in camera action + marker bound to camera -> crash.
'camera' Object pointer of TimeMarkers is a 'temp' hack since Durian project...
Would need to be either made definitive now, or removed/reworked/whatever.

But since we intend to use that object pointer for other needs, and current code
could lead to crashing .blend files, for now let's fix that mess (was missing
some bits in read code, and also totally ignored in libquery code).

Should be safe for 2.78a.
2016-09-30 10:14:12 +02:00
396a6d8a86 UPBGE: Fix crash when calling shade_light texture when mtex has no tex. 2016-09-30 07:41:18 +02:00
Julian Eisel
42ed1f0e3c Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/writefile.c
2016-09-30 01:18:41 +02:00
47bba7e15f OpenGL: draw nurbs control verts with new imm mode
patch P397 by @lichtwert + minor const by @merwin

Notes from drawvertsN function:
this used to be called twice (once for selected/active, once for unselected -- guess: to avoid state switches[color]?)
this used to be called in a loop, too (subcurves), moved the loop here to avoid multiple init stuff

Part of T49043
2016-09-29 15:23:13 -04:00
Julian Eisel
35bd833e02 Cleanup: Style 2016-09-29 21:15:27 +02:00
bbf32980b0 OpenGL: draw speaker with new immediate mode
patch P388 by @lichtwerk, I tweaked a few things.

Since speaker theme color is opaque we leave blend mode alone.

Part of T49043
2016-09-29 14:47:38 -04:00
80837d06de Cycles: Support earlier tile rendering termination on cancel
It will discard the whole tile, but it's still kind of more friendly than
fully locked interface (sort of) for until tile is fully sampled.

Sorry if it causes PITA to merge for the opencl split work, but this issue
bothering a lot when collecting benchmarks.
2016-09-29 16:00:25 +02:00
333366dbcf Cycles: Fix typo in shader cancel routines 2016-09-29 15:48:10 +02:00
57a2015f56 Adopt referenced scene in the context when evaluating sequences within a Scene Strip
This change makes it so that when the sequences within a Scene strip are
evaluated, they use the Scene that they come from as the context as opposed
the Scene that the Scene strip is in. This is necessary, for example, in the
case of the MulticamSelector where it needs to reference strips in the original
Scene as opposed to the Scene where the Scene strip is located.

Patch by @Matt (HyperSphere), thanks!
2016-09-29 15:00:03 +02:00
31ebbe40a0 Cycles: Improve OpenCL line information handling
Previously it was falling back to just a path after #include
statement was finished. Now we fall back to a proper current
file name after dealing with the preprocessor statement.
2016-09-29 10:20:24 +02:00
94c919349b Cycles: Cleanup file headers
Some of the files were wrongly attributing code to some other
organizations and in few places proper attribution was missing.

This is mainly either a copy-paste error (when new file was
created from an existing one and header wasn't updated) or due
to some refactor which split non-original-BF code with purely
BF code.

Should solve some confusion around.
2016-09-29 10:11:40 +02:00
8deddba392 Update source tgz builder script
Was broken since splitting BKE_blender_version from BKE_blender.
2016-09-29 10:05:42 +02:00
78c380d3b8 [MSVC] make.bat updates.
- The build folder name used to be depended on the order of the parameters, this is now normalized to
"build_windows_[Release/Full/Lite/Headless/Cycles/Bpy]_[x86/x64]_vc[12/14]_[Release/Debug]" regardless of the order of the parameters.

-Use CUDA8 for all kernels when building the release convenience target with visual studio 2015
2016-09-28 19:57:25 -06:00
f1de438bba Revert "[Windows/MSVC] Blosc doesn't require debug libraries."
turns out it's a C++ lib now-days and it *DOES* require debug libs.

This reverts commit bde5eb8b63.
2016-09-28 17:27:35 -06:00
26d7d995db Fix Windows mouse wheel scroll speed
In Windows, event dispatching code is throwing out the wheel scroll count value.
Despite of how many fast you move the wheel, it only make one-notch scroll event.

This patch convert wheel event to multiple 1-notch wheel events.

This also correct the handling of smooth scroll mouse wheel (which can report smaller than 1-notch wheel movement) by accumulating the small wheel delta values.

Reviewers: djnz, shadowrom, elubie, #platform:_windows, sergey, juicyfruit, brecht

Reviewed By: shadowrom, elubie, #platform:_windows, brecht

Subscribers: dingto, elubie, brachi, brecht

Differential Revision: https://developer.blender.org/D143
2016-09-28 17:22:02 -06:00
Dalai Felinto
9bac74c27b Complement fixup for 4a1feaa555 (texture shaders)
We now multiply the alpha by the image alpha (as per severin
suggestion).
That still doesn't solve the main question of user preference drawing
black.
2016-09-28 19:11:11 +00:00
Dalai Felinto
4c7ff8fb1e Fix animation transition in region overlay not working since 4a1feaa5
We still have stills with the User Preference window, though.
2016-09-28 18:48:51 +00:00
344a669c41 Fix T49478: triangulate of face hangs Blender.
Another case of float imprecision leading to endless loop. INcreasing a bit 'noise threashold' seems to work OK.

Not a regression, but might be nice to have in 2.78a.
2016-09-28 20:05:46 +02:00
0ec87f1227 Cycles: Cleanup, indentation 2016-09-28 17:05:33 +02:00
e1bfb89da2 Cycles: Fix compilation error with minimal feature set 2016-09-28 17:03:59 +02:00
c5d7602925 Fix T49471: Vertex Connect randomly broken.
Not sure where this comes from, but code was converting BMEdge* to BMVert* to check oflags,
i.e. not accessing correct memory.

Regression, to be backported to 2.78a.
2016-09-28 16:58:11 +02:00
305fec8358 Fixes for pose library change 601ce6a89c
Apparently the keying sets system doesn't support subclassing
KeyingSetInfo subclasses. I have added a note to the top of the file to
indicate this to future developers.
2016-09-28 15:40:22 +02:00
dea7ef4dd9 Curve pinning: Allow pinning object data without animated object
Special case, so now we can pin tricky cases like animated camera DOF
without requiring to have animation on the object level.
2016-09-28 15:25:05 +02:00
cbd3827d83 Fix T49460: Particle group instance 'Use Count' value gets reset on file-load.
Regression caused rBbcc863993ad, write code was assuming dw->ob was always valid,
wich is no more the case right after reading file e.g.

Another good example of how bad it is to use 'hidden' dependencies between datablocks. :(
And another fix to be backported to 2.78a. :(((
2016-09-28 15:08:45 +02:00
601ce6a89c POSELIB_OT_pose_add: only create keyframes for selected bones.
Previously the pose library used the WholeCharacter key set, which ignores
selection and add keys for almost all bones in the rig. This is a very
slow operation on complex rigs. With this patch, only selected bones are
keyed, defaulting to keying all bones when none are selected.

Note that this fixes the FIXME previously mentioned in the source.
2016-09-28 13:54:57 +02:00
Julian Eisel
dbb8222baa Fix missing properties editor update when changing 3D View camera
Actually two errors here:
* Properties editor wasn't refreshing on (NC_SCENE | ND_RENDER_OPTIONS) notifiers
* Was using notifier info bits wrongly, needs to send two separate notifiers

Decided to remove ND_RENDER_OPTIONS rather than adding properties editor scene context refresh for it, this is more than a render option change.
2016-09-28 00:53:59 +02:00
83d5a919e2 modernize basic shader a tiny bit
"varying" is redundant here, all GS inputs & outputs vary.

Any code that uses this will be GLSL 1.3 or newer.
2016-09-27 21:25:38 +02:00
0ca2118851 safety checks in GPU shader library
If shader compilation fails, or for some other reason the shader is NULL or 0, we need to know.
2016-09-27 21:25:38 +02:00
ad32b774cb fix basic shader syntax when drawing lines
Fixed on GL 3.2+, Mac still lays an egg due to the geometry shader.
2016-09-27 21:05:48 +02:00
13a4147c17 Dynamic Paint: Don't store duplicate adjacency links.
Duplicates can happen at UV seams in case of resolution mismatch
or other complications. It's better not to store them in case it
confuses some math later on.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D2261
2016-09-27 21:54:54 +03:00
9a66d0ad1b Dynamic Paint: Fix adjacency computations at UV seams.
1. When adding one pixel border to UV islands prefer grid directions.
   This is more logical as it means neighbor pixels will commonly
   share a border, opposed to just corners.
2. Don't subtract 0.5 when converting float UVs to int in computing
   adjacency across a UV seam. Pixels cover a square with corners
   at int positions and adding/subtracting 0.5 is only for dealing
   with the center point of a pixel.
3. Use the neighbour_pixel field from the correct pixel, and check
   it's not back to the origin point.
4. In the connected UV case, ensure that the returned index actually
   refers to a valid active pixel.

This fixes paint spread not traversing some UV seams, while at the
same time spreading to random unrelated points on other seams.
The first problem is primarily fixed by 2, while the second one
is addressed by item 4.

Differential Revision: https://developer.blender.org/D2261
2016-09-27 21:54:54 +03:00
bde5eb8b63 [Windows/MSVC] Blosc doesn't require debug libraries. 2016-09-27 10:24:09 -06:00
dd0de53d29 Fix T49466: Stupid typo in logicbricks new copy code from rB776a8548f03a
Moved that code forth and back a few times while creating rB776a8548f03a fix,
ended up forgetting to update it correctly for function where it layed down in the end.

Last-minute fixes are never a good thing... Now we already have real reason for 2.78 'a' release :(
2016-09-27 17:55:12 +02:00
b63e9a96df Fix T49423: Data Preview of group containing only group instances is empty.
Code was not getting correct boundbox in some cases (group only instancing other groups e.g.), now
compute our own bbox in those cases.

Based on patch by @lichtwerk, but extended the fix to include linked datablocks in some cases
(linked objects in local groups, linked objects in local scene, etc.), this was also broken in existing code.

Reviewers: mont29

Subscribers: duarteframos

Differential Revision: https://developer.blender.org/D2257
2016-09-27 17:03:03 +02:00
5d0de39238 fix Mac build for Xcode < 8
We need a long-term fix, but this will get 2.78 out the door.
2016-09-27 16:16:47 +02:00
2ebb367b0f cleanup: spacing & alignment 2016-09-27 14:56:58 +02:00
54ed22c843 Fix T49461: Dynamic paint wetmap flickers.
Regression from rBa4a968f, we would adjust current point's wetness without actually protecting it
in new multi-threaded context, leading to concurrent access mess.

Now delay applying wetness reduction to current point to end of function, allows us to avoid having
to lock current point twice together with neighbor one (and reducing spinlock awainting too).

To be backported to 2.78a.
2016-09-27 13:58:01 +02:00
e6dda514ba Fix T49464: Data Transfer modifier slows down redraw of window.
Never call function that might recompute a DM in an RNA itemf callback (or any UI-related func in general)!
There was an XXX comment asking if this was OK - well, no, it was not. :P

Could be ported back to some 2.78 flavour should we need it.
2016-09-27 12:03:18 +02:00
Julian Eisel
88aa42a6f7 Fix most toolbar panels not visible
Was likely in here since initial blender2.8 branch commit (particle removal).
2016-09-27 03:38:24 +02:00
Dalai Felinto
fc485302cc immediate mode: using texture shader for stereo drawing
(for side-by-side and top-bottom stereo modes)
2016-09-26 15:38:24 +00:00
8cff9c20ff Merge branch 'master' into blender2.8
WARNING! Full build is broken, alembic has not been merged in correctly and has some references to particle stuff.
Don't have time to tackle this now (and probably would be better if someone knowing what he's doing does it anyway).

Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/blenkernel/intern/library_remap.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/editors/physics/particle_object.c
	source/blender/editors/physics/physics_intern.h
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_view3d/drawvolume.c
	source/blender/makesrna/intern/rna_smoke.c
2016-09-26 17:19:03 +02:00
7f76f6f249 Fix export image generated by export UV layout
Was only happening with new dependency graph.

The issue here is that scene's depsgraph layers will be 0 unless
it was ever visible. Worked around by checking for 0 layer in the
update_tagged of new depsgraph. This currently kind of following
logic of visible_layers, but is weak.

Committing so studio is unlocked here, will re-evaluate this layer.
2016-09-26 16:46:08 +02:00
b23ffded08 Fix Scene datablocks being created with a real user while never having any real datablock user.
Now using new system dedicated to that kind of cases, id_ensure_real_user(), instead.
That way, usercount of Scenes is handled correctly at deletion time.

Reported by @sergey over IRC, thanks.
2016-09-26 16:37:17 +02:00
Dalai Felinto
eab3e0af1c Cleanup: stereo windowmanager code
This will make the changes in blender2.8 branch simpler
2016-09-26 13:56:45 +00:00
7c53260109 Fix crash in own recent rB776a8548f03a049.
New ID may be null, have to check this too!

Reported by @panzergame over IRC, thanks.

To be ported to 2.78 as well.
2016-09-26 09:49:34 +02:00
07de832e22 Cycles: Use correct light sampling PDF for MIS calculation with Branched Path Tracing
The light sampling functions calculate light sampling PDF for the case that the light has been randomly selected out of all lights.
However, since BPT handles lamps and meshlights separately, this isn't the case. So, to avoid a wrong result, the code just included the 0.5 factor in the throughput.

In theory, however, the correction should be made to the sampling probability, which needs to be doubled. Now, for the regular calculation, that's no real difference since the throughput is divided by the pdf.
However, it does matter for the MIS calculation - it's unbiased both ways, but including the factor in the PDF instead of the throughput should give slightly better results.

Reviewers: sergey, brecht, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2258
2016-09-25 23:16:05 +02:00
18b0738303 Cleanup: remove unused function. 2016-09-25 22:11:38 +02:00
04230e80d1 Alembic: only interpolate vertices when their number don't differ
between samples.

This could cause some crashes.
2016-09-25 22:11:37 +02:00
0b89b31a18 Cycles: Fix T49411: Multiscatter GGX with zero roughness when Filter Glossy is enabled 2016-09-25 22:09:38 +02:00
448ee227be Volume slice settings: tweak/fix UI enabling conditions.
It was still possible to have some properties enabled when it does not
make sense to have them so.
2016-09-25 21:55:29 +02:00
584288a97c Smoke debug draw: take adaptive domain position into account.
Eventually the various functions that deals with adaptive domain
bounding box shall de-duplicated.
2016-09-25 21:45:09 +02:00
628ef78e8a overhaul gpuMatrix API
Complete (for our needs) 2D & 3D transformation API. Should be easy to port legacy OpenGL matrix stack-based code to this. Still needs testing.

Ported ortho, frustum, lookAt functions from Viewport FX (rB194998766c65). Kept plenty of Viewport FX code from previous commit.

Stack API and 2D routines ported from Gawain. This version uses BLI_math library so everything is licensed under GPL instead of the usual MPL.

Part of T49450
2016-09-25 19:29:45 +02:00
a731c75442 port math function from Viewport FX
mul_v4_m4v3(r, M, v) means r = M * vec4(v, 1.0)
Based on rB194998766c65
2016-09-25 19:01:18 +02:00
9bea012b8c specialize mat3 multiply routines
Same as 5c6baf1ee9 but for 3x3 matrices.
2016-09-25 18:48:11 +02:00
ae69986b70 Viewport smoke: fix a couple of issues in the new display settings.
- WITH_SMOKE macro was not defined so some code was not compiled, though
it was still accessible from the UI
- some UI elements were disappearing due to bad indentation, also rework
the UI code to not hide but rather disable/grey out button in the UI
- Display thickness was not used due to bad manual merge of the code
from the patch.
2016-09-25 17:02:46 +02:00
5c6baf1ee9 specialize mat4 multiply routines
mul_m4_m4m4(R, A, B) gives us R = AB in general. Existing code assumed the worst, that A and B both alias the output R. For safety it makes internal copies of A and B before calculating & writing R.

This is the least common case. Usually all 3 matrices differ. Often we see M = AM or M = MB, but never M = MM.

With this revision mul_m4_m4m4 is called in exactly the same way but copies inputs only when needed. If you know the inputs are independent of the output use the "uniq" variant to skip the saftety checks.
2016-09-25 14:27:48 +02:00
335ee5ce5a Fix T49310: incorrect Cycles standalone normals with negative scale. 2016-09-25 05:23:52 +02:00
6dd87f2abb Curve Fitting: re-fitting heap pre-allocated too much 2016-09-25 12:19:43 +10:00
6b5ad4a4d7 Curve Fitting: 'offset' method used sign when it shouldn't 2016-09-25 12:19:42 +10:00
05dbd65098 Curve Fitting: inline dot-product (avoid temp vector) 2016-09-25 12:19:42 +10:00
d9b242f5fb Curve Fitting: de-duplicate cubic evaluation 2016-09-25 12:19:42 +10:00
5bdff9ea80 Quiet shadow warning
No need to declare new iterator for second loop.
2016-09-25 12:19:38 +10:00
d35bf3f421 Fix compile error when building without smoke support.
Also fixes possible NULL pointer dereference.

Fixes T49445.
2016-09-25 00:26:21 +02:00
14e825aa1f Viewport smoke: add options to draw velocity vectors.
This basically exposes to the UI a function that was only available
through a debug macro ; the purpose is obviously to help debugging
simulations. It adds ways to draw the vectors either as colored needles
or as arrows showing the direction of the vectors. The colors are based
on the magnitude of the underlying vectors.

Reviewers: plasmasolutions, gottfried

Differential Revision: https://developer.blender.org/D1733
2016-09-24 22:36:54 +02:00
4446acbf17 Viewport smoke: add support for axis aligned slicing.
Current approach uses view aligned slicing to generate polygons for GL
texturing such that the generated polygons are always facing the view
plane. Now it is also possible to use object aligned slicing, which
creates polygons by slicing the object perpendicular to whichever axis
is facing the most the view plane. It is also possible to create a
single slice for inspecting the volume, or for 2D rendering effects.

Settings for this, along with a density multiplier setting, are to be
found in a newly added "Smoke Display Settings" panel in the smoke
domain properties tab.

Reviewers: plasmasolutions, gottfried

Differential Revision: https://developer.blender.org/D1733
2016-09-24 22:21:02 +02:00
Peter Lu
a070a5befa Mesh: added default UVs for Monkey, improved UVs for UV Sphere and Icosphere.
Fixes T47488 and T47478.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2224
2016-09-24 16:39:23 +02:00
addc666999 constify BLI_math_matrix inputs
GPU_matrix needs this very soon, and it's good practice in general.

also sprinkled in some TODOs for later
2016-09-24 16:21:38 +02:00
bf2c2d43ef Fix T49441: Grease Pencil - pie menu - brush name field crashes blender
Using context.active_gpencil_brush to access the active Grease Pencil brush
would result in a crash if trying to rename the brush, because the "ID" pointer
was not set.

To be backported to 2.78
2016-09-24 12:50:37 +12:00
36d0ea3123 Collada: Trying to get rid of some warning messages on linux 2016-09-24 01:47:55 +02:00
7a259d8422 Collada: Trying to get rif of some warning messages on linux 2016-09-24 01:27:37 +02:00
4b891b40c2 Fix: Collada Importer did not import the Blender Profile information correctly when multiple objects are bound to same armature. This caused Bone tails to be placed wrong. 2016-09-24 01:06:32 +02:00
25b61662f5 Quiet warning. 2016-09-23 19:45:33 +02:00
c3b754f9bd Alembic: only export face sets when required by the user.
Also remove deprecated face set code.
2016-09-23 19:45:33 +02:00
36bbdf142c OpenGL: fix new shader for Mac
Follow-up to rB4a1feaa5558ed60388fd3be41db74fbc54f2ab08
2016-09-23 18:16:45 +02:00
7fc2e333bb small merge fix
Follow-up to rB1dfb89d22930
2016-09-23 18:12:24 +02:00
4e3578f470 Cycles: Prevent crash in special cases when object has less slots than mesh
This is something what was guaranteed in give_current_material(), just
copied some range checking logic from there.

Not sure what would be a proper fix here tho.
2016-09-23 15:57:39 +02:00
06b51c64ad Particles: Prevent crash when copying to an object with subsurf modifier
Probably something will be remapped wrongly, but better than crash.
2016-09-23 15:39:33 +02:00
1925b9b2fa Particle: Add option to duplicate settings together with particle system itself
This way it's possible to copy combed hair, use it as a basis for another
particle system to do some awesome artistic stuff.
2016-09-23 15:33:07 +02:00
c61cb0e076 Particle: Prevent crash duplicating hair on objects with modifiers 2016-09-23 14:51:42 +02:00
1e89a261b2 Outliner: Fix assert failure with palette ID 2016-09-23 14:49:55 +02:00
1d03bc73ce Particles: Add operator to quicly duplicate active particle system to the same object 2016-09-23 14:32:36 +02:00
776a8548f0 Fix T49430: append scene with gamelogic broken.
In fact, it was the whole remapping process that was broken in logic bricks area,
due to terrible design of links between those bricks...

Object copying was also broken in that case, fixed as well.

To be backported to 2.78.

Note that issue was actually probably there since ages, hidden behind dirty hacks
used in previous append code (though likely visible in some corner cases).

Listen kids: do not, never, ever, do what has been done for links between logic bricks. Never. Ever.
Even as pure runtime data it would have been bad, but as stored data...
2016-09-23 14:25:15 +02:00
2372e67dd6 Cycles: Don't sum up memory usage of all devices together for the stats 2016-09-23 12:43:23 +02:00
Julian Eisel
1dfb89d229 Merge branch 'master' into blender2.8
Conflicts:
	intern/ghost/intern/GHOST_ContextCGL.mm
	intern/ghost/intern/GHOST_WindowCocoa.mm
	source/blender/makesrna/intern/rna_main.c
2016-09-23 01:40:19 +02:00
1b2b7cfa20 Cycles: Fix overflow caused by wrong size calculation in Mesh::add_undisplaced 2016-09-22 17:44:22 -04:00
Julian Eisel
56498757ce Clip Editor: Enable Continuous Grab for view panning 2016-09-22 22:50:59 +02:00
d84c55f0fa Fix T49417: Cycles crash - can't use 5 Gigabyte Tile EXR texture file
Was an integer overflow issue when calculating offsets.
2016-09-22 17:30:31 +02:00
4e031073df Fix T49427: Drivers of Shapekeys break when Append a group.
Optimization attempt with BKE_library_idtype_can_use_idtype() was not taking into account
the fact that drivers may link virtually against any datablock...

Has to be rethinked, but for after 2.78 release, this commit is safe to backport.
2016-09-22 16:12:43 +02:00
Dalai Felinto
4a1feaa555 immediate mode: Triple Buffer and two new shaders for TEXTURE_2D and TEXTURE_RECT
Use the same vertex shader for both fragment shaders
2016-09-22 13:40:33 +00:00
9937f28877 Buildinfo: Improve behavior with detached HEAD
Try real hard to detect which branch we've detached from.
2016-09-22 15:01:01 +02:00
ab09a80d33 Fix T49425: Freestyle in viewport keeps updating over and over.
Regression caused by rBb27ba26, we would always tag datablocks to update in G.main,
ignoring given bmain, now always use this one instead.

To be backported to 2.78.
2016-09-22 14:57:16 +02:00
1d469f3780 OpenGL: remove double precision matrix functions
Proper fp64 is a GL 4.x feature. Pretending to support it in our API is just clutter.
2016-09-22 12:19:24 +02:00
0e7c3dfe75 OpenGL: matrix code from viewport-fx
Bringing over whole files from rB194998766c65
2016-09-22 12:11:40 +02:00
f915ee8e76 CMake: Fix copy-paste error 2016-09-22 11:01:37 +02:00
c77da24116 Fix non-finite normalization factor in certain cases 2016-09-22 10:04:51 +02:00
ca1c7a0cf7 Fix T49422: Metadata not showing in OpenGL renders
Own regression since recent optimization.
2016-09-22 09:42:09 +02:00
Julian Eisel
6f80604509 RNA/UI: Allow displaying in tooltip why RNA property isn't editable
This commit allows RNA properties to return additional info on their editable state which may then be displayed in tooltips. To show how it works, it also adds some info for the editable check of proxies. For generally un-editable properties or properties of a linked data-block, RNA returns default strings.

| {F362785} | {F362786} | {F362787} |

Reviewed by brecht, thanks!

Differential Revision: https://developer.blender.org/D2243
2016-09-22 00:10:53 +02:00
9493e3b2d6 UI: Theme options for vertex/edge bevel weight colors
Drawing used colors for select (TH_EDGE_SELECT/TH_VERTEX_SELECT) which was inconsistent with crease, seam, sharp, .. (which all had their own them color -- also was a bit hard to read).

NOTE: UI team usually doesn't allow adding more theme options, this is an exception.

Differential Revision: https://developer.blender.org/D2234
2016-09-21 23:16:38 +02:00
Julian Eisel
e9bcdcdbbd UI: Make eyedropper shortcut configurable
It's now possible to change the shortcut for invoking the eyedropper while hovering a button (E by default). Also removed the keymap editor entry for the modal eyedropper keymap, it's now automatically appended to the eyedropper shortcut.
2016-09-21 22:20:24 +02:00
825150605e GPU_basic_shader uses GLSL by default
switch back to old mode at runtime:
blender --enable-legacy-basic-shader
2016-09-21 20:24:02 +02:00
Julian Eisel
f6c09eadf0 UI: Make button driver and keying set shortcuts configurable 2016-09-21 20:09:37 +02:00
a3d258bfb4 fix for potential pitfall with glMatrixMode
close D696 by @jwilkins

The matrix mode should always be left in modelview mode, since a lot of code assumes it is before setting a matrix.
2016-09-21 17:41:59 +02:00
Julian Eisel
e8d953000a UI: Configurable shortcuts for keyframe operators
Adds support for editing the shortcuts for inserting (I), deleting (Alt+I) and clearing (Alt+Shift+I) button keyframes.
2016-09-21 17:06:52 +02:00
9047717b3f Gawain: support triangle strips & fans in immediate mode
fixes crash in Vertex Paint (color picker)
2016-09-21 15:47:08 +02:00
a7e7479122 FFmpeg interface improvements
This patch changes a couple of things in the video output encoding.

{F362527}

- Clearer separation between container and codec. No more "format", as this is
  too ambiguous. As a result, codecs were removed from the container list.
- Added FFmpeg speed presets, so the user can choosen from the range "Very
  slow" to "Ultra fast". By default no preset is used.
- Added Constant Rate Factor (CRF) mode, which allows changing the bit-rate
  depending on the desired quality and the input. This generally produces the
  best quality videos, at the expense of not knowing the exact bit-rate and
  file size.
- Added optional maximum of non-B-frames between B-frames (`max_b_frames`).
- Presets were adjusted for these changes, and new presets added. One of the
  new presets is [recommended](https://trac.ffmpeg.org/wiki/Encode/VFX#H.264)
  for reviewing videos, as it allows players to scrub through it easily. Might
  be nice in weeklies. This preset also requires control over the
  `max_b_frames` setting.

GUI-only changes:
- Renamed "MPEG" in the output file format menu with "FFmpeg", as this is more
  accurate. After all, FFmpeg is used when this option is chosen, which can
  also output non-MPEG files.
- Certain parts of the GUI are disabled when not in use:
    - bit rate options are not used when a constant rate factor is given.
    - audio bitrate & volume are not used when no audio is exported.

Note that I did not touch `BKE_ffmpeg_preset_set()`. There are currently two
preset systems for FFmpeg (`BKE_ffmpeg_preset_set()` and the Python preset
system). Before we do more work on `BKE_ffmpeg_preset_set()`, I think it's a
good idea to determine whether we want to keep it at all.

After this patch has been accepted, I'd be happy to go through the code and
remove any then-obsolete bits, such as the handling of "XVID" as a container
format.

Reviewers: sergey, mont29, brecht

Subscribers: mpan3, Blendify, brecht, fsiddi

Tags: #bf_blender

Differential Revision: https://developer.blender.org/D2242
2016-09-21 15:03:11 +02:00
Julian Eisel
2476faebd7 Fix crash in space context cycling when leaving window bounds 2016-09-21 14:53:42 +02:00
Julian Eisel
bb6af17799 Make space context cycling a proper screen-level OP
This is really more of a screen level operation, UI-level is more like button handling etc.
2016-09-21 14:53:42 +02:00
Julian Eisel
d10f54ee75 UI: Support UI operators with configurable shortcuts
After all a super simple solution that allows us to get rid of hardcoded keymap items.
2016-09-21 14:53:42 +02:00
622c9ced6c Cycles: Cleanup, whitespace 2016-09-21 14:42:05 +02:00
Dalai Felinto
8ced4417f9 Fix T49393: Baking ignores backfaces
For some reason (which I can't recall), backing was doing backface
culling. Since Cycles itself doesn't ignore them (nor does Blender
Internal), they should be visible.
2016-09-21 10:39:54 +00:00
166286e6de Cycles: Make code more uniform across two versions of shadow_blocked()
Just to make it easier to research ways of possible code de-duplication.
2016-09-21 11:50:11 +02:00
e4f7bf6ccb Cycles: Remove out of date comment 2016-09-21 11:48:36 +02:00
586c58902d Fix: Grease Pencil sculpting crashes when sculpting on layers without any strokes
Reported by @loochmunz. I've also gone through checking for and fixing other places
where this was also occurring.


To be included in 2.78
2016-09-21 17:03:45 +12:00
0b9cfbf6a8 GPencil D+W Pie: Don't show editing operators when not in editmode
These operators only operate on the selected strokes, but when not in editmode,
stroke vertices are not shown.

Safe for 2.78
2016-09-21 17:03:44 +12:00
Julian Eisel
c5326958a5 UI: Fix crash using drag-toggle over window bounds with button callback
Steps to reproduce:
* Go to modifier context in properties editor
* Add modifier, collapse it
* Press down LMB over collapse button of modifier, hold it
* Drag over pin-icon in properties editor (to keep fixed data-block displayed)
* Drag outside of window bounds (should crash)

Also could've solved by getting space data from callback arguments instead of context, but this fix is much nicer (though not totally un-risky).
2016-09-21 00:44:14 +02:00
0f759da370 Gawain: batch drawing works
Forgot to tell OpenGL which shader program the batch is using. Now it works!
2016-09-20 18:03:59 +02:00
2382d1c401 regression fix for 1346482d23: The length of leaf bones should always be set to the length of the smallest bone. since the mentioned commit the importer did only recalculate the leaf bone length when the 'fix leaf bones' option was also enabled. 2016-09-20 17:33:17 +02:00
a5f14ad1a2 Cycles: Make regular bvh traversal functions close to each other 2016-09-20 16:58:39 +02:00
a6db95cd42 Cycles: Re-group ifdef so we check for particular feature only once 2016-09-20 16:58:39 +02:00
Dalai Felinto
284398e517 immediate mode refactor: walk navigation cross 2016-09-20 14:50:24 +00:00
Dalai Felinto
04bc828fb6 gawain update: immAttribute for 2i 2016-09-20 14:50:20 +00:00
Dalai Felinto
6ebf5c18c3 immediate mode refactor: fly navigation square 2016-09-20 14:47:14 +00:00
d3365c5c72 OpenGL: fix GPU_SHADER_TEXT on non-Mac
Developed on Mac and committed quickly.. oops
2016-09-20 16:13:01 +02:00
Julian Eisel
42ad5952ff Quiet warning with -Wformat-signedness
Is actually a redundant cast since Blender uses -funsigned-char, however I think it's fine to be explicit about it in new code so cast is required to make compiler happy. Am not a fan of -funsigned-char anyway...
2016-09-20 14:23:15 +02:00
f3b94a54bc Alembic: add support to interpolate transform matrices in-between
frames.
2016-09-20 14:17:05 +02:00
386da0cc77 Cycles: Avoid conversion from bool to uint 2016-09-20 13:00:36 +02:00
Dmitry Dygalo
87c08fa681 Small speedup for blend_render_info.py
Do not close and re-open the file in case it's compressed, gzip module can now directly take a file object as parameter.

Differential Revision: https://developer.blender.org/D2235
2016-09-20 12:38:54 +02:00
075a2175d5 Fix T49391: Texture paint is not aware of disabled color management
There might be some extra missing points here, but it's all rather
a TODO than a real bug and can be tweaked further once issues are
actually discovered.
2016-09-20 12:22:50 +02:00
f64aa4e0af Fix T49343: ImageFormatSettings were not setting their rna struct path correctly
Reviewers: brecht, mont29

Reviewed By: brecht, mont29

Subscribers: brecht, sergey

Differential Revision: https://developer.blender.org/D2228
2016-09-20 12:14:53 +02:00
78c0bc52de Fix T49408: OpenGL light widget breaks viewport shading 2016-09-20 11:56:37 +02:00
f2da63cb12 Fix T49386: Blender crashes when told to load an OCIO LUT that does not exist 2016-09-20 10:48:25 +02:00
e12f5b699d OpenGL: software renderer for old Mac GPUs
We raised the minimum to GL 2.1 in Blender 2.77, and dropped support for older GPUs (pre-2012 Intel mostly). On Windows you get a popup message, but on Mac we simply crashed. Every Mac has a builtin software renderer for GL 2.1 so let's use that when the GPU is not capable!

Run blender --debug-gpu to see version detection & software fallback.
2016-09-19 20:27:12 +02:00
Julian Eisel
16ed49b26e UI Messages: Consistent spelling of term "data-block"
Was using a bunch of different spellings, mostly "data-block" though, so went with that one (would have been my #1 choice anyway ;) )
2016-09-19 16:50:45 +02:00
7d63ea4a1c Buildbot: Another attempt to have OSX builder fixed 2016-09-19 16:45:08 +02:00
12680d36f5 Buildbot: Temporary disable CUBIN compilation 2016-09-19 16:24:55 +02:00
838e0a09c7 Buildbot: Attempt to use proper Clang for CUDA binaries 2016-09-19 16:11:19 +02:00
100b2ad775 Cycles: Cleanup code style in split kernel 2016-09-19 16:05:12 +02:00
1f5cd85976 Fix T49375: align rotation with snap target isn't toggleable in edit mode.
Based on D2237, but fixed patch always hiding 'snap on self' button...

Should be safe for 2.78.
2016-09-19 15:51:05 +02:00
5c6a14f4e5 Cycles: More tweaks to make specialized BVH traversal matching 2016-09-19 15:29:37 +02:00
7901f62a9d Cycles: Avoid redundant intersection pre-calculation 2016-09-19 15:18:27 +02:00
6ba59660fb Cycles: Cleanup, sync some comments across different traversal 2016-09-19 15:18:27 +02:00
85f48216ed Cycles: Cleanup, always use parenthesis
Makes it simpler to compare different traversal algorithms.
2016-09-19 15:18:27 +02:00
Martijn Berger
cc9d0eff81 Lowercase includes for psapi.h and dbghelp.h windows includes.
This makes cross compilation a little less painful
2016-09-19 14:22:38 +02:00
25ee094226 Fix T49385: Copy buffer is not from pose mode. Report Error
Quick fix for now, need to unlock studio here as well.

Proper fix would be to modify API a bit and pass flags which will
prevent expand called on bmain perhaps. But this we should discuss
a bit,
2016-09-19 14:17:05 +02:00
2980c6ebae Cycles: Move BVH constants to an own files, so they are easily re-usable 2016-09-19 13:00:41 +02:00
b19c6f8f43 Remove null-check of argument which is attributed as non-null
This was logically incorrect and was causing warning and compilation
errors with strict compiler flags.
2016-09-19 10:18:10 +02:00
722226b610 CacheFile: make sure SpinLock is destroyed when exiting Blender.
Missed in rB62b1cdd6.
2016-09-19 09:02:41 +02:00
772dab9df1 Cycles: Fix typo that would sometimes result in subsurf modifier being disabled 2016-09-18 22:14:15 -04:00
Julian Eisel
c2d7d4764e Various cleanups related to button locking
* Rename uiBut.lockstr to disabled_info
* Remove unreachable code
* Replace duplicated check with assert
* Replace overly ambitious check with assert
* Add comments
2016-09-19 02:41:10 +02:00
Julian Eisel
976e591e93 Cleanup: Completely replace/remove uiBut.lock
Old leftover from pre 2.5 days. Now handled through UI_BUT_DISABLED button flag.
2016-09-19 01:49:17 +02:00
Julian Eisel
404a427dfd Minor corrections for previous commit
Was using wrong argument name in doxygen comment. Also reduced scope of vars.

Sorry for the noise :/
2016-09-18 21:54:24 +02:00
Julian Eisel
572bc1364c BLI_listbase: Add/use utility to move link (BLI_listbase_link_move)
We were calling BLI_remlink and then BLI_insertlinkbefore/after quite often. BLI_listbase_link_move simplifies code a bit and makes it easier to follow. It also returns if link position has changed which can be used to avoid unnecessary updates.

Added it to a number of list reorder operators for now and made use of return value. Behavior shouldn't be changed.

Also some minor cleanup.
2016-09-18 21:44:42 +02:00
6c28d3bac2 Fix T49245: Adaptive Subdivision with Auto Smooth causes weird mesh appearance 2016-09-18 13:22:54 -04:00
Julian Eisel
c0aabeede8 GPencil: Don't show error popup when strokes can't be reordered further
Was spawning error popup each time user tried to move a stroke higher or lower than the list allowed. We don't do that anywhere else and it's not really useful info for the user. So rather not bother her.
2016-09-18 19:08:20 +02:00
940f360479 Cycles: Fix update of subdivision meshes when global dice rates change
When subdivision settings were moved from meshes to objects this was missed,
should work fine now.
2016-09-18 12:44:43 -04:00
799454821e Cycles: Soft minimum for dice rates
Use 0.5 as a soft minimum for dice rates to help from setting them too
low. Lower values can still be set by typing in the value.
2016-09-18 12:44:43 -04:00
8f28441487 Cycles: Adaptive isolation
Idea here is to select the lowest isolation level that wont compromise quality.
By using the lowest level we save memory and processing time. This will also
help avoid precision issues that have been showing up from using the highest
level (T49179, T49257).

This is a pretty simple heuristic that gives ok results. There's more we could
do here, such as filtering for vertices/edges adjacent geometric features that
need isolation instead of checking them all, but the logic there could get a
bit involved.

There's potential for slight popping of edges during animation if the dice
rate is low, but I don't think this should be a problem since low dice rates
really shouldn't be used in animation anyways.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D2240
2016-09-18 12:44:43 -04:00
Julian Eisel
63b90851ce GPencil: Fix memory leak using stroke arrange OP 2016-09-18 17:25:12 +02:00
0552d5820b Fix T49384: crash in tangent space calculation with NaN mesh vertices. 2016-09-18 13:38:20 +02:00
40247ee491 [Windows/make.bat] Clean only after all parameters have been processed so the full path is known, and require a convenience target to be set. Also added a helpful error message if any of the required data is not available. 2016-09-17 09:19:54 -06:00
34bd89a9f6 OpenGL: draw_view_axis with new immediate mode
Changed drawing to use smooth lines, and to fade away when axis points toward / away from screen. (transform manipulators do this already)

Also fixed a nearby (but unrelated) missing immUnbindProgram.

Part of T49043
2016-09-17 15:52:32 +02:00
e21853abb9 OpenGL: streamline font rendering
Ignore texture matrix in the shader, stop messing with texture matrix in BLF code.

Use linear screen-space interpolation instead of perspective.

Avoid redundant call to glMatrixMode.
2016-09-17 13:54:30 +02:00
1b1275f0db add GPU_SHADER_TEXT for font rendering
With USE_GLSL enabled, GPU_basic_shader(TEXTURE|COLOR) always rendered black. New shader uses a solid color + alpha channel of texture (which in our case is a font glyph). See fragment shader for details.

I prefer this approah -- multiple shaders that each do one thing well (and are easy to read/write/understand), instead of one shader that can do many things given the right options.
2016-09-17 13:33:48 +02:00
c3034afa58 OpenGL: simplify basic_shader_bind
No need to enable/disable texturing with GLSL, just use textures in the fragment shader.
2016-09-17 13:33:48 +02:00
09925d52f5 Fix T49383: Color pickers are available if the color is locked
If the color is locked, the row is disabled, but the picker is still
available.

This error was present in older versions for layer color.
2016-09-17 09:02:03 +02:00
cade262c47 OpenGL render: Bugfix (unreported) after rB6f92604e539b2114763150fb1ace60d28e59a889
Crashes occured immediately when clicking on "OpenGL render image" because there was only a task pool created previously when it was an animation. Solved it by introducing a variable is_animation to the openglrender and omitting the task_pool call when it's no animation.

@sergey: Please check my changes, moved the pool_ok and the lock into the is_animation clause.
2016-09-17 00:21:34 +02:00
c9c933ac81 Pose Library pose list: Default to 5 rows to match the new up/down buttons
The buttons now nicely align with the pose list itself.
2016-09-16 18:21:25 +02:00
634508ca3f Buildbot: Disable QuickTime for the time being
Buildbot machine was updated to the new SDK which seems to have
QTKit removed.

For until we've installed older SDK or ported our code to a new
AVFramework disabling QuickTime.
2016-09-16 17:51:01 +02:00
716e712a83 Pose library sorting: return OPERATOR_CANCELLED when no-op
A no-op happens when trying to move the top pose further up, or the
bottom pose further down.
2016-09-16 17:33:34 +02:00
834cb93f40 Blender 2.8: Fix some strict aspects on Linux 2016-09-16 17:18:19 +02:00
d96b8e168f Merge branch 'master' into blender2.8 2016-09-16 17:09:28 +02:00
Julian Eisel
2aca1d85e6 Improve description of move operator direction properties
These may be exposed in UI (keymap editor & redo panel), so better avoid using identifiers like "UP" "DOWN". They are redundant anyway (already displayed).
2016-09-16 17:03:44 +02:00
Julian Eisel
4b39069908 Fix jumping view when expanding graph editor channel over view bounds
Didn't change versioning_250.c entries, flags will be overridden anyway.
2016-09-16 16:41:36 +02:00
Julian Eisel
df3394a386 Fix vertical scrollbar adding to region width in graph editor
Had to calculate draw region width based on region size excluding scrollbars.
2016-09-16 16:21:51 +02:00
9883899d62 Remove debug only code
Thanks Severin for spotting it!
2016-09-16 16:11:38 +02:00
9a7891da90 Tweak for pinned/always visible curves in Graph Editor
Allow such kind of pin for armature bones.
2016-09-16 16:01:38 +02:00
19268fbad3 Added buttons to move a pose in a pose library up/down.
This will break the pose library preview add-on, since that add-on uses
file indices rather than pose names.
2016-09-16 15:11:45 +02:00
Julian Eisel
661a316c72 Picky correction to previous commit
A bit nicer to do empty-string check for operator poll message as well.
2016-09-16 15:09:21 +02:00
Julian Eisel
1df115d9a3 UI: Allow showing why button is disabled in tooltip
Uses red alert color. Operators that failed poll check already did this.
2016-09-16 15:05:27 +02:00
f3058c1b66 OpenSubdiv: Remove redundant section define from shader compilation 2016-09-16 12:28:35 +02:00
a27b54f6e2 OpenSubdiv: Split shader source files
Was a bit annoying to do tweaks in a file which contained all
vertex, geometry and fragment shaders.
2016-09-16 12:28:35 +02:00
98af402357 GPencil: Remove toggle option for pop-up specials menu
According UI rules, no toggle options in pop-ups menus, so remove it.
2016-09-16 11:58:10 +02:00
b06584dbf8 Fix T49349: Baking action doesnt bake multiple objects.
Tooltip was wrong here, it can only bake a single (active) object, 'only selected' option
is for pose bones only...
2016-09-16 11:50:49 +02:00
b2f1b8ab7a GPencil: Add a new special menu for editing and replace subdivision shortcut
Replace the W shortcut for subdivision by a new menu for edit specials
in order to keep consistency in UI.

Subdivision is not used all the time, so it's better assign this
shortcut to menu.
2016-09-16 11:49:29 +02:00
4b046c530d Fix T49372: Fresnel node: difference between 2.76 and 2.78 GLSL output 2016-09-16 11:48:42 +02:00
ac7ff55f11 GPencil: New subdivide stroke operator
In some situations the artist needs to subdivide a stroke created with
few points before, specially for sculpting.

The subdivision is done for any pair of continuous selected points in
the same stroke.

The operator can be activated in edit mode with W key and has a
parameter for number of cuts.
2016-09-16 10:32:39 +02:00
6f92604e53 OpenGL render: Move file writing to a separate thread
The idea is to have a dedicated thread which is responsive for all the
file writing to a separate thread, so slow disk will not slow down
OpenGL itself.

Gives really nice speedup around 1.5x when exporting barber shop layout
file to h264 video.
2016-09-16 10:31:37 +02:00
04bfea0d67 Fix T49369: Blender crashes/closes down application at alembic export of
any object

There were a couple of crashes caused by stupid typos in
rB631af9f930d2fd2c76751204ff22239aa95f761d and
rB78ea06fea4a74181c25254ed72d50d8a743b6954, as well as a shamefull lack
of 'testing before committing' which only affect exporting.

One crash was due to using RNA_boolean_get instead of RNA_enum_get, the
other one was a tricky case of order of deletion happening in the
destructors of AbcExporter and ArchiveWriter.

Should not affect RC or release.
2016-09-16 09:27:44 +02:00
76c99f361f Gawain improvements
Fixed compile error in debug build (thanks mont29)

Renamed some functions for consistency.

New features:

Create a Batch with immediate mode! Just use immBeginBatch instead of immBegin. You can keep the result and draw it as many times as you like. This partially replaces the need for display lists.

Copy a VertexFormat, and create a VertexBuffer using an existing format.

Resize a VertexBuffer to a different number of vertices. (can only resize BEFORE using it to draw)
2016-09-15 21:45:10 +02:00
5eddb80513 Extend Gawain to use Blender's built-in shaders
Was already done for immediate mode, but rearranged code to make a clean separation. Cleaned up #includes for code that uses this feature.

Added same for batched rendering.
2016-09-15 18:41:28 +02:00
39f7a81176 Gawain: batch rendering API
Follow-up to rBddb1d5648dbd

API is nearly complete but untested.

1) create batch with vertex buffer & optional index buffer
2) choose shader program
3) draw!
2016-09-15 16:51:10 +02:00
e156abe467 Cleanup: Redundant forward declaration 2016-09-15 16:46:19 +02:00
04e2e4fdc1 Fix mistake in previous commit
Was copying things in other way around and was not performing
proper color space conversion.
2016-09-15 16:34:10 +02:00
2d81e88865 OpenGL render: Avoid byte-float-byte roundtrip
It was annoyingly slow to do roundtrip from byte OpenGL render to
float render result and back to byte image format (which is used
in 99% of cases for the OpenGL previews),

Now we use render result's rect32 to store render result which is
already supposed to be in the display space.

Gives about 30% speed improvement for OpenGL previews here.
2016-09-15 15:56:47 +02:00
6fb874369c OpenCOlorIO: Add explicit linearSRGB -> sRGB lookup table
Previously converting from linear space to SRGB was doing rather
slow inverted 1D lookup. Adding explicit inverse LUT gives 20%
speedup of OpenGL render.

Next question is: why do we even bother with sRGB conversion here,
OpenGL is already in the proper space so in theory we can avoid
quite some color space conversions. In any case, having this case
optimized in nice anyway.
2016-09-15 15:56:47 +02:00
1af547a223 OpenGL render: Add developer option to easily enable time information 2016-09-15 15:56:47 +02:00
42c17cb769 Bring blender_release.cmake uptodate with the changes from D2227 2016-09-15 06:34:57 -06:00
f339d5a8ce [windows] add some helpers to make.bat to facilitate making release builds.
New features:
1) Release target that checks for both cuda 7.5 and 8 with WITH_CYCLES_CUDA_BINARIES=ON and CYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 options set.
2) Option to switch between x86 and x64 builds, the default remains (auto detect the architecture) but can be overridden.
3) Option to switch between vs12(2013) and vs14(2015) default is 2013.

Reviewers: juicyfruit, sergey

Reviewed By: sergey

Tags: #platform:_windows

Differential Revision: https://developer.blender.org/D2180
2016-09-15 06:27:58 -06:00
0d54d32dd6 Gawain: simplify attrib binding API
This API is used internally by the immediate and batch drawing systems.
2016-09-15 12:57:07 +02:00
2fb5a959e9 Gawain: delete bind_attrib_locations
This function modifies the GL program object, which reduces our ability to share a shader among meshes with different vertex formats. Recommended approach is to use get_attrib_locations.
2016-09-15 12:24:06 +02:00
52181a26c6 Depsgraph: Avoid some false-positive time dependencies of scripted drivers
This was quite weak to consider all scripted expression to be time-dependent.
Current solution is somewhat better but still crappy. Not sure how can we make
it really nice.
2016-09-15 12:14:54 +02:00
ddbbcbbbba Fix filebrowser not getting back to valid dir in Release builds.
Stupid mistake wrapping path validation code inside a BLI_assert, which means it was
only called in Debug builds...

Found by Sergey, thanks.

Should be backported to 2.78.
2016-09-15 12:12:19 +02:00
a8ed9144a3 Fix crash in some cases when deleting particle systems.
Those 'never null' ID pointers are really a PITA to handle... luckily we don't have much of those around!

Found by Sybren, thanks.

Should be backported to 2.78.
2016-09-15 11:50:56 +02:00
a2a5ae5b54 Fix Py's IDs user mapping: do not consider ShapeKeys' from here.
This is internal pointer helper for scene evaluation and tools, though exposed to bpy API,
it can give false 'dependency cycles' in bpy.data.user_map() results.

That's followup to rBe007552442634 really, both should be backported to 2.78
2016-09-15 11:28:53 +02:00
21e9db9cf1 OpenGL render: Skip GP passes if viewport has GP visibility disabled 2016-09-15 11:23:11 +02:00
e007552442 Fix Py's IDs user mapping: do not consider proxy_from here.
This is internal pointer helper for scene evaluation and tools, it's not exposed to bpy API anyway,
and can give false 'dependency cycles' in bpy.data.user_map() results.

Found by sybren in his Splode work.
2016-09-15 10:16:54 +02:00
fe1342ab9b Use temp .blend file copybuffer for pose copy-paste
Uses similar way of storing temp data as object copy paste, just
uses different read entrypoint which does not modify current bmain.

This gives ability to easily copy-paste poses from one blender to
another one.

Hopefully doesn't introduce user-measurable differences.

Request from Peer here in the studio.

Reviewers: mont29

Reviewed By: mont29

Subscribers: hjalti, fsiddi

Differential Revision: https://developer.blender.org/D2229
2016-09-15 09:51:15 +02:00
ec54a08d30 Revert "Cycles: Tweak empty boundbox children"
This reverts commit ecbfa31caa.

Original commit broke logic in nodes re-fitting. That area can
access non-existing children momentarely. Not sure what would
be best solution here, for now simply reverting the change/
2016-09-15 09:39:33 +02:00
fe28e350e9 Fix T49179: Parts of mesh disappear with adaptive subdivision
Problem was zero length normal caused by a precision issue in patch evaluation.
This is somewhat of a quick fix, but is better than allowing possible NaNs to
occur and cause problems elsewhere.
2016-09-14 19:53:55 -04:00
b9d1852c5a Cycles: Deduplicate light pass code 2016-09-14 20:09:37 +02:00
b459d9f46c Cycles: Stop lamp sampling if the lamp isn't visible
Both spot and area light have large areas where they're not visible.
Therefore, this patch stops the light sampling code when one of these cases (outside of the spotlight cone or behind the area light) occurs, before the lamp shader is evaluated.
In the case of the area light, the solid angle sampling can also be skipped.

In a test scene with Sample All Lights and 18 Area lamps and 9 Spot lamps that all point away from the area that the camera sees, render time drops from 12sec to 5sec.

Reviewers: brecht, sergey, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2216
2016-09-14 19:45:12 +02:00
aae2cea28d Cycles: Also support the constant emission speedup for mesh lights
Reviewers: brecht, sergey, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2220
2016-09-14 18:53:35 +02:00
51e8c167f4 Fix T49352: Blender's file browser do not display previews.
Own stupid 'logical inversion' mistake in rBa2677100fef06af.
2016-09-14 17:26:42 +02:00
804f6bf31e fix Mac build with Xcode 8
Small issues in GHOST
- use NSApplicationDelegate protocol for our app delegate
- make sure NSApp is initialized before using
(cherry picked from commit df7be04ca6)
2016-09-14 16:35:01 +02:00
110d68ca1d Gawain: flesh out VertexBuffer
create, specify, fill with data
2016-09-14 16:29:01 +02:00
df7be04ca6 fix Mac build with Xcode 8
Small issues in GHOST
- use NSApplicationDelegate protocol for our app delegate
- make sure NSApp is initialized before using
2016-09-14 16:29:01 +02:00
30a7e75089 Cleanup: Fix epic indent failure in previous commit :/ 2016-09-14 16:18:36 +02:00
3525fd605a Fix missing PaintCurves list in bpy.data
Minimal list features for now, no add/remove stuff, that we can add later...

Reported by sybren.

Should be safe for 2.78.
2016-09-14 16:14:32 +02:00
3b6ce4123c Fix memory leak in copy pose operator 2016-09-14 15:57:04 +02:00
ce952fd36e Fix T49342: TypeError when autocompleting bpy.app.something.
Regression from rB036c006cefe471. We can't use self here, self is bpy.app, not pydescriptor of python path getsetter...

So for now, do not try to replace getsetter by actual value in bpy.app's dict,
just return static var generated on first run.

Should be safe for 2.78.
2016-09-14 15:54:54 +02:00
ab6a3dd6c1 Fix T49341: Bad motion blur behavior in Cycles when using Speed effect in Sequencer
Cycles was thinking it always rendering integer frame, which is not correct.
2016-09-14 14:59:39 +02:00
66d4006f51 Attempt to fix broken path remapping in own rB443b3ca9b9cb. 2016-09-14 12:58:01 +02:00
48c4a5a4dd CMake: decouple WITH_CYCLES_OPENSUBDIV from WITH_OPENSUBDIV, and enable on OS X.
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D2227
2016-09-14 12:02:44 +02:00
443b3ca9b9 Fix two issues related to 'partial' .blend files:
I) Filename was not put in temp Main generated to save selected data only,
this was breaking readcode when trying to open partial file, leading to missing
filename in final loaded Main data.

II) Read code would confuse partial .blend files with Undo ones, when they had no screen in them
(which happens to 99.999% of partial .blend files I guess).

Reported by @sybren, thanks.

Should be safe enough for 2.78 release.
2016-09-14 11:35:16 +02:00
a2677100fe FileBrowser: Always do full cache refresh while we are still listing...
Does not seem to be a problem with embeded filelisting code, but was breaking with some experimental asset engines.
2016-09-13 19:02:27 +02:00
0de69e56b4 Cycles: Implement threaded SVM nodes compilation
The title says it all actually. From tests with barber shop scene here
gives 2-3x speedup for shader compilation on my oldie i7 machine. The
gain is mainly due to textures metadata query from jpeg files (which
seems to requite de-compression before metadata can be read). But in
theory could give nice improvements for scenes with huge node trees
as well (i'm talking about node trees of complexity of fractal which
we had reports about in the past).

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: brecht

Subscribers: monio, Blendify

Differential Revision: https://developer.blender.org/D2215
2016-09-13 13:46:49 +02:00
f38f787448 Fix bpy.data.user_map() ignoring unused datablocks.
Should be backported to 2.78.
Found by Sybren here in studio, thanks!
2016-09-13 13:23:03 +02:00
d82710cc02 Outliner: Report linked datablock edit failure when trying to rename linked data in outliner 2016-09-13 13:12:44 +02:00
7f67885526 Fix T49323: Ineffective bone roll calculation with low rig scale
The code was expecting vector to be normalized, however after
applying inverted object matrix it was possible to have scale
applied to it.
2016-09-13 12:38:47 +02:00
0307369211 Fix T49336: Outliner allows to edit restrict flags for linked objects 2016-09-13 11:33:55 +02:00
ecbfa31caa Cycles: Tweak empty boundbox children
The idea here is to make assert failure to fail sooner on an incorrect
node address rather than later with stack overflow.
2016-09-13 11:05:11 +02:00
52038fd8c7 Fix T49290: Specific .blend with hair crashes in MacOS 2.78 RC1 on render
The issue was caused by some false-positive empty non-AABB intersection.
Tried to tweak it a bit so it does not record intersection anymore.

Hopefully will work for all platforms. Tested here on iMac and Debian.
2016-09-13 10:59:48 +02:00
54b00657ca Gawain: fix Windows compile error
MSVC was NOT happy about uint64_t, now it is.
2016-09-13 03:21:16 -04:00
1b5b899228 OpenGL: add built-in GPU_SHADER_3D_DEPTH_ONLY
We’re discussing several techniques that require a depth pre-pass.
2016-09-13 02:51:38 -04:00
ddb1d5648d Gawain: geometry batches (unfinished)
Vertex Buffer to store vertex attribute data.
Element List (AKA Index Buffer) to select which vertices to use.
Batch combines these into an object that can be built once then drawn
many times.

Porting over from the C++ version… Most of this C code is compiled but
unused. Some of it is not even compiled. Committing now in case I’m
lost at sea.
2016-09-13 02:41:43 -04:00
56c798ee62 API doc update script: Fix generated zipfile name, was broken in 'release' case... 2016-09-13 08:39:01 +02:00
b6bd299359 Gawain: reorganize source code
Put Gawain source code in a subfolder to make the boundary between the
library and the rest of Blender clear.

Changed Gawain’s license from Apache to Mozilla Public License. Has
more essence of copyleft — closer to GPL but not as restrictive.

Split immediate.c into several files so parts can be reused (adding
more files soon…)
2016-09-13 02:18:33 -04:00
Julian Eisel
620724d5e2 Fix error in --debug-handlers printing
Was missing else block (and also missing newline character). Caused by e672e7a070.
2016-09-12 18:39:25 +02:00
91eb1c2e2a Fix code which was commented by accident
Well, more like some last-minute checks which i did not see before commit.

Let's increase commit ratio!
2016-09-12 16:29:54 +02:00
ad40ae1e06 Fix T49327: Cycles OSL Mode: RGB Curves node only outputs gray scale images
To be backported to 2.78 release.
2016-09-12 16:14:40 +02:00
d15899cca7 Cycles: Fix compilation error after recent commits 2016-09-12 16:06:50 +02:00
98c7e75897 Graph editor: Add channel option to make it persistent on display
The idea is to allow certain animation channels to be always visible in
animation editors. So, for example, one can pin Camera animation to the
editor so it is always possible to refine/tweak camera animation when
animating something else in the scene.

There is probably some more polishing required, and some current
limitations could be solved in the future but should be a good starting
point already.

Currently only works for object without recursing into deeper datablock
(so for example, it's not possible to pin object material animation).

Studio request by Colin Levy.
2016-09-12 15:39:40 +02:00
0f8f494d63 Fix T49296, assert failure in Bevel code.
The mesh interpolation function failed to fill a fractions-of-the-way
array properly when the distances are very small but nonzero.
2016-09-12 07:29:31 -04:00
fb2c435d86 Cycles: Fix wrong SSS in combination with hair on AVX2 platform
Not sure why exactly that happened, need a closer look.
2016-09-12 12:48:35 +02:00
91e0a16f2f Cycles: Use XDG's .cache folder for cached kernels
Basically just moves cached kernels from ~/.config/blender/BLENDER_VERSION to
~/.cache/cycles/kernels. This has following benefits:

- Follows XDG specification more closely,
  not as if it's totally crucial or measurable by users, but still nice.

- Prevents unexpected sizes of config folder, makes disk space used in more
  predictable for users way.

- Allows to share kernels across multiple Blender versions,
  which makes it easier debugging at the times close to release.

- "Copy Previous Settings" operator will no longer be copying possibly
  gigabytes of cached kernels, which used to lead to really nast disk usage
  and annoying delays of copying settings.

- In the future we can have some smart logic to clear old unused cached
  kernels.

Currently only done for Linux and OSX. Windows still follows old "cache"
folder logic, but it's not really important for now because we don't
support kernel compilation on this platform yet.

Reviewers: dingto, juicyfruit, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2197
2016-09-12 09:39:05 +02:00
49df5d0980 Cycles: Fix shading and crashes resulting from constant folding on displacement
Constant folding was removing all nodes connected to the displacement output
if they evaluated to a constant, causing there to be no valid graph for
displacement even when there was displacement to be applied, and sometimes
caused crashes.
2016-09-11 13:49:34 -04:00
013b46d6bd Cycles: Replace object index hack with actual checks for SD_TRANSFORM_APPLIED
Using ones complement for detecting if transform has been applied was confusing
and led to several bugs. With this proper checks are made.

Also added a few transforms where they were missing, mostly affecting baking
and displacement when `P` is used in the shader (previously `P` was in the
wrong space for these shaders)

Also removed `TIME_INVALID` as this may have resulted in incorrect
transforms in some cases.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2192
2016-09-11 13:49:05 -04:00
92a2c49aab Cycles: Fix bump mapping to use object space when used with true displacement
Bump mapping was happening in world space while displacement happens in object
space, causing shading errors when displacement type was used with bump mapping.

To fix this the proper transforms are added to bump nodes. This is only done
for automatic bump mapping however, to avoid visual changes from other uses of
bump mapping. It would be nice to do this for all bump mapping to be consistent
but that will have to wait till we can break compatibility.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2191
2016-09-11 11:20:21 -04:00
ac2fe8312b Revert "GPencil: Add IFACE_ macro to some strings"
This reverts commit b50a5b92c1 because BKE_report functions are already automatically handled by translation system.
2016-09-11 13:06:37 +02:00
b50a5b92c1 GPencil: Add IFACE_ macro to some strings 2016-09-11 12:28:09 +02:00
347d759c62 GPencil: Change interpolate stroke factor
Now the factor works similar to other Blender areas to make the factor
more consistent for artists. The value 0% means equal to original
stroke, 100% equal to final stroke (50% means half way). Any value below
0% or greater than 100% create an overshoot of the stroke.
2016-09-11 12:28:09 +02:00
96f28f9b50 [CMAKE/Platform/Windows] Only perform version check if the actual compiler is MSVC 2016-09-10 17:58:56 -06:00
Kai Mach
56064b508b NDOF: allow view movement for modal border and circle select operators.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2167
2016-09-10 23:37:53 +02:00
Dmitry Dygalo
9fc1cfc4f1 Fix undefined variable on errors in Cycles ctests.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2201
2016-09-10 23:04:14 +02:00
d8681c99c4 Fix OpenSubdiv related buffer overrun with multiple FVar channels.
The existing code uses the input value count of the first channel
for all of them. If the first channel is the largest, it leads to
a crash-causing buffer overrun in memcpy below. Likely this was
left since the time when only one channel was supported.

As a crash fix, probably should go into 2.78
2016-09-10 21:15:52 +03:00
037df2aaa6 Fix T49303: Fix T49314: More issues with new handling of X11 shortcuts.
This commits changes two things:
* It adds more keysyms preferably taken from XLookupKeysym than XLookupString (namely, all numpad ones).
* It falls back to keysyms from XLookupKeysym in other cases, when XLookupString does not produce anything we know of.

Finding the correct balance here is far from easy, but think we are comming rather close to it now...
2016-09-10 12:38:12 +02:00
2820ab5a8f Cleanup: Indentation 2016-09-09 13:08:21 +02:00
4c1d40d87e Cycles: Add overall timing log to SVNShaderManager 2016-09-09 12:27:27 +02:00
ff1ba0861d Fix missing 'prop_required' flags in some ID RNA funcs.
Not critical, but would rather have this in 2.78 (for API doc reasons mostly).
2016-09-09 12:00:23 +02:00
70e7c0829e Cycles: Deduplicate QBVH node packing across BVH build and refit 2016-09-09 11:32:05 +02:00
d205bc3059 Fix/Workaround T49297: Crash related to custom data draw (Blender with ASAN)
Root of the issue is that active render index became wrong. This is the actual
thing to be fixed, but as usual this is quite tricky to reproduce. Since such
bad situation might have happened more and fix isn't really difficult or
intruisive let's avoid crash for now.

Can be revisited once we figure out root of the issue.

Nice for 2.78 release.
2016-09-09 10:57:25 +02:00
b27ba26b44 Fix T49299: Removing offset object in modifiers doesn't update mesh.
Own fault in new ID management work, thought rebuild the DAG itself was
enough to actually update whole scene, but we actually need to tag datablocks
for update as well, when we change (or remove) one of their ID pointers...
2016-09-09 10:44:49 +02:00
2fe0125fcd Smoke viewport: remove dead code.
OCD commit, but cleans the code a bit:
- the first `if 0` block was supposed to draw collision objects but is
vastly outdated as most of the SmokeCollisionSettings member variables
were removed a few years ago and collision objects are drawn like other
objects anyway. Also it was committed already commented out back in
2009.
- the second `if 0` block was doing pretty much the same thing as the
few lines above it.
2016-09-09 06:05:58 +02:00
0053a91165 Alembic streaming: initial support to interpolate data between frames.
Pretty self-explanatory, allows to get some slow motion type of playback
and animations.
2016-09-09 05:59:20 +02:00
631af9f930 Alembic: add option to triangulate meshes upon export. 2016-09-09 05:30:43 +02:00
78ea06fea4 Alembic, cleanup: split archive opening code in their own classes and
files.

Also helps keeping platform specific code in separate from the rest of
the code.
2016-09-09 05:06:06 +02:00
1558f5b660 Cycles: Don't run full shader evaluation for constant emission lamps
Most of the time, Lamps in Cycles are just a constant emission closure, no texturing etc. Therefore, running a full shader evaluation is wasteful.
To avoid that, Cycles now detects these constant emission shaders and stores their value in the lamp data along with a flag in the shader.
Then, at runtime, if this flag is set, the lamp code just uses this value and only runs the full shader evaluation if it is neccessary.

In scenes with a lot of lamps and with "Sample all direct/indirect" enabled, this saves up to 20% of rendering time in my tests.

Reviewers: #cycles

Differential Revision: https://developer.blender.org/D2193
2016-09-09 01:39:09 +02:00
6de08f6cd1 Cycles: Fix regular BVH nodes refit
For proper indexing to work we need to use unaligned node with
identity transform instead of aligned nodes when doing refit.

To be backported to 2.78 release.
2016-09-08 15:08:35 +02:00
27e2317513 Cycles: Add asserts to BVH node packing 2016-09-08 15:03:55 +02:00
3598a3d1d5 Cycles: Cleanup: line wrapping 2016-09-08 14:26:10 +02:00
45f833c21d Fix T49283: Crash in BKE_ptcache_make_particle_key.
This is really hack-fix actually, not sure why `get_pointcache_keys_for_time()` seems to assume
it will always find key for given part index at least for current frame, and whether this assumption
is wrong or whether bug happens elsewhere...

Anyway, this is to be wiped out in 2.8, so no point loosing too much time on it, for now merely
returning unchanged (i.e. zero'ed) ParticleKeys in case index2 is invalid. Won't hurt anyway,
even if this did not crash in release builds, would be returning giberish values.
2016-09-08 10:24:56 +02:00
a2e8b7e216 Fix compilation error: Shadowing of variable 2016-09-08 09:40:25 +02:00
a6f733310b Fix strict compiler warnings 2016-09-08 09:39:18 +02:00
ace92854b2 Fix compilation error: missing forward declaration 2016-09-08 09:38:24 +02:00
18ae1504ea Fix T49286: Compilation error with XCode 7.0
Weirdly enough, this version of XCode seems to have static_assert()
even when NOT using C++11. This is totally weird and counter intuitive
since static_assert() is supposed to be C++11 onlky feature.

Can XCode stop using future, please? :)
2016-09-08 09:27:51 +02:00
7e7a9d146c Cycles: Fix OpenCL speed regression introduced with the improved bump mapping
The two SVM nodes added with e7ea1ae78c caused a slowdown on AMD cards when rendering with OpenCL, whether displacement was used or not.
In the Barcelona Pavillon scene on a RX480, this would cause a 12% slowdown.

Therefore, this commit adds a additional flag for feature-adaptive compilation so that the new SVM nodes are only enabled when they are needed (Node tree connected to the Displacement output and Displacement type set to Both).

Also, the nodes were also added to shaders when the Displacement Type was set to Bump (the default), which was unneccessary and is fixed now.

Thanks to linda2 on IRC for reporting and testing and to maiself for help with the displacement shader code.

This fix might be relevant for 2.78, but it should be tested further before including it.
2016-09-08 01:33:41 +02:00
afd3a55e3e GPencil UI: Ensure "Move to Color" can be found from the colors panel dropdwon too 2016-09-08 01:42:16 +12:00
19e6321ac0 GP Interpolation: Mark created frames as being "breakdowns"
This brings this tool more in line with the Breakdowner for armature animation,
with which it shares many commonalities.
2016-09-08 01:24:02 +12:00
4b65662483 Fix: GPencil drawing sessions now respect limits for maximum undo steps
When drawing with Grease Pencil "continous drawing" for a long time
(i.e. basically, drawing a very large number of strokes), it could be
possible to cause lower-specced machines to run out of RAM and start
swapping. This was because there was no limit on the number of undo
states that the GP undo code was storing; since the undo states grow
exponentially on each stroke (i.e. each stroke results in another undo
state which contains all the existing strokes AND the newest stroke), this
could cause issues when taken to the extreme.
2016-09-08 01:14:53 +12:00
5b42e07e18 Code Cleanup: Deduplicate undo node freeing code 2016-09-08 01:14:52 +12:00
bcc863993a Fix T49273: Crash during access to dupli weights at launch time.
See commit's comments for details, but this boils down to: do not try to use
purely runtime cache data as a 'real' ID pointer in readcode, it's likely
doomed to fail in some cases, and is bad practice in any case!

Thix fix implies dupliweight's object will be invalid until first scene update
(i.e. first particles evaluation).
2016-09-07 12:48:22 +02:00
1263965f83 GPencil: New interpolate strokes operators
Two new modal operators to create a grease pencil interpolate drawing
for one frame or a complete sequence between two frames.  For drawing
the temporary strokes in the viewport, two drawing handlers have been
added to manage 3D and 2D stuff.

Video: https://youtu.be/qxYwO5sSg5Y

The operator shortcuts are Ctrl+E and Ctrl+Shift+E. During the modal
operator, the interpolation can be adjusted using the mouse (moving
left/right) or the wheel mouse.
2016-09-07 10:02:52 +02:00
008afa446f OpenSubdiv: Support multiple materials drawing in Cycles textured view
Consider for inclusion into 2.78.
2016-09-07 09:48:13 +02:00
18d49a8283 Gawain: add immBeginAtMost
immBegin requires us to know how many vertices will be drawn. Most times this is fine, but sometimes it can be tricky. Do we make the effort to count everything in one pass, then draw it in a second?

immBeginAtMost makes this simple. Example: I'll draw at most 100 vertices. Supply only 6 verts and it draws only 6.

Any unused space is reclaimed and given to the next immBegin.
2016-09-06 16:56:08 -04:00
d0e7c7a032 Add XK_ISO_Left_Tab to ghost's known X11 keydefines... 2016-09-06 22:32:17 +02:00
031c5bad87 Gawain: fix GL_POINTS in immediate mode
Was using GL_NONE to mean "no primitive" but GL_NONE and GL_POINTS are both defined as 0x0000.

Introducing PRIM_NONE = 0xF which does not clash with any primitive types.
2016-09-06 15:45:10 -04:00
f298c9ea1a Cleanup previous commit... 2016-09-06 18:01:14 +02:00
87b3faf557 GHOST X11 keyboard: Attempt to fix issues with modifier keys on some systems.
Could not reproduce it here, but since users having the issue claims it comes from
rB16cb9391634dcc50e, let's try to use again ugly `XLookupKeysym()` for those modifier keys too...
2016-09-06 17:54:40 +02:00
049ed1f4e7 [cmake/cpack] allow override of package name
Cpack generates a standard filename with git information in it, which might not always be wanted for release builds, this patch adds an option to override that default filename.

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

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

ammended to fix: wrong variable name in main CMakeLists.txt
2016-09-06 08:47:45 -06:00
c02f9bc569 Revert "Depsgraph: Prioritize evaluation of the new scheduled nodes"
This reverts commit 9444cd56db.

This commit caused some flickering in the bones when swapping IK to Fk.

While it's unclear why such change caused any regressions, let's revert
it to unlock the studio.
2016-09-06 16:45:03 +02:00
abd54f1ed2 [cmake/cpack] allow override of package name
Cpack generates a standard filename with git information in it, which might not always be wanted for release builds, this patch adds an option to override that default filename.

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

Differential Revision: https://developer.blender.org/D2199
2016-09-06 07:22:04 -06:00
b40d1c1903 Fix T41883: Strip keyframes not respected for scenes rendered by other scenes 2016-09-06 14:08:11 +02:00
e3e8ce08a6 Add script which scales splash screen down
Based on reading documentation around. This particular version
is based on the ImageMagic documentation which could be found
there:

  http://www.imagemagick.org/Usage/filter/
  http://www.imagemagick.org/Usage/filter/nicolas/

Current filter is based on measuring mean error with the current
splash screen and choosing combination of parameters which
gives minimal mean error.
2016-09-06 12:27:58 +02:00
14e47472fe cleanup: macro whitespace \ alignment
Gotta be careful mixing tabs & spaces. This commit uses 4-space indent
to align the line continuation markers.

Follow-up to 3b52c4056a
2016-09-05 13:30:57 -04:00
8f509698d7 Fix cast shadows (material option) in the viewport
Fix cast shadows options (in material tab) not working in the viewport.
An off-by-one error. See D2194 for more.

Committing for Ulysse Martin (youle) who found & fixed this.
2016-09-05 13:05:47 -04:00
56d2f4c20a Fix T49252: Crash when image textures used with true displacement 2016-09-05 12:57:33 -04:00
Julian Eisel
718bf8fd9d UI: Ctrl+Tab and Ctrl+Shift+Tab to cycle through space context "tabs"
In User Preferences, Properties Editor and toolshelf, Ctrl+Tab and Ctrl+Shift+Tab now activates the next or previous space context (or category in case of toolshelf tabs), respectively.

For Properties Editor such functionality was completely missing, only toolshelf allowed cycling using ctrl+mousewheel (or only mousewheel while hovering tab region). Ctrl+Tab and Ctrl+Shift+Tab are common web browser shortcuts, so they're a reasonable choice to go with.
Reaching the first/last item doesn't cause the cycling to stop, we continue at the other end of the list then. (I didn't add this to Ctrl+Mousewheel toggling in toolshelf since I wanted to keep its behavior unchanged.)

We could get rid of (Ctrl+)Mousewheel cycling in toolshelf, but this may break user habits.

The cycling happens using a new operator, UI_OT_space_context_cycle, for toolshelf tabs it's hardcoded in panel handling code though.
Generalized rna_property_enum_step a bit and moved it to rna_access.c to allow external reuse.

Reviewed By: venomgfx
Differential Revision: https://developer.blender.org/D2189
2016-09-05 17:28:41 +02:00
922aefba25 OpenSubdiv: Fix missing ORCO when enabling OSD but having dependency to the geometry
Was causing huge viewport lags.

Reported by angavrilov in IRC, thanks!

Safe and nice for 2.78.
2016-09-05 17:08:09 +02:00
a31eca3fdd Fix T49251: moving smoke domain with additional resolution causes crash.
This is a bug in the multithreaded task manager in negative value range.

The problem here is that if previter is unsigned, the comparison in the
return statement is unsigned, and works incorrectly if stop < 0 &&
iter >= 0. This in turn can happen if stop is close to 0, because this
code is designed to overrun the stop by chunk_size*num_threads as
the threads terminate.

This probably should go into 2.78 as it prevents a crash.
2016-09-05 15:50:12 +03:00
c51cfbbc7f Fix own mistake in recent rB8b2a45052093, broke saving render results as images in some cases.
Reported by sebastian_k over IRC, thanks.

To be backported to 2.78.
2016-09-05 13:13:49 +02:00
1df4f792db Attempt to fix compilation error with static boost on certain platforms
This was reported in T49231.
2016-09-05 13:10:19 +02:00
33fcd0444d Fix T35333: Update some WM/UI API functions docstrings.
Based on patch by @codemanx, but with slightly less verbose descriptions.

More detailed behavior etc. rather belongs to doc/python_api/examples/bpy.ops.x.py imho.
2016-09-05 11:04:33 +02:00
7f682dd704 Fix T49226: Incorrect Material viewport shading of Cycles Normal Map node in Edit mode for an object with Array modifier
Was incorrect indexing done in the array. Caused by 5abae51.

Not sure why it needed to be changed here, but array here is supposed to be
a loop data, so bringing back loop index as it originally was. The shading was
wrong in edit mode with BI active as well (so it's not like it's needed for
BI only).

Patch in collaboration with Alexander Gavrilov (angavrilov), thanks!

Should be double-checked and ported to 2.78.
2016-09-05 10:20:43 +02:00
3b52c4056a Fix glUniform called from glBegin/glEnd blocks
Was causing some invalid operations in OpenGL.

After more testing should be fine for 2.78.
2016-09-05 10:14:07 +02:00
062732905a Fix T49220: Vertex paint doesn't work with OpenSubdiv
It's a bit tricky to align vertex color data between Blender and OpenSubdiv
so for now we simply disable OpenSubdiv in the paint modes.

Safe for 2.78.
2016-09-05 10:14:07 +02:00
83ae39cc2e CMake: Skip addons_contrib for release candidate builds
Nowadays release candidates are supposed to be as close to the final
release as possible.

Safe for 2.78 release branch.
2016-09-05 10:14:07 +02:00
e35a87c5ff API doc: add new pure-rsync py script to update API doc on Blender server.
The other one (sphinx_doc_gen.sh) needs an ssh account on the server to work - and I hate bash, too! :P
2016-09-05 09:38:53 +02:00
f50ddbf60a We are in bcon again, so master goes back to alpha in release cycle. 2016-09-05 09:23:49 +02:00
0bd87b1976 Cycles: Fix unreported - Missing node group for the Camera Node
Thanks to linda2 for reporting in IRC.
2016-09-05 04:08:51 +02:00
569a13f4b2 Alembic: fix parenting issues when an object has multiple curves/points
subobjects.
2016-09-05 03:46:25 +02:00
2024cd09a0 Fix T49249: Alembic export with multiple hair systems crash blender
Crash was due to a name collision in Alembic objects caused by the fact
that names derive from the one of the Blender object. An object having
multiple particles system would thus give its name to various
subobjects.

Now use the name of the particles system for the Alembic object.
2016-09-05 03:32:36 +02:00
Julian Eisel
0351e701ce Correction to previous commit (PEP 8) 2016-09-05 00:55:44 +02:00
Julian Eisel
2b240b0430 Combine all Proportional Editing options under one menu
Image of the result of this patch:

{F352849}

The only thing different from the above image and this patch is I added a colon after "Falloff" after I took the screen shot.

Reviewers: Severin, meta-androcto

Subscribers: plyczkowski

Tags: #bf_blender, #user_interface

Maniphest Tasks: T33436

Differential Revision: https://developer.blender.org/D2195
2016-09-05 00:27:11 +02:00
Julian Eisel
c126a5179f Fix menu drawing printing 'unknown operator' warning when building without WITH_BULLET 2016-09-05 00:11:12 +02:00
3c29aad787 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_particles.cpp
	source/blender/blenkernel/intern/particle.c
	source/blender/gpu/intern/gpu_shader.c
2016-09-04 16:41:06 +02:00
e76e8fcdcc Fix a few OpenCL compiler warnings. 2016-09-03 23:06:12 +02:00
95cb714511 fix: not initialised variable can crash blender (related to modifiers with cage editing enabled) 2016-09-03 18:01:04 +02:00
16cb939163 Fix T48911: Fix T48847: Issues with some shortcuts on non-US latin keyboards, and with non-first layouts.
This is a tentative fix, own tests here seem to be working OK,
but don't think it's safe enough to be backported to 2.78.
2016-09-03 17:50:56 +02:00
6c0307f888 Fix T49228: Separate by material, materials dissappear after reload.
Yet another mismatch where code would decrease usercount (of Material here) but never increase it again
when re-assigning the datablock...
2016-09-03 12:51:50 +02:00
27c64e3f46 Fix T49229: ID user decrement error when deleting group instance twice.
Another great example of inconsistency in usercount handling - dupli_group was considered
as refcounted by readfile.c code (and hence by library_query.c one, which is based on it),
but not by editor/BKE_object code, which never increased group's usercount when creating
an instance of it etc.

To be backported to 2.78.
2016-09-03 11:47:17 +02:00
ad400006d3 Point submodules to latest master branches
We did not update them for really long time and the currently used
hashes are quite old and probably wouldn't work without manually
updating all submodules.

Not as if it's something totally crucial (we ask to update submodules
all the times and that's what `make update` does) but updating hashes
will save some cloning/checkout time.
2016-09-02 11:44:22 +02:00
98d28a8a6c Blender 2.78 commit!
Includes:

- Version bump to 2.78
- Doxy file update
- New splash screen
- Wrapped some do_versions with version check
- Updated template to use proper font

After poking around a lot it seems Droid Sans was used during 2.7x series.
(or at least difference between using this font and comparing to previous
splash screens gives none visible difference).
2016-09-02 11:37:25 +02:00
b399a6d33f Fix T49180: Cycles MIS Map for Animated Environment Texture Movie Doesn't Update on Frame Change
Not really ideal fix at all, but we are at RC today, so better to play really safe.
2016-09-02 09:58:41 +02:00
fce8f24628 Cycles: Silence strict compiler warning in release build 2016-09-02 09:14:34 +02:00
8b2a450520 Fix T49222: Image Save settings are overridden by the File Save Screen ones.
There were two inconsistencies in how 'save image' op initiated its settings:
* It would always use ImBuf->planes value.
* It would always use Image views settings.

Both of those settings should come from scene->r.im_format (as everything else)
when saving render/compo result...
2016-09-02 08:37:57 +02:00
e7ea1ae78c Cycles microdisplacement: Improved automatic bump mapping
Object coordinates can now be used in the displacement shader and will give
correct results, where as before bump mapping was calculated from the displace
positions and resulted in incorrect shading.

This works by evaluating the shader in two parts, first bump then surface, and
setting the shader state to match what it would be if the surface was
undisplaced for the bump shader evaluation. Currently only `P` is set as if
undisplaced, but other shader variables could be set as well, such as `I` or
`time`. Since these aren't set to anything meaningful for displacement I left
them out of this patch, we can decide what to do with them separately.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2156
2016-09-01 22:45:49 -04:00
62aecbdac1 Cycles: Store undisplaced coordinates for meshes when needed
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2156
2016-09-01 22:45:29 -04:00
9f1c42392e Cycles: remove duplicate shader storage
Storing multiple copies of a shader was needed when the displacement method was
a mesh option and could be different for each mesh. Now that its a shader option
this is unnecessary.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2156
2016-09-01 22:44:42 -04:00
f0159d1d48 Fix T49215 2016-09-01 14:00:20 -06:00
159ac3f638 Fix T49224: Crash due to dangling value in 'Object.proxy_from' pointer.
Why/how this may happen remains a mystery, so for now simply clearing this runtime-only
pointer on Object reading...
2016-09-01 21:16:54 +02:00
ff57589afc Curve Fitting: correct initial handle sign
In practice the initial values are almost never used.
2016-09-02 02:58:34 +10:00
2d589e8549 Math Lib: avoid char > int conversion w/ line plot 2016-09-02 02:54:16 +10:00
Julian Eisel
96dd1943af Fix crash calling wm.open_mainfile from menu with --debug-memory enabled
Didn't do any bisecting, but guess it's caused rBb54e95a5c8dcb7 (2.74 is fine, 2.75 isn't).
I think this fix makes some other hacks redundant but need to check details (will do when we're back to bcon1 to avoid regressions).
2016-09-01 16:55:01 +02:00
Julian Eisel
e240025276 Fix T49199: Combination of dialog + wm.open_mainfile causes crash
Issue was that the wm.open_mainfile OP caused all handlers to be removed and since rB45592291 cancelled (which is correct in general), the menu that triggered the OP should not be cancelled though.
Not sure if this is a nice fix or not, it's however the safest fix I found. A different fix would be to call UI_popup_block_close before WM_operator_call_ex (in dialog_exec_cb), but not sure how safe this is and want to further investigate if it makes other hacks/fixes redundant.

There's still a crash with --debug-memory that confused the heck out of me (since I always have --debug-memory enabled), but I'll commit fix for that separately.
2016-09-01 16:37:45 +02:00
40d072ca7f D2184 Stamp: Make drawing stamp labels optional.
When using metadata stamping, it's often handy to have "Camera" in
front of the camera name, "Marker" in front of the marker text, etc.,
but sometimes those get in the way. This patch allows an artist to
turn those labels on/off.

Reviewed by: sergey, mont29, venomgfx
2016-09-01 15:45:54 +02:00
718f8ae141 pydoc: added missing 'compress' parameter to b.t.BlendDataLibraries.write 2016-09-01 15:30:05 +02:00
9e39488fa6 OpenSubdiv: Fix missing object ORCO when Subsurf uses OpenSubdiv but disabled fore viewport 2016-09-01 15:27:08 +02:00
f7263b8b1a Cleanup: Reduce amount of misleading indentation
Was polluting compile output too much.
2016-09-01 12:14:16 +02:00
475b43ad4a Fix T49175: GLSL material crash with environment maps. 2016-08-31 20:13:08 +02:00
bfd8da753d Fix T49210: Issue with User Count on Images in some shader nodetrees when rendering previews
Our usercount handling was really... infuriating :|

Here, localization (i.e. 'shalow' copy that should not touch to usercounts) was incrementing
usercounts of the sole Textures IDs of lamps and worlds (on the weak and fallacious pretext
that related BKE_free... functions would decrement those counts)... Seriously...

So now, localize funcs do not increment any usercount anymore (since matching BKE_free... ones do
not decrement any either), and we do not call anymore that stupid unlink when freeing temp
localized copies of lamps/materials at end of preview generation.

Note that we probably still have a lot to do to cleanup that copy/localize code, pretty sure
we can dedpulicate a lot more.
2016-08-31 16:48:27 +02:00
8fb9f2dbe9 [Windows] Add support for code signing the final binaries.
The option is controlled with the WITH_WINDOWS_CODESIGN option and needs:

- Signtool must be found on the system, the standard windows sdk folders will be searched for it.
- The path to the pfx file (WINDOWS_CODESIGN_PFX)
- The password for the pfx , this can either be set by the WINDOWS_CODESIGN_PFX_PASSWORD variable but given that ends up in CMakeCache.txt (which might be undesirable) there is a backup option of setting the PFXPASSWORD environment variable on the system.

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

Tags: #bf_blender, #platform:_windows

Differential Revision: https://developer.blender.org/D2182
2016-08-31 06:26:23 -06:00
b06a70323c Cycles: don't crash if OSLRenderServices::osl_ts is unset 2016-08-30 20:50:22 -04:00
23e3b9f35b Correct render pass identifier usage in toolitps 2016-08-30 22:08:09 +02:00
c5a66b7872 Fix stupid mistake in previous commit 'cleanup' part.
Thanks to sergey for spotting it.
2016-08-30 21:09:33 +02:00
a0cdebde11 Fix bad usercount handling of materials in BKE_mesh_new_from_object().
Curves and meshes (when no modifier application required) would increase their material usercount twice.

Not sure how/why it worked in previous code, but with new, stricter ID handling we need more
careful check of ID 'ownership' handling.

Reported by Sergey over IRC, thanks.
2016-08-30 20:38:53 +02:00
7aedd0e6b0 Cycles: Fix calculation of normals for subdivision meshes
Not sure what happened here. Will have only effected Cycles standalone with
linear subdivision in use.
2016-08-30 12:24:57 -04:00
959b06b3c8 Fix type mismatch causing the buffer overflow in D810 2016-08-30 17:15:26 +03:00
43dcfcb27a Fix T49201: Mesh with OpenSubdiv subsurf and a texture disappears in Material viewport mode 2016-08-30 12:12:46 +02:00
c376878e54 Fix T49187: inconsistent Normal Map node output for backfacing polygons.
There basically are two issues here: in smooth mode (and all non-tangent
normal map types) it doesn't invert the normal for backfacing polys;
on the other hand for flat shaded tangent type it is inverted too soon.

This fix does a brute force correction by checking the backfacing flag.

Reviewers: #cycles, brecht

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D2181
2016-08-30 12:48:59 +03:00
3a0c0c1b54 Fix node editor to display node group names in the bottom left corner.
Currently it pointlessly repeats the material name there, separated by
slashes. That obviously should display the nested group path instead.
2016-08-30 12:32:31 +03:00
47b87e1f3b Usual i18n/UI messages fixes... 2016-08-30 10:43:37 +02:00
de64f66a2f Fix T49158: Take II, some more untranslated UI messages... 2016-08-30 10:43:37 +02:00
062cf99fd1 Cleanup: Indentation 2016-08-30 10:29:53 +02:00
5f14bc1b47 GPencil: Fix segment fault when undo
When undo in UV/Image editor and press ESC key, there was segment fault
in Toolsettings because the reference was missing. Now the toolsetting
is loaded from context and not from local operator data.
2016-08-29 22:17:57 +02:00
fa092da377 GPencil: Replace strcpy by BLI_strncpy 2016-08-29 21:57:08 +02:00
5c04b4fdfb Fix T49196 2016-08-29 13:33:30 -06:00
2090ed164f Cleanup/refactor spacefile's 'check dir' code.
Was kinda split in two different places (one allowed to modify given path to always get a valid one,
the other only checking for validity of given path), not nice - and broken in asset branch case.

So rather extended a bit FileList->checkdirf to handle both cases (modifying and non-modifying path).
2016-08-29 16:42:49 +02:00
8f215d9b52 Fix for Bevel segments bug T49183; but doesn't fix whole report yet. 2016-08-29 08:51:04 -04:00
09dc8a7954 Fix T49181: Movie clip animation lost when invoking action which reloads the clip
Was a bug since the very beginning of movie clip animation support
which was done on Feb 2012.
2016-08-29 13:09:03 +02:00
a9f8e384f1 Movie clip: Add missing animation data RNA declaration
Was missing since the beginning of the days.
2016-08-29 13:04:24 +02:00
cc2faa409f Fix T49172: mixdown sound op not exporting full length
Thanks Flavio Perez for the fix.
2016-08-29 10:55:17 +02:00
5af58faf79 Fix compilation error caused by wrong array initialization
We usually don't silence migh-be-uninitialized warning (which is the only
thing which could explain setting matrix to all zeroes) so we can catch
such errors when using tools like Valgrind.

I don't get warning here and the initializer was wrong, so removing it.

If it-s _REALLY_ needed please do a proper initialization.
2016-08-29 09:40:15 +02:00
936a2c6459 GPencil UI: Move the "quick toggles" for colors into their own row below the list
Previously, they were in a column alongside the list, but because the lists were
rarely that long, there would always be a large gap left below the list.
2016-08-29 17:10:53 +12:00
195c7797e6 Fix: Some settings (e.g. "volumetric strokes") from old files were not getting correctly ported to GPv2 2016-08-29 17:00:18 +12:00
f5ddcd4ce9 Code Cleanup: Fixes for some issues noticed during previous fix 2016-08-29 16:39:27 +12:00
cea8f024ec Fix: GPencil Paste couldn't be used to paste strokes from one datablock to another
This was because the poll callback was checking for the presence of an active layer.
If you just create an empty datablock and try to paste, nothing would happen.

However, this check was kindof redundant anyway, as the operator would add a layer for
you if it didn't find one.
2016-08-29 16:27:23 +12:00
44524f7519 Small optimisation: Only calculate the inverse_diff_mat once per stroke instead of for every point
(Later this calculation should be moved into the iteration macro instead, since
it only needs to be applied once per layer along with the diff_mat calculation)
2016-08-29 14:51:31 +12:00
299bb019b5 GPencil: "Reproject Strokes" operator
A common problem encountered by artists was that they would accidentally move
the 3D cursor while drawing, causing their strokes to end up in weird places in
3D space when viewing the drawing again from other perspectives.

This operator helps fix up this mess by taking the selected strokes, projecting them
to screenspace, and then back to 3D space again. As a result, it should be as if
you had directly drawn the whole thing again, but from the current viewpoint instead.
Unfortunately, if there was originally some depth information present (i.e. you already
started reshaping the sketch in 3D), then that will get lost during this process.
But so far, my tests indicate that this seems to work well enough.
2016-08-29 14:51:30 +12:00
dec7145032 GPencil: Include basic brush settings in "Grease Pencil Settings" panel for 2D Editors
After the GP v2 changes, it wasn't possible to easily set the thickness of strokes
if you didn't know about the pie menus already. This just exposes the same set of
settings.
2016-08-29 14:51:29 +12:00
71eaa28d0e Code Cleanup: Just some fixes for whitespace/typos that I noticed while working on other stuff 2016-08-29 14:51:29 +12:00
20c708d471 GPencil UI: Make "Tint" settings take full width of panel in 2D editors
Parenting options are not visible there (i.e. they're only for the 3D view),
so reserving space that isn't going to be used in those editors doesn't really
make much sense. Furthermore, those property regions are often quite narrow
too, so it doesn't help too much to keep these settings so narrow there.
2016-08-29 14:51:28 +12:00
8a02c5fc62 Fix T49163: let Cycles only hide particles with missing motion data, not regular objects. 2016-08-28 21:26:03 +02:00
116bab702e Fix T47639: OpenGL render with smoke and fire incorrect when using
transparency.

The issue is that we are rendering to a 0..1 clamped sRGB buffer with
unpremultiplied alpha, where the correct thing to do would be to render
to an unclamped linear premultiplied alpha buffer. Then we would just
make fire purely emissive without affecting the alpha channel at all,
but that doesn't work here.

So for now, draw fire and smoke separately using different shaders and
blend modes, like it used to before the smoke programs were rewritten
(see rB0372b642).
2016-08-28 16:50:59 +02:00
a5261e06a3 Fix T49167: Normals in wrong coordinate space when adaptive subdivision is used
Meshes with Cycles subdivision were being transformed to world space leading to
normals to sometimes be calculated in that space, while they should be in
object space. Also caused dicing to happen at the wrong rate for scaled meshes.
2016-08-27 18:07:04 -04:00
Julian Eisel
4ebfb700ba Fix missing viewport update changing BI lamp shadow method 2016-08-27 23:23:17 +02:00
498583844f OpenGL: use new uniform color functions
Color picker code motivated these convenience functions. looks much better now.
2016-08-27 14:14:01 -04:00
9d3813e602 Gawain: convenience functions for uniform color
Application code can pass ubytes, Gawain converts to float vec4 expected by shader.

For now the conversion is simple linear. We can add sRGB support later if needed.
2016-08-27 14:10:37 -04:00
0a8344e843 GPencil: Added entry for the "Select Strokes Using Active COlor" operator to the Colors panel dropdown
It was already present in a few of the Pie Menus, but it was hard to find it,
so I've included it here too for good measure.
2016-08-28 00:09:16 +12:00
7bc9353957 Code Cleanup (Non-functional tweaks)
General reshuffling of defines and spacing/brace usage for consistency.
In particular:
* When defining types, don't mix pointers and non-pointer types on same line
  to avoid confusion
* As much as possible, have all defines at the top of each block instead of
  scattered haphazardly throughout the code
2016-08-27 22:58:09 +12:00
2a6362255d GPencil: Cleanup change color operator
It is faster to assign the color to the pointer instead to force the new
lookup in drawing function.
2016-08-27 12:52:30 +02:00
fef0cd8191 Fix T49151: ParticleSettings' usercount not decremented when removing a psys from an object. 2016-08-26 20:29:40 +02:00
5849651a46 Cycles: Make UI for subdivision more clear
Users have been getting a bit confused by the way things are worded/arranged in
the UI. This patch makes a few changes to the UI to make it more clear how to
use subdivision:

- make Subdivide UVs option inactive when adaptive subdivision is enabled as UV
  subdivision is currently unsupported
- add "px" to dicing rates in the Geometry Panel
- display the final dicing rate in the modifier
- reworded "Dicing Rate" in the modifier to "Dicing Scale" to make more clear
  that this is a multiplier for the scene dicing rate and added a note the the
  tooltip pointing the user to that setting in the Geometry Panel

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2174
2016-08-26 12:14:07 -04:00
e9c5359f43 Usual i18n/UI messages fixes... 2016-08-26 16:14:56 +02:00
1a1bcad43a Fix T49158: Untranslatable elements in UI.
We cannot skip 'collections clesse' when generating i18n messages from RNA, some of them
are visible and UI...
2016-08-26 15:46:56 +02:00
fcffb14d7b Fix linking issue with OpenEXR and Zlib.
Link Zlib after OpenEXR.

Differential Revision: https://developer.blender.org/D2176
2016-08-26 14:28:51 +02:00
62b1cdd66e Fix over creation of cache files handles (leading to memory leaks).
Multiple threads could create multiple handles for the same cache file,
so protect handle creation with a mutex, to make sure only one is
created.
2016-08-26 14:28:50 +02:00
8870c454a1 Fix cache constraint not reference counting cache files. 2016-08-26 14:28:50 +02:00
f2f107572c Fix T49168: crash when evaluating a cache constraint with a NULL cache
file.
2016-08-26 14:28:50 +02:00
1ada3231ec Depsgraph: Report number of objects to which update as flished
This is an easiest way in the new depsgraph to get an idea how much objects
were handled on update.
2016-08-26 14:05:24 +02:00
72b24d9c6c Cleanup: Remove unused variable 2016-08-26 14:01:03 +02:00
5f1b580edc Depsgraph: Report overall number of updates objects 2016-08-26 14:00:15 +02:00
86e0485b2e Cleanup: Use more meaningful names and move calculation into am if statement 2016-08-26 13:58:17 +02:00
a80977cd21 Fix T49139: Memory leak in UV image editor related to Undo (and possibly Waveform and Vectorscope).
Assigning NULL to scopes' data pointer in 'non-UI readfile' context was terribly wrong for sure,
if we'd really want to reset them here we should freed them first.

But we can rather just ignore them here, those are purely runtime data managed by image editor,
no need to touch them here.
2016-08-26 12:54:49 +02:00
42bbfe7f0a OpenGL: draw grid floor & axes with new immediate mode
Significant rewrite with some improvements.

Maintain visual hierarchy of the grid:
- emphasized lines draw atop normal lines
- axes draw atop all lines (same as before)

Draw axes only once, not twice.

Return early if nothing to draw.

Single draw call for the default case (grid floor with X and Y axes).

Z axis needs a second draw call because it uses 3D coordinates.

Part of T49043
2016-08-26 01:12:44 -04:00
f73c4b421d Fix: Use submenu for GPencil -> Select Grouped 2016-08-26 16:38:31 +12:00
274e1c4f1f Code Cleanup
* Stroke editing functions should be in gpencil_edit.c not gpencil_data.c
  (the latter is only for handling "CRUD" operations on things like
   layers, brushes, and palettes)
* Deduplicate the GP_STROKE_BUFFER_MAX define
2016-08-26 16:25:39 +12:00
2ac75fe035 Fix: Color of frame/selected object indicator in 3D View didn't indicate GPencil keyframes
when there was no active object
2016-08-26 16:15:48 +12:00
84cd137503 GPencil: Select Grouped -> By Color
Added a way to select all the currently visible strokes that use the same
color as the selected stroke. This can be accessed via the Select Grouped (Shift-G)
operator as an alternative to selecting by layer.
2016-08-26 16:15:48 +12:00
56360a3ddf GPencil RNA: Set pressure and strength to 1.0 by default for new stroke points added via stroke.points.add()
This commit adds optional "pressure" and "strength" arguments to the
stroke.points.add() method. These are given default values of 1.0,
so that old scripts can be ported over to the new API with less effort
while reducing confusion about why auto generated strokes won't appear.
2016-08-26 16:15:47 +12:00
060bf1bd28 OpenGL: draw empties without GLU
Also reduced number of matrix ops by generating final positions directly.

Also removed a display list (deprecated in modern GL).

Tried to reuse sinval & cosval tables but those values are skewed (last value repeats first value, middle values are squished to compensate). Went with sinf & cosf instead.

Part of T49042
2016-08-25 13:45:39 -04:00
50a44edca4 Cycles: Remove some redundant checks 2016-08-25 10:52:00 -04:00
2d1f522a74 Fixed little error in comment
"amount" is for uncountable things, "number" is for countable things.
2016-08-25 16:22:37 +02:00
9444cd56db Depsgraph: Prioritize evaluation of the new scheduled nodes
The idea here is again to finish objects evaluation as soon as possible.

Seems to be giving another 3% speedup in the barber scenes.
2016-08-25 16:08:41 +02:00
84be763be2 Depsgraph: Merge some traversal back on
After previous commit there is no longer measurable difference
in speed and doing all stuff in one go is preferrable here anyway.
2016-08-25 15:51:19 +02:00
eb2cfc3a25 Depsgrpah: Use deque for the flush queue
The idea of the change is to avoid queue growing too long
and handle all the operations as quick as possible.

Gives about 3% speedup on one of the barber shots here.
2016-08-25 15:13:36 +02:00
adfd58aa49 Fix T48788: Diffuse color in BI Textured Solid mode is not updating properly in Sculpting mode
Was caused by 6276726, so for the time being revert the optimization part of change.
2016-08-25 13:48:23 +02:00
6a48318163 Cycles: Cleanup, indentation 2016-08-25 12:33:07 +02:00
86c719f796 Cycles: Fix crash after recent subd fixes
Was happening when object only had curves (doe example, object with hair
particle system and emitter rendering disabled).
2016-08-25 11:31:36 +02:00
086ec8af48 Cycles: Support proper visibility check in single volume intersection step for QBVH 2016-08-25 11:13:35 +02:00
99451698d3 Cycles: Implement proper visibility check in QBVH volume all intersection 2016-08-25 11:09:06 +02:00
29c733e6f2 Fix T49078: Cycles tries to render volume from another render layer when camera is in volume 2016-08-25 10:55:59 +02:00
da36b447c7 OpenGL: de-GLU the transform manipulator
Part of T49042

Also reduced the number of matrix ops.

TODO: replace glBegin/glVertex with new immediate mode
2016-08-24 23:47:45 -04:00
3c533be77e Fix T49112: Alembic unicode path issues on Windows.
Now we pass streams to Alembic instead of passing the filename string.
That way we can open the stream ourselves with the proper unicode
encoding.

Note that this only applies to Ogawa archive, as HDF5 does not support
streams.

Differential Revision: https://developer.blender.org/D2160
2016-08-25 05:19:41 +02:00
bfc5a94292 Windows Packaging : Make package-name confirm to the windows[32/64] naming scheme we use. 2016-08-24 09:37:42 -06:00
438bcc6d28 Cycles: Fix crash when empty mesh has subdivision
OpenSubdiv doesn't like empty meshes, so we need to be careful not to
subdivide when the mesh is empty.
2016-08-24 10:39:00 -04:00
74bd809962 Cycles Standalone: Fix support for subdivision meshes
Changes from microdisplacement work broke previous support for subdivision
meshes, sometimes leading to crashes; this makes things work again. Files
that contain "patch" nodes will need to be updated to use meshes instead, as
specifying patches was both inefficient and completely unsupported by the new
subdivision code.
2016-08-24 10:39:00 -04:00
0ca4e39424 Fix T49148: Blender Crash With B select on Skeleton Sketching 2016-08-24 14:17:26 +02:00
8d8316a057 Cycles: Consolidate the various split CL kernel feature defines within the AMD platform
Reviewers: sergey

Differential Revision: https://developer.blender.org/D2172
2016-08-24 12:32:40 +02:00
389b4feec1 Fix T49128: Ghost of Previous Mask appears in Double Edge Mask
Patch by Ted Schundler (tschundler), thanks!

Differential Revision: https://developer.blender.org/D2163
2016-08-24 11:20:13 +02:00
262adf7d91 Fix T49130: "Inner Edge" / "Buffer Edge" options in the Double Edge Mask are wired to the wrong settings
Patch by Ted Schundler (tschundler), thanks!

Differential Revision: https://developer.blender.org/D2141
2016-08-24 11:00:21 +02:00
22b913a278 Fix T49121: VSE and border render incompatible
For now just check for such incompatible configuration, real fix
requires quite some work to be done.
2016-08-24 10:24:24 +02:00
d99c513afa Cycles OpenCL: use AoS rather than SoA storage for ShaderData.
Fixes part of the performance regressions compared to 2.76b, see T49046, T48876.
2016-08-24 01:45:27 +02:00
e484fe84cd Usual i18n/UI messages fixes. 2016-08-23 22:03:18 +02:00
fe8b197269 Fix T49150: make new 'operator categories' in search menu i18n-aware. 2016-08-23 21:48:16 +02:00
7dc328e8a1 D2078 Windows : add option to prevent find_package from picking up the wrong libraries and use hardcoded paths instead. 2016-08-23 08:48:27 -06:00
36b80b185f Cycles: Fix/workaround for missing AA on Pascal (GTX10x0) cards 2016-08-23 16:32:09 +02:00
eb5cd578b8 Cleanup: Output argument name and const qualifier 2016-08-23 15:56:10 +02:00
a853367fbf Fix T49140: Noise and jitter present at some areas when using ambient oclusion in Blender internal renderer 2016-08-23 15:54:36 +02:00
f732293147 OpenCL: Support multiple ABI libraries on Linux
Solves issue reported in T49144.
2016-08-23 12:23:37 +02:00
e2f323c3ec attempt to fix compilation error on windows 2016-08-23 12:01:55 +02:00
9c3b9f6a83 2D stabilization: Fix broken auto-scale all the recent work
Auto-scale is expected to work just fine now.

Only thing changed now is the pivot point for the scale: it is now
the same as rotation pivot, so scaling happens around weighted median
of the translation tracks. This seems to be what is actually required
for the VFX workflow.
2016-08-23 11:53:35 +02:00
baaa2d6d39 Change Request: use weight centre of location tracks as pivot
Previously, this extension used the translation compensated image centre
as reference point for rotation measurement and compensation. During
user tests, it turned out that this setup tends to give poor results
with very simple track configurations.

This can be improved by useiing the weighted average of the location
tracks for each frame as pivot point. But there is a technical problem:
the existing public API functions do not allow to pass the pivot point
for each frame alongside with the stabilisation data. Thus this
change implements a trick to package a compensation shift into
the translation offset, so the rotation can be performed around
a fixed point (center of frame). The compensation shift will then shift
the image as if it had been rotated around the desired pivot point.
2016-08-23 11:53:35 +02:00
498ba756ab 2D stabilization: by default init anchor_frame to frame 1
It is common in blender to use 1-based counting for
frame sequences (while 0-based is allowed). Thus
initializing to use frame 1 as reference for stabilization
is likely to produce smooth start values in most cases
2016-08-23 11:53:35 +02:00
fd65a64930 2D stabilization: change presentation of target_scale in UI
Alongside with this change, we fix disabling of Autoscale,
because this feature works even when rotation/scale is disabled.
2016-08-23 11:53:35 +02:00
3dbe174440 2D stabilization: flip orientation of the scale parameter
values > 1 will zoom in and values < 1 zoom out

Rationale: the changed orientation is more natural
from a user POV and doing it this way is also more
consistent with the calculation of the other
target_* parameters.

Compatibility: This will break *.blend files saved
with the previous version of this patch from the
last days (test period). It will *not* break any
old/migrated files: Previously, the DNA field "scale"
was only used to cache autoscale. Only with the
Stabilisator rework, "scale" becomes a first class
persistent DNA field. There is migration code to
init this field to 1.0
2016-08-23 11:53:35 +02:00
95d3ca8bc6 Fix inconsistency: expected scale not be subject to scale influence
We should treat all three "target" ("expected") parameters in a similar way:
The "influence" control should only work on the measurement part of stabilisation,
i.e. it should only control the automatic part of stabilisation, while
the target parameters are deliberately set by the user and thus should
even be in effect when the automatic stabilsation is turned down.

It used to be so for location and rotation, but for the scale part,
I re-used the existing code for autoscale, which also had the scale influence
work on the autoscale factor. This was sensible in the old version,
since scale_influence was the only way to control the result. But now,
the user has always total control trough the "target_*" parameters
and thus we should prefer to treat all similar.
2016-08-23 11:53:35 +02:00
1fc1fd8372 OpenGL: draw area resize handle with new immediate mode
The little grabby handle in the corner of an area. Now uses 1 draw call
instead of 6.

Also one version of the (+) icon to show a hidden region. Why do we
have multiple versions of this?

Fixed a harmless signed/unsigned error.

Fixed a GL state error that prematurely disabled blending.

Added imm_draw_filled_circle function, which can be used for drawing
other widgets.

Work toward T49042 and T49043
2016-08-22 23:39:42 -04:00
0dec3d6e22 Build Packaging : Set proper package name on Windows. 2016-08-22 08:15:03 -06:00
eb2ee7212e Fix T49136: full constant Curves with zero Fac input crashes in assert.
The if branches were reordered when the original patch was
committed, which broke the implicit non-NULL guarantee on link.

To prevent re-occurrence, add a couple of unit tests.
2016-08-22 11:11:45 +03:00
28cf9cfd15 NDOF: fix crash on Mac with old drivers
For best results use the latest 3Dconnexion driver. But latest is only
supported on Mac OS 10.9+. We go all the way back to Mac OS 10.6 so
have to deal with older driver versions.

See the original dlclose line for my faulty assumption. Waiting to
unload the driver later fixes the crash. Newer drivers don’t seem to
have this issue.

Also removed WITH_INPUT_NDOF guards as NDOFManager.h takes care of
this. Follow-up to b10d005 a few days ago.
2016-08-21 23:09:30 -04:00
Julian Eisel
ea69d471c8 Sculpting: Avoid calculating and chaching viewport matrices
Really couldn't find where this was used.
2016-08-21 23:59:18 +02:00
ced66f1da9 Update .gitignore to some more generated/non-git-stored files. 2016-08-21 22:40:57 +02:00
0f01f7bb54 Update sphinx_doc_gen.py to work with recent changes (GPv2). 2016-08-21 22:38:06 +02:00
81b1792fb7 Icons: Fix small alignment and shadow issue in prvicons. Add missing copyright notice. 2016-08-21 19:10:02 +02:00
ff8d16399c Cleanup: let's try to avoid too much indirect header imports, makes things harder when some cope changes... 2016-08-21 13:20:49 +02:00
069569f820 Merge branch 'master' into blender2.8
In addition to pack of conflicts listed below, also had to comment out particle part of new Alembic code... :/

Conflicts:
	intern/ghost/intern/GHOST_WindowWin32.cpp
	source/blender/blenkernel/BKE_effect.h
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/depsgraph.c
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/effect.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenkernel/intern/pointcache.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/blenkernel/intern/softbody.c
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/gpu/intern/gpu_debug.c
	source/blender/makesdna/DNA_object_types.h
	source/blender/makesrna/intern/rna_particle.c
2016-08-21 13:18:26 +02:00
be2bc7e0f6 OpenGL: draw color picker wheel with new immediate mode
Includes new imm_draw_lined_circle function that can be used for other
widgets.

Part of T49043
2016-08-20 15:40:08 -04:00
eb717ee979 Gawain: more immediate mode functions
Scanned Blender code for commonly used glVertex, glColor functions.
Implemented immVertex, immAttrib versions of these to ease transition
away from legacy OpenGL.
2016-08-20 15:09:32 -04:00
1e6b3ef1a1 cleanup: unused OpenGL utility code
Keeping unused gla2D code because it might be useful, or inspire
something useful, for Blender 2.8 development.

Also removed an old Mac driver bug workaround. Disabled this before the
2.77 release and nobody has complained.
2016-08-20 13:57:17 -04:00
43bb8f12f4 Fix T49060: crashes during render with no apparent reason...
Was a concurrent access of pointcache from both particle system and UI (time space).

Pointcache not being threadsafe is really an issue to be addressed for its next version,
for now simply locking spacetime (like we already do with 3DView), not ideal fix
but it's working and safe for release.
2016-08-20 16:03:33 +02:00
67dcad4011 Fix T49119: Batch-Generate Previews operator fails.
previews render utils needed to be updated slightly against new behavior of maindata.remove.
2016-08-20 14:49:44 +02:00
8e02b024c0 Fix OpenSubdiv driver crash due to recently added uninitialized field.
For some reason my NVidia linux driver crashes in
glDeleteTextures when the ID is total garbage.
2016-08-20 13:48:29 +03:00
0e5e53c651 Fix crash in OpenVDB highres smoke cache when seeking to frame 0.
This code obviously should also use the cache_fields flag variable,
like the code for reading the lowres data in the same function.
This is because fluid_fields actually represents the old state before
smoke was reallocated to match cache_fields read from the file, and if
it has some fields enabled that aren't allocated any more, it crashes.

This also fixes a reverse glitch: when a file was loaded with
the current frame in the middle of a baked smoke+fire simulation,
smoke appeared immediately, but the fire didn't until the frame
was changed. The reason is the same: after file load no fields
are initially allocated and thus fluid_fields is 0.
2016-08-20 12:13:20 +03:00
36ab737ef7 Alembic export UI: avoid displaying empty box. 2016-08-20 09:30:38 +02:00
cf53389425 Fix T49090: color picking draws wrong when using subsurf in material draw mode.
ccgDM_drawMappedFacesMat was missig a smooth shade model restore, some other
functions were redundantly setting it since we can assume it to be the default
state already.
2016-08-19 23:20:24 +02:00
62e3849f40 Fix T49105: Array modifier displayed in Edit mode crashes on selection, with End Cap enabled.
Origindex can be invalid, code was not fully protected against it...
2016-08-19 17:00:34 +02:00
33fbf9b7e0 Fix broken keymap loading with disabled ndof - revert part of recent rBb10d0058d72da30
ifdef’ing out defines in DNA/RNA is not a good idea, was breaking alternative keymaps loading
from splash screen e.g. (reported by Sergey over IRC, thanks).
2016-08-19 15:51:44 +02:00
793900d46c 2D stabilization: Make interface more compact
Joins some things to the same row and uses aligned columns to get
minimum use of vertical space.

Probably still some tweaks required, but getting there :)
2016-08-19 12:21:13 +02:00
7e02d335c0 OpenGL: don't poll for errors, rely on KHR_debug
Errors are caught & reported by our GL debug callback. This gives us way more useful information than sporadic calls to glGetError.

I removed almost all use of glGetError, including our own GPU_ASSERT_NO_GL_ERRORS and GPU_CHECK_ERRORS_AROUND macros.

Still used in rna_Image_gl_load because it passes unvalidated input to OpenGL functions.

Still used in gpu_state_print_fl_ex as an exception handling hack -- will rewrite this soon.

The optimism embodied by this commit will not prevent OpenGL errors. We need to analyze what would cause GL to fail at certain points and proactively intercept these failures. Or guarantee they can't happen.
2016-08-19 00:52:52 -04:00
5f7611a8f1 Alembic: fix crash accessing invalid objects. 2016-08-19 05:22:46 +02:00
bf4875001d Fix T49111: Automatically add file path suffix for Alembic and Collada
export.

This aligns the behaviour of the file selection with the other
exporters. The Alembic case would fail if the filepath did not have an
extension set.

Also set a default file name for the Alembic export operator in case the
Blender file was not saved before exporting.
2016-08-19 04:42:45 +02:00
Julian Eisel
4d8ac1eaa5 Cleanup: Remove redundant comment 2016-08-19 01:20:35 +02:00
ca5271e637 Cycles: Fix wrong allocator used for spatial builder 2016-08-18 20:47:48 +02:00
f4e4009afd Cleanup: some bad sizeof() usages. 2016-08-18 16:18:58 +02:00
2e6d4270cd Cleanup/security fix: do not use strcpy (at least in new code).
This function is only really secure in a very limited amount of cases,
and can especially bite you later if you change some buffer sizes...
So not worth bothering with it, just always use BLI_strncpy instead.
2016-08-18 16:06:11 +02:00
7b4ba65a87 Cleanup for previous commit (nasty IDE replacing tads with spaces, tsst)
Sorry for the noise :|
2016-08-18 15:21:53 +02:00
b4d36c77da Two fixes for optional ndof & fix bplayer for that...
Seriuosly, guys... Please always check that kind of changes with and without affected option, and in full build case.
2016-08-18 15:18:26 +02:00
7b78532950 Freestyle: fix wrong arg order, and cleanup confusing loop (both reported by coverity).
Error: `origin` and `edge` args were swapped in final `FindOccludee()` call of `ViewMapBuilder::ComputeRayCastingVisibility()`

Cleanup: main for loop in `Strip::createStrip()` was really confusing (though correct),
generated a false positive in coverity scan, now should be cleaner how it loops over its vprev/v/v2
triplet of consecutive items.
2016-08-18 14:37:48 +02:00
26f4f7edca Final UI messages fixes (for this session...). 2016-08-18 14:37:48 +02:00
8a72ec80a0 Fix bplayer (c) after NDOF changes from merwin 2016-08-18 11:28:41 +02:00
12c3002618 Cleanup: ifdef function which is only used from ifdef-ed code 2016-08-18 10:36:06 +02:00
b10d0058d7 NDOF: compile 3D mouse code only if WITH_INPUT_NDOF
When WITH_INPUT_NDOF is disabled, 3D mouse handling code is removed
from:

- GHOST (was mostly done, finished the job)
- window manager
- various editors
- RNA
- keymaps

The input tab of user prefs does not show 3D mouse settings. Key map
editor does not show NDOF mappings.

DNA does not change.

On my Mac the compiled binary is 42KB smaller after this change. It
runs fine WITH_INPUT_NDOF on or off.
2016-08-18 00:22:18 -04:00
a195dd15d4 NDOF: suppress buttons debug log
Accidentally left this in the 3D mouse code. Mac only.
2016-08-18 00:22:18 -04:00
f92a6b8d1b Fix compiler warning after fix for T48913. 2016-08-18 02:24:24 +02:00
e8b5e66db1 Code cleanup to use array.data() rather than &array[0]
(Now without the build errors)
2016-08-18 02:24:13 +02:00
7baf93c711 Revert "Code cleanup to use array.data() rather than &array[0]."
This reverts commit 40b367479c.

Didn't build or solve any known issue. Please don't push changes without
testing them first.
2016-08-17 18:49:18 -04:00
40b367479c Code cleanup to use array.data() rather than &array[0].
These latter can cause MSVC debug asserts if the array is empty. With C++11
we'll be able to do this for std::vector later. This hopefully fixes an assert
in the Cycles subdivision code.
2016-08-17 23:54:47 +02:00
c0161a1bab Fix T48913: cycles viewport render stuck in loop due to non-unique dupli ID. 2016-08-17 23:16:37 +02:00
11e9c5e10a Fix T49104: normal problem in imported Alembic objects
Recompute the normals if the normals are supposed to be varying (e.g. in
the ISchema).
2016-08-17 23:03:34 +02:00
8e7bbe66dd Alembic import: fix scene min/max time computation to take objects with
transform animations into account.
2016-08-17 22:26:50 +02:00
294b0756b4 Fix T49081: Alembic sampling times are not taking start frame into
account.

This resulted in animations always starting at frame 0.
2016-08-17 22:26:50 +02:00
c783e65762 Fix/add some tooltips to 'Object Align' operator options. 2016-08-17 21:24:13 +02:00
e3b5aa9bb1 Fix Bevel crashes T49088 and T48858.
Was calling the fast path for finding edge order in cases
where it should not have been called.
2016-08-17 11:24:31 -04:00
8cac980a28 Cycles: Fix regression where smoke wouldn't show in renders 2016-08-17 10:43:13 -04:00
ab775b6ae9 Fix T49102: Angle option of new GP brush settings is too restricted in value
Now the range is between -90 to 90 degrees to give more customization
options.
2016-08-17 16:23:30 +02:00
47e08ee924 Fix T49086: UV Along Stroke can be set as vector input for environment texture 2016-08-17 14:51:25 +02:00
294eac2991 CMake: Move main platform checks to separate files
Basically title says it all.

The goal is to make platform maintenance easier, so you don't have
to constantly scroll back and forth looking for if() branches to
check which exact platform you're currently working on.

Ideally we also would move option defaults to a platform files,
but that i'm not sure how to implement in a nice way yet.

Reviewers: mont29

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2148
2016-08-17 14:00:29 +02:00
186ee0934f More UI messages fixes and cleanup. 2016-08-17 12:53:24 +02:00
acbef397ac 2D stabilizer: Cover rotation tracks label with enabled flag 2016-08-17 10:55:41 +02:00
1fb8bbcd3e 2D stabilizer: Use exact getter instead of regular one followed with frame check 2016-08-17 10:49:42 +02:00
1e605357b5 2D stabilizer: Remove check for markers count in the track
This would be a real disaster if track has no markers, which we should
not masquerade and detect such weird cases as soon as possible.
2016-08-17 10:47:05 +02:00
069bc4086c 2D stabilizer: Remove redundant rows from the interface 2016-08-17 10:45:52 +02:00
83d94ef4d0 2D stabilizer: One more occurrence of len() in the drawing code 2016-08-17 10:40:34 +02:00
1c633dea1c 2D Stabilizer: Use more consistent RNA naming for properties
Annoying i did not notice this originally, but for RNA we need to keep
things as much consistent as possible.
2016-08-17 10:37:55 +02:00
de28940b15 2D Stabilzier: Don't use len() for checking whether something is enabled or not
This code runs on every redraw and iterates the whole tracks list, which
is something we should avoid.
2016-08-17 10:37:55 +02:00
e392658405 Fix T49100: Replace old tooltip for GPencil brush iterations 2016-08-17 09:11:58 +02:00
34928ca98a GPencil: Change ruler line thickness to make it thicker 2016-08-17 09:05:37 +02:00
d8f036efd6 OpenGL: draw NDOF guide with new immediate mode
This is the rotation pivot guide for 3D mouse input.

Work toward T49043
2016-08-16 21:54:50 -04:00
6b34eed217 Gawain: add v functions to immediate mode
Legacy OpenGL has a matching Vertex3fv for every Vertex3f, and so on. Add something similar to Gawain, just for a few common functions. Might add more as the need arises.
2016-08-16 21:45:17 -04:00
b92d76000d fix #includes for GPU debug
Can now build release and debug.

Close to final version in master (which took several commits).
2016-08-16 17:14:42 -04:00
d41dfe36e5 First set of UI/i18n messages fixes (mostly new GP code). 2016-08-16 22:36:59 +02:00
b90421019b Fix T49097: GP ruler data reinstances GP_Palette Color
If the ruler is saved, a new color was created for each ruler. With the
change, a color is created for the first instance, and it reused in the
following instances. The default color is the current default color for
GP.
2016-08-16 22:29:13 +02:00
b8f27b2514 OpenGL: shaders for simple 3D drawing
These are intended for very simple drawing. No lighting etc.

Shares some fragment code with the 2D shaders.

Similar to their 2D counterparts, but are not combined because of
future plans for separate 2D & 3D matrix stacks.
2016-08-16 14:58:53 -04:00
a67ca5e30c Cleanup unused return value (was making coverity sad). 2016-08-16 18:22:03 +02:00
1e4e140efb More fixes from coverity report. 2016-08-16 18:19:52 +02:00
64a6a86d57 Fix two memleaks found by coverity. 2016-08-16 16:16:22 +02:00
ae475e3554 Fix release build after recent fix for debug one
It's becoming annoying to have public API dependent on build type
and everything. Let's just always have API defined and do stubs
in the function implementation instead.
2016-08-16 15:06:16 +02:00
9368bdab01 Fix depsgraph to compute more accurate links for collision & force.
Current implementation more or less indiscriminately links physics
objects to colliders and forces, ignoring precise details of layer
checks and collider groups. The new depsgraph seemed to lack some
such links at all. The relevant code in modifiers suffers from a
lot of duplication.

Different physics simulations use independent implementations of
collision and similar things, which results in a lot of variance:

* Cloth collides with objects on same or visible layer with dupli.
* Softbody collides with objects on same layer without dupli.
* Non-hair particles collide on same layer with dupli.
* Smoke uses same code as cloth, but needs different modifier.
* Dynamic paint "collides" with brushes on any layer without dupli.

Force fields with absorption also imply dependency on colliders:

* For most systems, colliders are selected from same layer as field.
* For non-hair particles, it uses the same exact set as the particles.

As a special quirk, smoke ignores smoke flow force fields; on the other
hand dependency on such field implies dependency on the smoke domain.

This introduces two utility functions each for old and new depsgraph
that are flexible enough to handle all these variations, and uses them
to handle particles, cloth, smoke, softbody and dynpaint.

One thing to watch out for is that depsgraph code shouldn't rely on
any properties that don't cause a graph rebuild when changed. This
was violated in the original code that was building force field links,
while taking zero field weights into account.

This change may cause new dependency cycles in cases where necessary
dependencies were missing, but may also remove cycles in situations
where unnecessary links were previously created. It's also now possible
to solve some cycles by switching to explicit groups, since they are
now properly taken into account for dependencies.

Differential Revision: https://developer.blender.org/D2141
2016-08-16 15:46:36 +03:00
a74dab86ee Fix redundant declarations after recent changes in GPU debug 2016-08-16 14:40:23 +02:00
b7d656c3b2 2D stabilizer: Revert majority of UI change
For now simply reshuffle option so they keep proper dependency flow.

Benefits:

- Has an ability to hide tracks lists to work with other sliders around.
  Could be really handy to quickly get rid of lenghty lists.

- From a feedback seems to be fitting workflow better.

Things to doublecheck on:

- Feels a bit misordered: first you define whether one want to have
  rotation stabilized, then have tracks, then scale options.

  While this follows dependency flow (which is really good and which
  we should not violate) it has weird feeling on whether things are
  really where they have to be.

- Autoscale controls visibility of max-scale, can we just make it
  active/inactive instead?

- Autoscale replaces slider with label. Can it be disabled slider
  instead to reduce visual jumping (disabled slider prevents user
  input)

Hopefully we'll still want to have collapsable box after re-iterating
over this points, so we don't waste bits in DNA.
2016-08-16 14:25:55 +02:00
cd5116e914 2D stabilizer: Fix compilation error in debug mode 2016-08-16 14:24:06 +02:00
e3576c7bf4 Correct previous commit, need to indent verisoning code 2016-08-16 13:53:29 +02:00
5e8c09921e 2D stabilization: Modify interface so dependency goes strictly from top to bottom 2016-08-16 13:32:11 +02:00
b1677201f9 Rework 2D stabilizator
See this page for motivation and description of concepts:
https://github.com/Ichthyostega/blender/wiki

See this video for UI explanation and demonstration of usage
http://vimeo.com/blenderHack/stabilizerdemo

This proposal attempts to improve usability of Blender's image stabilization
feature for real-world footage esp. with moving and panning camera. It builds
upon the feature tracking to get a measurement of 2D image movement.

  - Use a weighted average of movement contributions (instead of a median).
  - Allow for rotation compensation and zoom (image scale) compensation.
  - Allow to pick a different set of tracks for translation and for
    rotation/zoom.
  - Treat translation / rotation / zoom contributions systematically in a
    similar way.
  - Improve handling of partial tracking data with gaps and varying
    start / end points.
  - Have a user definable anchor frame and interpolate / extrapolate data to
    avoid jumping back to "neutral" position when no tracking data is available.
  - Support for travelling and panning shots by including an //intended//
    position/rotation/zoom ("target position"). The idea is for these parameters
    to be //animated// by the user, in order to supply an smooth, intended
    camera movement. This way, we can keep the image content roughly in frame
    even when moving completely away from the initial view.

A known shortcoming is that the pivot point for rotation compensation is set to
the translation compensated image center. This can produce spurious rotation on
travelling shots, which needs to be compensated manually (by animating the
target rotation parameter). There are several possible ways to address that
problem, yet all of them are considered beyond the scope of this improvement
proposal for now.

Own modifications:

- Restrict line length, it's really handy for split-view editing
- In motion tracking we prefer fully human-readable comments, meaning we
  don't use doxygen with it's weird markup and comments are supposed to
  start with capital and end with a full stop,
- Add explicit comparison of pointer to NULL.

Reviewers: sergey

Subscribers: kusi, kdawg, forest-house, mardy, Samoth, plasmasolutions, willolis, sebastian_k, hype, enetheru, sunboy, jta, leon_cheung

Maniphest Tasks: T49036

Differential Revision: https://developer.blender.org/D583
2016-08-16 13:30:40 +02:00
8619e09107 OpenGL: tweak legacy 2D shader
EXT_gpu_shader4 lets us say “noperspective” in GLSL #version 120 just
like in later GLSL.

Mac shader now matches modern GLSL available on other platforms.
2016-08-15 21:44:44 -04:00
c00b2d8991 OpenGL: ignore deprecated API warnings
Reduces noise from --debug-gpu so we can spot serious errors.

Blender 2.7x uses OpenGL 2.1, we don't care if features are deprecated.

I'll re-enable these warnings for blender2.8 after next merge.
2016-08-15 14:55:09 -04:00
76b6c77f2c Cycles microdisplacement: Allow kernels to be built without patch evaluation
Kernels can now be built without patch evaluation when not needed by the
scene (Catmull-Clark subdivision not in use), giving a performance boost
for some devices.
2016-08-15 11:13:18 -04:00
33c83a289d Fix Cycles OpenCL textures after recent CUDA fix.
kernel_textures.h is included in device_opencl.cpp, so we can't check
__KERNEL_OPENCL__ there.
2016-08-15 16:28:48 +02:00
ad4a01ec0f Fix OpenGL backtrace build errors, without disabling warnings. 2016-08-15 15:36:01 +02:00
988b4e2c80 Tentative compile fix after recent gpu debug changes 2016-08-15 13:46:38 +02:00
2c03d0186a OpenGL: debug context on Windows
Enable based on --debug-gpu at the command line. Linux already works
this way.

This commit in master (2.78 timeframe) is the smallest change that gets
the desired result. I did a similar commit in blender2.8. Most ongoing
GL debug work will go into 2.8, not 2.7x.

In support of T49089
2016-08-15 04:49:07 -04:00
ad6e7a0be1 OpenGL: backtrace on errors (--debug-gpu)
Backtrace so we can pinpoint where the GL error came from. Then fflush
on severe errors in case it's severe enough to crash Blender.
2016-08-15 04:10:54 -04:00
55eb8ce873 OpenGL: enhance debug output
When running blender --debug-gpu

Display which debug facilities are available. One of these, in order of preference:
- OpenGL 4.3
- KHR_debug
- ARB_debug_output
- AMD_debug_output

All messages are logged now, not just errors. Will probably turn some of these off later.

GL_DEBUG_OUTPUT_SYNCHRONOUS lets us break on errors and backtrace to the exact trouble spot.

Callers of GPU_string_marker no longer pass in a message length, just the message itself (null terminated).

Apple provides no GL debug logging features.
2016-08-15 04:06:14 -04:00
23d7ae1843 OpenGL: backtrace on errors (--debug-gpu)
Backtrace so we can pinpoint where the GL error came from. Then fflush
on severe errors in case it's severe enough to crash Blender.
2016-08-15 04:00:59 -04:00
9b0f6fa7f7 Revert "Cycles: Use half storage for 16bit files (e.g. 16bit pngs) as well."
After discussion in IRC, 16bit int should not be converted to half, too much precision loss.
2016-08-15 01:01:43 +02:00
4d41d8be79 Fix CUDA compilation after OpenCL changes. 2016-08-15 00:04:19 +02:00
a18b2ba643 Cycles: Use half storage for 16bit files (e.g. 16bit pngs) as well.
Note: This only works for textures loaded from disk via OIIO, not packed textures. That's still a ToDo.
2016-08-14 22:24:29 +02:00
9396e11180 Cycles microdisplacement: Move call to tessellate() from addon to Cycles
By calling `tessellate()` from the mesh manager in Cycles we can do pre/post
processing or even threaded tessellation without concerning client side code
with the details.
2016-08-14 15:04:21 -04:00
5c0a67b325 Cycles: Add single channel texture support for OpenCL.
This way OpenCL devices can also benefit from a smaller memory footprint, when using e.g. bumpmaps (greyscale, 1 channel).

Additional target for my GSoC 2016.
2016-08-14 20:21:08 +02:00
f1ad3483af get latest OpenGL version on Windows + AMD
When we ask for GL 3.2 compatibility profile:
AMD (Radeon HD 6970) gives us exactly this version
NVIDIA (Quadro K600) gives at least this version
Still need to check Intel behavior

We want *at least* the version requested, plus more recent features if
available.

Both GPUs tested & mentioned above are capable of GL 4.5. With this
commit they both give 4.5 to Blender.
2016-08-14 01:27:00 -04:00
91f04b82a5 early out for ortho grid drawing
Helps most when real-world units are used.

Previous code started at the smallest visible unit (e.g. Inches) then
followed to Feet, Yards, Chains, Furlongs, Miles. Always to the largest
unit of the set, even though most would be way off screen.

New code knows whether it skipped any grid lines for the next unit to
fill in, can stop once all lines are on screen.
2016-08-13 22:33:49 -04:00
90c4ad7387 Mac fixes for new ortho grid drawing
Previous commit works on Windows, found some issues after trying on Mac.

- benign warnings about && within ||
- replaced nearbyint() with round() to avoid floating point environment
surprises
- remquo function appears to be broken on Mac (!) results were way way
off. Replaced with simple division.
- minor tweaks to debug output
2016-08-13 22:13:24 -04:00
db5ad6a79e draw ortho grid with new immediate mode
Work toward T49043, with a side of client vertex arrays.

Not a straightforward port from glVertex to immVertex since Gawain needs
to know how many vertices we'll be drawing *before* we start drawing.

Fixed these not-so-great aspects of grid drawing:
- coarse grids would draw atop some lines from the finer grids
- visible axes would draw atop lines from coarse grid
- axes were drawn even if they weren't in view
- terrible misuse of vertex arrays
- each line issued its own draw call

New code draws each line exactly once. The entire grid is one draw call.

Bonus: I had to / got to learn how the units system works!
2016-08-13 18:14:45 -04:00
e36af2c257 Gawain: increase size of immediate mode buffer
New value of 4MB should handle our needs without taking up too many GPU
resources.

Old value of 1KB was for observing what happens when the buffer fills up
and we need to flush and start a new one.
2016-08-13 16:31:44 -04:00
Luca Rood
da77d9873f Prevent max stiffness values from going under normal stiffness values in cloth stiffness scaling.
When updating the max values under stiffness scaling, they clip at the normal stiffness values
as expected, however when updating stiffness values, you could set them higher than the max
values, and the max values weren't updated accordingly. As the stiffness scaling computes using
the absolute difference between the max values and the stiffness values, you got higher
stiffnesses in scaled areas even though your max is actually lower than the normal stiffness.

This diff fixes that behaviour, by updating the max values to be equal to the stiffness whenever
you set a higher stiffness than the max value.

Also, I have initialized the max values to the same as the stiffnesses, as they were previously
just set to zero, and caused the same problem described above.

Reviewers: lukastoenne

Reviewed By: lukastoenne

Tags: #physics

Differential Revision: https://developer.blender.org/D2147
2016-08-13 19:48:33 +03:00
35a6e540b1 GPencil: Cleanup code 2016-08-13 17:09:19 +02:00
c395d044fc Fix T49082: Intermediate update call when making links can change group socket layout.
Node tree update calls in the middle of a socket loop are dangerous, they can change sockets
on group nodes and link instances in particular. Updates should only happen after the operator
has finished.

Simply removed the extra convenience check for validity now. Worst case an invalid (red) link
is created which can be removed by the user as well and should simply be ignored by node systems.

The update system in nodes needs a complete rewrite to handle complex cases like this, where an
operator may need to react to changes during its execution.
2016-08-13 16:35:34 +02:00
Julian Eisel
fcb78f2402 Add DNA_struct_find (useful for version patching) 2016-08-13 01:40:19 +02:00
Julian Eisel
25872cae29 Fix error in GPencil V2 version patching
GPencil conversion would just always run for file version 2.77.3. This wasn't an issue in master, but possibly for other branches that used the 2.77.3 block.

Wasn't aware that you have to add the asterisk for pointers either, this is kinda weird. Anyway, it's running correctly now.
2016-08-13 01:35:12 +02:00
dfbc51f764 cleanup: ortho grid drawing
Getting this ready for Gawain treatment.

Removed setlinestyle(0) -- solid lines are the default,  hope this isn't
really needed.

Eliminated redundant math.

Arithmetic is still double precision, passed to OpenGL as single
precision. Even though it said GL_DOUBLE before, values were converted
to GL_FLOAT internally.

Use C99-isms for declaring variables close to where they're used.

Minor whitespace tweaks.
2016-08-12 17:20:21 -04:00
04c7d9d566 Depsgraph: tag relations for update when aterial slots changes
New dependency graph puts materials to the graph in order to deal with animation
assigned to them and things like that. This leads us to a requirement to update
relations when slots changes.

This fixes: T49075 Assignment of a keyframed material using the frame_change_pre handler
                   doesn't update the keyframe using the new dependency graph
2016-08-12 14:59:11 +02:00
82268fa100 Depsgraph: Tag relations for update when making datablocks single user
This is mainly required for the new dependency graph where non-object
datablocks are a part of dependency graph.

This solves issue when making mesh shared by multiple objects a single
user one.
2016-08-12 13:58:48 +02:00
bac1279b03 Fix T49045: splash not working correctly on OS X, after recent bugfix. 2016-08-12 01:19:22 +02:00
f3bff6a1a1 Fix T49071: Cycles OSL build problem with oslc compilers that can't find their own stdosl.h. 2016-08-12 01:01:09 +02:00
9d236ac06c Cycles: Enable half float support (4 channels and 1 channel) on CUDA.
Atm OpenEXR half files benefit from this and will use only 1/2 of the memory now. More space for HDRs!

Part of my GSoC 2016.
2016-08-11 22:47:53 +02:00
5ac7ef873b Cycles: Change code order for Image Data Types.
Now we have the 4 component ones first (float4, byte4, half4) followed by the 1 component ones (float, byte, half).
Makes code a bit more consistent and also reduces code a bit when enabling half support on GPU in next commit.

This also exposed a typo in half CPU images for 3D textures, which wasn't used yet, but good to have that one fixed anyway.
2016-08-11 22:30:03 +02:00
3aed54dbd5 Cycles: Fix change of sign warning 2016-08-11 15:09:58 -04:00
013a5c27a5 Cycles: Remove odd definition from CMake file
This was causing Cycles standalone to fail to build from Blender repo.
Hopefully nothing breaks from removing this.
2016-08-11 14:35:43 -04:00
1fe9d671cf Fix T49004 and motion blur of cloth, softbody, etc past the end frame.
Point cache read code contains checks designed to prevent it reading
stale data when the relevant simulation code should instead compute
the next frame from the previous one. However in some situations like
motion blur subframes the simulation can't possibly do it and just
exits. This causes completely incorrect motion blur at or after the
last cached frame.

To fix, add a parameter that tells the cache code whether it should
apply the checks and exit, or read what it can even if stale (true
means exactly same as old behavior).

Doing this in cache rather than clamping the frame number better in
the caller lets it handle the case of incomplete cache that stops
before the official last frame.

Reviewed By: mont29, lukastoenne

Maniphest Tasks: T49004

Differential Revision: https://developer.blender.org/D2144
2016-08-11 13:36:29 +03:00
fdc43f993d Cycles: Use static assert to control structures alignment 2016-08-11 10:12:06 +02:00
a501668cc5 Revert "Cycles Tests: Add test for correct 16 byte alignment of KernelData structs"
Using unit tests is a wrong way to control static behavior of the
application. They should only be used for checking dynamic behavior,
all the rest is easily controllable at compile time.

Doing tests at ocmpile time are actually more robust approach since
we don't have strict policy of runnign unit tests before accepting
any change.

Proper alignment control is coming shortly.

This reverts commit 7c3a06c349.
2016-08-11 10:08:23 +02:00
4565f3d0c8 use new immediate mode for UI_draw_box_shadow
This serves as a good example of the Gawain API. (I’ve thought of a
better way to draw drop shadows, but that can wait!)

Part of T49043.

This is what I had in mind for D1753.
2016-08-11 01:06:17 -04:00
7664d947b3 Gawain: allow partial vertex specification
If you don’t specify a vertex’s color, it will use the color of the
previous vertex. Similar for all other attributes.

This matches the legacy behavior of glColor, glNormal, etc. *except* in
Gawain the first vertex of each immBegin must be fully specified. There
is no “current” color in the new system.
2016-08-11 00:11:48 -04:00
4aadf7331e Gawain: tweak immediate mode API
Should be simpler to use now.

Made vertex format structure private. New immVertexFormat() function
clears and returns the format. Devs can start with add_attrib(format...)
and not have to clear it first.

immBindProgram automatically packs the vertex format if needed.

Updated 3D cursor drawing to use new API.
2016-08-10 18:01:04 -04:00
f537d96286 Merge branch 'blender2.8' of git.blender.org:blender into blender2.8 2016-08-10 16:09:08 -04:00
adbbcefe57 Gawain: fewer glEnable/DisableVertexAttribArray calls
Track previously enabled attrib locations so we can call OpenGL only
when needed.

Same result, fewer GL calls.
2016-08-10 16:08:32 -04:00
7c3a06c349 Cycles Tests: Add test for correct 16 byte alignment of KernelData structs 2016-08-10 20:49:45 +02:00
4d1bf1472e Cycles Standalone: Fix building after microdisp changes 2016-08-10 14:08:13 -04:00
82e65abfef Cycles: Fix KernelIntegrator padding to 16-byte boundary 2016-08-10 20:04:52 +02:00
498b7bd7ce Updated install_deps.sh to OSD 3.0.5 (and switch from git repo to download archive of sources). 2016-08-10 19:19:46 +02:00
ef27d8ec5a Cycles Standalone: Add option to set the tile size from the command line
Since the optimal values depend on the device used, this option doesn't make much sense in the XML.
Therefore, it's now specified via the command line, just like the device itself.
2016-08-10 19:17:03 +02:00
bbbc079a6c Cycles: Correct maximum number of textures on pre-Kepler CUDA cards
Commit c96ae81160 added three data textures and therefore removed three image texture slots, but the value in util_textures.h wasn't updated.
2016-08-10 17:19:16 +02:00
ebdb5490b3 GPencil: Avoid segment fault if new stroke function is called without colorname 2016-08-10 15:51:40 +02:00
8fd4a8ab5d Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/particle.c
2016-08-10 15:06:40 +02:00
774beb7c3c GPencil: Rename color name property to keep consistency in naming 2016-08-10 12:21:18 +02:00
e7a32365cf Gawain: map vertex format to shader inputs
glBindAttribLocation does not take effect until the program is
re-linked. In other words I was doing it wrong!

New code gets attrib locations from program, then remembers the attrib
-> location mapping for subsequent draw calls.

The program and VertexFormat are not modified (makes threading and reuse
easier).
2016-08-10 04:45:23 -04:00
5320a0ad9b Gawain: fix compiler warnings
properly typed function parameters
pointer casting & arithmetic
ptrdiff_t formatting
2016-08-10 02:38:51 -04:00
e4e1b0c7d3 OpenGL: invalidate buffers the modern way
There are older ways to give OpenGL hints about buffer invalidation, but
glInvalidateBufferData does exactly what we want. Use this function when
OpenGL 4.3 is available (Windows and proprietary Linux drivers).

Part of Gawain immediate mode.
2016-08-09 17:17:34 -04:00
c19d527ed8 Fix crash in id remapping of Graph editor.
dopsheet data pointer is not guaranteed to be set it seems...
2016-08-09 20:00:53 +02:00
0433ae3026 Cycles: Use proper property getter 2016-08-09 16:37:40 +02:00
02719521d2 Attempt to fix previous commit for non-c++11 builds 2016-08-09 15:47:51 +02:00
3bbf8fbaeb Fix for isfinite breaking builds when WITH_CXX11 is enabled.
This happens when cmath.h is included after math.h in cpp code.
Kudos to Sergey for pointing this out.
2016-08-09 15:34:38 +02:00
d5a0ae00d0 Fix T48916: Proxy Custom File is broken 2016-08-09 14:58:34 +02:00
1647d89cf1 Fix T49027: Sequence uses too much memory when rendering scene with lots of movie strips
Now we free sequencer cache and close all unneeded FFmpeg handles when rendering.
This is the same logic as image sequence memory freeding.
2016-08-09 14:33:00 +02:00
f990518041 CMake: Once again, don't use find_package to get hardcoded libraries 2016-08-09 12:38:09 +02:00
62b670633c CMake: Remove hardcoded DIR_ROOT for alembic and MinGW
Do it for until precompiled libraries are there so we can allow
MinGW users to compile their own library and pass it via ROOT_DIR.
2016-08-09 12:38:09 +02:00
f0bf33fd1b CMake: Use proper way to define debug/release libraries for alembic
Please do not spread platform+library specific code all over the CMake file,
we already have sections dedicated to that.
2016-08-09 12:38:09 +02:00
bccaa994f1 CMake: Do not force set root folder for Alembic
it is incorrect to set ROOT_DIR and then call find_package.

If something is expected to be in a given location use hardcoded
locations (for the precompiled libraries). Otherwise just use
find_package() and let users to set ROOT_DIT when it is required.
2016-08-09 12:38:09 +02:00
a7f6f900f3 Cycles: avoid making NaNs in Vector Math node by normalizing zero vectors.
Since inputs are user controlled, the node can't assume they aren't zero.
2016-08-09 13:20:22 +03:00
c2a7317d1f CUDA: We don't support Toolkits < 7.5, update error message. 2016-08-09 11:41:25 +02:00
151390069a Bugfix. glDisable with bad enum argument in GPU_texture_unbind
Reported by @panzergame in D1414.

`glDisable` calls with bad enum argument `GL_TEXTURE_2D_MULTISAMPLE` that came from this line:
`tex->target = (n == 1) ? GL_TEXTURE_1D : (samples ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D);`

Reviewers: brecht

Reviewed By: brecht

Subscribers: AlexKowel, yurikovelenov, panzergame

Differential Revision: https://developer.blender.org/D2145
2016-08-09 12:34:52 +03:00
f3d65ad23c OpenGL: debug context on Windows
Enable based on --debug-gpu at the command line. Linux already works
this way.
2016-08-09 03:29:49 -04:00
b7f3fb0ef9 Gawain: fix Windows build error
MSVC is more strict than  gcc or clang about pointer arithmetic. Also
fixed pointer cast warnings.
2016-08-09 02:27:54 -04:00
a77e77599d OpenGL: enhance debug output
When running blender --debug-gpu

Display which debug facilities are available. One of these, in order of preference:
- OpenGL 4.3
- KHR_debug
- ARB_debug_output
- AMD_debug_output

All messages are logged now, not just errors. Will probably turn some of these off later.

GL_DEBUG_OUTPUT_SYNCHRONOUS lets us break on errors and backtrace to the exact trouble spot.

Callers of GPU_string_marker no longer pass in a message length, just the message itself (null terminated).

Apple provides no GL debug logging features.
2016-08-09 01:29:58 -04:00
Julian Eisel
b53eca1711 Cycles: Fix crash in empty scenes
To recreate, just delete default cube and render.

Simple fix, but @maiself or @sergey may want to double-check ;)
2016-08-09 04:32:38 +02:00
040fa75d7b Fix Cycles CUDA adaptive kernel not working correctly after recent closure changes. 2016-08-09 01:31:07 +02:00
d1b9306cd5 Alembic: fix finding boost headers for win32 2016-08-08 16:57:04 -06:00
9893153799 OpenGL: fix FBO error messages
Old code had a mix of framebuffer error codes from OpenGL ES, EXT_framebuffer_object, and desktop GL. We use desktop GL (or ARB_framebuffer_object which acts just like GL 3.x) so I made it compatible with that.

Changed messages to the actual GL_FRAMEBUFFER_XXX symbols. These are less friendly and more accurate. Can easily look up what an error means, unfiltered by what a Blender dev thinks it means.

Kept ES error codes around in case we support that one day. Just flip the #if or use a compile-time option.
2016-08-08 18:02:40 -04:00
903e9ce0c9 Make previous alembic fix only apply to MSVC 2016-08-08 14:17:43 -06:00
39259fc8ab draw 3D cursor with new immediate mode
Replace legacy OpenGL with Gawain. Use shaders instead of fixed
function pipeline.

This simple UI element is shown at startup so is easy to verify things
are working. It also serves as a good example for people converting
other parts of the code.

Part of T49043
2016-08-08 15:45:18 -04:00
01350910fd Fix extra ; warning for OpenCL as well. 2016-08-08 20:01:21 +02:00
8534071521 Alembic/ msvc : Link alembic_d.lib instead of alembic.lib when doing debug builds. 2016-08-08 11:19:41 -06:00
b745a2401b Fix ID types DAG update tagging.
The first character of the ID type was used to tag IDs for updates which
is weak since different IDs can have the same first character (for
example meshes, materials and metaballs), causing unnecessary updates of
unrelated IDs.

Now we use a unique index per ID type to tag for updates, unifying IDs
arrays indexing along the way.

Reviewers: sergey, mont29

Differential Revision: https://developer.blender.org/D2139
2016-08-08 17:51:15 +02:00
5e5d3d6391 BGE: Call DNA_sdna_current_init when launching blenderplayer.
Don't calling DNA_sdna_current_init was creating a crash because a global uninitialized
variable was used when reading blender files.
2016-08-08 15:41:19 +00:00
308cc491cd Cycles: Fix compilation on Cycles unit tests after recent changes 2016-08-08 15:10:03 +02:00
f1040d7d94 Disable depth buffer writes while rendering smoke in the viewport.
Depth buffer values are used by the viewport pan and zoom code to
adjust response scaling factors between mouse and viewport movement.
Letting smoke write to the buffer confuses it and causes the camera
to get stuck and move very slowly inside smoke domains, because it
thinks it is very close to an object.
2016-08-08 13:48:59 +03:00
444422120f GPencil: Cleanup - Rename function for better naming
The old function name was not clear enough
2016-08-08 11:26:28 +02:00
31c34acff0 GPencil: Move polygon to back only if something was drawn
If the user enable polygon draw and press ESC before drawing something,
the last stroke must not be moved back.
2016-08-08 11:26:28 +02:00
c73e4e99a5 OpenGL: simple 2D shader with flat color
Flat color means each primitive will use color from the provoking
vertex.
2016-08-08 04:56:02 -04:00
5c815a6d78 Cycles: Remove set but unused variable 2016-08-08 10:50:23 +02:00
4214b3c44a OpenGL: simplify 3D cursor drawing
Use simple alternating colored lines instead of stippled overdraw.

Reimplement circ function to not use deprecated GLU (T49042). It also
leaves matrix stack untouched.

Remove unused circf function.
2016-08-08 03:17:24 -04:00
6c65e5a00c GPU: bind builtin shader for immediate mode
immBindBuiltinProgram extends Gawain’s immBindProgram to use Blender’s
library of built-in shader programs.

It uses imm prefix instead of GPU_ so people won’t be tempted to call
GPU_unbind_program() afterward.

From my understanding, Apache code is not allowed to call GPL code, so
this function needs to be in the GPU lib.
2016-08-07 22:11:45 -04:00
8e99eec026 Gawain: immediate mode set uniforms for active program
Start simple with vec4 uniforms. Add more later.
2016-08-07 21:30:02 -04:00
Julian Eisel
a0c187667e Cycles: Quiet warning with WITH_OPENSUBDIV disabled
Checked with @maiself, for now going with this simple solution.
2016-08-07 23:20:22 +02:00
aa30f993d2 Cycles: fix objects disappearing when starting or stopping movement.
Another issue with the modified particle motion blur fix: since
pre and post are used as validity markers, they must be set even
if there is no actual motion, like the original bool flags were.
Otherwise an object starting to move or stopping is interpreted
as having invalid blur data and hidden.
2016-08-07 22:45:28 +03:00
Julian Eisel
e635f0413d Fix local view editing broken after changing object's layer from non-local view
Wasn't copying back local view bytes to object after changing layer.

Steps to reproduce were:
* Split 3D view in default startup.blend
* Enter local view in one of the 3D views
* Move default cube to different layer *in the other 3D view* (the one that's not in local view)
* Try transforming object from 3D View that's in local view (should lag)
2016-08-07 20:58:26 +02:00
a58fe05c05 Cycles microdisplacement: Move displacement options from mesh to material settings
Displacement is now a per material setting, which means old files will have to
be updated if they had used displacement. Cool side effect of this change is
material previews now show displacement.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2140
2016-08-07 14:15:20 -04:00
dd1929754f Set WIN32_WINNT for all windows platforms, not just x64 2016-08-07 11:00:35 -06:00
0b68c68006 Cycles microdisplacement: Support for Catmull-Clark subdivision via OpenSubdiv
Enables Catmull-Clark subdivision meshes with support for creases and attribute
subdivision. Still waiting on OpenSubdiv to fully support face varying
interpolation for subdividing uv coordinates tho. Also there may be some
inconsistencies with Blender's subdivision which will be resolved at a
later time.

Code for reading patch tables and creating patch maps is borrowed
from OpenSubdiv.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2111
2016-08-07 11:13:11 -04:00
fc9747fa89 GPencil: Handle drawing on back for polygons
The polygons must move the stroke to back only when polygon is complete
2016-08-07 16:45:02 +02:00
97b0d23357 GPencil: Add option to draw new strokes on back of layer
For artist point of view is very useful to have an option to draw by
default the new strokes on back of all strokes in the layer.
2016-08-07 16:45:02 +02:00
0e25dc4acc GPencil: Fix error in arrange strokes
During code review a field was renamed, but one line was missing.
2016-08-07 16:45:02 +02:00
945b9f4c3f GPencil: Do not disable continuous drawing if click out of drawing area
Do not clear continuous drawing. This code was related to a previous
test and must be removed.
2016-08-07 16:45:02 +02:00
bc7d331767 Don't hide on/off buttons of the Softbody modifier when there's Collision.
From source code history, it seems this behavior is a relic of a very
old limitation when the same object couldn't be both a Softbody and a
Collision object. In those times if somehow both modifiers were added
to an object, Softbody auto-disabled itself and buttons were hidden.

Now however there is no problem having both modifiers on an object,
so there is no point hiding the buttons. The same exact buttons are
available on the physics tab in any case.
2016-08-07 16:45:31 +03:00
e1cdde5d14 Particles: don't output nonsense UV data for Grid distribution particles.
As reported in T48928, From Dupli UV is not supported for grid
distribution, and running the normal code as usual simply produces
nonsense data, because fuv is used to hold orco instead of
interpolation factors for uv, and num is zero.

Since support won't be added in 2.78, just stop outputting nonsense.
2016-08-07 13:48:25 +03:00
912f46d309 Fix pretty stupid mistake in last 'append fix' commit (rB50c017b6eabd). 2016-08-07 10:02:17 +02:00
11ffbfb36a Gawain: bind a shader for immediate mode
How to use:
1) set up vertex format
2) bind a shader
3) draw with immBegin … immEnd
4) unbind shader

TODO: expand this a little, so we can send uniform values to the bound
shader.
2016-08-07 01:35:42 -04:00
6fea42d677 Gawain: initialize & destroy immediate mode
TODO: make this work better with multiple OpenGL contexts
2016-08-07 01:30:45 -04:00
f27516839f fix simple 2D built-in shaders
Forgot the projection matrix.
2016-08-07 01:26:29 -04:00
0ea8430549 Gawain: legacy Mac VBO workarounds
glMapBufferRange is a wonderful function that doesn’t exist on GL < 3.0.

Use the APPLE_flush_buffer_range extension on Mac. It offers several of
glMapBufferRange’s benefits.

Use older “black arts” method to orphan VBOs when we are done with
them. In modern OpenGL this behavior is more obvious.

Add APPLE_flush_buffer_range to Mac requirements. Every GPU is
supported. T49012
2016-08-07 01:05:49 -04:00
e7f9614f07 Gawain: legacy OpenGL compatibility
Apple invented VAOs and exposes them via an extension in legacy GL.
Other platforms use at least GL 3.0 which has VAOs built in.

QUADS were removed from core profile but are useful for immediate-mode
drawing. We’ll have to implement our own QUAD drawing before switching
to core profile.
2016-08-07 01:05:49 -04:00
6b21d22c60 Gawain: fix VAO and VBO binds
Immediate mode no longer leaves its internals bound after use. Part of
transition from a simple prototype app to non-simple Blender, which has
lots of other parts using OpenGL.
2016-08-07 01:05:49 -04:00
a55c5dbcc4 Gawain: flesh out immediate mode
More ways to send values via immAttrib:
2D float vectors
3 & 4 component ubytes (for colors mostly)

New immVertex functions that act more like familiar glVertex. We’ll
find a balance between making this API convenient and keeping it small.
2f and 3f are enough for now.
2016-08-07 01:05:49 -04:00
3eae585791 Merge branch 'master' into blender2.8 2016-08-06 12:57:21 +02:00
566dd4e8a5 Cleanup: add missing ID types to BKE_library_idtype_can_use_idtype(). 2016-08-06 12:56:15 +02:00
9843921288 Merge branch 'master' into blender2.8
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	release/scripts/startup/bl_ui/properties_physics_cloth.py
	release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
	release/scripts/startup/bl_ui/properties_physics_softbody.py
	source/blender/blenkernel/BKE_library.h
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_query.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenkernel/intern/scene.c
	source/blender/blenkernel/intern/softbody.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/space_file/filesel.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_object_force.h
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesrna/intern/rna_particle.c
	source/blender/makesrna/intern/rna_sculpt_paint.c
	source/blender/makesrna/intern/rna_smoke.c
	source/blender/makesrna/intern/rna_space.c
2016-08-06 12:45:03 +02:00
b4cd289cdf Fix T49028: crash when copying a scene without grease pencil data. 2016-08-06 12:43:52 +02:00
28c3bdf50b Cleanup: better not split UI strings when possible... 2016-08-06 11:27:05 +02:00
604302a271 Cleanup some new gpencil rna functions names.
Convention for properties callback names is to prefix them with a version of the RNA struct name.
2016-08-06 11:22:34 +02:00
61050f75b1 Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.

A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.

Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.

Reviewers: sergey, campbellbarton, mont29

Reviewed By: sergey, campbellbarton, mont29

Differential Revision: https://developer.blender.org/D2060
2016-08-06 10:58:13 +02:00
4158737cb2 Add the collision group option to the UI for boid particle physics.
The option already works, just missing from the ui since it
has completely different option set from newtonian and fluid.
2016-08-06 10:49:42 +03:00
277b1d76ff Fix T26658: particles stopped or bounced by 100% permeability colliders.
There were two issues here. One is that the fix done originally for this
bug only checks for colliding with the same face as the single preceeding
hit. If the particle hits an edge or vertex of the collider, it in fact
hits two or more faces, so the loop ends up cycling between first two
of them and reaches the max collision limit.

The fix is to disable the collider for the sim step once a permeability
roll succeeds, by adding it to a skip list. Skipping just one face causes
some particles to bounce at odd angles in case of partial permeability.

The second problem was that the collider bounced back a small percentage
of particles, and the cause seemed to be that the code was set to flip
the velocity if the particle was just past the collider but still within
collision distance. Inverting both values causes a half permeable collider
to stop particles, so it seems that this if branch shouldn't bounce at all.

Test file: {F327322}

Reviewers: lukastoenne, brecht

Reviewed By: brecht

Subscribers: brecht, #physics

Maniphest Tasks: T26658

Differential Revision: https://developer.blender.org/D2120
2016-08-06 10:11:33 +03:00
Julian Eisel
b988309028 Fix wrong property type usage
Prints error on startup.
2016-08-06 06:33:28 +02:00
cd809b95d8 Cycles: Add AttributeDescriptor
Adds a descriptor for attributes that can easily be passed around and extended
to contain more data. Will be used for attributes on subdivision meshes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2110
2016-08-05 23:49:21 -04:00
734e0aca38 Fix for Cycles particle motion blur hiding fix.
My mistake in modifying the patch.
2016-08-06 01:14:32 +02:00
df7be61438 Fix T49023: Segfault when switching brushes while renaming another brush.
rna_GPencilBrush_name_set() was trying to use a mere bGPDbrush as a complete ToolSettings,
was doomed to fail...
2016-08-05 23:36:43 +02:00
8adcd93769 GPencil: Tweaks to layout to try and get the spacing a bit nicer
Currently, the lack of spacing (or rather, odd spacing/clumping) in places
seemed a bit off.
2016-08-06 03:49:14 +12:00
3971c83c96 GPencil: Various UI name fixes
* "Flip direction" -> "Flip Direction"
* "Show drawing direction" -> "Show Directions"
* "Grease Pencil Curves" -> "Brush Curves"
  (I was considering "Brush Response Curves" instead, but that seemed like too much
   of a mouthful)
* "X" for removing a palette. The UI there was more similar to a standard datablock
  selector, so it should use the "+X" combo instead of "+-" combo for consistency.
  (Note though, presets tend to use "+-" instead - e.g. see the Render Settings)
2016-08-06 03:49:14 +12:00
83ee537398 GPencil: Added Ctrl-J hotkey for Joining strokes
(Ctrl-Shift-J is for "Join and Copy")
2016-08-06 03:49:13 +12:00
d4bdb99f26 GPencil: "Join Strokes" tool doesn't leave gaps by default now
Previously, it would insert "invisible" points after the endpoints of the strokes,
so that they wouldn't appear to be joined, but that behaviour could also get quite
confusing as you wouldn't be sure whether the strokes were really joined or not.

To keep the previous behaviour, simply enable the "Leave Gaps" option on the operator
after running it. This setting will get saved between runs of the operator.
2016-08-06 03:49:13 +12:00
50c017b6ea Fix T49022: Crash in BKE_libblock_remap_locked.
Previous check to skip non-linkable IDs resulted in not clearing those skipped ID's newid member,
wich lead to try to remap it later in code.
2016-08-05 17:09:56 +02:00
b7bf9ed2b4 Cleanup: add missing entries to library_query.c ID types switch case. 2016-08-05 16:13:11 +02:00
a2a7316d92 Fix T48366: Freestyle will unnecessary exclude some linked objects.
Group membership testing for including/excluding feature lines was not
accounting for object names possibly further qualified by library file
paths.

Also fixed a few potential (but unlikely) references of uninitialized
variables.

A big thank to Bastien Montagne for the insight on the cause of the
problem and how to fix it.
2016-08-05 22:25:16 +09:00
bed32bf004 Freestyle: minor code cleanup (whites pace). 2016-08-05 22:25:12 +09:00
a0e72a0996 Fix T49014: Append does not work in some cases.
There were actually two issues, one in recent changes and one existing... forever?

I) id_make_local() would never proceed over indirectly linked data, which is required in specific 'append' context.
II) BKE_image_copy() was not setting id->newid pointer of newly copied ID.

About II: don't really know why image copy does its own cooking instead of using generaic ID copy helpers.
Think this should be changed, but that would be after 2.78 now.
2016-08-05 14:48:22 +02:00
c5eb400b7c Cycles: Fix embarrassing typo
Spotted by Mai Lavelle, thanks!
2016-08-05 14:45:54 +02:00
61d7289023 Cycles: Correction to previous commit
The change didn't fix difference render result on CUDA as i've hoped,
so reverting change for GPU rendering for now.

Sorry for the noise.
2016-08-05 12:16:24 +02:00
470cc98945 Cycles: Fix/workaround for wrong/noise render results with GCC6 2016-08-05 11:56:20 +02:00
a8b3ff9e16 Curve Fitting: fix off by one error
In practice this wasn't likely to cause problems, but better fix.
2016-08-05 18:50:49 +10:00
633e93e270 VSE sound strips: draw either the waveform or text label, not both.
Drawing both text and the wave onto a sound strip makes both hard to read,
which is a concrete issue for Hjalti at the moment. This was the simplest
fix I could think of to give him control over what he sees.
2016-08-05 09:33:04 +02:00
4571fdde0e OpenGL: transition to ARB FBOs, remove runtime checks
ARB_framebuffer_object replaces several related EXT extensions. The ARB
version pulls GL 3 FBO features into GL 2.1, useful for Mac platform.
Its functions and enums have no ARB suffix so transition to modern GL
will be seamless!

Extension is checked at startup, so is guaranteed to be true at runtime.

Part of T49012
2016-08-04 21:11:45 -04:00
58697444bb OpenGL: remove runtime check for EXT_gpu_shader4
It’s checked at startup, so is guaranteed to be true at runtime.

Part of T49012
2016-08-04 20:27:24 -04:00
32757d488f OpenGL: require EXT_gpu_shader4 & ARB_framebuffer_object on Mac
Mac’s OpenGL version is furthest away from our target of GL 3.2. This
commit brings Mac closer to other platforms, so that our shaders and
other code don’t diverge too much during development.

According to Apple’s OpenGL matrix these useful extensions are
available on all GPUs that will be able to run Blender 2.8.

Only checked in debug builds; we might need something more forceful.

Part of T49012
2016-08-04 20:25:47 -04:00
1f19fba566 Cycles: hide particles with broken motion blur traces.
Currently cycles cannot correctly render motion blur for objects that appear or
disappear during the shutter window. Until that can be fixed properly, it may be
better to hide such particles rather than let them render as if they were
stationary for half of the frame.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2125
2016-08-05 01:00:41 +02:00
2ce9bab8ce Fix python error when OSL file has wrong extension. 2016-08-05 01:00:41 +02:00
7812d821a5 Add upstream information to curve_fit_nd library 2016-08-05 08:36:17 +10:00
e1a4219523 Curve Fitting: sync with upstream
Correct accidental float use
2016-08-05 08:36:17 +10:00
396dd82428 OpenGL: add simple shaders for 2D drawing
The first two of several new simple built-in shaders (will test these
before adding more). These are intended for the new immediate mode API,
but you can use them just like any built-in GPUShader.

Due to limitations on different platforms, shaders need to work with
GLSL versions 120, 130 and 150. Final Blender 2.8 will be pure #version
150.
2016-08-04 15:59:38 -04:00
797f1896fa OpenGL: immediate mode work-alike
Introducing an immediate mode drawing API that works with modern GL 3.2
core profile. I wrote and tested this using a core context on Mac.

This is part of the Gawain library which is Apache 2 licensed. Be very
careful not to pull other Blender code into these files.

Modifications for the Blender integration:
- prefix filenames to match rest of Blender’s GPU libs
- include GPU_glew.h instead of <OpenGL/gl3.h>
- disable thread-local vars until we figure out how best to do this
2016-08-04 15:36:20 -04:00
Julian Eisel
357480f8c3 Cleanup: Use BKE_gpencil prefix
This is a good point to change this as grease-pencil-v2 branch was just merged, so I hope merge conflicts with other branches are minimal.
2016-08-04 15:11:21 +02:00
5f63797c09 Cycles: copy shader node names over in the blender sync code.
This makes constant folding logs with --debug-cycles more meaningful.
A tiny fix is needed in OSL generator to match recent node refactoring.
2016-08-04 15:19:58 +03:00
29dc04d9bb Cycles: Report human-readable string of compilation error code
It is possible that compilation will fail without giving anything in the
log buffer. For this cases giving a tip about error code will be really
handy.

Patch by @Ilia, thanks!
2016-08-04 12:14:43 +02:00
42d816a3d9 Blender 2.8 requires Mac OS 10.7 or later
MacOS 10.7 “Lion” was the first to implement OpenGL 3.2, which will be
required to run Blender 2.8.

Minimum OS version was unspecified before.
2016-08-04 03:13:20 -04:00
3d9cc4d3f1 support automatic GPU switching on Mac
First attempt. On my laptop (Intel + nVidia) Blender still switches to
nVidia at launch time.
2016-08-04 03:08:13 -04:00
b3cb7e2652 OpenGL: on Mac use legacy 2.1 or core 3.2
This implements Mac part of T49012.

Removed options for EGL, ES2, compatibility profile. None of these
exist on Mac platform.

Create a GL 3.2 core context when requested at build time. Old code
just pretended to support core profile.
2016-08-04 02:36:46 -04:00
Julian Eisel
14720e2e62 Cleanup: Use bool 2016-08-04 03:10:28 +02:00
Julian Eisel
9a8c572121 Minor whitespace correction for eaea4ea51f
Caused by merge conflicts, slipped throug when double checking.
2016-08-04 01:45:00 +02:00
42f6252f2d Fix T47782: popups with wrong size when switching from retina to non-retina on OS X. 2016-08-04 01:11:09 +02:00
Julian Eisel
7830ec5418 UI: Correct tooltips for properties region toggle OP
Now all consistent and using term "properties region" instead of "properties panel". Ideally we had a more generic operator for all those.

Fixes T49006.
2016-08-04 00:26:49 +02:00
0d1f0116fe OpenGL: Blender 2.8 on X11 requires GL 3.0
Implements the Linux part of T49012.

Simplify the options for context creation. No options for legacy GL or EGL or ES2. Select 3.2 CORE or COMPATIBILITY profile at build time.

If that fails, use a GL 3.0 context. This keeps Mesa supported while we work on full 3.2 core elsewhere in the code.
2016-08-03 17:58:24 -04:00
eaea4ea51f Grease Pencil v2 Branch
Improve current Grease Pencil in order to get a better 2D animation tool.

More info in WIKI pages: https://wiki.blender.org/index.php/User:Antoniov

Reviewed By: Severin, aligorith, campbellbarton

Patch by @antoniov, with edits by @Severin.

Differential Revision: https://developer.blender.org/D2115
2016-08-03 23:39:36 +02:00
9d4ea84277 Fix T48164: messed up interface switching between retina and non-retina display on OS X. 2016-08-03 22:45:14 +02:00
eccf5a6f81 OpenGL: Blender 2.8 on Windows requires GL 3.2
This greatly simplifies the options for context creation. No options for
legacy GL or EGL or ES2. Select CORE or COMPATIBILITY profile at build
time.

OpenGL 3.2 core profile will be our final target on all platforms. Until
all our code is ready we can use 3.2 compatibility profile or "legacy"
GL 2.1 on platforms that don't support compatibility profile.
2016-08-03 14:46:29 -04:00
Julian Eisel
980fbb35e2 Boolean modifier UI improvement
This patch improves UI of a recently added solver preference in boolean modifier:

{F331776}

Issue with the current UI is that it shows user unnecessary information and breaks established grid layout.

Reviewers: carter2422

Reviewed By: carter2422

Subscribers: carter2422

Tags: #user_interface, #bf_blender

Differential Revision: https://developer.blender.org/D2136
2016-08-03 19:48:01 +02:00
99b1c1018a Cycles: Recent SSS inline changes broke CPU tests
Very weird, but let's just fall back a bit for now.
2016-08-03 15:27:48 +02:00
285e082a77 Fix T49010: Portals don't work in recent Blender versions 2016-08-03 12:38:25 +02:00
960db4c961 Cycles: Revert recent inline changes for CUDA 8 and sm_50+
This changes actually lead to 2x slowdown. It's getting a bit annoying
because those are the changes to make pre-maxwell cards render with the
same speed.
2016-08-03 11:41:58 +02:00
70100b4ec7 Fix T48283: on OS X, mouse clicks not working properly if application launch takes a long time. 2016-08-03 02:39:29 +02:00
Julian Eisel
75f37feb5c Viewport: Make lights in local view behave like BI and Cycles
Ignore that lights are not included in local view, always render them if they are on the correct layers. BI and Cycles do this as well.
2016-08-02 21:52:08 +02:00
41a4967b30 Fix T49003: Cycles volumes have wrong results after recent microdisp commits
Problem was that sd->prim can be -1 for volumes and was causing check in subd
code to access out of bounds
2016-08-02 15:28:07 -04:00
f593333099 Fix T43220, T47551: collider scaling or rotation causes smoke to explode.
The problem happens because smoke collides only with the surface of the
collider and uses incompressible fluid solver. This means that scaling
the collider tries to compress or decompress fluid within the volume of
the collider, which can't be handled by the simulation. Fast rotation
likely also causes transient scaling due to emulation of arcs by chords.

This can be fixed by finding compartments completely isolated by obstacles
from the rest of the domain, and forcing total divergence within each one
to be zero so that equations are solvable. Physical validity is somewhat
dubious, but without this the solver simply breaks down.

From the physics point of view, the effect of the correction should be
similar to opening a hole from every cell to another dimension that lets
an equal amount of air to pass through to balance the change in volume.

Reviewers: miikah, lukastoenne

Reviewed By: lukastoenne

Subscribers: dafassi, scorpion81, #physics

Maniphest Tasks: T43220, T47551

Differential Revision: https://developer.blender.org/D2112
2016-08-02 19:47:31 +03:00
ae9e9700c2 Fix T43782: smoke simulation problems with multiple touching colliders.
When the colliders are joined, each cell that touches them only gets
velocity contribution once. When there are multiple objects, velocities
are summed, which causes some cells to get 2x, 3x or more than the actual
object velocity.

Fix this by using the average velocity of all colliders touching a cell.

Reviewers: miikah, lukastoenne

Reviewed By: lukastoenne

Subscribers: dafassi, scorpion81, #physics

Maniphest Tasks: T43782

Differential Revision: https://developer.blender.org/D2112
2016-08-02 19:45:45 +03:00
f2d5295abf Cycles: log how many nodes were deduplicated for use in tests.
To make the number more meaningful, also skip deduplicating
obviously unused nodes with no outgoing links.
2016-08-02 19:26:57 +03:00
e54320c488 Cycles: add folding for redundant A to B to A conversions.
As a result of other folding simplifications it may happen that
two type conversion nodes end up directly connected. In some
cases it may be possible to then remove both. A realistic case
might be an optimized out Mix RGB node used to blend vectors.

It seems it's safe to optimize when B is a float3 type
(color, vector), and A is float3 or float.

Reviewers: #cycles, sergey

Reviewed By: #cycles, sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2134
2016-08-02 18:41:15 +03:00
2f5db2e45b Fix T48986: Incorrect normals or tangents when using custom split normals.
(Re)-setting custom normals could cause some unwanted splitting of some of them, leading
to slightly different tangent space. Simply enlarged slightly the threshold detecting
similar normals as identical ones for now, afarid this is the kind of issue that cannot
get a full complete solution for until we drop floats...
2016-08-02 16:08:00 +02:00
08ebd72851 Buildbot: Use annoying hybrid setup of two CUDA toolkits
This is for until we'll solve issues with toolkit 8.0.
2016-08-02 15:32:03 +02:00
500e0e9a3d Cycles: Some more inline policy tweaks for CUDA 8
Makes it so toolkit does exactly the same decision about what to inline,
but unfortunately it has really barely visible difference on GTX-980.
2016-08-02 15:13:34 +02:00
b416168d85 Cycles: Cleanup, trailing whitespace 2016-08-02 14:09:34 +02:00
7b8b16a18c Cycles: Some cleanup in CUDA device file 2016-08-02 14:09:34 +02:00
ad48f13099 Cycles: Include NVCC compiler flags into md5 hash
This way we can easily switch between toolkits without worrying
whether some kernel was compiled with old or new CUDA toolkit.

It's also now possible to switch machine architecture and have
proper cached kernel detected. Not as if it happens every day,
but i did such a bitness switch back in the days :)
2016-08-02 14:09:34 +02:00
fb94f4b884 Fix T48998: 'header input' of rotation transform was clamped in [-PI, PI[ range.
Can't see any reason for this behavior (inherited from 2.4x code), so for now just removing it.
2016-08-02 12:43:03 +02:00
c6398a525d Fix T47591: Smoke keeps both .bphys and .vdb cache files
Delete old caches when changing cache type.
2016-08-02 12:20:54 +02:00
3c70c4f970 Fix T47520: Compositor Node "Filter" Outputs clear image
Make 'Laplace' filter an edge filter operation, since this what it is
typically used for, and such operation does not affect the input's alpha
channel.

Reviewers: sergey, campbellbarton

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D1817
2016-08-02 11:38:03 +02:00
ca6f53d15e Cycles: tweak some folding tests to avoid unnecessary type conversion.
It's easy to connect a simple value to output without forcing
conversion to color by using the Strength socket of Emission.
2016-08-02 12:08:48 +03:00
Julian Eisel
de3181bc38 Fix tmp screen becoming permanent after going fullscreen
Doubt this is intentional.
2016-08-01 22:57:12 +02:00
4067ab38ab Fix T48991: some particles emitted at a distance from object.
The cause seems to be that despite dt_frac being computed as
1/(subframes+1) with integer subframes value, it doesn't always
add up to exactly 1.0 due to precision limitations. If the sum
is similar to 1.00000???, the last subframe is skipped, and all
particles that were supposed to be emitted in that interval are
emitted next frame, with the code working incorrectly due to
skewed time range.

To fix, separate the code from the dynamic timestep feature that
adjusts the last subframe length into a separate function, and
use it even when dynamic timestep is disabled.
2016-08-01 22:14:56 +03:00
538b30250d Audapsace: Make it work with Jack and no libjack-dev package installed
@neXyon, mind backporting it to your upstream? :)
2016-08-01 20:39:54 +02:00
8e015e30b5 Buildbot: Enable proper Pascal architecture 2016-08-01 18:26:53 +02:00
b1d0432bb7 Fix strict compiler flags with older GCC 2016-08-01 18:01:27 +02:00
138362a3c9 Cycles: add unit tests for supported constant folding rules.
Code coverage of different combinations of secondary conditions
is obviously not complete because there are so many of them, but
all main rules should be there.

The reason for CORRECT vs INVALID is that both words have the same
number of characters so calls line up, but look quite different.

Reviewers: #cycles, sergey

Reviewed By: #cycles, sergey

Subscribers: dingto, sergey, brecht

Differential Revision: https://developer.blender.org/D2130
2016-08-01 18:53:20 +03:00
473fc0cf0e Buildbot: Seems quotes are not really needed when passing list 2016-08-01 16:25:03 +02:00
98b8a68f9d Buildbot: Attempt to enable sm_60 CUDA architecture for build slaves 2016-08-01 16:05:33 +02:00
6353ecb996 Cycles: Tweaks to support CUDA 8 toolkit
All the changes are mainly giving explicit tips on inlining functions,
so they match how inlining worked with previous toolkit.

This make kernel compiled by CUDA 8 render in average with same speed
as previous kernels. Some scenes are somewhat faster, some of them are
somewhat slower. But slowdown is within 1% so far.

On a positive side it allows us to enable newer generation cards on
buildbots (so GTX 10x0 will be officially supported soon).
2016-08-01 15:54:29 +02:00
7065022f7a Fix T48901: Blender ignores xinput cursor matrix 2016-08-01 13:51:44 +10:00
a3ce64be5a Cleanup: unused vars, imports, pep8 2016-08-01 11:55:06 +10:00
83ebec7322 Replace pep8 with flake8 checker 2016-08-01 11:02:01 +10:00
8c74ebb64f Support Auto-Clamped Handle for Curve-Mapping
This patch supports auto-clamped handles for curves,
useful since without this it can be difficult to have 'flat' sections of a curve.
2016-08-01 09:06:40 +10:00
36a790653c Fix T48980: crash when loading a file that contains a custom node tree.
Syupid logical mistake in own recent rB018d336cbd51...
2016-07-31 20:07:33 +02:00
Julian Eisel
dda2d1dbea Correction to 0f2ff52c08
This info is shown while dragging, so should stay where it was.
2016-07-31 18:38:21 +02:00
Julian Eisel
0f2ff52c08 Enable Undo for "Add background Image"
Enabled the Undo option for the operation "Add background Image". This is to treat adding a background image like opening an image. This behavior is useful when a background image is add using 'drag and drop'.

Reviewers: Severin

Reviewed By: Severin

Subscribers: brecht

Tags: #bf_blender

Maniphest Tasks: T47050

Differential Revision: https://developer.blender.org/D1725
2016-07-31 17:55:32 +02:00
feac208557 Fix mistake in Cycles mix node multiply constant folding. 2016-07-31 15:00:40 +02:00
81f4bc1665 Cleanup: reduce Vector_getseters size using macros 2016-07-31 20:43:52 +10:00
4734781653 Correct own error in last commit 2016-07-31 19:12:40 +10:00
64d4d6b134 Support limiting collisions by group for softbody and particles
This feature is extremely useful for layering multiple cloth objects,
and there is no reason there shouldn't be the same kind of feature for softbody.
2016-07-31 18:57:19 +10:00
710ab5be36 Cleanup: spelling, style 2016-07-31 17:41:05 +10:00
a96c9def6f PyAPI: minor optimization for dictionary creation
Pass size when its known.
2016-07-31 17:22:04 +10:00
e97ab8347a PyAPI: fix leak in unlikely case converting idprops fail 2016-07-31 16:59:08 +10:00
2dfc954c4a PyAPI: Add PyC_UnicodeAsByteAndSize
Read the string length from Python directly when assigning id-properties
2016-07-31 16:52:44 +10:00
409316434c Docs: add initial idprop.types API docs 2016-07-31 15:40:40 +10:00
516f890b63 Docs: simplify EXCLUDE_MODULES handling 2016-07-31 15:40:40 +10:00
0ec1be1816 Cleanup: capitalize Blender & Python 2016-07-31 15:40:40 +10:00
fc36c2f70e simplify redundant conditionals
The redundant terms were harmless but check an expression we already
know to be true (from earlier in the same conditional).

Found by PVS-Studio T48917
2016-07-31 01:22:36 -04:00
6fffe6cfcc Improve description for use_self py-driver option 2016-07-31 14:23:14 +10:00
3fe7aacdf7 Curve Fitting: circular fit could give NAN handles
Fitting lines that exactly double back on themselves could give NAN length handles.
2016-07-31 13:58:14 +10:00
8fab198aae Cleanup: rename btree (incorrect & confusing) 2016-07-31 12:05:53 +10:00
b2e16c5700 Fix Cycles OpenCL compile error on Windows. 2016-07-31 02:02:28 +02:00
01d5d2853b Py-Driver: re-use self PyObject when its unchanged. 2016-07-31 11:46:36 +10:00
55f481d052 Py-Driver: use intern strings
Avoids managing strings inline
2016-07-31 11:46:36 +10:00
873a623be4 Fix for previous commit changing the addons submodule. 2016-07-31 03:23:51 +02:00
9b6ed3a42b Cycles: refactor kernel closure storage to use structs per closure type.
Reviewed By: dingto, sergey

Differential Revision: https://developer.blender.org/D2127
2016-07-31 02:34:43 +02:00
1776f75c3b Cycles: constant fold add/mul type nodes with known 0 and 1 arguments.
These values often either turn the node into a no-op, or even make it
evaluate to 0 no matter what the other input value is, thus allowing
deletion of a branch of the node graph that otherwise is not constant.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2085
2016-07-31 02:34:34 +02:00
ea2ebf7a00 Cycles: constant folding for RGB/Vector Curves and Color Ramp.
These are complex nodes, and it's conceivable they may end up constant
in some circumstances within node groups, so folding support is useful.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2084
2016-07-31 02:18:23 +02:00
f4bcc97729 Fix Cycles OpenCL not always allocating enough space for closures. 2016-07-30 23:21:03 +02:00
34a639bd0f Fix CUDA warning, due to extra ; at the line ending. 2016-07-30 21:37:20 +02:00
1e2efbc908 Cycles OpenCL: use #line directives for better error messages. 2016-07-30 18:25:52 +02:00
6dc72b3ce6 Cycles OpenCL: detect incorrect usage of SOA members in the split kernel. 2016-07-30 18:25:52 +02:00
c937a42c61 Fix Cycles OpenCL address space compile error with amdgpu-pro drivers on Linux. 2016-07-30 18:25:17 +02:00
e20d306ffa Cleanup: pep8 2016-07-30 18:41:07 +10:00
de103497c4 Fix bplayer (c) 2016-07-30 10:35:30 +02:00
8018f5bd35 Cleanup: pep8 2016-07-30 18:17:11 +10:00
6e9ad094b2 Cleanup: minor changes from last commit
Un-indent blocks, rename vars.
2016-07-30 16:48:44 +10:00
4e845e0670 Py-Driver: add 'self' option
Drivers can use this to refer to the data which the driver is applied to,
useful for objects, bones, to avoid having to create a variable pointing to its self.
2016-07-30 16:46:13 +10:00
362b3bbe58 Cloth Simulation: add time scale property
This setting can also be animated, to create a "time warp" effect.

D2122 by @LucaRood
2016-07-30 15:14:26 +10:00
7a4353160c Cloth: option to use dynamic base mesh
This adds the ability for cloth simulations to respect changes in the underlying mesh.
So you can for instance, animate shape keys, armatures, or add any deformation modifiers (above the cloth modifier).

This is mainly useful for (but not limited to) cartoon animations,
where your character might stretch or change shape, and you want the clothes to follow accordingly.

D1903 by @LucaRood
2016-07-30 14:57:48 +10:00
ca93ebee7f Cloth: UI cleanup & quality hard limit removal
D2121 by @LucaRood
2016-07-30 14:55:07 +10:00
ca983d1825 Cleanup: pep8 2016-07-30 09:00:41 +10:00
3d7cf808b8 Add copy/make_local to movieclip datablock.
As title says... Copying tracking data from movieclip was not the simplest thing...

Reviewers: sergey

Differential Revision: https://developer.blender.org/D2126
2016-07-29 23:13:31 +02:00
4d79fa8382 Gtests: Re-apply strict compiler fixes 2016-07-29 22:19:30 +02:00
37933cb048 Cycles: Add fundamentals to test constant folding
This commit adds some easy to use way to check whether the graph
was properly optimized. The idea is based on using mock glog sync
which keeps track on all messages and expects specific log message
to appear in the logging.

This means each optimization step should report that it optimized
something (specifying what exactly was optimized) and what was used
for optimization.

There's also some ease-ish way to define shader networks which we
might want to make a bit more global and available for all tests
in the future.

For now only RGBToBW node is covered as an example, really hope
to get help from active guys in the community to finish covering
all existing optimization cases. Ready to fix any possible issues
with builder when needed tho :)
2016-07-29 22:19:30 +02:00
ac655be0e3 Add GMock library which is responsive for dealing with mock objects 2016-07-29 22:19:30 +02:00
c6f468d8ed GTests: Update to a newer Git version
Required to get GMock working with GTest.
2016-07-29 22:19:30 +02:00
Julian Eisel
574bbf5d1d Fix missing redraw of timeline when changing GPencil layer settings 2016-07-29 20:42:57 +02:00
e4255a9535 Cleanup space/tabs, Grrr. 2016-07-29 18:49:50 +02:00
8e00406261 Fix a bunch of missing expand calls in object/particle physics area, was breaking linking of those.
Initial report/patch by Alexander Gavrilov (@angavrilov), found more on the road.

Nice demo of why we should use libquery ID looper in read code too - but that's for another day
(also because read code needs to take care of some deprecated pointers sometimes)...
2016-07-29 18:47:43 +02:00
ceb03a4d32 Cycles: Fix wrong projection coordinates for points behind the camera
Points behind camera will be flipped on projection, but that did not
happen.

This solves second issue reported at T48848.
2016-07-29 17:30:24 +02:00
1d154fe271 Cycles: Fix wrong check for object is behind camera after recent fixes 2016-07-29 17:30:24 +02:00
cdc7a24d7b Fix T48971: Append creates linked image textures if object has shape keys.
Hating all those not-so-real ID types... Here there were two causes for the issue:
1) Linked shapekey ID was made local twice (once from mesh's make local, once by itself).
   Solved by not explicitely making shapekeys (nor any other non-linkable datatype) local.
2) Key->from 'back pointer' to its owner was messing 'still in used' detection of linked data
   after localization. Fixed with a hack for now, thinking correct solution might actually
   be to not consider this pointer at all in libquery ID looper, since it's nothing like
   and actual usage of mesh/lattice/curve.

Again, shapekeys as ID is a joke, those should be mere struct, they have absolutely nothing to do in Main, period. :(

Point 2) still demonstrates the need for better handling of IDs dependencies though,
so far we only hit corner cases, but think there could also be valid cases generating those
'dependency cycles' between IDs (ID a using ID b which uses ID a), this will have to be addressed some day...
2016-07-29 17:00:29 +02:00
821394937f Remove "debug build only" event printing.
This makes no sense since user usually only has release build... And those noisy printings are
behind debug flag anyway, so really no reason to only print them out in debug build.
2016-07-29 15:12:56 +02:00
c9134d86f0 Cycles: Fix strict compilation warning 2016-07-29 15:06:13 +02:00
899947c89e Fix T48679: Bone transform only alters between translation and rotation
There was some smart code in the transform which would alter between translation
and rotation based on whether bone is connected or not and whether translation is
locked or not.

It could be handy to also fallback to scale if both rotation and translation are
locked.
2016-07-29 14:47:23 +02:00
992257cfa0 Cycles: remove narrowing conversion from recent commit 2016-07-29 04:00:37 -04:00
66e2e2484c Cycles microdisplacement: move subdivision options to subsurf modifier
Subdivision options can now be found in the subsurf modifier. The modifier must
be the last in the stack or the options will be unavailable. Catmull-Clark
subdivision is still unavailable and will fallback to linear subdivision instead

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2109
2016-07-29 03:37:55 -04:00
c96ae81160 Cycles microdisplacement: ngons and attributes for subdivision meshes
This adds support for ngons and attributes on subdivision meshes. Ngons are
needed for proper attribute interpolation as well as correct Catmull-Clark
subdivision. Several changes are made to achieve this:

- new primitive `SubdFace` added to `Mesh`
- 3 more textures are used to store info on patches from subd meshes
- Blender export uses loop interface instead of tessface for subd meshes
- `Attribute` class is updated with a simplified way to pass primitive counts
  around and to support ngons.
- extra points for ngons are generated for O(1) attribute interpolation
- curves are temporally disabled on subd meshes to avoid various bugs with
  implementation
- old unneeded code is removed from `subd/`
- various fixes and improvements

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2108
2016-07-29 03:36:30 -04:00
f74645578c Missing free for single-sided edge-slide failure 2016-07-29 14:24:03 +10:00
e0c7aaf5ad Fix Cycles OSL hair BSDF inconsistencies with SVM. 2016-07-29 03:29:05 +02:00
52fb441c13 Fix Cycles ctests not always deleting fail.png files on success. 2016-07-29 03:29:05 +02:00
e30f9b04fc Fix use of uninitialized variable in Cycles, mostly harmless. 2016-07-29 03:29:02 +02:00
66552ca586 Make ID types typed enum, to easily spot missing ones in core switches of library.c
Note that all deprecated/non-real ID types are kept as defines.
2016-07-28 19:32:36 +02:00
035b40337a Fix T48965: Cannot Append Palette As Local Datablock.
Palette and PaintCurve were totally missing from id_copy/id_make_local switch... :/
2016-07-28 19:32:36 +02:00
d834759423 Cycles: Fix difference in Ashikhmin Shirley shader between CPU and GPU
The issue was caused by some NaN appearing in calculations.

Visible with scifi_armor_concept.blend from the cloud.
2016-07-28 18:46:29 +02:00
85ccdf37c0 Cleanup: Indentation 2016-07-28 14:17:35 +02:00
f86aa6a879 Fix T48838: Tiling sculpt problem with custom brush 2016-07-28 14:01:15 +02:00
cba8e03672 Fix T48962: Edge-slide, random edge switch order 2016-07-28 21:50:41 +10:00
df00529648 Cycles: Fix missing mesh flags update when tweaking shaders
This is a bit weak, but better than tagging whole mesh manager for update.

Maybe we'll solve such dual-look up in the future.

This commit finally solves T48963: Noise when changing Diffuse node to Emission node
2016-07-28 12:37:44 +02:00
9f18e3acd6 Cycles: Fix wrong order of light manager update tag
Shader's has_surface_emission will only be known for sure after compilation.
2016-07-28 12:31:01 +02:00
d3d1313ca4 Cycles: De-duplicate more checks around light emisive meshes
Once again, should be no functional changes.
2016-07-28 12:28:31 +02:00
87717c6449 Cycles: De-duplicate check for MIS shaders in meshes
Should be no functional changes.
2016-07-28 12:27:05 +02:00
aaac4e965e Cycles: Add some extra logging for light debugging 2016-07-28 12:13:11 +02:00
402d4ea0b6 DupliObject: Remove unused and confusing index argument from the context 2016-07-28 10:49:31 +02:00
3673a5adba Curve Fitting: Use normalized projection function 2016-07-28 18:33:14 +10:00
5ecc6a824a Fix T48404: Translate fails w/ snap orientation option
Rotate the object around the snap-target so it meets the snap-point.
2016-07-28 18:16:31 +10:00
8df5f97c2c Cleanup: unused transform member 2016-07-28 18:16:31 +10:00
d66a27de2e Fix T48961: Material slots become easily desynced over linked duplicates.
Own mistake in recent changes (split to test_object_materials()/test_all_objects_materials()).
2016-07-28 09:23:46 +02:00
d60acd0e94 Fix crash fitting single point curve 2016-07-28 14:37:55 +10:00
251349c3c2 Merge branch 'master' into blender2.8 2016-07-28 12:00:58 +10:00
3a4c307652 Use COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll methods
This mostly affects physics panels. Any engines relying on
RenderEngine.use_game_engine flag to show/hide panels will need to be
updated. The COMPAT_ENGINES technique is how we usually deal with this.
One issue with use_game_engine is that I cannot find a way to set it; it
appears only the BGE can set it. This means (without this commit)
external RenderEngines cannot get rid of the default physics panels.

The RE_GAME flag (the C flag behind use_game_engine) is pretty hacky
and we should look into removing its usage where possible.
2016-07-27 19:00:35 -07:00
a27acefd0c Fix T48951: Crash refreshing some popups
Fix for T48874 caused popups to be tagged to be refreshed, that didnt support it.

Tag popups that can't be refreshed.
2016-07-28 11:16:11 +10:00
Julian Eisel
8f16181e9c Add comments on behavior of spacedata and regionbase lists 2016-07-28 02:36:12 +02:00
Julian Eisel
c59b21feec Fix own mistake from c05363e889
Didn't know slink->regionbase is removed when area is active. Don't see why this is done, but it's confusing :S
2016-07-28 02:27:39 +02:00
b645e7081d Fix T48790: Cycles render bug with zero strength lights. 2016-07-27 23:09:38 +02:00
Julian Eisel
c05363e889 Fix crash closing Blender while in rendered local view
Happens because it was always using regionbase of active/visible area, not the correct one of the (possibly inactive) 3D view. Was pretty hidden because you had to be in local view to trigger it.
Could also remove ScrArea * argument from SpaceType.id_remap now, but leaving in there to avoid bigger changes (might also be useful for some case).

Steps to reproduce:
* Default startup.blend
* Enter local view with default cube (/-key)
* Render (or open a different editor where the 3D View is)
* Close Blender - should invoke crash
2016-07-27 21:05:44 +02:00
Julian Eisel
4559229163 Fix memory leak when closing Blender with operator popup open
Steps to reproduce:
* Default startup.blend
* RMB-Click on "Cube" item in outliner
* Select Remap Users
* Close Blender using window 'x' button
2016-07-27 19:45:43 +02:00
e4646c52c0 Fix T48946: Blender+Tahiti+DRI3+Unity+Linux GUI corruption/not rendering
Enable triple buffer by default for AMD cards on opensource driver.

Should be safe now, since it was only old cards causing problems,
which we don't support now most likely anyway.
2016-07-27 16:06:18 +02:00
25bd01f2f7 Avoid creating multiple outputs connected to the same socket when creating a node group
This patch fixes the annoyance that when creating a node group where one of its nodes is connected
to several other nodes, a separate output will be created for each link, even though they're all
connected to the same socket in the group.
Now, before adding an output for an outgoing link, the existing outputs are checked to find whether
any output is already connected to the same socket. If such an output is found, it is reused instead of
creating a new one.

Reviewers: Severin

Subscribers: Blendify

Differential Revision: https://developer.blender.org/D1836
2016-07-27 15:56:48 +02:00
d7bd64df5d Fix T48061: Crash with adaptive domain and cases when there's no smoke 2016-07-27 15:40:32 +02:00
ae881ddf43 Fix T48760: Changing Renderlayer Compositor node Layer does not update enabled outputs until script is finished 2016-07-27 15:17:15 +02:00
2e38c07e48 Cycles: Style, placement of asteric in pointers
Seems we are using `void *` much much more often in Cycles.
2016-07-27 14:10:09 +02:00
183874841b Cycles: Some minor tweaks to emission sharder
- Nodification of shader nodes changed default strength from 10 to 1.
  If that was intentional, IMO should happen as a separate commit.

- Fixed indentation.
2016-07-27 14:05:22 +02:00
5f95ffe350 Fix T48829: Memory leak on Blender Exit
It was possible to have missing outlink but GPUNodes in material.
2016-07-27 10:59:09 +02:00
3d8c2e25a3 Fix T48950: Movie Clip mode segfaults
Missing linking code in blenloader.
2016-07-27 10:18:54 +02:00
Julian Eisel
24b8e781f6 Correct UI names of ID types
Also correct typo.
2016-07-26 20:25:55 +02:00
Julian Eisel
3c59a5068f More useful block name for report popup blocks
Report popups simply reuse popup menu code, so their blocks got "UI_popup_menu_begin" assigned as name, which was a bit misleading. Now uses "UI_popup_menu_reports".
Ideally they'd have their own popup code.
2016-07-26 20:25:55 +02:00
c1fd97f15d Fix T45936: invalid cycles motion blur for particle rotation and children.
Commit rB709ca0ece changed how rotation was handled for particles so
that unless actual rotation physics is enabled, there is no rotation.
However it only updated ptcache_particle_read, forgetting to change
exactly the same code in ptcache_particle_interpolate.

This means that for subframes old code that computes a rotation from
velocity is used, resulting in completely different rotation than for
integer frames. This causes rotational motion blur by itself, and also
mangles motion blur paths of child particles.

Reviewers: sergey, lukastoenne

Maniphest Tasks: T45936

Differential Revision: https://developer.blender.org/D2124
2016-07-26 18:06:42 +02:00
f3f10e4515 Fix T48813: Custom icon is not drawn on header / addons prefs panel.
For now use 'brute force' and refresh whole UI when new icons get rendered.

See comment of T48813 for ideas about how to handle that in future (2.8 project ?).
2016-07-26 17:55:18 +02:00
f31f740bd0 Cycles: Proper fix for buffer overflow in volume intersect all 2016-07-26 17:16:23 +02:00
7030794171 Cycles: Revert previous fixes to intersect_all functions
While they prevent legit write past the array boundary error
those fixes introduced regression in behavior when having exact
max_hits transparent intersections and nothing else.

Previous code would have considered such case a totally opaque,
but it's not correct.

Fixes T48941: Some materials don't get transparent shadows anymore
2016-07-26 17:16:23 +02:00
b91aea6096 Fix issues in ID usages checks - we are not interested in self-usages here.
Drivers or constraints referencing self object could break deletion of proxy objects
(due to their ambiguous, half-local, half-linked status).
2016-07-26 15:12:43 +02:00
01e3141ce6 Fix T48902: MCE Dopesheet does not respect Left Click select
Make the operator consistent with animation dopesheet now.
2016-07-26 14:39:06 +02:00
711d3a8a2b Depsgraph: Use proper check whether ID is an object
Fixes bug which resulted in making it so layers from all
layers are getting updated.

Reported by Juan Pablo Bouza.
2016-07-26 10:49:54 +02:00
40a0fa8a8f Depsgraph: Use proper unsigned int bitfield for layers flags 2016-07-26 10:45:07 +02:00
eececb0d80 Curve Drawing: use more closely spaced samples
Re-fitting makes better use of more samples.
2016-07-26 06:43:59 +10:00
4da8543d0d Resolve undefined M_PI w/ MSVC2013 2016-07-26 05:28:13 +10:00
6e131ce075 Call to python3 for stand-alone scripts
Needed since Debian & FreeBSD both move away from keeping a synlink to `python`.
2016-07-26 05:18:00 +10:00
1ea410c559 OpenSubdiv: Fix opensubdiv option obscuring the interface 2016-07-25 18:36:14 +02:00
1870e166de Cleanup: factorize the 'ensure local' part of datablock copy into a single BKE_id_copy_ensure_local function. 2016-07-25 16:16:35 +02:00
d9cc3ea2c6 Cycles: Fix rays parallel to the surface in the triangle refine and MultiGGX code
In the triangle intersection refinement code, rays that are parallel to the triangle caused a divide by zero.
These rays might initially hit the triangle due to the watertight intersection test, but are very rare - therefore, just skipping the refinement for them works fine.

Also, a few remaining issues in the MultiGGX code are fixed that were caused by rays parallel to the surface (which happened more often there due to smooth shading).
2016-07-25 16:14:25 +02:00
83ae0a0e06 Cycles: Calculate differentials in the Multiscattering GGX closures
The Multiscattering GGX closures didn't set the omega_i differentials, which could cause undefined behaviour.
2016-07-25 16:14:25 +02:00
988ec3c40c OpenSubdiv: Support shadeless shading 2016-07-25 15:38:28 +02:00
c967a381fa OpenSubdiv: Fix missing support of flat shading in textured viewport 2016-07-25 15:27:38 +02:00
27db7ef81d OpenSubdiv: Use proper material index 2016-07-25 15:17:37 +02:00
b1532493c2 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/particle.c
2016-07-25 15:07:17 +02:00
e7721f5ec8 Cycles: Fix SSS with spatial splits and motion blur 2016-07-25 13:55:03 +02:00
a4db868092 Resolve build error on OSX 2016-07-25 20:30:24 +10:00
bbf62931de Cleanup: debug-only variable. 2016-07-25 09:31:56 +02:00
f4cb6d45d5 Error in curve update, uninitialized var use 2016-07-25 15:12:46 +10:00
2aa5e44b5d Curve Drawing: Use cyclic for stroke with near start/end points 2016-07-25 14:55:16 +10:00
a323d8edbf Curve Drawing: Add option to use new refit method 2016-07-25 14:55:16 +10:00
2418daede5 Curve Fitting: Add alternate 'refit' method
This is an alternative method for fitting a curve which incrementally simplifies the curve, then re-fits.

Generally gives better results, also improves corner detection.
2016-07-25 14:55:08 +10:00
f23fecf306 Fix use of uninitialized variable in recent SSS fix. 2016-07-24 16:40:30 +02:00
f283aa61c5 Fix T48397: Can not bake tweaked NLA
We need to leave tweak mode before trying to modifiy the action as doing
so will leave Blender in a semi-corrupted state.

Reviewers: #animation

Reviewed by: aligorith

Maniphest Tasks: T48397

Differential Revision: https://developer.blender.org/D2119
2016-07-24 03:18:40 +02:00
e4efa16b00 Fix T48663: The Soft Light blend type layer make the color darker in the
3D view

There was a misusage of the `outcol` and `texcol` params. The actual
formula should have been:

  incol = facm * outcol + fact * ((one - outcol) * texcol * outcol +
outcol * scr);

To make sure the result is consistent with material mode, reuse the
material blend function (mix_soft), similarly to what most other texture
blend modes do.
2016-07-24 01:04:54 +02:00
4cbefde47c Audaspace: fix incorrect parameter check in python API.
Found by PVS-Studio T48917
2016-07-23 13:35:36 +02:00
8001854083 Cleanup: style 2016-07-23 18:52:18 +10:00
6ef37faa58 Cleanup: warning 2016-07-23 18:52:18 +10:00
bd11d917c1 fix atan2f input conditional
Suspicious conditional found by PVS-Studio T48917

Original code (from Blender’s initial open-source commit!) looks like
it’s testing inputs to atan2f, to avoid undefined function values.
Passing xn=0 does *not* always evaluate to 0 though… I’m not sure if
this is a coding error or was done for a desired visual result.

Also changed xn==0 to xn>=0 to avoid function call in more cases.

Good description and visualization of atan2f function:
http://en.cppreference.com/w/c/numeric/math/atan2
2016-07-22 21:00:12 -04:00
164575af29 OpenSubdiv: Properly respect Subdivide UVs option 2016-07-22 17:53:00 +02:00
Julian Eisel
7ca4cf2be5 Fix crash using ID remapping on invalid ID pairs
Missing NULL checks caused crash in BKE_reportf formatting.
2016-07-22 17:13:23 +02:00
9c63878085 OpenSubdiv: Initial support of UV maps in material shading mode 2016-07-22 16:12:03 +02:00
b2f91d8acf OpenSubdiv: Use BLI module math functions
It became rather annoying to have those functions duplicated.

Surely, it's not really nice it's actually a bad level call,
but similar thing is happening in OCIO and Cycles.

IMO, it's better than having functions re-implemented, and
have this solved with new OpenGL pipeline.
2016-07-22 15:13:42 +02:00
165f710519 OpenSubdiv: Make drawing code a bit more flexible for FVar width 2016-07-22 15:08:18 +02:00
ccd51bb922 OpenSubdiv: Properly support active UV layer in textured view 2016-07-22 14:56:15 +02:00
48c4b700dc OpenSubdiv: Lay down fundamentals to support multiple UV maps 2016-07-22 14:56:15 +02:00
98970f71fe OpenSubdiv: Get number of UVs from topology refiner
This allows us to store more than one UV layer in the UVs array.
2016-07-22 14:56:15 +02:00
177c4aff8b OpenSubdiv: Cleanup, please don't use insanely long lines 2016-07-22 14:56:15 +02:00
adf97edc8f OpenSubdiv: Cleanup, don't use camel case for variable names 2016-07-22 14:56:15 +02:00
e8037867b6 Correct mistake comparing vertices 2016-07-22 18:18:59 +10:00
a7e742f9c4 use bool consistently, fix redundant conditional
Redundant conditional (line 939) found with PVS-Studio T48917

There’s still a lot of true/false, 1/0, SELECT/DESELECT usage nearby.
Not a problem, just confusing to read.
2016-07-22 02:17:52 -04:00
2b77b1ce46 remove double-checked conditions
Checking a condition right after we’ve checked it (and it hasn’t
changed). Most of these are trivial to understand.

split_quads in convertblender.c:
It seems quads should be processed and triangles should be marked as
not needing split. So I removed the outer vlr->v4 check.

Found with PVS-Studio T48917
2016-07-22 02:17:52 -04:00
bd52875dd6 Add Subdivide Edge-Ring to menu 2016-07-22 15:51:02 +10:00
192df299d9 Fix T48926: Subdivide edge-ring crash
Also resolves: T34294
2016-07-22 15:45:04 +10:00
08e1bba10c fix confusing operator precedence
Assigning within a conditional is confusing and error prone so I
rewrote in a more straightforward way.

Found with PVS-Studio T48917
2016-07-21 18:52:44 -04:00
9ff8d4a957 fix enum type / values mismatch
Found with PVS-Studio T48917
2016-07-21 18:26:54 -04:00
7c99b7110e fix null pointer dereferences
Found with PVS-Studio T48917
2016-07-21 18:16:08 -04:00
23f1b2073f fix comparison of identicals
Some of these check that dimensions match before running code that
assumes they do match.

For imb_stereo3d_write_anaglyph I *assume* this change reflects the
intended behavior. Before it was always grabbing alpha from buffer 0.

Found with PVS-Studio T48917
2016-07-21 18:16:08 -04:00
d1f9342e37 Cleanup: pass pointer to texture draw state 2016-07-22 07:33:29 +10:00
cddef5589a BMesh: compare face angles as angles cosine 2016-07-22 07:22:47 +10:00
875c1313b1 Fix broken proxy object deletion.
Check to ensure we do not delete last instancing of an indirectly used object (forbidden
because it creates 'ghost' objects user have no real way to re-instance) was defeated by
the backward pointer 'proxy_from', which generated a 'false' indirect usage of (local)
proxy object itself (the one we are trying to delete).

Fixed by actually considering that ID usage as local if proxy object itself is local
(because that pointer actually does not 'pertain' to the object holding it, but to its proxy).

Yeah, it's... complicated, twisted and ugly - it's proxy.
2016-07-21 23:07:14 +02:00
6ebce7e948 fix typo in condition
(A - A).norm() is always 0 so condition is always true.

(A - B).norm() and (B - A).norm() both compute the same distance so I
picked one to match surrounding code.

Found with PVS-Studio T48917
2016-07-21 15:53:39 -04:00
b5ba14ef70 Fix T48915: Wrong threshold on scaled objects and ortho view.
`ray_is_normalized` == true in DerivedMesh
2016-07-21 16:36:20 -03:00
14995c5617 Fix crash w/ auto-insert offset 2016-07-22 04:22:26 +10:00
1cc0ce58fd Cleanup: warnings 2016-07-22 04:06:10 +10:00
9279bee583 remove repeated codec-supports-alpha check
I don’t think any other codec enum makes sense here, so probably just
an extra copy/paste. Here are the video codecs:

AV_CODEC_ID_NONE
AV_CODEC_ID_MPEG4
AV_CODEC_ID_MJPEG
AV_CODEC_ID_DNXHD
AV_CODEC_ID_MPEG2VIDEO
AV_CODEC_ID_MPEG1VIDEO
AV_CODEC_ID_DVVIDEO
AV_CODEC_ID_THEORA
AV_CODEC_ID_PNG <— alpha
AV_CODEC_ID_QTRLE <— alpha
AV_CODEC_ID_FFV1 <— alpha (if enabled)
AV_CODEC_ID_HUFFYUV <— alpha
AV_CODEC_ID_H264
AV_CODEC_ID_FLV1

Found with PVS-Studio T48917
2016-07-21 13:50:35 -04:00
9d0cbbe1dd Tracking: Fix bug when tracker will keep trying tracking past the footage 2016-07-21 17:02:33 +02:00
aedff9dbef Add BKE_mesh_calc_islands_loop_poly_uvmap and use it in new OSD UV subdiv.
Also renamed BKE_mesh_calc_islands_loop_poly_uv to BKE_mesh_calc_islands_loop_poly_edgeseam,
to avoid confusion...
2016-07-21 16:54:36 +02:00
db0c2be55e BKE mesh mapping: add new BKE_mesh_edge_loop_map_create().
Maps edges to all their pair of loops.
2016-07-21 16:54:36 +02:00
d4342b3897 Fix (unreported) memleak in image copy function. 2016-07-21 16:54:36 +02:00
2969b30813 Fix stupid (harmless) mistake in recent commit. 2016-07-21 16:54:36 +02:00
77ff125232 BKE_library_make_local: clear behind us no more used linked datablocks.
This is really not elegant solution, but simplest for now.

Ideally, we'd check all IDs first and directly 'make local' (without need to copy)
those only indirectly used by other datablocks to be made local. Would also save us from the
need of the extra 'lib_local' parameter recently added to id_make_local.

Current code seems to work well enough though, and this is not high priority to fix imho.
2016-07-21 16:54:36 +02:00
af2deb5438 Fix (unreported) crash in some case when remapping armature data.
Those bone pointers in object's pose bite again - turns out they can be accessed
before pose actually gets rebuilt in some cases (e.g. from undo writefile), so
we need to clear the pointers immediately.
2016-07-21 16:54:36 +02:00
b156674251 Fix missing datablocks types in id_make_local.
Adding make_local for vfont/gpencil/group/freestyle linestyle/mask/scene/sound/text.

Note that there are still some lose ends here, since some type are not handled by id_copy
(Scene, Sound and VFont), which means in case a datablock of that type is used both
directly and indirectly, localization will fail.

Scene copying might be doable though (maybe with a simple new 'full shalow' mode to existing BKE_scene_copy?),
not sure about sounds and vfonts... Situations where this becomes an issue should be very rare corner cases anyway.
2016-07-21 16:54:36 +02:00
5dc7dc70ea Cleanup: get rid of lib_indirect_test_id.
id_make_local and later remapping are supposed to handle that already,
and in a much much saner and more complete way.
2016-07-21 16:54:36 +02:00
d8d4bef6cc Refactor/deduplicate even more make_local code (and fix part of T48907).
Turns out most BKE_foo_make_local datablock-specific functions are actually doing
exactly the same thing, only two currently need special additional operations
(object and brush ones). So added a BKE_id_make_local_generic instead
of copying same code over and over.

Also, changed a bit how make_local works in case we are localizing a whole library.
We need to do the 'remap' step (from old linked ID to new local one) in the second loop,
otherwise we miss some dependencies. This fixes main part of T48907.
2016-07-21 16:54:36 +02:00
2977dcf2f7 Tracking: Fix possible cases when tracker will try tracking failed tracks 2016-07-21 16:54:18 +02:00
1deb01a9b9 Attempt to fix compilation on Windows, take 2
Previous patch was wrong apparently... :|
2016-07-21 16:12:31 +02:00
be1c854019 Attempt to fix compilation error on Windows.
Patch from @fjuhec.
2016-07-21 15:45:07 +02:00
aa316c73e0 OpenSubdiv: Prepare majority of things to have proper subdivided UV
Mainly the changes are related on establishing API to feed UV islands
to OpenSubdiv, so it will know all the connectivity information and
will be able to do proper interpolation.

Island calculation is currently rather slow, not sure how to make it
fast and not use lots of allocations.

Shouldn't be THAT bad, since this code is only runs once when creating
OSD mesh, and it's probably still faster than our orientation code.
2016-07-21 12:34:57 +02:00
e44fa4e6a9 Fix another Cycles OSL script node issue with shaders using bump. 2016-07-21 04:40:28 +02:00
ecd33bacf0 Cleanup: use const, move comments to enum 2016-07-21 11:52:41 +10:00
1c6b8c6675 Fix Cycles OSL script node not working in shader using bump, after node type refactoring. 2016-07-21 02:56:17 +02:00
97ef8777fc Fix T48908: gray out Cycles motion vector pass if motion blur is enabled, doesn't work then. 2016-07-21 01:03:12 +02:00
a2a1b34cd1 Cleanup: warnings 2016-07-21 07:38:15 +10:00
a96c7daf80 Cleanup: unused brush DNA 2016-07-21 07:17:43 +10:00
21425e54bc Cleanup: spelling 2016-07-21 07:16:59 +10:00
5ef1821a0f Fix copy-materials resetting objects material indices 2016-07-21 06:03:02 +10:00
e0f16bdcc2 Cleanup: use BKE naming convention for object materials
Also remove unused 'material_from' function (which isn't very useful).
2016-07-21 06:02:34 +10:00
dd020caa04 Cleanup: remove completely call to test_object_materials in BKE_mesh_new_from_object.
Don't know why this was ever added to start with, BKE_mesh_new_from_object shall never affect ob->data!
2016-07-20 16:42:09 +02:00
1270ab91be Fix T48898: shaders are removed from metaballs on cycles render.
Note that issue has several levels here actually, first one was metaball's materials
not being properly copied into new mesh (code was commented out because of some crash it
seems, made it a bit closer to mesh one and got no crash at all...).

Then, we were calling test_object_materials when ob->data is actually *not* new tmpmesh!

Will remove this call completely in next commit (to make it easier to bisect), I cannot see
any case where object would be assigned with newly generated tmpmesh in this func.
2016-07-20 16:42:09 +02:00
4e5ee5b75e Fix own error in recent heap update 2016-07-21 00:35:42 +10:00
f0f60d775d OpenSubdiv: Initial work to support UV maps in textured OSD viewport
A bit work in progress, currently the following limitations:

- Texture shading only, Material shading will come later

- No UVs subdivision yet

- Always uses active UV and currently changing active UV will
  not properly update the viewport.

Well, need to start somewhere :)
2016-07-20 14:16:38 +02:00
9a0634a253 OpenSubdiv: Wrap OSD's TopologyRefier with own struct
This is a way for us to store extra data, such as UVs which we can
collect now on topology refiner stage.
2016-07-20 12:38:33 +02:00
690063edb9 Fix T48897: Flatten brush fails on first stroke
The flatten brush depended on accumulate being disabled,
Adding dynotopo support for accumulate caused problems for this tool (see T44390).
Enable for existing files.
2016-07-20 13:54:55 +10:00
f2fa73786b possible fix for crash mentioned in T48887 - Adjust the depth min to the object scale 2016-07-19 22:25:13 -03:00
5f7fd0444d BMesh: improve BM_face_splits_check_legal
- remove edge scaling, instead avoid checking intersections with connected edges.
- replace local line intersection functions with BLI_math
- center the projection for more precise calculation.
2016-07-20 10:00:35 +10:00
6ff7a891e7 Update tracker URL
Also wrap line-length
2016-07-20 06:37:21 +10:00
5f4a3785c6 Add 'reload' function to libraries' RNA API. 2016-07-19 17:49:33 +02:00
6921bb7a4a Improved warning message when creating empty export file 2016-07-19 16:34:22 +02:00
b9e4e69a4d Fix (IRC reported by Sergey) assert regarding icon_id of newly copied datablocks.
BKE_previewimg_copy() would simply copy PreviewImage's icon_id, without bothering about
ID one.

When we duplicate an ID, we want to reset its icon_id to zero (and regenerate it on-demand),
not keep same icon_id as original, so added new BKE_previewimg_id_copy helper to handle that.
2016-07-19 16:27:40 +02:00
eeedcf3892 Usual i18n/UI messages fixes... 2016-07-19 15:41:28 +02:00
307250723b Fix building on NetBSD 2016-07-19 22:04:14 +10:00
eac9d2d430 OpenSubdiv: Fix wrong shading in BI texture mode
This probably makes code somewhat slower, but we can't easily know
whether we can use a shortcut and only use directional lighting from
the scene.

Need some better integration between GPU and OpenSubdiv for that.
2016-07-19 12:49:37 +02:00
c883946441 OpenSubdiv: Fix broken structure alignment when using color material 2016-07-19 12:49:37 +02:00
d8de018398 update player stub 2016-07-19 19:31:27 +10:00
95da68822b Fix missing break in libblock relink 2016-07-19 10:27:37 +10:00
3948f65686 Cleanup: style, spelling 2016-07-19 10:27:33 +10:00
bd59206b5c Cleanup: style, spelling 2016-07-19 09:16:38 +10:00
5234e9ddd3 Cycles: add ConstantFolder class for constant folding boilerplate.
Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D2089
2016-07-18 22:54:30 +02:00
10b0e33de1 Cycles: add support for motion blurring of fluid meshes.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2063
2016-07-18 22:40:08 +02:00
20ec6bc166 Fix Cycles kernel build without render passes support. 2016-07-18 22:40:08 +02:00
277cb12395 Fix T48874: Nested pop-up didn't update its parent 2016-07-19 06:01:56 +10:00
399c978a55 fix breakage caused by D2094 / rB404f41d22de46119ee8afb409011eb1ba1840092 2016-07-18 13:09:41 -06:00
ffe106a56a Docs: improve bpy.props.EnumProperty reference 2016-07-19 05:03:50 +10:00
a99dbb9aa0 Fix T48885: Wheel in image space changes wrong window 2016-07-19 02:46:12 +10:00
de0f371528 Fix missing release w/ mouse wheel over layer menu 2016-07-19 02:46:12 +10:00
404f41d22d [bf_intern_ghost/Windows] Cleanup
This patch addresses the following issues in bf_intern_ghost

```
Warning	C4312	'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	179
Warning	C4312	'type cast': conversion from 'GHOST_TEmbedderWindowID' to 'HWND' of greater size	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	198
```

GHOST_TEmbedderWindowID is defined as long, handles are however of pointer size,
so this should have been an issue when we moved to 64 bits, guess we got lucky.
fixed by turning GHOST_TEmbedderWindowID from long into void*

```
Warning	C4302	'reinterpret_cast': truncation from 'HKL' to 'LANGID'	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ImeWin32.cpp	67
```

reinterpret_cast emits warnings on truncation, LOWORD does the job just
as well with no warnings.

```
Warning	C4838	conversion from 'int' to 'DWORD' requires a narrowing conversion	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp	734
Warning	C4838	conversion from 'int' to 'BYTE' requires a narrowing conversion	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_ContextWGL.cpp	734
```

Weird warning, it does a really bad job at telling you what parameter is
causing the warning , tuns out there's a bunch of parameters that cause it
but it still only yields a single warning, the problem is that every
(somevar ? a : b) construct results in an integer type. which needs to be
properly cast to get rid of the warning.

```
Warning	C4996	'GetVersionExA': was declared deprecated	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	105
Warning	C4996	'GetVersionExA': was declared deprecated	bf_intern_ghost	K:\BlenderGit\blender\intern\ghost\intern\GHOST_WindowWin32.cpp	107
```

The warning was clear, the code not as much. The version check in place
here is quite convoluted and could be replaced by including VersionHelpers.h
and calling IsWindows7OrGreater, However, CreateInstance will just return NULL
in m_Bar if the interface is not supported, so the whole check is useless.
This however did require that the CreateInstance call actually asked for
ITaskbarList3 and not ITaskBarlist . (You're not really allowed to assign
different interface types to each-other, a roundtrip through QueryInterface
is required there, we were violating spec here by asking for ITaskBarlist and
storing it in ITaskbarList3*  )

Reviewers: sergey

Reviewed By: sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2094
2016-07-18 15:48:51 +02:00
a76e69f5f7 Additional Waveform Drawing Mode
This diff adds a 6th drawing mode to the Waveform Scope.

The new mode shows the RGB colour channels overlaid as a "Full colour" waveform.

The old "Red Green Blue" mode is renamed "Parade" which is the standard industry
term for RGB channels shown side-by-side.

This full colour style of waveform is very much more useful for colour grading than the
Parade mode and is the default waveform for many artists.

Files from older Blender versions which show scopes open as expected.

Patch by John Cox (johnedwardcox), thanks!

Reviewers: sergey

Reviewed By: sergey

Subscribers: campbellbarton, tmw, Blendify

Differential Revision: https://developer.blender.org/D1936
2016-07-18 15:42:21 +02:00
3e882c91e0 [MSVC2015/Cycles] MSVC2015 before update 3 produce invalid builds
I'm not quite sure where the codegen bug gets triggered but it's easily
noticeable in the barcelona scene. (extra saturated leafs and illumination
on the right ledge of the pool)

2013 buildbot reference image:
{F320792}

2015 With no updates (compiler version 19.00.23026)
{F320793}

2015 With Update 2 (Compiler version 19.00.23918)
{F320794}

2015 With Update 3 (Compiler version 19.00.24210)
{F320795}

This patch blocks all compiler builds before update 3 in a similar way we
did for msvc 2013 update 4

Reviewers: campbellbarton, brecht, juicyfruit

Reviewed By: juicyfruit

Tags: #bf_blender

Differential Revision: https://developer.blender.org/D2100
2016-07-18 15:26:52 +02:00
6239afd36f [MSVC/LNK4199/Cleanup] Delay loading is causing linker warnings.
We recently added delay-loading of the openmp dll's so we no longer had to use
the stub loader, we however put these linker flags on the global linker flags
causing any sub projects not using openmp to spit linker warning 4199 while building,

```
Warning	LNK4199	/DELAYLOAD:vcomp140.dll ignored; no imports found from vcomp140.dll	datatoc	k:\BlenderGit\build_windows_2015a\source\blender\datatoc\LINK	1
```

This patch makes the delay-load only apply to the blender project.

Reviewers: sergey

Subscribers: sergey

Tags: #bf_blender

Differential Revision: https://developer.blender.org/D2092
2016-07-18 15:20:29 +02:00
65e7caf950 Fix (unreported) ED_region_tag_redraw_partial() could override a previously defined partial redraw, instead of extending it.
Probably not an issue currently, since partial redraw is not much used
(only from sculpt code and box-rendering it seems?), but logic was broken here.
2016-07-18 14:41:56 +02:00
bbc1507871 Fix T48848: Cycles - Camera Culling - Camera Culling removes objects which are still in frame 2016-07-18 14:29:37 +02:00
6533d72056 Fix T48877: Lightmap Pack fails w/ 1-3 faces
Unnecessary limit was applied.
2016-07-18 19:44:51 +10:00
d42cb44ea2 CMake: correct py-module on OSX 2016-07-18 19:30:32 +10:00
9186b9ae48 Merge branch 'master' into blender2.8 2016-07-18 19:25:44 +10:00
9946cca146 Fix T48860: Cycles SSS artifacts with spatially split BVH
The issue was caused by SSS intersection code gathering all
intersections without check for duplicated ones. This caused
situations when same intersection will be recorded twice in
the case if triangle is shared by several BVH nodes.

Usually this is handled by checking intersection distance
after sorting intersections (in shadow_blocked for example)
but for SSS we don't do such sorting and using number of
intersections to calculate various things.

Didn't find anything smarter than to check intersection
distance in triangle_intersect_subsurface().

This solves render artifacts in the cost of 1.5% slowdown
of extreme case rendering (SSS object filling in whole
FullHD screen).

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2105
2016-07-18 10:04:20 +02:00
a2c82f5e5d Cycles: Fix OpenCL compilation after the recent numerical fixes 2016-07-17 19:24:53 +02:00
c974def837 BLI_heap: replace memarena w/ local allocator
- Since element size its known it's less work to do inline.
- In test with high-poly model, gave ~9% overall speedup for decimate modifier.
2016-07-17 19:29:30 +10:00
c57d823683 Cleanup: minor edits to BLI_heap 2016-07-17 19:29:30 +10:00
d9281a6332 Cycles: Fix three numerical issues in the fresnel, normal map and Beckmann code
- In fresnel_dielectric, the differentials calculation sometimes divided by zero.
- When the normal map was (0.5, 0.5, 0.5), the code would try to normalize a zero vector. Now, it just uses the regular normal as a fallback.
- The approximate error function used in Beckmann sampling sometimes overflowed to inf while calculating r^16. The final value is 1 - 1/r^16, however,
  so now it just returns 1 if the computation would overflow otherwise.
2016-07-16 20:54:14 +02:00
5ba78d76d4 Cycles: Deduplicate geometric factor calculation in the Beckmann distribution
Also, this fixes a numerical issue where A would be inf.
Since later G is set to 1 if A is larger than 1.6, the code now checks the reciprocal of A for being smaller than 1/1.6 - same effect, but no inf involved.
2016-07-16 20:54:14 +02:00
a40073ffcc Fix use after free error from ab993e37 2016-07-17 03:03:22 +10:00
c885cea7bb Cleanup: spelling 2016-07-16 17:48:57 +10:00
f0f9a87614 Cleanup: line length 2016-07-16 17:29:08 +10:00
4e9409c087 Use the value VIEW_PROJ_PERSP in the remaining places
also changes the name of the callbacks:
- walk_parent_snap_project_cb to cb_walk_parent_snap_project;
- cb_leaf_snap_vert to cb_walk_leaf_snap_vert;
- cb_leaf_snap_edge to cb_walk_leaf_snap_edge;
- test_vert_depth_cb to test_vert_ray_dist_cb;
- test_edge_depth_cb to test_edge_ray_dist_cb;

and cleanup:
2016-07-15 21:25:44 -03:00
ac061de20d Cycles: Fix refitting of regular BVH
Was causing CUDA issues on viewport edits.
2016-07-15 18:12:34 +02:00
69787cb7bd UI: modifier keys now trigger number button updates
Number buttons & sliders weren't updating when shift/ctrl were pressed.

Note that this is a regression in 2.77 but hard to track down since it worked unreliably for some time.
2016-07-16 01:20:16 +10:00
12cdc67d83 Bump maximum threads number to 1024
This commit contains all the changes required for most optimal maximum threads
number bump. This is needed to avoid possibly unneeded initialization or data
allocation on systems with lower threads count.

TODO: Still need to review arrays in render data structures from render_types.h,

P.S. We might remove actual bump of max threads from this patch, so when we'll
be applying the patch we can do all the preparation work and then do actual
bump of max threads.

Reviewers: mont29, campbellbarton

Reviewed By: mont29, campbellbarton

Maniphest Tasks: T43306

Differential Revision: https://developer.blender.org/D1343
2016-07-15 16:47:30 +02:00
6cd675af30 Cycles: Add option to disable new Hair BVH
While it's an extra option added to the interface which might not be
fully obvious for artists, it allows to save up to 20% of memory in
hairy scenes.

This is high enough memory saver in my opinion which might become
handy for some production files where it's more important to make
scene to fit into memory rather than trying to use more optimal BVH
structure but go into swap or crash.

Reviewers: dingto, brecht

Reviewed By: dingto, brecht

Differential Revision: https://developer.blender.org/D2090
2016-07-15 16:29:28 +02:00
b679767656 fix T48857: Improved the handling of Material Alpha, based on patch D1949 with some small modifications 2016-07-15 16:14:53 +02:00
27641b51e7 Collada: changed specification of material alpha from using transparency to using transparent with opaque=A_ONE 2016-07-15 16:14:51 +02:00
e3b79544be Re-initialize source/tools submodule 2016-07-15 15:12:51 +02:00
711fca1db5 missed from last commit 2016-07-15 20:00:18 +10:00
fafb8aaaf1 Object Snap: make normal argument optional
Often its not needed, setting correctly takes some extra calculation - so allow for it to be left unset.
2016-07-15 19:46:59 +10:00
e68f068682 Fix T48855: Ruler thickness broken in ortho view
Don't do ray-casts from the view unless cursor coords are passed.
2016-07-15 19:27:45 +10:00
3eb7d41c67 Object Snap: replace perspective bool with enum
Allows to set the projection as none,
to make it more obvious when we don't want to handle viewport projections in some cases.
2016-07-15 19:27:23 +10:00
dec59618b4 Correct error in snap commit 2016-07-15 18:40:16 +10:00
e5e128e30c Cleanup: use BLI_math for paint smooth-stroke 2016-07-15 17:17:42 +10:00
0deb7e6c15 Cleanup: rename snap vars 2016-07-15 17:12:43 +10:00
91556cb973 Add "Snap Selection to Active" option in menu
D1963 by @wisaac, re-worked to de-duplicate logic
2016-07-15 17:11:58 +10:00
ccee251a40 Support for loading multiple images from the file selector
D2035 by @jside, extended to support mixing single images and sequences in the one selection.
2016-07-15 16:06:11 +10:00
e56aa5d788 Fix select grouped parent, extend option was ignored
D2067 by @mangostaniko
2016-07-15 15:56:28 +10:00
97f894f3fa UI: Remove spaces around '/'
D2093 by @Blendify
2016-07-15 15:50:42 +10:00
10f5a6a57e Sequencer: Remove add effect strip filesel properties
D2096 by @chadf

Unused, copy-paste error.
2016-07-15 15:47:42 +10:00
3bfa8d9fd4 Fix py-driver in startup.blend crash in background mode
Obscure regression in own commit from b34929786.
While this could be considered correct, it introduces a crash so disable the update call.
2016-07-15 15:41:38 +10:00
71bbf0e1b5 Code cleanup: show unused arguments names for ShaderNode::constant_fold. 2016-07-14 22:59:44 +02:00
558f85473e fix T48857: Added support for transparency (used Patch D1949 from bwrsandman with some slight changes) 2016-07-14 21:43:26 +02:00
902d4c92ac Use BMesh solver for new boolean modifiers 2016-07-15 02:46:04 +10:00
8343518272 Cleanup: comment blocks 2016-07-15 02:39:45 +10:00
39dee8a201 Fix T48844: Nodetrees of appended materials/textures/etc. were not correctly made local.
Previous commits now allow to use id_make_local() here, as one would expect.

Note that I also checked T36003 case, working fine as well with new code.
2016-07-14 18:33:12 +02:00
bcfd8d9ab8 Correct recent own fix to id_clear_lib_data_ex().
Datablocks' nodetree are *never* in main, while shapekeys are...
2016-07-14 18:33:12 +02:00
e7d4d661f3 Cleanup/refactor: handle shapekeys exactly like 'owned' nodetrees in make_local process. 2016-07-14 18:33:12 +02:00
018d336cbd Cleanup: use BKE's ntreeFromID in readfile instead of local same function.
Also, no need to set ntree->id.lib to NULL after BKE_libblock_copy_nolib(),
generic datablock copy function always make copy local.
2016-07-14 18:33:12 +02:00
54ed0bb653 Fix bad handling of datablock's nodetree id_clear_lib_data_ex().
Those data blocks are never shared, exactly as with shapekeys, much simpler
to also clear their lib_data (especially since they have no user!).
2016-07-14 18:33:12 +02:00
e10ddc7a91 Get rid of BKE_key_make_local().
This function was only a wrapper around id_clear_lib_data(), and shapekeys
are not linkable nor shareable anyway, no point keeping this currently,
was only adding confusion about shapekey 'status' as a datatblock.
2016-07-14 18:33:12 +02:00
f87603662d Add option to id_make_local to force localization of datablock, even if not used locally.
Will be used by link/append code.
2016-07-14 18:33:12 +02:00
f2509e764e Fix T48843: Sequencer crash with many effects
Switch from a fixed stack to a linked list,
since guessing the maximum possible size may fail with invalid/overlapping strips.
2016-07-15 02:30:37 +10:00
3ba83e247a Add developer tools submodule
This is intended for utilities to help with development,
which aren't needed for building.

See https://wiki.blender.org/index.php/Dev:Doc/Tools/Blender_Tools_Repo for details
2016-07-15 01:28:00 +10:00
7faf76a618 Cleanup: line length 2016-07-15 01:26:26 +10:00
34642fe532 PyAPI: minor cleanup with library linking 2016-07-15 00:06:33 +10:00
17e40f821e Consolidate multiple checks for out->rect_float in prepare_effect_imbufs()
Many checks for out->rect_float being [non-]NULL are done back-to-back.
Combining them into a single check for slightly more efficient code and
less code clutter for easier readability/understanding.

Differential Revision: https://developer.blender.org/D2097
2016-07-14 14:17:54 +02:00
Julian Eisel
3a5eff95c5 Cleanup: Use BKE_scene_base_add for creating bases
And use __func__ macro.
2016-07-14 14:00:24 +02:00
274795045c Cycles: Give better idea which OpenCL kernel is currently compiling 2016-07-14 12:49:20 +02:00
95a0bff83a Cycles: Avoid strings passed by value in OpenCL device
Also use more const qualifiers in the code.
2016-07-14 12:46:57 +02:00
af53fee4b4 Make --debug-all include --debug-cycles and --debug-libmv 2016-07-14 12:14:55 +02:00
c183f0c94e Libmv: Fix some strict compiler warnings
One of them was a real bug!
2016-07-14 11:49:38 +02:00
56c9c1ab43 Cycles: Fix wrong size of sobol texture
After reformulation of SSS indirect rays it became possible to
try accessing dimension higher than was pre-calculated on scene
preparation.

This is because we're traversing rays backwards, which means we
are using higher dimensions first now.
2016-07-14 11:26:20 +02:00
3637cbbcf8 Cycles: Fix wrong termination criteria in intersect_all functions
It was possible to miss bounces termination criteria in this functions,
mainly when max_hits was set to 0.

Made the check more robust in traversal functions (which should not
affect performance, it's an operation of same complexity AFAIK).

Also avoid doing ray-scene intersection from shadow_blocked when
limit of transparent bounces was already reached.
2016-07-14 11:26:20 +02:00
103a515043 CMake: per-target CFLAG & CXXFLAG support
Applying cflags globally can be problematic especially with extern, intern libs.

Now flags from target named will be used when defined,
allowing for developers to define flags for modules they maintain.

Convention is CMAKE_CFLAGS_${UPPERCASE_TARGET_NAME}, (CXXFLAGS for C++).

eg: CMAKE_CFLAGS_BF_BLENDER, CMAKE_CFLAGS_MAKESDNA, CMAKE_CXXFLAGS_CYCLES_KERNEL

On Linux run `make help` for full list of names, MSVC shows these in the solution.
2016-07-14 19:17:34 +10:00
036c006cef PyAPI: Leak fix caused crash w/ attr swap trick
Accessing `bpy.app.binary_path_python does search, then swaps its getset with the string it finds.
This caused a freed pointer to be stored in bpy.app's dictionary.

Fix by using the same string for get/set access.
2016-07-14 18:32:28 +10:00
b00bc3cbc1 PyAPI: fix leak linking library data 2016-07-14 17:38:22 +10:00
f5e020a7a6 PyAPI: fix memory leaks in dictionary assignment
Thanks to Kévin Dietrich for spotting driver leak,
checked other uses of PyDict_SetItem and found more.
2016-07-14 17:30:52 +10:00
cca57bf04c PyAPI: Use module names on initializaton
No need to re-convert from C strings to PyUnicode.
2016-07-14 15:51:56 +10:00
06908955c3 Improves the accuracy of snap to edges
Recently the snap to edges has been changed to work with coordinates 2d. Thus, the lambda of the snap pointon on edge becomes different from the actual lambda in a 3d edge.

The solution to correct the lambda was this:

```
if (is_persp) {
	const float fac = depth_a / (depth_a + depth_b);
	lambda *= (1.0f + (fac - 0.5f) * (1.0f - lambda));
````

...
But the lambda was still not very accurate.
Now the function uses the `dist_squared_ray_to_seg_v3` to get the coordinate of the snap point on the edge. And then tests that point.

The accuracy returned to normal values.
2016-07-14 00:47:32 -03:00
6771165229 Cleanup: style 2016-07-14 13:37:49 +10:00
1b8e7b5cb0 Use BLI_endian_switch in dna_genfile 2016-07-14 13:28:24 +10:00
b014f03077 Simplify snapping functions
from D2104: reference all repeated (and strange) equations (example: mul_m4_m4m4(pmat_local, pmat, obmat)) in the function `precalc_project.

This is useful for maintenance.
2016-07-14 00:02:21 -03:00
743f931584 Fix T48846: Ruler/Protractor crash in ortho mode
Error in recent snap changes.
2016-07-14 11:14:03 +10:00
91bda21cfe Fix T48845: Crash when right-clicking on a curve property
Caused by typo in rBd2312602125a452e6562a76ab91779943c67396d
2016-07-14 00:24:31 +02:00
029de800a4 Fix T48734: Driver not updating when using Single From Driver within same object 2016-07-13 15:00:57 +02:00
afe954e64c Fix T48839: Selection from pose mode gives wrong snap results
Current code changes the selection then then runs ED_armature_sync_selection
to copy to the bones rootsel flag from the parents tipsel.

Use this logic for entering edit-mode too.
2016-07-13 22:24:20 +10:00
2aa0569861 Boolean Modifier: Add back BMesh option
There are still issues with overlapping geometry,
however some of the issues reported are are causing problems,
or fail entirely with Carve too.
2016-07-13 19:55:31 +10:00
95b1cf6f7d Depsgraph: Make proxy behavior closer to old depsgraph
Fixes possible missing update of proxy_from pointer before using
it in relations builder.
2016-07-13 10:55:35 +02:00
c0d8166f82 Revert "Depsgraph: Russian electric tape bodge to have multiple proxies work"
This reverts commit 47d0d9cca4.

Reverting the commit. Not only it did not solve all the cases of proxy popping,
but also broke real cases with single proxy involved.
2016-07-13 10:41:09 +02:00
527674b316 Depsgraph: Accumulate object layers from all bases
This solves bug when same object is instanced from multiple bases.
2016-07-13 10:07:09 +02:00
8939787bfb Use BLI_bvhtree_walk_dfs for snapping
The snapping functions when performed in the perspective view,
have some problems in the threshold (a distortion) and in the clip plane (the normal is incorrect).
These problems can be only observed when making the snap to edges or to vertices (nearest to ray function).

This patch propose a totally different solution.
The idea is to project the edges of bvh nodes and test the 2d projection of the snap element.

For this it used the BLI_bvhtree_walk_dfs function.

It is important to pay particular attention also to the changes in `ED_transform_snap_object_project_view3d_ex`
2016-07-13 14:45:35 +10:00
7a633d7c4f Vertex/Weight Paint: Support view-selected on last-stroke
D1875 by @lichtwerk
2016-07-13 13:57:46 +10:00
eb04908ccd Fix 48831, Step II: UI icon code was not able to update/generate 'auto ID icon' from non-ID icon draw code.
Now using generic icon rendering system in that case too, instead of custom code
which was only handling 'deferred' custom file-loaded icons.
2016-07-12 21:11:38 +02:00
51812fb502 Fix 48831, Step I: Mismatch issues bewteen ID icon and preview system.
- icon_id from ID and PreviewImage were not guaranteed to be in sync.
- PreviewImage one was not reset on file read.
- Through RNA e.g., it was possible to ensure an ID icon via its preview image,
  which was running code designed for custom previews/icons system, instead
  of generating correct 'auto ID icon'.
2016-07-12 21:11:38 +02:00
5fae2503bf Revert "OpenJPEG: update to 2.1 from 1.5"
This reverts commit f12204196f.

Campbell, sorry. have to revert this for the time being.

We've missed some very important bits, such as:

- FFmpeg is usually linked against OpenJPEG
- OIIO needs OpenJPEG as well.

For FFmpeg issues we can either disable OpenJPEG there (since
we don't really use it), or bump FFmpeg to version 3.1.1 which
can use either of OpenJPEG 1.5 or 2.1.

For OIIO we do need OpenJPEG support (otherwise Cycles will
not be able to use j2k/j2c textures) and currently there is
NO solution to make OIIO working with OpenJPEG 2.1.

According to Matthias Fauconneau (aka mfv) Larry is working
on the patch to get OIIO work with OpenJPEG 2.1, but it'll
take some time still.

I've tried to look into support of some sort of build system
flag and do ifdefs, but it all becomes quite nasty, especially
with bundled OpenJPEG bumped to 2.1.

Surely such an update is something we'll have to apply to
but at this exact moment it causes quite some pain for all
developers.

Suggest to wait for until OIIO supports OpenJPEG 2.1 and then
go with the updates for real.
2016-07-12 17:38:26 +02:00
51b274a6be Fix T48818: Objects with alpha maps cast wrong ray shadows in BI 2016-07-12 15:41:00 +02:00
f12204196f OpenJPEG: update to 2.1 from 1.5
Stream handling has changed so this required changes to how files & memory are accessed.
2016-07-12 23:13:30 +10:00
5798301291 Fix saving jpeg2k images from Python
Quality was defaulting to lowest and no codec was set.
2016-07-12 20:35:02 +10:00
59c59cc402 Cleanup: remove redundant check 2016-07-12 17:59:25 +10:00
b8f217ef21 Fix T48830: Outliner draw crash, missing NULL check
Fix from @cheleb
2016-07-12 14:44:59 +10:00
0708b9aba8 writefile: reuse SDNA between writes
Avoids decoding the SDNA string every undo step.
2016-07-12 13:03:04 +10:00
4db1db327a readfile: report SDNA decoding errors on file read
This was printed to the stdout, however the error case wasn't checked or well supported.
Also, errors decoding SDNA would sometimes call exit(1).
2016-07-12 12:28:06 +10:00
0b3183d13c writefile: remove SDNA last-hit, optimize DNA reconstruct
- Move last-hit index out of SDNA struct
  (allows for access by multiple threads).
- Replace O(n^2) search with hash lookup in DNA reconstruction.
2016-07-12 11:56:45 +10:00
cfbd605567 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/addon/ui.py
	source/blender/blenkernel/BKE_particle.h
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_distribute.c
	source/blender/blenkernel/intern/texture.c
	source/blender/editors/object/object_add.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/physics/particle_object.c
	source/blender/editors/transform/transform_snap_object.c
2016-07-12 00:07:44 +02:00
7212ebd09f Remove usercount handling from BKE_id_expand_local.
Idea looked good, but we have too much custom situations here (some half-fake-sub-ID
being copied with their 'owner', animdata, etc.), let's let datablock copy functions
handle that themselves.

Also allows to safely call BKE_id_expand_local from all copy functions now (only when
copying linked data).
2016-07-11 21:30:02 +02:00
3b8e0606e1 Cleanup: remove call to BKE_id_lib_local_paths() in make_local functions.
This one is already called by matching copy functions, no need to call it twice!
2016-07-11 21:30:02 +02:00
5b2bc1d713 Use new generic BKE_id_expand_local() for make_local() for object. 2016-07-11 21:30:02 +02:00
3c8f22a528 Use new generic BKE_id_expand_local() for make_local() for image/material/texture/world.
As said in previous commits, did not touch to copy functions for now, due to ntree issues...
2016-07-11 21:30:02 +02:00
c3996b792a Revert 'use new BKE_id_expand_local()' change for Lamp's copy function.
ntree is once more time a PITA - actually, all sub-IDs that get copied together with the 'main' one are
(shapekey was workedaround, as was animdata/action issue, but nodes are more touchy).

For now, better not to touch that, needs careful check & rethink.
2016-07-11 21:30:02 +02:00
eac7faa0e6 Use new generic BKE_id_expand_local() for make_local() for nodetree.
Did not changed ntree copy for now, this func is a mess of expand/non-expand/bmain/non-bmain cases...
Keep it for later!
2016-07-11 21:30:02 +02:00
13f0b59f11 Use new generic BKE_id_expand_local() for both make_local() and copy() functions of actions, brushes and particles.
This greatly simplifies said code, once again no change expected from user PoV.
2016-07-11 21:30:02 +02:00
2ec17e655c Use new generic BKE_id_expand_local() for both make_local() and copy() functions of obdata
(armature, mesh, curve, mball, lattice, lamp, camera, and speaker).

This greatly simplifies said code, once again no change expected from user PoV.
2016-07-11 21:30:02 +02:00
439ccca1e0 Add an exception/hack to new BKE_id_expand_local(), to ignore actions datablock in its usercount handling.
Reason is, typically those actions datablock usercounts have already been adjusted in BKE_animdata_copy()
(called by generic iddata copy function).

Think this needs to be reworked a bit too, there are way too much ways to copy animdata currently,
it's rather confusing. But not the goal here, so for now we'll live with the hack!
2016-07-11 21:30:02 +02:00
62ea383622 Fix (unreported) memory leak when making local linked databock which has a preview image.
Also cleaned-up/synchronized code across al ID types that support preview.
2016-07-11 21:30:02 +02:00
4569e19b83 Add generic 'BKE_id_expand_local' to BKE_library,
will be used by both make_local() and copy() datablock functions.

Note that this new func make 'extern' all IDs used by localized datablock,
not only refcounted ones as it used to be in each type's functions (with a few exceptions).
2016-07-11 21:30:02 +02:00
c06d3b6c36 Cycles: Fix compilation error on Windows with OSL enabled
Seems there's some conflict around `near` identifier in that configuration.
2016-07-11 18:15:51 +02:00
7602b6bf62 Cycles: Fix typo 2016-07-11 18:01:40 +02:00
ea32a03801 Fix T48824: Crash when having too many ray-to-volume intersections
Code might have writing past the array boundaries.
2016-07-11 17:59:46 +02:00
8bc6f8bf20 Fix T48812: Brush size invalid with HIDPI
Missed from c5b2f12b
2016-07-12 01:19:07 +10:00
bbe33ecc88 Depsgraph: Fix crash in Weight VG modifier 2016-07-11 15:15:26 +02:00
0f457a3f8d Depsgraph: Fix shape key nodes trying to be added multiple times 2016-07-11 15:07:39 +02:00
96dd4cdb9e Cleanup: line length 2016-07-11 23:06:14 +10:00
b99f7a9b2a Cycles: Fix Extend image extension mode on OpenCL 2016-07-11 14:46:42 +02:00
cb3b19730c Cycles: Use utility define for restrict pointers
This way restrict can be used for CUDA and OpenCL as well.

From quick tests in areas i've been testing this it might give some
barely measurable %% of speedup, but it increases registers pressure.

So use of this qualifier is still really limited.
2016-07-11 13:58:47 +02:00
cf82b49a0f Cycles: Cleanup, variables name
Using camel case for variables is something what didn't came from our original
code, but rather from third party libraries. Let's avoid those as much as possible.
2016-07-11 13:58:47 +02:00
2ecbc3b777 Cycles: Add _all suffix to shadow traversal file
Matches better naming of volume traversal files, where we've got
optimized versions of a single step of volume intersection and
traversal which will gather all volume intersections.
2016-07-11 13:58:47 +02:00
4355603790 Cycles: Move BVK kernel files to own directory
BVH traversal is not really that much a geometry and we've got
quite some traversals now. Makes sense to keep them separate in
the name of source structure clarity.
2016-07-11 13:58:47 +02:00
c58ae20f6c Dyntopo: fix lop-sided edge collapse
When an edge was collapsed, one of the vertices would be removed.
Edges attached to the deleted vertex wouldn't be considered for collapsing again,
making the outcome from collapsing edges depend on the edge-vertex order.

Use a hash to lookup the final vertex when collapsing edges, instead of skipping them.
2016-07-11 21:59:15 +10:00
6ea43f9aca Fix sculpting high poly meshes
Attempted to free unallocated memory,
interestingly nobody noticed this for ~7 years (error from 3078c806).
2016-07-11 17:17:08 +10:00
0eb61baecc Dyntopo: possible modified option was incorrectly set 2016-07-11 17:17:08 +10:00
12d2329d0e Dyntopo: remove redundant existing face check
Gives minor speedup
2016-07-11 17:17:02 +10:00
b32408eff8 BLI_math: move interp_*_cubic to its own function 2016-07-11 17:16:35 +10:00
e41abdb907 CMake: suppressing indentation warning for extern 2016-07-11 17:16:35 +10:00
47c47c7e78 Fix T48822: Crash when I try to use "Join" (Ctrl Key + J) with two meshes.
Own stupid typo in recent refactor work...
2016-07-10 20:12:58 +02:00
8df92988cf Refactor/enhance BKE_action_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
406309cd8c Refactor/enhance ntreeMakeLocal().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
ad5918d278 Refactor/enhance BKE_image_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
f35320bddf Refactor/enhance BKE_material_make_local() and BKE_image_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
8932b5945e Refactor/enhance BKE_lamp_make_local() and BKE_camera_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
0f0eeffece Refactor/enhance BKE_brush_make_local() and BKE_speaker_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
c8c00636bf Refactor/enhance BKE_particlesettings_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-10 17:14:45 +02:00
bb8bfdd4b6 Cycles: Fix failed assert with isotropic Ashikhmin-Shirley distribution in the Glossy node
The shader sync code used the anisotropic version of the Ashikhmin-Shirley closure for both
Anisotropic and Glossy BSDF, which caused a failed assert because the anisotropic closure
expects an addiitonal SVM node.
2016-07-10 16:41:21 +02:00
e0c163661d Add missing braces 2016-07-11 08:45:16 +10:00
885870be51 Fix T48815: Translate node's 'Relative' checkbox has the same tooltip as blur node's 'Relative' checkbox.
Differential Revision: https://developer.blender.org/D2099
2016-07-10 14:57:31 +02:00
87b974caa1 Cleanup/Refactor: pass Main pointer to all ID copy functions.
Also allows us to get rid of a few _copy_ex() versions...
2016-07-10 14:52:00 +02:00
ae2033aca2 Add BKE_key_copy_ex() that takes a Main as parameter. 2016-07-09 15:44:12 +02:00
429394078b Refactor/enhance BKE_lattice_make_local(), and add BKE_lattice_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
338121e2a0 Refactor/enhance BKE_mball_make_local(), and add BKE_mball_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
11f64f494b Refactor/enhance BKE_curve_make_local(), and add BKE_curve_copy_ex() that takes a Main as parameter.
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).
2016-07-09 15:44:12 +02:00
9044ccec5f Cleanup to shapekeys' make_local (and copy) functions.
Mostly pass bmain and do not check for NULL key, keys' make_local is
suspiciously simple in fact, but think until those behave like real
full-featured IDs, it's doing enough!
2016-07-09 15:44:12 +02:00
8bb7a339f7 Minor fix/cleanup to object's make_local. 2016-07-09 15:44:12 +02:00
1b45c52734 Fix: Apply Scale to Delta Scale was doubling the effect 2016-07-09 12:00:28 +12:00
245f97d7dc Clear Transforms and Deltas
* Alt-G, Alt-R, Alt-S  --> These don't clear delta transforms by default anymore,
  making it possible to use these to properly store a "rest" pose

* Alt-Shift-G, Alt-Shift-R, Alt-Shift-S  --> These WILL clear both the normal
  transform and the delta, should you need to do so.
2016-07-09 12:00:28 +12:00
8662f583da Fix (unreported) broken shapekeys after 'make_local' of datablocks used both directly and directly.
At first thought it was own recent work, but think issue is there since ages actually...

Basically, id_make_local() would always localize mesh/curve/lattice shapekeys, even in case
obdata localization actually made a local copy instead of localizing original datablock.

This was causing shapekeys being localized twice, and other odd nasty effects.
2016-07-08 19:53:57 +02:00
282de867d4 Initial fix for proxy issues regarding new libquery/libremap ID handling code.
libquery now passes an extra flag info to the callback, in case that specific
ID usage is considered as indirect.

In most cases, it's just set from ID_IS_LINKED_DATABLOCK() result on datablock owner,
but in proxy object case we also consider ob->data, materials and pose usages as indirect.

Does not fixes all issues yet, but should already make behavior with proxy object saner.
2016-07-08 19:33:22 +02:00
77680abaf9 Refactor/enhance BKE_mesh_make_local().
Now using modern features from libquery/libremap areas.

Provides same kind of fixes/improvements as for BKE_object_make_local() (see rBd1a4ae3f395a6).

Note: this enlightened broken case of proxy objects regarding make_local
(and also whole remapping, in fact). Will be fixed in near future.
2016-07-08 18:19:34 +02:00
db79537dbc Fix own very stupid mistake in BKE_library_idtype_can_use_idtype() usage (inverted arguments). 2016-07-08 18:11:20 +02:00
f34fc60aa4 Libquery: fix missing image pointers from Mesh's UV layers.
Not really happy with this, could lead to a **lot** of callback executions...
But libquery foreach looper must go over **all** ID pointers,
otherwise remapping & co is broken!

A possible fix for future would be to have 'image slots' defined at root of poly/facetex layers,
and just a (short) index in each face/poly item - would also save a reasonable amount of memory...
2016-07-08 18:11:20 +02:00
d1a4ae3f39 Refactor/enhance BKE_object_make_local().
Now using modern features from libquery/libremap areas.

Also, it should handle much better cases where localized ID was also indirectly used by non-refcounting users
(typical case: object used as modifier/constraint/whatever target from another linked object, previous
code would not take those into account and just localize original object instead of making a local copy.
Would result in local object used by linked one, which would be partially 'undone' on next file reload... Crappy behavior).

And it fixes some obvious errors too (nullifying all proxy pointers unconditionnaly,
some missing refcounted usages cases in extern_local_object(), etc.).
2016-07-08 18:11:20 +02:00
f3fe1f9c44 Refactor: pass Main to id_make_local.
Totally stupid to not pass it, and then let (some) BKE_foo_make_local() use G.main!

Note: unused for now, much more refactoring still to come in make_local area!
2016-07-08 18:11:20 +02:00
cf19055236 Fix (unreported) missing special updates in case we are remapping obdata (mesh/curve/metaball at least). 2016-07-08 18:11:20 +02:00
ab993e373c Rework/split test_object_materials().
Now test_object_materials only handles one object. New test_all_objects_materials
checks the whole bmain->object list for cases where it is actually needed.

Should avoid some useless looping over all objects!
2016-07-08 18:11:20 +02:00
71f5df9f44 Refactor remapping's pre/post process of special cases.
Main issue was that BKE_libblock_relink_ex was pretty much ignoring all those...
Also, unlinking of objects was not handling correctly indirect-related flags.

Refactored code into helper functions to avoid too much duplicated code.
2016-07-08 18:11:20 +02:00
3b7bce42d7 Fix T48799: Particles set as objects cast wrong ray shadows in BI 2016-07-08 18:10:47 +02:00
8bb69b6157 BMesh: add decimate edit-mode tool
Support applying decimate to the mesh selection.
2016-07-08 23:38:52 +10:00
c206b7cbb6 Correct error in non-uniform scale IK commit
Rename arg to avoid confusion
2016-07-08 21:13:19 +10:00
a62967787c Fix T48808: Regression: Cycles OpenCL broken after Hair BVH commit 2016-07-08 09:41:36 +02:00
d5d26338b5 Mesh/Curve Join: remove edit-mode toggle
Toggling edit-node after joining objects is redundant as far as I can see -
(dates back to first revision).

Also caused all edges to be drawn w/ meshes, redundant undo step w/ curves.
2016-07-08 16:52:10 +10:00
83fe139b2b Undo: use system memcmp
`my_memcmp` didn't work properly comparing memory sizes not aligned to 4 bytes,
this worked while we used guarded-alloc (which always wrote a guard at the end of each allocation).
Since moving to lockfree allocator it could read uninitialized memory.

It also consistently performed ~10-30% worse then glibc's.
This is typically well optimized, no need to do ourselves.
2016-07-08 15:54:34 +10:00
dda96e3472 Fix T48807: Each stroke halves brush size
Missed from c5b2f12b
2016-07-08 14:51:12 +10:00
a02915c0f3 writefile: optimize undo memory use
Slop-space on Linux wasted ~20% of memory for undo storage.
2016-07-08 14:36:55 +10:00
a92fc348f4 Fix/Workaround non-uniform scaled bones failing w/ IK solver
Scaling a bone on the Y axis (for a stretch effect), wasn't supported by the IK solver.

Support this by solving as uniform scaled bones by matching the X,Z axis to the Y.

Requested by @pepeland, see D2088 for details.
2016-07-08 10:28:07 +10:00
7a3ea87bbf Cleanup: use normalize_v#_length 2016-07-08 10:14:49 +10:00
6035cf05bf BLI_math: add normalize functions which fit to a length
Convenient since its common to normalize then scale,
since these are inlined, use for regular normalize w/ 1.0 length.
2016-07-08 09:52:29 +10:00
30d951ce34 Cleanup: spelling 2016-07-08 09:49:01 +10:00
3fb2c1e4a2 Make use of new 'idtype can use idtype' check (in ID usages code, and ID remapping one too).
Reduces calls to BKE_library_foreach_ID_link() from 312 to 105 when relocating a library in a
rather simple lib reload test...
2016-07-07 21:21:33 +02:00
e2d469f878 libquery: add new 'BKE_library_idtype_can_use_idtype()' helper.
This should allow us to avoid a lot of useless processing when iterating over the
whole main database (unlink/remap/usages checks/etc.).

Note that some ID types report they can use any type for now, due to
fuzzyness/indefined nature of some usages (like constraints/modifiers/game logic,
or ID pointer of nodes...). Maybe we could address this (like e.g. adding defines
in relevant headers to restrict ID types used by constraints, by modifiers, etc.).
But don’t think this is top priority for now.
2016-07-07 21:21:33 +02:00
b651812721 Cleanup/fix animsys 'id_type_can_have_animdata()'.
This func now actually takes an ID type as argument, added new 'id_can_have_animdata()'
to check whether a datablock may be animated or not.
2016-07-07 21:21:33 +02:00
25e3657970 Extend libquery checks to test wether an ID is used locally and/or indirectly. 2016-07-07 21:21:33 +02:00
f36741c2eb Fix T48793: Bilinear filter clamps at edge pixels 2016-07-08 02:14:54 +10:00
1bb145e023 Fix single threaded compositor define 2016-07-08 01:41:36 +10:00
4beae09bae Cycles: Enable unaligned BVH builder for scenes with hair
This commit enables new unaligned BVH builder and traversal for scenes
with hair. This happens automatically, no need of manual control over
this.

There are some possible optimization still to happen here and there,
but overall there's already nice speedup:

                      Master                 Hair BVH
  bunny.blend         8:06.54                 5:57.14
  victor.blend       16:07.44                15:37.35

Unfortunately, such more complexity is not really coming for free,
so there's some downsides, but those are within acceptable range:

                      Master                Hair BVH
  classroom.blend     5:31.79                5:35.11
  barcelona.blend     4:38.58                4:44.51

Memory usage is also somewhat bigger for hairy scenes, but speed
benefit pays well for that. Additionally as was mentioned in one
of previous commits we can add an option to disable hair BVH and
have similar render time but have memory saving.

Reviewers: brecht, dingto, lukasstockner97, juicyfruit, maiself

Differential Revision: https://developer.blender.org/D2086
2016-07-07 17:25:48 +02:00
a08e2179f1 Cycles: Implement unaligned nodes BVH traversal
This commit implements traversal of unaligned BVH nodes.

QBVH traversal is fully SIMD optimized and calculates orientation
for all 4 children at a time, regular BVH might probably be optimized
a bit more.
2016-07-07 17:25:48 +02:00
b03e66e75f Cycles: Implement unaligned nodes BVH builder
This is a special builder type which is allowed to orient nodes to
strands direction, hence minimizing their surface area in comparison
with axis-aligned nodes. Such nodes are much more efficient for hair
rendering.

Implementation of BVH builder is based on Embree, and generally idea
there is to calculate axis-aligned SAH and oriented SAH and if SAH
of oriented node is smaller than axis-aligned SAH we create unaligned
node.

We store both aligned and unaligned nodes in the same tree (which
seems to be different from what Embree is doing) so we don't have
any any extra calculations needed to set up hair ray for BVH
traversal, hence avoiding any possible negative effect of this new
BVH nodes type.

This new builder is currently not in use, still need to make BVH
traversal code aware of unaligned nodes.
2016-07-07 17:25:48 +02:00
1a2012145d Cycles: Switch node address to absolute values in BVH tree
This seems to be straightforward way to support heterogeneous nodes
in the same tree.

There is some penalty related on 4gig limit of the address space now,
but here's are the thing:

Traversal code was already using ints to store final offset, so
there can't be regressions really.

This is a required commit to make it possible to encode both aligned
and unaligned nodes in the same array. Also, in the future we can use
this to get rid of __leaf_nodes array (which is a bit tricky to do since
trickery in pack_instances().
2016-07-07 17:25:48 +02:00
17e7454263 Cycles: Reduce memory usage by de-duplicating triangle storage
There are several internal changes for this:

First idea is to make __tri_verts to behave similar to __tri_storage,
meaning, __tri_verts array now contains all vertices of all triangles
instead of just mesh vertices. This saves some lookup when reading
triangle coordinates in functions like triangle_normal().

In order to make it efficient needed to store global triangle offset
somewhere. So no __tri_vindex.w contains a global triangle index which
can be used to read triangle vertices.

Additionally, the order of vertices in that array is aligned with
primitives from BVH. This is needed to keep cache as much coherent as
possible for BVH traversal. This causes some extra tricks needed to
fill the array in and deal with True Displacement but those trickery
is fully required to prevent noticeable slowdown.

Next idea was to use this __tri_verts instead of __tri_storage in
intersection code. Unfortunately, this is quite tricky to do without
noticeable speed loss. Mainly this loss is caused by extra lookup
happening to access vertex coordinate.

Fortunately, tricks here and there (i,e, some types changes to avoid
casts which are not really coming for free) reduces those losses to
an acceptable level. So now they are within couple of percent only,

On a positive site we've achieved:

- Few percent of memory save with triangle-only scenes. Actual save
  in this case is close to size of all vertices.

  On a more fine-subdivided scenes this benefit might become more
  obvious.

- Huge memory save of hairy scenes. For example, on koro.blend
  there is about 20% memory save. Similar figure for bunny.blend.

This memory save was the main goal of this commit to move forward
with Hair BVH which required more memory per BVH node. So while
this sounds exciting, this memory optimization will become invisible
by upcoming Hair BVH work.

But again on a positive side, we can add an option to NOT use Hair
BVH and then we'll have same-ish render times as we've got currently
but will have this 20% memory benefit on hairy scenes.
2016-07-07 17:25:48 +02:00
1eacbf47e3 Cycles: Support visibility check for inner nodes of QBVH
It was initially unsupported because initial idea of checking visibility
of all children was slowing scenes down a lot. Now the idea has changed
and we only perform visibility check of current node. This avoids huge
slowdown (from tests here it seems to be withing 1-2%, but more tests
would never hurt) and gives nice speedup of ray traversal for complex
scenes which utilized ray visibility.

Here's timing of koro.blend:

                  Without visibility check         With visibility check
Original file           4min 20sec                      4min 23sec
Camera rays only        1min 43 sec                       55sec

Unfortunately, this doesn't come for free and requires extra data in
BVH node, which increases memory usage of BVH nodes by 15%. This we
can solve with some future trickery of avoiding __tri_storage created
for curve segments.
2016-07-07 17:25:48 +02:00
a19da5c10d Quiet gcc warning-as-error about non-const pointer passed to const parameter. 2016-07-07 17:23:59 +02:00
b9dbcf406e Fix T48802 Unwrap buttons, can't add hotkey in 3DView's UV Unwrap menu.
Those unwrap operators are a bit tricky, some are available from both 3DView and UVEditor, others only from 3DView...

Hacked around this by returning Mesh keymap for UV_OT ops for specific 3DView/MeshEditMode context.
2016-07-07 17:06:53 +02:00
c8be112523 RNA: rename sorting -> sort
Shorter and consistent with other RNA.
2016-07-08 00:56:01 +10:00
6e6073e13c Skip the ID part of object names when comparing
Also no need to calloc arrays which are immediately filled
2016-07-08 00:50:08 +10:00
124bfa4d2d Cleanup: spelling, style 2016-07-08 00:48:45 +10:00
bef034e154 Cleanup: use static sets, remove redundant copy 2016-07-08 00:28:41 +10:00
91533b6f34 Revert "ChildOf Constraint: Hide the Loc/Rot/Scale toggles"
This reverts commit 4fd78bb06f.

After further testing, it turns out that these options are less-broken than
I remember them being (and have been hearing about). Specifically, as long
as you disable all 3-axes of a transform component (i.e. all location, all
rotation, all scale) you're not likely to have problems, whereas if you only
disabled one axis (i.e. y-rotation), you may have problems in some cases.

So, restoring these to the UI.
2016-07-08 01:59:43 +12:00
4bf19e163f Code Cleanup - Split out the FCurve auto-color code into a separate function 2016-07-08 01:49:27 +12:00
7793d1d26f Fix T48747: Stuck in edit mode after selecting another object in the animation editors 2016-07-08 01:49:26 +12:00
7f03c9de7e Fix: Keyframe click-selection threshold in Dopesheet was still hardcoded to 7px 2016-07-08 01:49:25 +12:00
f3b3eb70a6 Dopesheet: Added "Moving Hold" as a keyframe type
Currently "long keyframes" are only useful for indicating where stationary
holds occur. If however you try to create a "moving hold" (where the values
are slightly different, but in terms of overall effect, it's still a hold)
then it could get tricky to keep track of where these occur.

Now it's possible to tag such keyframes (using the keyframe types - RKEY)
as being part of a moving hold. These will not only be drawn differently
from normal keyframes, but they will also result in a "long keyframe"
being drawn between each pair of them, just like if they had been completely
stationary instead.

Currently the theming/styling of these is a bit rough. They reuse the existing
theme colours for long keyframes.
2016-07-08 01:49:25 +12:00
2ba2860e11 Transforms to Delta Transforms
* Added new operators to take the current transform value (loc/rot/scale or all 3)
  and convert/apply that transform to a corresponding delta transform value. By default,
  the transform value will be zeroed out again afterwards, so you don't end up with a
  double transform.

* These operators can be found in the "Apply" menu (Ctrl-A)

* The "Animated Transforms to Deltas" (which does a similar job, except it adjusts all
  existing animation data instead of the current transform) has also been moved to the
  Apply menu (it was in the Transform menu instead)
2016-07-08 01:49:24 +12:00
92c9bdbbb9 Animation Editors: Object datablocks are now sorted alphabetically by default
A long requested feature has been to have objects appear in alphabetical order
in the animation editors, so that it is easier to find where they occur. This
commit implements support for this.

The main sticking point has been the performance impact of having this sorting
happening all the time (as the actual list of "bases" cannot be modified, as the
old depsgraph still needs random-looking unsorted order of objects for scheduling
updates). However, it recently occurred to me that perhaps by restricting it to
the one case where the ordering actually matters (i.e. when we're getting the channel
list for drawing all channels, vs operating on them), and adding a toggle to turn the
sorting off in heavy scenes when it might bog down things, that it will probably
be acceptable enough in general.  Furthermore, if things get really bad, we can investigate
putting in place some sort of caching scheme for this too - though hopefully the
new depsgraph will make that unnecessary (i.e. it doesn't sort the bases directly anymore).
2016-07-08 01:49:23 +12:00
2910e288ab Code Cleanup: Move out logic for checking if an object can be included in the dopesheet 2016-07-08 01:49:23 +12:00
095c8dbe69 Dopesheet: Keyframe size can be adjusted as part of theme settings
This commit introduces a scale factor setting for scaling all keyframe indicators
in the Dopesheet Editor up/down, in order to make them easier to select. It is perhaps
most useful for keyframe types which are usually indicated using smaller keyframes
(e.g. breakdown), which may get tricky to quickly select.
2016-07-08 01:49:22 +12:00
fab4b907f6 NLA: Indicate position of action-local markers on strips
To make it easier to synchronise timing across multiple strips, if you add
markers locally to an action, these will show up in the NLA strip in the
NLA Editor. These markings can then be used to line up the start/end of
another strip, or even to make sure that the markers from two different
strips end up lining up.

By default, this is turned on, but it can be disabled (via the View menu)
if it adds too much visual noise.
2016-07-08 01:47:32 +12:00
514700b307 Fix (unreported) crash when remapping armatures.
Objects' Pose holds references to the armature bones, so we have to force POSE_RECALC in those cases...
2016-07-07 15:07:51 +02:00
8443628e66 Outliner: Match search length w/ id name length 2016-07-07 16:36:25 +10:00
dac125b8ec writefile: call undo flush after writing the windowmanager
Data here is constantly changing, avoids outliner data being included in those changes for undo.
2016-07-07 16:27:33 +10:00
2b5c93d8fe Cleanup: move write flush into its own function
No point passing dummy args to existing function, split out logic instead.

Also add flush after writing mesh data too.
2016-07-07 16:10:51 +10:00
fd43b7077f Fix memory leak switching sculpt mode + dyntopo
Auto-enabling dyntopo w/ mode switching leaked memory when undo was used.
2016-07-07 15:48:25 +10:00
003365df0e Transform Snap: fix vert & edit object in ortho view
The callback used in `BLI_bvhtree_find_nearest_to_ray` was wrong and could result in crash.

Also de-duplicate vert/edge logic.
2016-07-07 15:24:58 +10:00
74518b6e88 Fix failing script_load_addons test after recent code cleanup. 2016-07-06 21:57:53 +02:00
04b3d682bb Cycles tests: Don't create fail file on idiff warning 2016-07-06 17:39:09 +02:00
d501d0f91e Revert rB961ebfa8c40b9909 - do not set Main's versions directly in do_versions().
This breaks any post-versionning (like IPO conversion, python handler, etc.).

rB961ebfa8c40b9909 mentions some Main being do_versionned several times (which is not desired for sure),
will try to reproduce again and find another fix.
2016-07-06 17:16:34 +02:00
Dalai Felinto
1640796ccc Fix Python API error message (do_unlink, instead of unlink) 2016-07-06 11:32:46 -03:00
2fcb9ef919 writefile: add flushes
Flush on grease pencil and data with image preview or packed data.
2016-07-06 23:28:52 +10:00
a0793765ef writefile: avoid adding SDNA to every undo step
Since SDNA was allocated for each undo step,
the new address meant it was considered different and included again.

Add an option not to duplicate the DNA string when calling DNA_sdna_from_data,
as well as avoiding a redundant copy, it writes the same address each time.
2016-07-06 23:07:37 +10:00
94e84f5be4 Fix memleak with recent Outliner writefile changes. 2016-07-06 14:45:06 +02:00
b7e84f32ad Cleanup/simplify/fixes BKE_object_is_libdata and BKE_object_obdata_is_libdata.
Removed checks for ob->proxy from the equation, you can totally have proxy objects
linked into another .blend file!
2016-07-06 14:37:03 +02:00
d231260212 Replace of (id->lib != NULL) check by meaningful macro.
Idea is to replace hard-to-track (id->lib != NULL) 'is linked datablock' check everywhere in Blender
by a macro doing the same thing. This will allow to easily spot those checks in future, and more importantly,
to easily change it (see work done in asset-engine branch).

Note: did not touch to readfile.c, since there most of the time 'id->lib' check actually concerns the pointer,
and not a check whether ID is linked or not. Will have a closer look at it later.

Reviewers: campbellbarton, brecht, sergey

Differential Revision: https://developer.blender.org/D2082
2016-07-06 14:11:01 +02:00
b98b331d04 writefile: simplify outliner treestore workaround
Instead of keeping a list of allocations, write to unique addresses
based on the BLI_mempool address since we know this is unique.
2016-07-06 21:58:47 +10:00
95ff9e9904 Cleanup: redundant 4th index in sculpt PBVH
Since moving to MLoopTri this is no longer needed.
2016-07-06 19:15:47 +10:00
674756bfce Dyntopo: optimize edge collapsing
Checking if faces exist was a bottleneck,
use a simpler version of this function for triangles.

Gives approx 1.6x overall speedup (when many edges are being collapsed).
2016-07-06 16:43:29 +10:00
8f1b8611f5 Cleanup: group dyntopo utility functions 2016-07-06 16:32:17 +10:00
950c2eaf61 Transform Snap: Replace pixel limit w/ 'dist_to_ray_sq'
When snapping to edge/vert, check the distance to the ray
instead of the screen-space pixel projection.

This also corrects the conversion of `dist_to_ray_sq` to `dist_px` which was being done incorrectly.

While this change was planned, it fixes T48791, caused by error in b01a56ee.
2016-07-06 11:42:26 +10:00
1d81f69f5e Code cleanup: for Cycles compatible panels, use exclusion rather than inclusion list.
This shortens the list, and Blender render specific panels are added less often
than other panels anyway, so less chance to miss things.
2016-07-05 22:26:15 +02:00
5b99dd5859 Render border: don't disable when drawing around the entire camera.
Differential Revision: https://developer.blender.org/D712
2016-07-05 21:59:02 +02:00
29c38335a1 Render border: skip unnecessary uncropping if the border covers the entire image. 2016-07-05 21:59:02 +02:00
7fcab3324b Render border: make it work together with with cache result / save buffers / full sample.
Differential Revision: https://developer.blender.org/D2080
2016-07-05 21:59:02 +02:00
037aa544cc Dyntopo: missing PBVH update collapsing an edge
PBVH-nodes attached to the vertex to be deleted were updated,
but not nodes attached to the other vertex in the edge.
2016-07-06 03:47:18 +10:00
06c1e782b0 Dyntopo: avoid redundant vector copy 2016-07-06 03:17:06 +10:00
4a61d21f61 Dyntopo: inline lookups, remove type check
This was checking vert/face for every lookup,
so far the type is always known, do a direct lookup instead.
2016-07-06 03:17:06 +10:00
3c7f3d27e0 Dyntopo: use inline iterators
Gives small performance boost.
2016-07-06 03:16:56 +10:00
8a648c1913 Dyntopo: compare masks when collapsing
Was just checking the value of the first
2016-07-05 18:56:21 +10:00
020a420fe3 Dyntopo: verify had over zealous asserts 2016-07-05 18:56:21 +10:00
39ae324918 Cycles: remove extended precision hacks, no longer needed with SSE2 requirement.
Differential Revision: https://developer.blender.org/D2079
2016-07-04 18:22:11 +02:00
1ba90582f5 Fix a few compiler warnings on OS X / clang.
Two were actual bugs, though they existed only in unused code:
* In Freestyle it was unintentionally copying a scene rather than referencing it.
* In BLI_array_store_is_valid there was use of uninitialized memory.
2016-07-04 18:22:10 +02:00
439fe6568f Fix use of uninitialized variable introduced in fix for T48755. 2016-07-04 17:30:52 +02:00
99683f25e8 And one more fix to particle distribution!
As pointed by Brecht, previous fix in rB61b49de44940 was actually incomplete,
we could still hit float rounding issue and hence same value in more than one consecutive
items of element_sum.

New solution is a bit different, we remove the 'minimal weight' check, and rather simply
ignores an item when the sum of its normalized weight to previous item's sum does not add
anything. Shall be safe and 100% effective this time!
2016-07-04 16:10:40 +02:00
d3b27bd19c Fix bmesh test after recent refactor. 2016-07-04 11:48:48 +02:00
d4eb28ab7e BI Viewport(GLSL): support for envmap in Texture node
This patch is another step to achieve BI and it's Viewport consistency for cubemap textures.
{F318879}

To test world_space_shading flag D2072 is required.

Alexander (Blend4Web Team)

Reviewers: campbellbarton, brecht

Subscribers: homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D2074
2016-07-04 11:19:13 +03:00
4aaf5baccf Fix input for Texture node (envmap+world_space_shading)
This patch fixes shortcoming of D2046.
The original behavior without world_space_shading flag is that Texture node expects the reflected vector in view space. But with world_space_shading it should be in world space.

In attached file you will see a simple material setup and a node material analogue.

Simple material must have the same behavior regardless world_space_shading flag.

{F318866}

Alexander (Blend4Web Team)

Reviewers: brecht

Reviewed By: brecht

Subscribers: campbellbarton, homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D2072
2016-07-04 11:08:48 +03:00
fe44eacf78 Environment lighting for the GLSL mode
Environment lighting (aka ambient) is a key component of any renderer.
It's implemented like the Environment lighting of BI render for Approximate Gather mode. It support "Sky Color" and "White" Environment lighting modes.

It would be great if the user could see actual lighting conditions right in the Blender viewport instead of waiting for the renderer to complete the final image, exporting for external renderer or for a game engine.

Before:
{F113921}

After:
{F113922}

Example file: {F319013}

Original author: valentin_b4w

Alexander (Blend4Web Team)

Reviewers: valentin_b4w, campbellbarton, merwin, brecht

Reviewed By: brecht

Subscribers: panzergame, youle, duarteframos, AlexKowel, yurikovelenov, dingto, Evgeny_Rodygin

Projects: #rendering, #opengl_gfx

Differential Revision: https://developer.blender.org/D810
2016-07-04 11:01:32 +03:00
9269574089 Quiet warnings w/ USE_VERIFY define 2016-07-04 14:55:29 +10:00
b27322e71e Curve: utility to evaluate entire curve 2016-07-03 23:28:13 +10:00
b084003e88 Update pacman pkgbuild 2016-07-03 21:14:28 +10:00
8cc123a387 Fix T48783: OSL render errors after recent refactoring. 2016-07-03 13:08:21 +02:00
2c9add965b Fix use of uninitialized variable in Cycles OpenCL image textures. 2016-07-02 21:54:49 +02:00
0d4961cc52 Fix typo in bgl.Buffer report function
A GL_INT buffer was reported as GL_BYTE.
2016-07-02 18:38:05 +02:00
ee90badbd5 Install Deps: Use OSL 1.7.3, latest bugfix release. 2016-07-02 18:07:20 +02:00
aef72125da Correction for MSVC 2016-07-02 20:22:07 +10:00
b1047640ad BMesh: utility function to resize bmesh elements
This can be used to re-allocate bmesh data with/without tool flags.
Needed for Symmetrize since it uses bmesh operators from dyntopo.
2016-07-02 18:18:47 +10:00
9f5621bb4a Cleanup: comment blocks 2016-07-02 10:08:33 +10:00
1077514896 Cleanup: style 2016-07-02 10:00:30 +10:00
5c249fac9a Fix Cycles OpenCL not taking Extend and Clip extension types into account.
(See T48720).
2016-07-01 23:48:31 +02:00
85c9aefe0f "Fix" crash when deleting linked object which has indirect usages.
This is in fact very hairy situation here... Objects are only refcounted by scenes,
any other usage is 'free', which means once all object instanciations are gone Blender
considers it can delete it.

There is a trap here though: indirect usages. Typically, we should never modify linked data
(because it is essencially useless, changes would be ignored and ost on next reload or
even undo/redo). This means indirect usages are not affected by default 'safe' remapping/unlinking.

For unlinking preceeding deletion however, this is not acceptable - we are likely to end with
a zero-user ID (aka deletable one) which is still actually used by other linked data.

Solution choosen here is double:
I) From 'user-space' (i.e. outliner, operators...), we check for cases where deleting datablocks
should not be allowed (indirect data or indirectly used data), and abort (with report) if needed.
II) From 'lower' level (BKE_library_remap and RNA), we also unlink from linked data,
which makes actual deletion possible and safe.

Note that with previous behavior (2.77 one), linked object would be deleted, including from linked data -
but then, once file is saved and reloaded, indirect usage would link back the deleted object,
without any instanciation in scene, which made it somehow virtual and unreachable...

With new behavior, this is no more possible, but on the other hand it means that in situations of dependency cycles
(two linked objects using each other), linked objects become impossible to delete (from user space).

Not sure what's best here, behavior with those corner cases of library linking is very poorly defined... :(
2016-07-01 18:29:12 +02:00
ad717fe737 Outliner: pass operator's reports to all operation callbacks.
Also define single callback func typedef, cleaner this way!

Note: maybe we want to do that for the other callbacks too (data, etc.), but will be enough for now.
2016-07-01 18:29:12 +02:00
158679c9cc Fix T48666: Segfault on boolean operation when exiting edit mode of instanced operand
This is quite tricky situation which combined:

- Boolean modifier which accesses other object's derived mesh
  (in fact, it's nothing to do with boolean modifier, any other
  modifier which uses other's DM will have same bug).

- Dependency cycles in the scene which is rather russian-roulette
  from the cycle solver point of view.

- Multiple instanced objects used as boolean operand.

With all this things combined boolean modifier was accessing operand's derived
mesh which was referencing data from Mesh datablock. The issue is that those
references are becoming invalid after EDBM_mesh_load().

This function already had code to make sure object itself does not end up with
dangling pointers from derived mesh. Make it now so no possible instanced objects
are left with dangling pointers.

And who said it's a good idea to reference something from derived mesh..
2016-07-01 14:25:30 +02:00
50d715f970 UI: take zoom into account w/ curves widget
The Curves widget has buttons to zoom in on the curve. However the
click detection code doesn't take it into account, and at full zoom
in click on curve is detected very far from the actual visible curve.

Change it to compare the position to the actual line segments
in the UI coordinate space, i.e. with curve zoom applied.
2016-07-01 22:13:53 +10:00
b558fa6715 Add wait cursor toggling dyntopo 2016-07-01 21:50:53 +10:00
ff0079b40a UI: move dyntopo button to header
This looks a bit odd, but being able to see if dyntopo is enabled
when the panel is collapsed is handy.
2016-07-01 21:44:31 +10:00
85bdbd7653 Sculpt: skip normal calculation entering dyntopo
When no triangulation runs we can skip re-calculating normals.
2016-07-01 21:14:33 +10:00
dbd38e969f BGE: Display Hardware infos only in standalone.
This patch moves the PrintHardwareInfo() function in standalone only, not in embedded. Why? Because you can need this infos for debugging
purpose in "compiled" blender files but it was boring to have it displayed each time you launched embedded. So you can have this infos when you
click standalone or when you run your executable app from a console.

Reviewers: moguri, kupoman, panzergame.
2016-07-01 11:56:26 +00:00
c08f0ceeb7 Enable dyntopo re-entering sculpt mode 2016-07-01 19:49:13 +10:00
0a026033ae BMesh: make toolflags optional
Saves 8 bytes per vert/edge/face.
Gives overall ~20-25% memory saving for dyntopo sculpting
and modifiers that use BMesh.
2016-07-01 19:29:22 +10:00
4b0aeaf327 Fix T48757: Broken in D1120 normal baking 2016-06-30 12:40:35 +03:00
260da0cd91 Fix T48728, part 2: Vertex colors not shown in texture mode 2016-06-30 14:20:20 +05:00
b01a56ee5c Transform Snap: Optimize edge-snap using BVH tree
changes in BLI_kdopbvh:

- `BLI_bvhtree_find_nearest_to_ray` now takes is_ray_normalized and scale argument.
- `BLI_bvhtree_find_nearest_to_ray_angle` has been added (use for perspective view).

changes in BLI_bvhutils:

- `bvhtree_from_editmesh_edges_ex` was added.

changes in math_geom:

- `dist_squared_ray_to_seg_v3` was added.

other changes:

- `do_ray_start_correction` is no longer necessary to snap to verts.
- the way in which the test of depth was done before is being simulated in callbacks.
2016-06-30 17:52:03 +10:00
9d5661c9e8 CMake: list buildinfo.h as buildinfo.cmake's output
Keep the fake header to ensure we always run.
2016-06-30 08:53:25 +10:00
72792406c9 Correct fix for MSVC 2016-06-30 08:10:49 +10:00
71a57a37b2 Merge branch 'master' into blender2.8 2016-06-29 17:58:39 +02:00
94a80a1fb1 Fix bplayer (c) 2016-06-29 17:57:41 +02:00
f45fbf4b83 Merge branch 'master' into blender2.8 2016-06-29 17:45:16 +02:00
903cb13bb8 Cleanup: use const 2016-06-29 23:22:54 +10:00
0971749f4c Cleanup: spelling, indentation 2016-06-29 20:37:54 +10:00
2e41df6847 Fix T48695: Slowdown w/ edit-mesh & shrinkwrap
0b5a0d84 caused regression since edit-mesh BVH wasn't cached,
each shrink-wrap modifier created its own BVH.
2016-06-29 19:43:08 +10:00
68fcc3b1f6 Correction to previous commit: Only skip colors for texture paint
This way we avoid regression of sculpt mode shading.

Hopefully now it's all fine.
2016-06-29 13:31:45 +05:00
9e173afca3 Cleanup: endian tests 2016-06-29 18:14:45 +10:00
2f532c7844 Fix T48728: Vertex colors not shown in texture mode
Regression caused by own changes to make texture paint more efficient
from workflow point of view.

Now the idea is to use vertex color outside of paint mode, so we don't
break any compatibility here.
2016-06-29 13:08:12 +05:00
c7eb5eeaa9 Cleanup: warning 2016-06-29 17:12:48 +10:00
e6d947f037 BMesh Intersect: use flags to keep track of verts
For simple cases bitmasks were OK, but didnt work for vert/edge, vert/edge tests.

Tag verts instead, makes logic easier to follow and gives minor speedup.
2016-06-29 16:09:58 +10:00
29a73106b4 UI: prevent softrange from becoming nan
Quiets assert
2016-06-29 12:09:00 +10:00
20f634cfc2 Fix T48755: Crash UV unwrapping 2016-06-29 11:51:36 +10:00
a21549f822 Usual i18n/UI messages cleanup & fixes. 2016-06-28 21:34:18 +02:00
Martijn Berger
5b325abf60 [msvc2015/OpenEXR] Linker hackery is no longer required in vc2015
Reviewers: juicyfruit

Reviewed By: juicyfruit

Differential Revision: https://developer.blender.org/D1892
2016-06-28 16:02:12 +02:00
23cc453975 Fix T48732: New GGX breaks OpenCL kernel
Make sure we don't perform any implicit address space conversion.

A bit annoying, but less intrusive approaches (like using temp private
variable in .cl kernel) do not work correct here.

Using generic address space will help from code side here, but will
be somewhat slower due to extra things happening as far as i know.
2016-06-28 17:15:35 +05:00
b90b02a480 Merge branch 'master' into blender2.8 2016-06-28 21:21:11 +10:00
5ae6a3b6b6 Merge branch 'master' into blender2.8 2016-06-28 21:10:11 +10:00
0d7817d1a4 Cleanup: use bool for writefile 2016-06-28 21:00:00 +10:00
55546b4e13 writefile: replace most struct lookups /w constants
Removes many hash lookups per file-save and undo-step.
2016-06-28 20:25:52 +10:00
f181839c57 Cleanup: code-style
Other changes here planned which touch many lines, so run cleanup first.
2016-06-28 20:05:04 +10:00
72fc2b6afe Fix T48753: VSE must restart for international fonts 2016-06-28 16:25:49 +10:00
6ce0ddae96 GHOST/X11: Hotplug support for xinput
Allows to plug/unplug different tablets while Blender is running.

Also fixes crash unplugging tablet while Blender runs (T48750).
2016-06-28 16:08:39 +10:00
e5a1f3142e RNA: resolve assert w/ no languages available 2016-06-28 12:36:21 +10:00
66054caa1b RNA: perform reverse search on operators
In most the last added operator is being handles.
2016-06-28 12:13:43 +10:00
3569ea03d8 Cleanup: Python imports 2016-06-28 12:13:16 +10:00
5806268051 Fix MSVC error, co_return now a reserved word
D2073 by @LazyDodo
2016-06-28 08:35:05 +10:00
f738f66f1b Fix (unreported) wrong ID type check in Text editor's ID remap callback. 2016-06-27 17:42:38 +02:00
14f056144e Bendy Bones Instability Fix - Second Attempt
So the error seems to be in cubic_tangent_factor_circle_v3(),
which was introduced with D2001.

I've tweaked the most obvious culprit here - the epsilon factor.
It used to be 10^-7, but I've reduced it down to 10^-5 now,
and it's looking a lot more stable now :)

---------

BTW, about the derivation of the magic 0.390464 factor I briefly subbed back
as a workaround for this bug, see:
    http://www.whizkidtech.redprince.net/bezier/circle/
2016-06-28 02:52:20 +12:00
9466d1579d Bendy Bones: Temporary workaround for instability caused by D2001 when using custom handle bones
It's probably some numeric precision issue, but until we figure out exactly what's
going wrong here, let's just revert back to the hardcoded value that was used here
successfully for years without issues.
2016-06-28 02:20:54 +12:00
0f927d6eca Fix stupid merge error. 2016-06-27 16:07:38 +02:00
cbce7fef16 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/makesrna/intern/rna_particle.c
2016-06-27 15:59:01 +02:00
e2c7ee7733 Fix T48740: User could remap indirect libdata usages from outliner.
Remapping indirect usage of IDs is forbidden from user space, this is calling for
nice nightmare with libraries handling (and undo crash, among other things).

Not sure why I was 'laxist' about indirect usage cases detection like that,
for now just consider any ID used by another linked datablock as indirect usage case!

Also, added some error/warning reports to Outliner's remap code.
2016-06-27 15:46:43 +02:00
34024c7cd8 FCurve Auto Colours: "XYZ to RGB" works for Quaternions too now
The "W" channel will get a yellowish colour (i.e. a blend between the X/R and
Y/G axis colours), while the XYZ will behave as they do for other transforms.
2016-06-28 00:27:51 +12:00
f4e492ad71 Partial fix for T48734
The create drivers operator should not use the "Transform Channel" variable type
when driving one transform with another on the same object/bone. Otherwise, you
end up with a situation which technically results in a bit of a pseudo-dependency
cycle.
2016-06-28 00:27:50 +12:00
b6483a25f2 Code Cleanup: Use bools not shorts 2016-06-28 00:27:50 +12:00
de6064eab1 Ctrl-Shift-C: Made it easier to add constraints between bones in different armatures
The Ctrl-Shift-C operator to add constraints between a pair of selected items,
for example, between two objects, or between two bones (in the same armature).

This commit makes it possible to use this operator to add a constraint where the
target is a bone from another object - e.g. to make a deform bone follow the control
bone in another armature, or to make an object use a bone as a tracking target.

Usage:
1) Ensure you are in Pose Mode, then select the bone to use as the target
2) Shift-Select the other object and/or the bone that's going to get the constraint
3) Ctrl-Shift-C
2016-06-28 00:27:49 +12:00
ab921321e1 Fix (unreported) potential buffer overflow with BLO_library_path_explode() usage.
Also added warning to func doc, let's try to avoid this in future (for until we
pass string length systematically...).
2016-06-27 12:38:12 +02:00
5f77266baf Fix T48741: File browser back button doesn't work from inside Blend (library) file.
Problem was in fact slightly wider, File space was nearly not taking into account
library navigation case and its 'virtual' directoris, except in a few places.

Add a wrapper around BLI_is_dir that also check for lib paths, and used it in
ED_file_change_dir(), such that we now always check path is a
valid directory - in the filebrowser context, not filesytem context. ;)
2016-06-27 12:26:14 +02:00
4a641e3cbc Cycles: Fix corner case of human readable number returning empty string 2016-06-27 13:49:25 +05:00
f1253f5d2b Fix T48717: Modal operators called from Py omit reports from the UI 2016-06-27 17:09:52 +10:00
6021cc4007 Rename script stub
Was clear from name this is to run external scripts.
2016-06-27 16:04:59 +10:00
5181f085eb Fix T48733: World background fails in 3d-view
Missing from fix for T48555.
Unfortunately duplicates code.
2016-06-27 15:36:28 +10:00
936c176a71 Fix T48743: Broken menu key accelerators
Regression caused by fc96110b
2016-06-27 14:15:48 +10:00
538a70c9b6 Cleanup: unnecessary NULL check 2016-06-27 13:21:14 +10:00
c7a6ff0981 Docs: arg names 2016-06-27 13:21:14 +10:00
6e193c42cb Docs: minor edits to writefile comments 2016-06-27 12:39:28 +10:00
2a69b09b62 Fix T48732 v2: New GGX breaks OpenCL kernel
As far as I can see, the second issue there was that the functions receive a pointer to a member variable of the
ShaderData, which is stored in global memory. However, this means that the pointer points to global memory as well,
therefore OpenCL requires the ccl_addr_space "keyword" in front of the pointer.
With this commit, the OpenCL kernels build on Linux with the Intel CPU OpenCL runtime - however, they already did
without the change and I don't have an AMD card, so I can't really test whether the AMD runtime is happy as well now.
2016-06-26 00:51:16 +02:00
aff81c6393 Cleanup: Get rid of remaining 'BKE_<id>_unlink()' functions, no more used anyway. 2016-06-25 18:36:27 +02:00
1b6cf7a99b Cleanup: get rid of BKE_text_unlink(), replace by usage of generic BKE_libblock_... API. 2016-06-25 18:12:23 +02:00
42872656d8 Cleanup: remove RNA's ID.destroy() function.
We already have Main's ID lists' `remove()` function, better not do the same thing
in two different places!
2016-06-25 17:10:33 +02:00
d4e435836d Cleanup/refactor RNA IDs' remove functions.
Those (one per ID type!) were uselessly duplicated, and badly inconsistent
(some types were actually unlinking before deletion, others were only working if already unlinked!).

Now we use same func and same API for all types, by default deletion is performed only if ID is no more used,
set `do_unlink` parameter to True to always delete ID even if still in use.
Only exception now is with Scene, since we always want to keep at least one!

Note that this will change default behavior of some types (since unlinking is never done anymore by default).
2016-06-25 17:10:33 +02:00
bfcf8c8e03 CMake: exclude gitignore & arcconfig for addons
These files were included in releases
2016-06-25 21:57:54 +10:00
9c96585f3c Cleanup: remove bad-level call 2016-06-25 21:19:54 +10:00
0a99072f0d GPU: move select index code out of WM
This avoids bad-level calls.
2016-06-25 21:13:33 +10:00
28dbd572a4 Exclude obsolete static pythonlibs from install 2016-06-25 12:40:19 +02:00
99088f8b55 Fix T48732, OpenCL compile failure after Multiscatter GGX commit.
Use OpenCL "all" builtin type for conversion, according to OpenCL 1.1 spec 6.3e.
2016-06-25 11:14:06 +02:00
05a60aaa07 Fix T48723: Curve bevel creates invalid geometry 2016-06-25 13:57:35 +10:00
8f0a44a5d5 Cleanup: use BLI_bitmap for bevel-split 2016-06-25 11:24:25 +10:00
c376ff26be Fix T48725: UI message typo. 2016-06-24 11:00:19 +02:00
a10117562f BMesh: avoid redundant calculations comparing angles 2016-06-24 19:01:35 +10:00
73a9c56607 Fix T48716: Knife cut creates inverted normals
In the case of having 3+ boundary edges, we need to find the best.
2016-06-24 18:58:42 +10:00
823ab66eca Avoid memory leaks on exit during argument parsing
Exiting Blender during argument parsing would leak memory
(tests, documentation generation, utilities).

While harmless, it hides real leaks which should be resolved.
2016-06-24 10:05:23 +10:00
25866aa149 BKE_blender: Add own atexit functions
Runs before guarded-alloc leaks print.
2016-06-24 10:05:18 +10:00
4fc1510dd8 Cleanup: use return argument prefix 2016-06-24 10:05:09 +10:00
23c276832b Cycles: Add multi-scattering, energy-conserving GGX as an option to the Glossy, Anisotropic and Glass BSDFs
This commit adds a new distribution to the Glossy, Anisotropic and Glass BSDFs that implements the
multiple-scattering microfacet model described in the paper "Multiple-Scattering Microfacet BSDFs with the Smith Model".

Essentially, the improvement is that unlike classical GGX, which only models single scattering and assumes
the contribution of multiple bounces to be zero, this new model performs a random walk on the microsurface until
the ray leaves it again, which ensures perfect energy conservation.

In practise, this means that the "darkening problem" - GGX materials becoming darker with increasing
roughness - is solved in a physically correct and efficient way.

The downside of this model is that it has no (known) analytic expression for evalation. However, it can be
evaluated stochastically, and although the correct PDF isn't known either, the properties of MIS and the
balance heuristic guarantee an unbiased result at the cost of slightly higher noise.

Reviewers: dingto, #cycles, brecht

Reviewed By: dingto, #cycles, brecht

Subscribers: bliblubli, ace_dragon, gregzaal, brecht, harvester, dingto, marcog, swerner, jtheninja, Blendify, nutel

Differential Revision: https://developer.blender.org/D2002
2016-06-23 22:57:26 +02:00
2af4c80be6 GPencil: Eraser respects "Selection Mask" when in EditMode 2016-06-24 03:33:31 +12:00
9839aba84f Fix minor typo - Was m[3][4] instead of m[4][4] for a 4x4 matrix 2016-06-24 03:18:38 +12:00
4fd78bb06f ChildOf Constraint: Hide the Loc/Rot/Scale toggles
The RNA properties are still there (in case you really need them), except now
they will not be shown in the UI anymore, as this constraint really didn't
work well/at all when any of those was disabled. Most people shouldn't really
need to worry about this change.

If anyone wants a matrix-math challenge, they're welcome to try getting those
working for real, so that we can show these toggles again.
2016-06-24 03:18:37 +12:00
9466829ead DopeSheet Mask Mode: Circle/Lasso support
Adapted from the code for Grease Pencil (just like the whole mode was)
2016-06-24 03:18:36 +12:00
833e69ff7e DopeSheet: GPencil-Mode supports Circle and Lasso Select
To get this working the least effort, I've had to expose the helper functions
used by the lasso and circle select keyframe-test callbacks (which are generic)
and expose them for use by the GP keyframe editing code too. Hopefully in time
we clean this all up and just write the code once to operate on "keyframes"
2016-06-24 03:18:36 +12:00
7e53f9fb1a Dopesheet: Lasso and Circle Select tools work for selecting keyframes
This only works in the Action and Dopesheet modes (which operate on FCurve keyframes).
Support for Grease Pencil and Mask Keyframes though is still pending.
2016-06-24 03:18:35 +12:00
58acc184c4 Code Cleanup - Circle/Lasso select in the Graph Editor 2016-06-24 03:18:34 +12:00
b6a898b3db GPencil UI: Streamline toolbar options a bit
As suggested by mendiobox:

* Don't show "enable editing" in the 3D view. You can already do this by switching
  into stroke editing mode here, so no need for the duplication. (In other editors
  though, this can't be done yet, so we don't do it)

* Make the "Convert" button into a dropdown so that you don't need to deal with a
  a separate popup menu

* In the 3D view, don't show the selection + transform operators that can be easily
  found in the menus too (as well as having commonly used shortcuts)
2016-06-24 03:18:33 +12:00
ec7603d6f1 GPencil: Added a new version of the "delete active frame" operator which deletes on all editable layers
This new operator will delete any GP frame it finds on the current frame, regardless
of whether it's on the active layer or not. It will only remove the frames if the
layer is editable, but otherwise, it will just go for it.

The existing operator is great for use in the panel (where it only applies to the active
frame), but it was not so good for all the other places where tools can be invoked
(e.g. D-X, or Delete) as you're typically thinking about the whole scene more holisticaly
than just caring about a particular layer.
2016-06-24 03:18:33 +12:00
37560e77e8 Fix T48689: Transform proportional size was not seriously clamped.
Now use same, reasonable min/max values, to avoid getting inf or zero values when
using shortcuts during transform operation...
2016-06-23 16:45:06 +02:00
d9a01a1d04 Fix T48707: Edit-mesh intersect crash
In rare cases intersect would attempt to add edges with the same vertex twice
from edge-vert / edge-edge intersections.

Solve by checking for duplicates when creating vertex-array for these types of intersections
(always under 3x comparisons, so not much overhead).
2016-06-23 22:20:40 +10:00
57744df38f Correct recent change to edge-net
Need account for cases where vertex connects a single edge.
2016-06-23 22:20:40 +10:00
097611a92a Fix T48710: 'velocity' particle settings were incorrectly using 'speed' in their tooltips.
Not the same thing, velocity is a vector conveying both speed *and* direction...
2016-06-23 13:09:32 +02:00
219a8d046a Use hard min/max for view clipping
In rare cases its useful to have far clip below 1.
2016-06-23 18:47:55 +10:00
a8898d3105 Correct assert 2016-06-23 12:26:26 +10:00
fad0c336e4 RNA: Expose hook inverse matrix
Needed so scripts don't need to use operators to adjust hook modifiers.
2016-06-23 11:52:44 +10:00
475b7f5a2c BLI_array_utils: add BLI_array_rfindindex
Array search from back to front.
2016-06-23 11:36:49 +10:00
9bce807d0b Cycles: Fix the Convert Node type registration
The function that assigns names to socket types missed an entry, therefore all entries after it were mapped to the wrong name.
Long-term, it might be a better solution to use a map to avoid issues like these, but for now this fix works.
2016-06-23 03:15:57 +02:00
c2dc77983d Merge branch 'master' into blender2.8
No changes, just resolve conflicts.
2016-06-23 08:04:19 +10:00
29448bd99b Fix T48658: Cycles render & render preview corrupts particles
Replaces `G.is_rendering` with `use_render_params` argument.

This is needed for Cycles, which attempts to restore render-preview settings from particles,
after it gets its own particle data, but fails to restore because
`G.is_rendering` was being checked in psys_cache_paths (and other places).
2016-06-23 07:54:35 +10:00
3b0a5dd158 Merge branch 'master' into blender2.8 2016-06-23 07:52:58 +10:00
7547c6a250 ID-Remap, step two: add some user-level tools.
This commit adds operators and Outliner menu entries to reload or relocate a library,
and to delete or replace a datablock.

RNA ID API is also extended to allow ID deletion and remapping from python.

Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 18:05:55 +02:00
fb1f7fad78 Cleanup: use proper RNA struct type for ListBase type
(otherwise all code using RNA has to link DNA_listbase.h, not clean at all!).
2016-06-22 18:04:04 +02:00
897e97f078 ID-Remap - Step one: core work (cleanup and rework of generic ID datablock handling).
This commit changes a lot of how IDs are handled internally, especially the unlinking/freeing
processes. So far, this was very fuzy, to summarize cleanly deleting or replacing a datablock
was pretty much impossible, except for a few special cases.

Also, unlinking was handled by each datatype, in a rather messy and prone-to-errors way (quite
a few ID usages were missed or wrongly handled that way).

One of the main goal of id-remap branch was to cleanup this, and fatorize ID links handling
by using library_query utils to allow generic handling of those, which is now the case
(now, generic ID links handling is only "knwon" from readfile.c and library_query.c).

This commit also adds backends to allow live replacement and deletion of datablocks in Blender
(so-called 'remapping' process, where we replace all usages of a given ID pointer by a new one,
or NULL one in case of unlinking).

This will allow nice new features, like ability to easily reload or relocate libraries, real immediate
deletion of datablocks in blender, replacement of one datablock by another, etc.
Some of those are for next commits.

A word of warning: this commit is highly risky, because it affects potentially a lot in Blender core.
Though it was tested rather deeply, being totally impossible to check all possible ID usage cases,
it's likely there are some remaining issues and bugs in new code... Please report them! ;)

Review task: D2027 (https://developer.blender.org/D2027).
Reviewed by campbellbarton, thanks a bunch.
2016-06-22 17:53:50 +02:00
73cfbb0ab9 Cycles: Fix crash with Environment Texture and OSL
In the OSL node compilation code for the Environment Texture, is_linear was used as a socket.
However, there was no socket for it, which caused Blender to crash.
Adding a socket doesn't really make sense since it's an internal value and not a parameter
of the node, so it now just uses the variable directly.
2016-06-22 16:12:40 +02:00
b204bdad47 EditMesh: Avoid creating deform-vert layer every redraw
Getting a new edit-derived-bmesh was always creating a deform-vert array, even when it wasn't needed.
Since this was called on redraw, in many cases it was doing it unnecessarily.

Now pass in a custom-data mask and only fill in deform-verts when needed.

Gives noticeable drawing speedup (~10-30% here).
2016-06-22 21:31:00 +10:00
97ee7f8609 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/physics/particle_edit.c
2016-06-22 13:12:44 +02:00
493c6b622f Cleanup: style 2016-06-22 14:02:51 +10:00
435fa9a015 Cleanup: remove unused Image space curves
Caused leaks reading old files, was read/written but not freed,
remove since its unused.
2016-06-22 09:50:53 +10:00
e0f314d750 readfile: use BLI_endian_switch
Replace inline endian switching
2016-06-22 09:38:23 +10:00
68040359d1 Remove module reloading for preview operators
This can be kept on file level but best keep out of operator functions.
2016-06-22 08:47:40 +10:00
63006c88a1 writefile: use const for old address
Also remove temp preview overwriting.
2016-06-22 08:44:26 +10:00
6fbe6eb033 Fix T48703: Name inconsistency w/ area maximize/fullscreen
Name operator based on default behavior.
2016-06-22 07:47:30 +10:00
a5b474e352 Docs: use doxy formatting for readfile 2016-06-22 07:47:30 +10:00
1fd773ed14 T48694: fix bge.texture.Texture.refresh() documentation
first parameter is mandatory and must be a bool indicating if the image
source should be refreshed after updating the texture.
2016-06-21 23:23:05 +02:00
8ae74ece9a Fix null-pointer free
Own error in recent decimeter commit
2016-06-22 05:34:04 +10:00
e783fddc01 Fix T48700: Crash when window creation fails
Check if Python is initialized before calling BPY_python_end.
2016-06-22 04:17:02 +10:00
028ba31903 Fix T48698: Rays from SSS act as diffuse for normal objects but have an undefined type for lamp objects
The problem here was that there are five path types internally (diffuse, glossy, transmission, subsurface and volume scatter), but subsurface isn't exposed to the user.
This caused some weird behaviour - if all four types are disabled on the lamp, Cycles doesn't even try sampling it, but if any type was active, the lamp would illuminate
the cube since none of the options set subsurface to zero.
In the future, it might be reasonable to add subsurface visibility as an option - but for now the weird and inconsistent behaviour can be fixed simply by setting both
diffuse and subsurface to zero if the user disables diffuse visibility.
2016-06-21 20:09:48 +02:00
db4a46bc3c Cleanup: hide debug print behind proper debug defines instead of using comments... 2016-06-21 16:19:08 +02:00
e34ade4eb3 Fix T48412: Blender 2.77a crashes on Undo in some specific multi-level linked libraries cases.
Good old dead-brain stupid error when iterating over a linked list from which you remove some items...
2016-06-21 16:12:33 +02:00
8dec4a0e79 Fix for string buffer overflow in DepsNode identifiers.
Layer flags can go up to 2^n-1 for n layers, requiring *at least* 9 chars + 1 terminator for 20 layers.
2016-06-21 12:51:18 +02:00
1abf7dd835 Fix T48697: Brush curve-stroke snaps strangely
Support Snapping screen-space 2d curves, (was applying world-space coords in screen-space).
Also show snap settings in header.
2016-06-21 16:19:45 +10:00
7cbd1285a5 Fix T48196: Crash enabling modal operator in exec
Not good practice, but better not crash.
2016-06-21 15:02:10 +10:00
994dd5c7c1 Cleanup: rename curve align-x flags 2016-06-21 12:45:25 +10:00
Dalai Felinto
cb5a77253a Text Object: Vertical Alignment
A new option for Font/Text objects vertical alignment:

* Top Base-Line (current mode)
* Top
* Center
* Bottom

The Top is the equivalent as the Top-Baseline with an empty line at the begin of the
text. It's nice to have this option too though, since if we are driving
the alignment via Python we don't want to add extra lines to the text
only to accomodate to the desired vertical alignment.

The Center and Bottom are as intuitive as their name suggest.

When working with text boxes, the vertical alignment only work for
paragraphs that are not vertically full.

Many thanks to Campbell Barton (ideasman42 / @campbellbarton) for the
code review, code comments, and overall suggestions and changes :)

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D2061
2016-06-20 23:21:24 -03:00
48c58bd913 Merge branch 'master' into blender2.8 2016-06-21 12:14:49 +10:00
1c19940198 Fix T48688: Crash loading particle effector weights 2016-06-21 09:44:35 +10:00
29ce3dfeb6 Fix T48691: Cycles - OpenCL - HDR Image mapping does not match CUDA rendering
The OpenCL texture code didn't offset the coordinates by half a pixel like the CPU code does.
2016-06-21 00:49:25 +02:00
93c6cf496e Cycles: Deduplicate Vector and RGB Curve nodes
Since most of the code for these two nodes was identical, this commit
now instead uses a common base class that implements all the functionality.
2016-06-21 00:19:51 +02:00
a170607578 Fix T48683: Knife cut creates hole
BM_face_split_edgenet wasn't correctly detecting boundary vertices to walk over,
since vertices may be attached to boundary edges not part of the newly created face.
2016-06-21 08:10:56 +10:00
ed225d4517 BMesh: avoid verts-of-edge iterator
Since this function is called a lot, loop over data directly.
2016-06-21 08:10:51 +10:00
dfa7ddd4a8 Cycles: Add svm_util_color.h file to CMake
The file wasn't included in CMake and therefore not installed into the addon folder.
2016-06-20 19:07:22 +02:00
Dalai Felinto
72273b08cc Fix building for Windows after 57cff46v (booleans unitialized) 2016-06-20 13:02:53 -03:00
61b49de449 Fix once more time particle distribution.
rB046adde64f16 was actually pretty useless (and broken), since issue ends up not being
in binary search code, but in generation of the 'summed weights' array used to distribute
particles over mesh items - looks like very small weights could lead to null accumulated
weights, wich was breaking binary search.

Fixed simply by adding a minimal, non-zero weight for mesh items to be allowed to emit particles.

Hopefully we are done with this distribution mess!
2016-06-20 11:12:33 +02:00
2e553f77b8 Cleanup: Remove todo comment, this is fine as is. 2016-06-19 21:09:54 +02:00
f7bada00a7 Cycles: add constant folding for more color operation nodes.
Invert, brightness & constrast, separate/combine and Mix RGB blend modes
and clamping.
2016-06-19 20:17:28 +02:00
81e391a727 Fix issues with node deduplication in Cycles shader graph.
It is not possible to use a set split by name as valid input to
check_node_input_traversed - it needs a complete set of all nodes visited so
far. On the other hand, the merge comparison loop should only check nodes that
were not just visited, but found unique. This means that there should really be
two separate data structures.

Without the fix, check_node_input_traversed actually never returns true, so
only nodes without any inputs are processed.
2016-06-19 20:17:27 +02:00
98547e8817 Fix Cycles RGB and Vector Curves node Fac handling. 2016-06-19 20:17:27 +02:00
34a42788e7 Code refactor: small code simplification for Cycles constant folding. 2016-06-19 20:17:27 +02:00
c87f7865b2 Fix Cycles OSL image texture issue after recent refactor. 2016-06-19 20:17:26 +02:00
e26eb9c93b Cycles: reduce CUDA stack memory access for Maxwell and up, increasing max registers.
For non-branched path tracing with a GTX 960 and CUDA 7.5, this gives a small reduction
in stack usage but mainly: 8% faster render on BMW, 5% on pabellon, 13% on classroom.
2016-06-19 20:17:26 +02:00
9b618c1a5a Cycles tests: raise failure threshold, copy failed image for comparison. 2016-06-19 20:17:26 +02:00
48caadfdd5 Fix Cycles assert after recent half changes. 2016-06-19 20:17:25 +02:00
600f7df71b Fix return type in case of single channel half. 2016-06-19 17:38:39 +02:00
6311a9ff23 Cycles: Support half and half4 textures.
This is an initial commit for half texture support in Cycles.
It adds the basic infrastructure inside of the ImageManager and support for these textures on CPU.

Supported:
* Half Float OpenEXR images (can be used for e.g HDRs or Normalmaps) now use 1/2 the memory, when loaded via disk (OIIO).

ToDo:
Various things like support for inbuilt half textures, GPU... will come later, step by step.

Part of my GSoC 2016.
2016-06-19 17:31:16 +02:00
2cfff95ba3 Merge branch 'master' into blender2.8 2016-06-15 17:41:22 +10:00
eedcc4a6a0 Merge branch 'master' into blender2.8 2016-06-15 17:29:11 +10:00
5864269b2c Merge branch 'master' into blender2.8 2016-06-13 19:26:56 +10:00
46e1d85e61 Reduce conflicts be keeping same indent-level as master 2016-06-10 05:51:34 +10:00
c96d4ec644 Merge branch 'master' into blender2.8 2016-06-10 05:46:29 +10:00
a151806698 Merge branch 'master' into blender2.8 2016-06-10 05:17:33 +10:00
10d57f991b Merge branch 'master' into blender2.8 2016-06-10 05:15:06 +10:00
4b99958ca1 Remove particle expander
Having this caused buffer-overrun on startup
2016-06-07 18:27:31 +10:00
1e5735ab99 World space switch for BI nodes.
At the moment light shading in Blender is produced in viewspace. Apparently, that's why
shader nodes work with normals in camera space. But it is not convenient for artists.
The more convenient approach is implemented in Cycles where normals are represented in world space.
Blend4Web Team designed the engine keeping in mind shader parameters readability,
so normals are interpreted in world space as well. And now our users have to use some tweaks, like
empty node group with the name "Replace", which is replacing one input by another on the engine side
(replacing working configuration in Blender Viewport by the configuration that has the same behavior in the engine).

This patch adds the ability to switch to world space for normals and lamp vector in BI and Viewport.
This patch is very important to us and we crave to see this patch in Blender 2.7 because
it will significantly simplify Blend4Web material creation workflow.

{F315547}

{F315548}

Reviewers: campbellbarton, brecht

Reviewed By: brecht

Subscribers: homyachetser, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D2046
2016-06-07 10:21:55 +02:00
5750549f6a Cleanup: warnings 2016-06-07 18:16:03 +10:00
ed6f86a510 Merge branch 'master' into blender2.8 2016-06-07 18:06:46 +10:00
24d29f2e50 Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/transform/transform_snap_object.c
2016-06-07 09:59:26 +02:00
11af9e9a5b Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	intern/cycles/blender/blender_particles.cpp
	source/blender/depsgraph/intern/builder/deg_builder_relations.h
	source/blender/depsgraph/intern/depsgraph_build.cc
2016-06-01 14:34:11 +02:00
faec430914 Merge branch 'master' into blender2.8
Conflicts:
	intern/cycles/blender/blender_curves.cpp
	source/blender/blenkernel/intern/dynamicpaint.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/transform/transform_snap_object.c
	source/blender/editors/util/undo.c
	source/blender/makesrna/intern/rna_object_force.c
2016-05-24 16:48:10 +02:00
f85745b17b Flat shading for basic shader
The purpose of the patch is to replace deprecated  glShadeModel.

To decrease glShadeModel calls I've set GL_SMOOTH by default

Reviewers: merwin, brecht

Reviewed By: brecht

Subscribers: blueprintrandom, Evgeny_Rodygin, AlexKowel, yurikovelenov

Differential Revision: https://developer.blender.org/D1958
2016-05-16 11:13:21 +03:00
b4a721af69 Merge branch 'temp_remove_pointcache' into blender2.8 2016-05-02 11:00:34 +02:00
5aa19be912 Merge branch 'temp_remove_particles' into blender2.8 2016-05-02 11:00:26 +02:00
735727e2b8 Removed DNA for point caches. 2016-04-30 14:20:13 +02:00
ac30a04b27 Removed point cache blenkernel code. 2016-04-29 15:03:58 +02:00
181d095f50 Removed PointCache RNA struct definition and uses. 2016-04-29 11:07:11 +02:00
ceb452bc9d Removed point cache operators. 2016-04-29 10:44:09 +02:00
c3863650cc Removed UI for point cache users. 2016-04-28 18:38:10 +02:00
1f723603c8 Merge branch 'master' into temp_remove_particles 2016-04-28 17:33:19 +02:00
3632c4997f Merge branch 'master' into temp_remove_particles 2016-04-20 16:25:16 +02:00
773efb506a Removed particle sync code from Cycles.
Note that this only removes the actual dependencies of Cycles on the
particle code in Blender, but not the internal "particle" definition
or the curve type handling inside Cycles. These structures may be in need
of some improvement themselves, but that is out of scope here.
2016-04-20 11:59:02 +02:00
ba279efbdb Removed the ND_PARTICLE notifier and outliner particle elements. 2016-04-16 17:27:49 +02:00
9465d3decf Removed the particle context of property buttons space. 2016-04-16 17:17:31 +02:00
ecb695ccc8 Removed tool settings for particle edit mode. 2016-04-16 14:26:09 +02:00
cd0ec340c4 Removed remaining uses of the particle edit mode flag. 2016-04-16 12:39:41 +02:00
15c8d095e5 Removed the Main.particle list, used for ParticleSettings ID blocks.
There were still some type-agnostic uses as well, owing to the generic
ListBase type.
2016-04-16 12:28:29 +02:00
7c57822afa Fixed some minor errors in game engine and player. 2016-04-16 12:11:34 +02:00
c92b6f1de6 Removed the translation context for particle settings. 2016-04-16 11:32:45 +02:00
d30b942f07 Removed the ID_PA code used for ParticleSettings. 2016-04-16 11:29:28 +02:00
df2e543d44 Removed some unused declarations for boids code. 2016-04-16 11:11:39 +02:00
fbed29a246 Merge branch 'master' into temp_remove_particles 2016-04-15 17:59:54 +02:00
987bb50a74 Removed remaining use of pointers to particle types as well as boids headers. 2016-04-13 18:10:23 +02:00
d474ed9b88 Partially revert 82ec9c87a7, to add back point cache operators.
Eventually point cache will also be replaced, but it can be kept working at first even without particles.
2016-04-13 16:58:44 +02:00
664f5b8c06 Removed particle DNA. 2016-04-13 13:41:11 +02:00
d8d49befa0 Removed particle system and particle instance modifiers. 2016-04-13 11:45:15 +02:00
d47173c8ca Removed blenkernel particle code. 2016-04-13 10:49:39 +02:00
cf6cb3dcaf Removed most particle system code from RNA. 2016-04-12 18:26:19 +02:00
bcd12bf64d Removed most partical-related code from UI scripts.
There are a lot of cases here where deciding for removal is a bit tricky.
Many features have options for "use_particles" and similar settings. Only
features which actually store a particle object reference or work on actual
particle data have been removed.
2016-04-12 16:28:00 +02:00
29a792a75b Removed all direct uses of BKE_particle.h and DNA_particle_types.h from source/blender/editors. 2016-04-12 13:04:31 +02:00
cc468c1974 Removed remnants of particle draw code. 2016-04-12 12:18:38 +02:00
82ec9c87a7 Removed particle operators API and point cache operators. 2016-04-12 11:47:08 +02:00
5a783144e2 Removed particle operators from editors/physics/. 2016-04-12 11:25:40 +02:00
1804 changed files with 202720 additions and 58403 deletions

6
.gitignore vendored
View File

@@ -33,3 +33,9 @@ Desktop.ini
/doc/python_api/sphinx-in-tmp/
/doc/python_api/sphinx-in/
/doc/python_api/sphinx-out/
/doc/python_api/rst/bmesh.ops.rst
/doc/python_api/rst/in_menu.png
/doc/python_api/rst/menu_id.png
/doc/python_api/rst/op_prop.png
/doc/python_api/rst/run_script.png
/doc/python_api/rst/spacebar.png

4
.gitmodules vendored
View File

@@ -10,3 +10,7 @@
path = release/datafiles/locale
url = ../blender-translations.git
ignore = all
[submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
ignore = all

File diff suppressed because it is too large Load Diff

View File

@@ -182,14 +182,20 @@ help: .FORCE
@echo " * package_archive - build an archive package"
@echo ""
@echo "Testing Targets (not associated with building blender)"
@echo " * test - run ctest, currently tests import/export, operator execution and that python modules load"
@echo " * test_cmake - runs our own cmake file checker which detects errors in the cmake file list definitions"
@echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting"
@echo " * test - run ctest, currently tests import/export,"
@echo " operator execution and that python modules load"
@echo " * test_cmake - runs our own cmake file checker"
@echo " which detects errors in the cmake file list definitions"
@echo " * test_pep8 - checks all python script are pep8"
@echo " which are tagged to use the stricter formatting"
@echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed"
@echo " * test_style_c - checks C/C++ conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo " * test_style_c - checks C/C++ conforms with blenders style guide:"
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo " * test_style_c_qtc - same as test_style but outputs QtCreator tasks format"
@echo " * test_style_osl - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo " * test_style_osl - checks OpenShadingLanguage conforms with blenders style guide:"
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide:"
@echo " http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo ""
@echo "Static Source Code Checking (not associated with building blender)"
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@@ -405,7 +411,8 @@ update: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
@@ -414,7 +421,8 @@ doc_doxy: .FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py
"$(BUILD_DIR)/bin/blender" --background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE

View File

@@ -25,17 +25,18 @@
ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,with-all,with-opencollada,\
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\
force-all,force-python,force-numpy,force-boost,\
force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
force-ffmpeg,force-opencollada,\
force-ffmpeg,force-opencollada,force-alembic,\
build-all,build-python,build-numpy,build-boost,\
build-ocio,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
build-ffmpeg,build-opencollada,\
build-ffmpeg,build-opencollada,build-alembic,\
skip-python,skip-numpy,skip-boost,\
skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
skip-ffmpeg,skip-opencollada \
skip-ffmpeg,skip-opencollada,skip-alembic \
-- "$@" \
)
@@ -167,6 +168,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--build-openvdb
Force the build of OpenVDB.
--build-alembic
Force the build of Alembic.
--build-opencollada
Force the build of OpenCOLLADA.
@@ -216,6 +220,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-openvdb
Force the rebuild of OpenVDB.
--force-alembic
Force the rebuild of Alembic.
--force-opencollada
Force the rebuild of OpenCOLLADA.
@@ -258,6 +265,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-openvdb
Unconditionally skip OpenVDB installation/building.
--skip-alembic
Unconditionally skip Alembic installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
@@ -272,8 +282,9 @@ SUDO="sudo"
NO_BUILD=false
NO_CONFIRM=false
USE_CXX11=true # Mandatory in blender2.8
PYTHON_VERSION="3.5.1"
PYTHON_VERSION="3.5.2"
PYTHON_VERSION_MIN="3.5"
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
@@ -306,7 +317,7 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
_with_built_openexr=false
OIIO_VERSION="1.6.9"
OIIO_VERSION="1.7.8"
OIIO_VERSION_MIN="1.6.0"
OIIO_VERSION_MAX="1.9.0" # UNKNOWN currently # Not supported by current OSL...
OIIO_FORCE_BUILD=false
@@ -321,14 +332,14 @@ LLVM_FORCE_REBUILD=false
LLVM_SKIP=false
# OSL needs to be compiled for now!
OSL_VERSION="1.7.1"
OSL_VERSION="1.7.5"
OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_BUILD=false
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.0.2"
OSD_VERSION="3.1.1"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
@@ -343,13 +354,20 @@ OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
# Alembic needs to be compiled for now
ALEMBIC_VERSION="1.6.0"
ALEMBIC_VERSION_MIN=$ALEMBIC_VERSION
ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
FFMPEG_VERSION="2.8.4"
FFMPEG_VERSION="3.2.1"
FFMPEG_VERSION_MIN="2.8.4"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
@@ -525,6 +543,7 @@ while true; do
OPENVDB_FORCE_BUILD=true
OPENCOLLADA_FORCE_BUILD=true
FFMPEG_FORCE_BUILD=true
ALEMBIC_FORCE_BUILD=true
shift; continue
;;
--build-python)
@@ -567,6 +586,9 @@ while true; do
--build-ffmpeg)
FFMPEG_FORCE_BUILD=true; shift; continue
;;
--build-alembic)
ALEMBIC_FORCE_BUILD=true; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
@@ -580,6 +602,7 @@ while true; do
OPENVDB_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
ALEMBIC_FORCE_REBUILD=true
shift; continue
;;
--force-python)
@@ -620,6 +643,9 @@ while true; do
--force-ffmpeg)
FFMPEG_FORCE_REBUILD=true; shift; continue
;;
--force-alembic)
ALEMBIC_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@@ -656,6 +682,9 @@ while true; do
--skip-ffmpeg)
FFMPEG_SKIP=true; shift; continue
;;
--skip-alembic)
ALEMBIC_SKIP=true; shift; continue
;;
--)
# no more arguments to parse
break
@@ -676,6 +705,21 @@ if [ "$WITH_ALL" = true -a "$OPENCOLLADA_SKIP" = false ]; then
fi
WARNING "****WARNING****"
PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
PRINT "for some troublesome/buggy libraries..."
PRINT ""
PRINT ""
PRINT "Ran with:"
PRINT " install_deps.sh $COMMANDLINE"
PRINT ""
PRINT ""
# This has to be done here, because user might force some versions...
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
@@ -683,7 +727,7 @@ NUMPY_SOURCE=( "http://sourceforge.net/projects/numpy/files/NumPy/$NUMPY_VERSION
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "http://sourceforge.net/projects/boost/files/boost/$BOOST_VERSION/boost_$_boost_version_nodots.tar.bz2/download" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams"
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options"
OCIO_SOURCE=( "https://github.com/imageworks/OpenColorIO/tarball/v$OCIO_VERSION" )
@@ -712,7 +756,7 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
OSL_SOURCE_REPO_UID="7d40ff5fe8e47b030042afb92d0e955f5aa96f48"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OSD_USE_REPO=true
OSD_USE_REPO=false
# Script foo to make the version string compliant with the archive name:
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
@@ -727,13 +771,32 @@ OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPEN
#~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
ALEMBIC_USE_REPO=false
ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
# ALEMBIC_SOURCE_REPO_UID="e6c90d4faa32c4550adeaaf3f556dad4b73a92bb"
# ALEMBIC_SOURCE_REPO_BRANCH="master"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
OPENCOLLADA_REPO_BRANCH="master"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
CXXFLAGS_BACK=$CXXFLAGS
if [ "$USE_CXX11" = true ]; then
WARNING "C++11 is now mandatory for blender2.8, this *should* go smoothly with any very recent distribution.
However, if you are experiencing linking errors (also when building Blender itself), please try the following:
* Re-run this script with `--build-all --force-all` options.
* Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above.
Please note that until the transition to C++11-built libraries if completed in your distribution, situation will
remain fuzzy and incompatibilities may happen..."
PRINT ""
PRINT ""
CXXFLAGS="$CXXFLAGS -std=c++11"
export CXXFLAGS
fi
#### Show Dependencies ####
@@ -746,7 +809,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [libopenjpeg], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl1.2, libglew, libglewmx.\""
* libsdl1.2, libglew, [libglewmx].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -767,7 +830,8 @@ You may also want to build them yourself (optional ones are [between brackets]):
* [OpenShadingLanguage $OSL_VERSION_MIN] (from $OSL_SOURCE_REPO, branch $OSL_SOURCE_REPO_BRANCH, commit $OSL_SOURCE_REPO_UID).
* [OpenSubDiv $OSD_VERSION_MIN] (from $OSD_SOURCE_REPO, branch $OSD_SOURCE_REPO_BRANCH, commit $OSD_SOURCE_REPO_UID).
* [OpenVDB $OPENVDB_VERSION_MIN] (from $OPENVDB_SOURCE), [Blosc $OPENVDB_BLOSC_VERSION] (from $OPENVDB_BLOSC_SOURCE).
* [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).\""
* [OpenCollada] (from $OPENCOLLADA_SOURCE, branch $OPENCOLLADA_REPO_BRANCH, commit $OPENCOLLADA_REPO_UID).
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).\""
if [ "$DO_SHOW_DEPS" = true ]; then
PRINT ""
@@ -919,7 +983,7 @@ prepare_opt() {
# Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name...
magic_compile_check() {
if [ -f $INST/.$1-magiccheck-$2 ]; then
if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then
return 0
else
return 1
@@ -928,7 +992,7 @@ magic_compile_check() {
magic_compile_set() {
rm -f $INST/.$1-magiccheck-*
touch $INST/.$1-magiccheck-$2
touch $INST/.$1-magiccheck-$2-$USE_CXX11
}
# Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib...
@@ -1118,7 +1182,7 @@ compile_Boost() {
fi
# To be changed each time we make edits that would modify the compiled result!
boost_magic=10
boost_magic=11
_init_boost
@@ -1588,6 +1652,10 @@ compile_OIIO() {
# fi
cmake_d="$cmake_d -D USE_OCIO=OFF"
if [ "$USE_CXX11" = true ]; then
cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
fi
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
else
@@ -1742,7 +1810,7 @@ compile_OSL() {
fi
# To be changed each time we make edits that would modify the compiled result!
osl_magic=20
osl_magic=21
_init_osl
# Clean install if needed!
@@ -1799,6 +1867,9 @@ compile_OSL() {
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
if [ "$USE_CXX11" = true ]; then
cmake_d="$cmake_d -D OSL_BUILD_CPP11=1"
fi
#~ cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
@@ -1873,7 +1944,7 @@ compile_OSD() {
fi
# To be changed each time we make edits that would modify the compiled result!
osd_magic=1
osd_magic=2
_init_osd
# Clean install if needed!
@@ -2138,6 +2209,102 @@ compile_OPENVDB() {
run_ldconfig "openvdb"
}
#### Build Alembic ####
_init_alembic() {
_src=$SRC/alembic-$ALEMBIC_VERSION
_git=false
_inst=$INST/alembic-$ALEMBIC_VERSION
_inst_shortcut=$INST/alembic
}
clean_ALEMBIC() {
_init_alembic
_clean
}
compile_ALEMBIC() {
if [ "$NO_BUILD" = true ]; then
WARNING "--no-build enabled, Alembic will not be compiled!"
return
fi
compile_HDF5
PRINT ""
# To be changed each time we make edits that would modify the compiled result!
alembic_magic=2
_init_alembic
# Clean install if needed!
magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
if [ $? -eq 1 -o "$ALEMBIC_FORCE_REBUILD" = true ]; then
clean_ALEMBIC
fi
if [ ! -d $_inst ]; then
INFO "Building Alembic-$ALEMBIC_VERSION"
prepare_opt
if [ ! -d $_src -o true ]; then
mkdir -p $SRC
download ALEMBIC_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking Alembic-$ALEMBIC_VERSION"
tar -C $SRC -xf $_src.tar.gz
fi
cd $_src
cmake_d="-D CMAKE_INSTALL_PREFIX=$_inst"
if [ -d $INST/boost ]; then
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
cmake_d="$cmake_d -D USE_STATIC_BOOST=ON"
else
cmake_d="$cmake_d -D USE_STATIC_BOOST=OFF"
fi
if [ "$_with_built_openexr" = true ]; then
cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
cmake_d="$cmake_d -D USE_ARNOLD=OFF"
cmake_d="$cmake_d -D USE_BINARIES=OFF"
cmake_d="$cmake_d -D USE_EXAMPLES=OFF"
cmake_d="$cmake_d -D USE_HDF5=OFF"
cmake_d="$cmake_d -D USE_MAYA=OFF"
cmake_d="$cmake_d -D USE_PRMAN=OFF"
cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
cmake_d="$cmake_d -D USE_STATIC_HDF5=OFF"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_LINK_STATIC=OFF"
cmake_d="$cmake_d -D ALEMBIC_SHARED_LIBS=OFF"
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_BOOST=ON"
cmake_d="$cmake_d -D ALEMBIC_LIB_USES_TR1=OFF"
INFO "ILMBASE_ROOT=$INST/openexr"
fi
cmake $cmake_d ./
make -j$THREADS install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
cd $CWD
INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
else
INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
run_ldconfig "alembic"
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
@@ -2305,7 +2472,7 @@ compile_FFmpeg() {
--enable-avfilter --disable-vdpau \
--disable-bzlib --disable-libgsm --disable-libspeex \
--enable-pthreads --enable-zlib --enable-stripping --enable-runtime-cpudetect \
--disable-vaapi --disable-libfaac --disable-nonfree --enable-gpl \
--disable-vaapi --disable-nonfree --enable-gpl \
--disable-postproc --disable-librtmp --disable-libopencore-amrnb \
--disable-libopencore-amrwb --disable-libdc1394 --disable-version3 --disable-outdev=sdl \
--disable-libxcb \
@@ -2432,8 +2599,9 @@ install_DEB() {
git libfreetype6-dev libx11-dev flex bison libtbb-dev libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev"
# libglewmx-dev (broken in deb testing currently...)
OPENJPEG_USE=true
VORBIS_USE=true
@@ -2746,6 +2914,17 @@ install_DEB() {
fi
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
# No package currently, only HDF5!
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
_do_compile_collada=false
@@ -3283,6 +3462,17 @@ install_RPM() {
compile_OPENVDB
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
# No package currently!
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
PRINT ""
@@ -3693,6 +3883,16 @@ install_ARCH() {
fi
fi
PRINT ""
if [ "$ALEMBIC_SKIP" = true ]; then
WARNING "Skipping Alembic installation, as requested..."
elif [ "$ALEMBIC_FORCE_BUILD" = true ]; then
INFO "Forced Alembic building, as requested..."
compile_ALEMBIC
else
compile_ALEMBIC
fi
if [ "$WITH_OPENCOLLADA" = true ]; then
PRINT ""
@@ -3835,9 +4035,6 @@ install_OTHER() {
fi
if [ "$_do_compile_llvm" = true ]; then
install_packages_DEB libffi-dev
# LLVM can't find the debian ffi header dir
_FFI_INCLUDE_DIR=`dpkg -L libffi-dev | grep -e ".*/ffi.h" | sed -r 's/(.*)\/ffi.h/\1/'`
PRINT ""
compile_LLVM
have_llvm=true
@@ -3856,7 +4053,6 @@ install_OTHER() {
if [ "$_do_compile_osl" = true ]; then
if [ "$have_llvm" = true ]; then
install_packages_DEB flex bison libtbb-dev
PRINT ""
compile_OSL
else
@@ -3875,7 +4071,6 @@ install_OTHER() {
fi
if [ "$_do_compile_osd" = true ]; then
install_packages_DEB flex bison libtbb-dev
PRINT ""
compile_OSD
fi
@@ -3892,10 +4087,6 @@ install_OTHER() {
fi
if [ "$_do_compile_collada" = true ]; then
install_packages_DEB libpcre3-dev
# Find path to libxml shared lib...
_XML2_LIB=`dpkg -L libxml2-dev | grep -e ".*/libxml2.so"`
# No package
PRINT ""
compile_OpenCOLLADA
fi
@@ -3980,16 +4171,6 @@ print_info_ffmpeglink() {
}
print_info() {
PRINT ""
PRINT ""
WARNING "****WARNING****"
PRINT "If you are experiencing issues building Blender, _*TRY A FRESH, CLEAN BUILD FIRST*_!"
PRINT "The same goes for install_deps itself, if you encounter issues, please first erase everything in $SRC and $INST"
PRINT "(provided obviously you did not add anything yourself in those dirs!), and run install_deps.sh again!"
PRINT "Often, changes in the libs built by this script, or in your distro package, cannot be handled simply, so..."
PRINT ""
PRINT "You may also try to use the '--build-foo' options to bypass your distribution's packages"
PRINT "for some troublesome/buggy libraries..."
PRINT ""
PRINT ""
PRINT "Ran with:"
@@ -4000,7 +4181,13 @@ print_info() {
_buildargs="-U *SNDFILE* -U *PYTHON* -U *BOOST* -U *Boost*"
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG*"
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*"
if [ "$USE_CXX11" = true ]; then
_1="-D WITH_CXX11=ON"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
_1="-D WITH_CODEC_SNDFILE=ON"
PRINT " $_1"
@@ -4106,6 +4293,17 @@ print_info() {
_buildargs="$_buildargs $_1"
fi
if [ "$ALEMBIC_SKIP" = false ]; then
_1="-D WITH_ALEMBIC=ON"
PRINT " $_1"
_buildargs="$_buildargs $_1"
if [ -d $INST/alembic ]; then
_1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
fi
if [ "$NO_SYSTEM_GLEW" = true ]; then
_1="-D WITH_SYSTEM_GLEW=OFF"
PRINT " $_1"
@@ -4154,3 +4352,6 @@ PRINT ""
# Switch back to user language.
LANG=LANG_BACK
export LANG
CXXFLAGS=$CXXFLAGS_BACK
export CXXFLAGS

View File

@@ -94,6 +94,7 @@ all_repositories = {
r'git://git.blender.org/blender-translations.git': 'blender-translations',
r'git://git.blender.org/blender-addons.git': 'blender-addons',
r'git://git.blender.org/blender-addons-contrib.git': 'blender-addons-contrib',
r'git://git.blender.org/blender-dev-tools.git': 'blender-dev-tools',
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
}
@@ -128,6 +129,7 @@ def schedule_force_build(name):
forcesched.CodebaseParameter(hide=True, codebase="blender-translations"),
forcesched.CodebaseParameter(hide=True, codebase="blender-addons"),
forcesched.CodebaseParameter(hide=True, codebase="blender-addons-contrib"),
forcesched.CodebaseParameter(hide=True, codebase="blender-dev-tools"),
forcesched.CodebaseParameter(hide=True, codebase="lib svn")],
properties=[]))
@@ -143,6 +145,7 @@ def schedule_build(name, hour, minute=0):
"blender-translations": {"repository": "", "branch": "master"},
"blender-addons": {"repository": "", "branch": "master"},
"blender-addons-contrib": {"repository": "", "branch": "master"},
"blender-dev-tools": {"repository": "", "branch": "master"},
"lib svn": {"repository": "", "branch": "trunk"}},
branch=current_branch,
builderNames=[name],
@@ -264,7 +267,8 @@ def generic_builder(id, libdir='', branch='', rsync=False):
for submodule in ('blender-translations',
'blender-addons',
'blender-addons-contrib'):
'blender-addons-contrib',
'blender-dev-tools'):
f.addStep(git_submodule_step(submodule))
f.addStep(git_step(branch))
@@ -293,13 +297,14 @@ def generic_builder(id, libdir='', branch='', rsync=False):
# Builders
add_builder(c, 'mac_x86_64_10_6_cmake', 'darwin-9.x.universal', generic_builder, hour=5)
add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
# add_builder(c, 'linux_glibc211_i686_cmake', '', generic_builder, hour=1)
# add_builder(c, 'linux_glibc211_x86_64_cmake', '', generic_builder, hour=2)
add_builder(c, 'linux_glibc219_i686_cmake', '', generic_builder, hour=3)
add_builder(c, 'linux_glibc219_x86_64_cmake', '', generic_builder, hour=4)
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=3)
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=4)
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=5)
add_builder(c, 'win32_cmake_vc2015', 'windows_vc14', generic_builder, hour=5)
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=6)
# STATUS TARGETS
#

View File

@@ -72,7 +72,11 @@ if 'cmake' in builder:
# Set up OSX architecture
if builder.endswith('x86_64_10_6_cmake'):
cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/bin/nvcc')
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda8-hack/bin/nvcc')
cmake_extra_options.append('-DWITH_CODEC_QUICKTIME=OFF')
cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.6')
build_cubins = False
elif builder.startswith('win'):
if builder.endswith('_vc2015'):
@@ -89,6 +93,7 @@ if 'cmake' in builder:
elif builder.startswith('win32'):
bits = 32
cmake_options.extend(['-G', 'Visual Studio 12 2013'])
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE:FILEPATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/nvcc.exe')
elif builder.startswith('linux'):
tokens = builder.split("_")
@@ -108,10 +113,13 @@ if 'cmake' in builder:
cuda_chroot_name = 'buildbot_' + deb_name + '_x86_64'
targets = ['player', 'blender', 'cuda']
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-8.0/bin/nvcc')
cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
# Prepare CMake options needed to configure cuda binaries compilation.
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=%s" % ('ON' if build_cubins else 'OFF'))
cuda_cmake_options.append("-DCYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61")
if build_cubins or 'cuda' in targets:
if bits == 32:
cuda_cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=OFF")
@@ -175,10 +183,8 @@ if 'cmake' in builder:
print('Condifuration FAILED!')
sys.exit(retcode)
if 'win32' in builder:
command = ['msbuild', 'INSTALL.vcxproj', '/Property:PlatformToolset=v120_xp', '/p:Configuration=Release']
elif 'win64' in builder:
command = ['msbuild', 'INSTALL.vcxproj', '/p:Configuration=Release']
if 'win32' in builder or 'win64' in builder:
command = ['cmake', '--build', '.', '--target', target_name, '--config', 'Release']
else:
command = target_chroot_prefix + ['make', '-s', '-j2', target_name]

View File

@@ -0,0 +1,70 @@
# - Find Alembic library
# Find the native Alembic includes and libraries
# This module defines
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers, Set when
# ALEMBIC_INCLUDE_DIR is found.
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
# This can also be an environment variable.
# ALEMBIC_FOUND, If false, do not try to use Alembic.
#
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
ENDIF()
SET(_alembic_SEARCH_DIRS
${ALEMBIC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/alembic
)
FIND_PATH(ALEMBIC_INCLUDE_DIR
NAMES
Alembic/Abc/All.h
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(ALEMBIC_LIBRARY
NAMES
Alembic
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib lib/static
)
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALEMBIC DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_INCLUDE_DIR)
IF(ALEMBIC_FOUND)
SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
ENDIF(ALEMBIC_FOUND)
MARK_AS_ADVANCED(
ALEMBIC_INCLUDE_DIR
ALEMBIC_LIBRARY
)
UNSET(_alembic_SEARCH_DIRS)

View File

@@ -0,0 +1,69 @@
# - Find HDF5 library
# Find the native HDF5 includes and libraries
# This module defines
# HDF5_INCLUDE_DIRS, where to find hdf5.h, Set when HDF5_INCLUDE_DIR is found.
# HDF5_LIBRARIES, libraries to link against to use HDF5.
# HDF5_ROOT_DIR, The base directory to search for HDF5.
# This can also be an environment variable.
# HDF5_FOUND, If false, do not try to use HDF5.
#
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If HDF5_ROOT_DIR was defined in the environment, use it.
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
ENDIF()
SET(_hdf5_SEARCH_DIRS
${HDF5_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/hdf5
)
FIND_LIBRARY(HDF5_LIBRARY
NAMES
hdf5
HINTS
${_hdf5_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_PATH(HDF5_INCLUDE_DIR
NAMES
hdf5.h
HINTS
${_hdf5_SEARCH_DIRS}
PATH_SUFFIXES
include
)
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG HDF5_LIBRARY HDF5_INCLUDE_DIR)
IF(HDF5_FOUND)
SET(HDF5_LIBRARIES ${HDF5_LIBRARY})
SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
ENDIF(HDF5_FOUND)
MARK_AS_ADVANCED(
HDF5_INCLUDE_DIR
HDF5_LIBRARY
)
UNSET(_hdf5_SEARCH_DIRS)

View File

@@ -1,15 +1,15 @@
# - Find Jack library
# Find the native Jack includes and library
# - Find JACK library
# Find the native JACK includes and library
# This module defines
# JACK_INCLUDE_DIRS, where to find jack.h, Set when
# JACK_INCLUDE_DIR is found.
# JACK_LIBRARIES, libraries to link against to use Jack.
# JACK_ROOT_DIR, The base directory to search for Jack.
# JACK_LIBRARIES, libraries to link against to use JACK.
# JACK_ROOT_DIR, The base directory to search for JACK.
# This can also be an environment variable.
# JACK_FOUND, If false, do not try to use Jack.
# JACK_FOUND, If false, do not try to use JACK.
#
# also defined, but not for general use are
# JACK_LIBRARY, where to find the Jack library.
# JACK_LIBRARY, where to find the JACK library.
#=============================================================================
# Copyright 2011 Blender Foundation.

View File

@@ -23,6 +23,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
${CMAKE_SOURCE_DIR}/extern/glog/src
${CMAKE_SOURCE_DIR}/extern/gflags/src
${CMAKE_SOURCE_DIR}/extern/gtest/include
${CMAKE_SOURCE_DIR}/extern/gmock/include
)
unset(_current_include_directories)
@@ -33,6 +34,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
bf_testing_main
bf_intern_guardedalloc
extern_gtest
extern_gmock
# needed for glog
${PTHREADS_LIBRARIES}
extern_glog

View File

@@ -27,13 +27,12 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git branch --list master --contains ${MY_WC_HASH}
execute_process(COMMAND git branch --list master blender-v* --contains ${MY_WC_HASH}
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_contains_check
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REGEX REPLACE "^[ \t]+" "" _git_contains_check "${_git_contains_check}")
if(_git_contains_check STREQUAL "master")
if(NOT _git_contains_check STREQUAL "")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git show-ref --tags -d
@@ -48,6 +47,22 @@ if(EXISTS ${SOURCE_DIR}/.git)
if(_git_tag_hashes MATCHES "${_git_head_hash}")
set(MY_WC_BRANCH "master")
else()
execute_process(COMMAND git branch --contains ${MY_WC_HASH}
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE _git_contains_branches
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^\\*[ \t]+" "" _git_contains_branches "${_git_contains_branches}")
string(REGEX REPLACE "[\r\n]+" ";" _git_contains_branches "${_git_contains_branches}")
string(REGEX REPLACE ";[ \t]+" ";" _git_contains_branches "${_git_contains_branches}")
foreach(_branch ${_git_contains_branches})
if (NOT "${_branch}" MATCHES "\\(HEAD.*")
set(MY_WC_BRANCH "${_branch}")
break()
endif()
endforeach()
unset(_branch)
unset(_git_contains_branches)
endif()
unset(_git_tag_hashes)

View File

@@ -239,8 +239,8 @@ def file_check_arg_sizes(tu):
if 0:
print("---",
" <~> ".join(
[" ".join([t.spelling for t in C.get_tokens()])
for C in node.get_children()]
[" ".join([t.spelling for t in C.get_tokens()])
for C in node.get_children()]
))
# print(node.location)

View File

@@ -29,11 +29,11 @@ if not sys.version.startswith("3"):
sys.exit(1)
from cmake_consistency_check_config import (
IGNORE,
UTF8_CHECK,
SOURCE_DIR,
BUILD_DIR,
)
IGNORE,
UTF8_CHECK,
SOURCE_DIR,
BUILD_DIR,
)
import os

View File

@@ -31,7 +31,7 @@ IGNORE = (
"extern/carve/patches/files/random.h",
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
)
)
UTF8_CHECK = True

View File

@@ -37,19 +37,19 @@ if not project_info.init(sys.argv[-1]):
sys.exit(1)
from project_info import (
SIMPLE_PROJECTFILE,
SOURCE_DIR,
CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
# is_py,
cmake_advanced_info,
cmake_compiler_defines,
cmake_cache_var,
project_name_get,
)
SIMPLE_PROJECTFILE,
SOURCE_DIR,
CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
# is_py,
cmake_advanced_info,
cmake_compiler_defines,
cmake_cache_var,
project_name_get,
)
import os

View File

@@ -43,17 +43,17 @@ def quote_define(define):
def create_qtc_project_main(name):
from project_info import (
SIMPLE_PROJECTFILE,
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
cmake_advanced_info,
cmake_compiler_defines,
project_name_get,
)
SIMPLE_PROJECTFILE,
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_project_file,
is_c_header,
cmake_advanced_info,
cmake_compiler_defines,
project_name_get,
)
files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
@@ -69,7 +69,7 @@ def create_qtc_project_main(name):
with open(os.path.join(PROJECT_DIR, "%s.includes" % FILE_NAME), 'w') as f:
f.write("\n".join(sorted(list(set(os.path.dirname(f)
for f in files_rel if is_c_header(f))))))
for f in files_rel if is_c_header(f))))))
qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % FILE_NAME)
with open(qtc_prj, 'w') as f:
@@ -87,7 +87,7 @@ def create_qtc_project_main(name):
# for some reason it doesnt give all internal includes
includes = list(set(includes) | set(os.path.dirname(f)
for f in files_rel if is_c_header(f)))
for f in files_rel if is_c_header(f)))
includes.sort()
# be tricky, get the project name from CMake if we can!
@@ -125,13 +125,13 @@ def create_qtc_project_main(name):
def create_qtc_project_python(name):
from project_info import (
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_py,
project_name_get,
)
SOURCE_DIR,
# CMAKE_DIR,
PROJECT_DIR,
source_list,
is_py,
project_name_get,
)
files = list(source_list(SOURCE_DIR, filename_check=is_py))
files_rel = [os.path.relpath(f, start=PROJECT_DIR) for f in files]
@@ -161,24 +161,24 @@ def argparse_create():
import argparse
parser = argparse.ArgumentParser(
description="This script generates Qt Creator project files for Blender",
)
description="This script generates Qt Creator project files for Blender",
)
parser.add_argument(
"-n", "--name",
dest="name",
metavar='NAME', type=str,
help="Override default project name (\"Blender\")",
required=False,
)
"-n", "--name",
dest="name",
metavar='NAME', type=str,
help="Override default project name (\"Blender\")",
required=False,
)
parser.add_argument(
"-b", "--build-dir",
dest="build_dir",
metavar='BUILD_DIR', type=str,
help="Specify the build path (or fallback to the $PWD)",
required=False,
)
"-b", "--build-dir",
dest="build_dir",
metavar='BUILD_DIR', type=str,
help="Specify the build path (or fallback to the $PWD)",
required=False,
)
return parser

View File

@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "python2"
@@ -42,7 +42,7 @@ CHECKER_ARGS = [
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
# stupid but needed
"-Dbool=char"
]
]
def main():

View File

@@ -32,7 +32,7 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "cppcheck"
@@ -43,7 +43,7 @@ CHECKER_ARGS = [
"--max-configs=1", # speeds up execution
# "--check-config", # when includes are missing
"--enable=all", # if you want sixty hundred pedantic suggestions
]
]
if USE_QUIET:
CHECKER_ARGS.append("--quiet")

View File

@@ -25,13 +25,13 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "smatch"
CHECKER_ARGS = [
"--full-path",
"--two-passes",
]
]
import project_source_info
import subprocess

View File

@@ -25,11 +25,11 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "sparse"
CHECKER_ARGS = [
]
]
import project_source_info
import subprocess

View File

@@ -25,7 +25,7 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
]
CHECKER_BIN = "splint"
@@ -61,7 +61,7 @@ CHECKER_ARGS = [
# dummy, witjout this splint complains with:
# /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
"-D_PC_MAX_CANON=0",
]
]
import project_source_info

View File

@@ -4,6 +4,7 @@
# cmake -C../blender/build_files/cmake/config/blender_full.cmake ../blender
#
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
set(WITH_BULLET ON CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
@@ -11,6 +12,7 @@ set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -8,6 +8,7 @@
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
@@ -15,6 +16,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_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
@@ -47,6 +49,7 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
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_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)

View File

@@ -0,0 +1,79 @@
# Turn everything ON thats expected for an official release builds.
#
# Example usage:
# cmake -C../blender/build_files/cmake/config/blender_release.cmake ../blender
#
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
set(WITH_BULLET ON CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_FRAMESERVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_BOOLEAN ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_MOD_SMOKE ON CACHE BOOL "" FORCE)
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
set(WITH_OPENMP 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_RAYOPTIMIZATION ON CACHE BOOL "" FORCE)
set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 CACHE STRING "" FORCE)
# platform dependent options
if(UNIX AND NOT APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
if(NOT CMAKE_COMPILER_IS_GNUCC)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
else()
# MinGW exceptions
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
endif()
elseif(APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
endif()

View File

@@ -32,3 +32,4 @@ set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)

View File

@@ -74,7 +74,7 @@ def main():
"rebuild_cache",
"depend",
"cmake_check_build_system",
])
])
targets -= set(bad)

View File

@@ -196,8 +196,33 @@ function(blender_source_group
endfunction()
# Support per-target CMake flags
# Read from: CMAKE_C_FLAGS_**** (made upper case) when set.
#
# 'name' should alway match the target name,
# use this macro before add_library or add_executable.
#
# Optionally takes an arg passed to set(), eg PARENT_SCOPE.
macro(add_cc_flags_custom_test
name
)
string(TOUPPER ${name} _name_upper)
if(DEFINED CMAKE_C_FLAGS_${_name_upper})
message(STATUS "Using custom CFLAGS: CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
endif()
if(DEFINED CMAKE_CXX_FLAGS_${_name_upper})
message(STATUS "Using custom CXXFLAGS: CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
endif()
unset(_name_upper)
endmacro()
# only MSVC uses SOURCE_GROUP
function(blender_add_lib_nolist
function(blender_add_lib__impl
name
sources
includes
@@ -225,6 +250,18 @@ function(blender_add_lib_nolist
endfunction()
function(blender_add_lib_nolist
name
sources
includes
includes_sys
)
add_cc_flags_custom_test(${name} PARENT_SCOPE)
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}")
endfunction()
function(blender_add_lib
name
sources
@@ -232,7 +269,9 @@ function(blender_add_lib
includes_sys
)
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
add_cc_flags_custom_test(${name} PARENT_SCOPE)
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}")
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
endfunction()
@@ -294,6 +333,11 @@ function(SETUP_LIBDIRS)
link_directories(${LLVM_LIBPATH})
endif()
if(WITH_ALEMBIC)
link_directories(${ALEMBIC_LIBPATH})
link_directories(${HDF5_LIBPATH})
endif()
if(WIN32 AND NOT UNIX)
link_directories(${PTHREADS_LIBPATH})
endif()
@@ -315,7 +359,6 @@ function(setup_liblinks
target_link_libraries(
${target}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${FREETYPE_LIBRARY}
)
@@ -372,7 +415,7 @@ function(setup_liblinks
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENSUBDIV)
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d")
target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}")
@@ -395,6 +438,9 @@ function(setup_liblinks
endif()
endif()
target_link_libraries(${target} ${JPEG_LIBRARIES})
if(WITH_ALEMBIC)
target_link_libraries(${target} ${ALEMBIC_LIBRARIES} ${HDF5_LIBRARIES})
endif()
if(WITH_IMAGE_OPENEXR)
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
endif()
@@ -463,11 +509,17 @@ function(setup_liblinks
endif()
endif()
target_link_libraries(
${target}
${ZLIB_LIBRARIES}
)
#system libraries with no dependencies such as platform link libs or opengl should go last
target_link_libraries(${target}
${BLENDER_GL_LIBRARIES})
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
#target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
endfunction()
@@ -568,6 +620,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_imbuf_openimageio
bf_imbuf_dds
bf_collada
bf_alembic
bf_intern_elbeem
bf_intern_memutil
bf_intern_guardedalloc
@@ -693,7 +746,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
endif()
if(WITH_OPENSUBDIV)
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()
@@ -1508,3 +1561,44 @@ function(print_all_vars)
message("${_var}=${${_var}}")
endforeach()
endfunction()
macro(openmp_delayload
projectname
)
if(MSVC)
if(WITH_OPENMP)
if(MSVC_VERSION EQUAL 1800)
set(OPENMP_DLL_NAME "vcomp120")
else()
set(OPENMP_DLL_NAME "vcomp140")
endif()
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELEASE "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_DEBUG "/DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
SET_TARGET_PROPERTIES(${projectname} PROPERTIES LINK_FLAGS_MINSIZEREL "/DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
endif(WITH_OPENMP)
endif(MSVC)
endmacro()
MACRO(WINDOWS_SIGN_TARGET target)
if (WITH_WINDOWS_CODESIGN)
if (!SIGNTOOL_EXE)
error("Codesigning is enabled, but signtool is not found")
else()
if (WINDOWS_CODESIGN_PFX_PASSWORD)
set(CODESIGNPASSWORD /p ${WINDOWS_CODESIGN_PFX_PASSWORD})
else()
if ($ENV{PFXPASSWORD})
set(CODESIGNPASSWORD /p $ENV{PFXPASSWORD})
else()
message( FATAL_ERROR "WITH_WINDOWS_CODESIGN is on but WINDOWS_CODESIGN_PFX_PASSWORD not set, and environment variable PFXPASSWORD not found, unable to sign code.")
endif()
endif()
add_custom_command(TARGET ${target}
POST_BUILD
COMMAND ${SIGNTOOL_EXE} sign /f ${WINDOWS_CODESIGN_PFX} ${CODESIGNPASSWORD} $<TARGET_FILE:${target}>
VERBATIM
)
endif()
endif()
ENDMACRO()

View File

@@ -38,7 +38,21 @@ unset(MY_WC_HASH)
# Force Package Name
execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE CPACK_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${CMAKE_SYSTEM_PROCESSOR})
if (MSVC)
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(PACKAGE_ARCH windows64)
else()
set(PACKAGE_ARCH windows32)
endif()
else(MSVC)
set(PACKAGE_ARCH ${CMAKE_SYSTEM_PROCESSOR})
endif()
if (CPACK_OVERRIDE_PACKAGENAME)
set(CPACK_PACKAGE_FILE_NAME ${CPACK_OVERRIDE_PACKAGENAME}-${PACKAGE_ARCH})
else()
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME_LOWER}-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-git${CPACK_DATE}.${BUILD_REV}-${PACKAGE_ARCH})
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# RPM packages
@@ -83,6 +97,8 @@ if(WIN32)
endif()
set(CPACK_PACKAGE_EXECUTABLES "blender" "blender")
set(CPACK_CREATE_DESKTOP_LINKS "blender" "blender")
include(CPack)
# Target for build_archive.py script, to automatically pass along

View File

@@ -0,0 +1,468 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Apple.
if(NOT DEFINED LIBDIR)
if(WITH_CXX11)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
else()
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
if(WITH_OPENAL)
find_package(OpenAL)
if(OPENAL_FOUND)
set(WITH_OPENAL ON)
set(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
else()
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_ALEMBIC)
set(ALEMBIC ${LIBDIR}/alembic)
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES Alembic)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
set(OPENSUBDIV ${LIBDIR}/opensubdiv)
set(OPENSUBDIV_LIBPATH ${OPENSUBDIV}/lib)
find_library(OSD_LIB_CPU NAMES osdCPU PATHS ${OPENSUBDIV_LIBPATH})
find_library(OSD_LIB_GPU NAMES osdGPU PATHS ${OPENSUBDIV_LIBPATH})
set(OPENSUBDIV_INCLUDE_DIR ${OPENSUBDIV}/include)
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_INCLUDE_DIR})
list(APPEND OPENSUBDIV_LIBRARIES ${OSD_LIB_CPU} ${OSD_LIB_GPU})
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
endif()
endif()
if(WITH_CODEC_SNDFILE)
set(SNDFILE ${LIBDIR}/sndfile)
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
set(SNDFILE_LIBRARIES sndfile FLAC ogg vorbis vorbisenc)
set(SNDFILE_LIBPATH ${SNDFILE}/lib ${LIBDIR}/ffmpeg/lib) # TODO, deprecate
endif()
if(WITH_PYTHON)
# we use precompiled libraries for py 3.5 and up by default
set(PYTHON_VERSION 3.5)
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
# normally cached but not since we include them with blender
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}m")
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else()
# module must be compiled against Python framework
set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}m")
set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}m")
set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}/config-${PYTHON_VERSION}m")
#set(PYTHON_LIBRARY python${PYTHON_VERSION})
#set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework Python") # won't build with this enabled
unset(_py_framework)
endif()
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
if(NOT EXISTS "${PYTHON_EXECUTABLE}")
message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
endif()
endif()
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBRARIES fftw3)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
set(PNG_LIBRARIES png)
set(JPEG_LIBRARIES jpeg)
set(ZLIB /usr)
set(ZLIB_INCLUDE_DIRS "${ZLIB}/include")
set(ZLIB_LIBRARIES z bz2)
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
set(FREETYPE_LIBRARY freetype)
if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
if(WITH_CXX11)
set(OPENEXR_POSTFIX -2_2)
else()
set(OPENEXR_POSTFIX)
endif()
set(OPENEXR_LIBRARIES
Iex${OPENEXR_POSTFIX}
Half
IlmImf${OPENEXR_POSTFIX}
Imath${OPENEXR_POSTFIX}
IlmThread${OPENEXR_POSTFIX})
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
set(FFMPEG_LIBRARIES
avcodec avdevice avformat avutil
mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg
)
if(WITH_CXX11)
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} schroedinger orc vpx webp swresample)
endif()
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_OPENJPEG OR WITH_CODEC_FFMPEG)
# use openjpeg from libdir that is linked into ffmpeg
if(WITH_CXX11)
set(OPENJPEG ${LIBDIR}/openjpeg)
set(WITH_SYSTEM_OPENJPEG ON)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG}/include)
set(OPENJPEG_LIBRARIES ${OPENJPEG}/lib/libopenjpeg.a)
endif()
endif()
find_library(SYSTEMSTUBS_LIBRARY
NAMES
SystemStubs
PATHS
)
mark_as_advanced(SYSTEMSTUBS_LIBRARY)
if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
set(PLATFORM_LINKFLAGS
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio"
)
if(WITH_CODEC_QUICKTIME)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QTKit")
if(CMAKE_OSX_ARCHITECTURES MATCHES i386)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework QuickTime")
# libSDL still needs 32bit carbon quicktime
endif()
endif()
if(WITH_CXX11)
list(APPEND PLATFORM_LINKLIBS c++)
else()
list(APPEND PLATFORM_LINKLIBS stdc++)
endif()
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
endif()
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
# force cmake to link right framework
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${LIBDIR}/opencollada/include/COLLADAStreamWriter
${LIBDIR}/opencollada/include/COLLADABaseUtils
${LIBDIR}/opencollada/include/COLLADAFramework
${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader
${LIBDIR}/opencollada/include/GeneratedSaxParser
)
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
set(OPENCOLLADA_LIBRARIES
OpenCOLLADASaxFrameworkLoader
-lOpenCOLLADAFramework
-lOpenCOLLADABaseUtils
-lOpenCOLLADAStreamWriter
-lMathMLSolver
-lGeneratedSaxParser
-lxml2 -lbuffer -lftoa
)
# Use UTF functions from collada if LLVM is not enabled
if(NOT WITH_LLVM)
list(APPEND OPENCOLLADA_LIBRARIES -lUTF)
endif()
# pcre is bundled with openCollada
#set(PCRE ${LIBDIR}/pcre)
#set(PCRE_LIBPATH ${PCRE}/lib)
set(PCRE_LIBRARIES pcre)
#libxml2 is used
#set(EXPAT ${LIBDIR}/expat)
#set(EXPAT_LIBPATH ${EXPAT}/lib)
set(EXPAT_LIB)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL2)
set(SDL_LIBPATH ${SDL}/lib)
if(WITH_CXX11)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lazy_framework ForceFeedback")
endif()
endif()
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib)
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib)
if(WITH_IMAGE_TIFF)
set(TIFF ${LIBDIR}/tiff)
set(TIFF_INCLUDE_DIR ${TIFF}/include)
set(TIFF_LIBRARY tiff)
set(TIFF_LIBPATH ${TIFF}/lib)
endif()
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(WITH_CXX11)
set(BOOST_POSTFIX)
else()
set(BOOST_POSTFIX -mt)
endif()
set(BOOST_LIBRARIES
boost_date_time${BOOST_POSTFIX}
boost_filesystem${BOOST_POSTFIX}
boost_regex${BOOST_POSTFIX}
boost_system${BOOST_POSTFIX}
boost_thread${BOOST_POSTFIX}
boost_wave${BOOST_POSTFIX}
)
if(WITH_INTERNATIONAL)
list(APPEND BOOST_LIBRARIES boost_locale${BOOST_POSTFIX})
endif()
if(WITH_CYCLES_NETWORK)
list(APPEND BOOST_LIBRARIES boost_serialization${BOOST_POSTFIX})
endif()
if(WITH_OPENVDB)
list(APPEND BOOST_LIBRARIES boost_iostreams${BOOST_POSTFIX})
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS)
endif()
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
endif()
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO}/lib/libOpenImageIO.a
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${TIFF_LIBRARY}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
)
if(WITH_CXX11)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${LIBDIR}/ffmpeg/lib/libwebp.a)
endif()
set(OPENIMAGEIO_LIBPATH
${OPENIMAGEIO}/lib
${JPEG_LIBPATH}
${PNG_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${ZLIB_LIBPATH}
)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
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_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIBPATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIBPATH})
if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
else()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -lLLVM-3.4")
endif()
else()
message(FATAL_ERROR "LLVM not found.")
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
# WARNING! depends on correct order of OSL libs linking
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
set(WITH_CYCLES_OSL OFF)
endif()
endif()
if(WITH_OPENMP)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VENDOR)
string(SUBSTRING "${COMPILER_VENDOR}" 0 5 VENDOR_NAME) # truncate output
if(${VENDOR_NAME} MATCHES "Apple") # Apple does not support OpenMP reliable with gcc and not with clang
set(WITH_OPENMP OFF)
else() # vanilla gcc or clang_omp support OpenMP
message(STATUS "Using special OpenMP enabled compiler !") # letting find_package(OpenMP) module work for gcc
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # clang-omp in darwin libs
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "C compiler flags for OpenMP parallization" FORCE)
set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "C++ compiler flags for OpenMP parallization" FORCE)
include_directories(${LIBDIR}/openmp/include)
link_directories(${LIBDIR}/openmp/lib)
# This is a workaround for our helperbinaries ( datatoc, masgfmt, ... ),
# They are linked also to omp lib, so we need it in builddir for runtime exexcution,
# TODO: remove all unneeded dependencies from these
# for intermediate binaries, in respect to lib ID
execute_process(
COMMAND ditto -arch ${CMAKE_OSX_ARCHITECTURES}
${LIBDIR}/openmp/lib/libiomp5.dylib
${CMAKE_BINARY_DIR}/Resources/lib/libiomp5.dylib)
endif()
endif()
endif()
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
endif()
else()
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
endif()
# Get rid of eventually clashes, we export some symbols explicite as local
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker ${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map"
)
if(WITH_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
endif()
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")

View File

@@ -0,0 +1,428 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for any *nix system including Linux and Unix.
macro(find_package_wrapper)
if(WITH_STATIC_LIBS)
find_package_static(${ARGV})
else()
find_package(${ARGV})
endif()
endmacro()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# else values are set below for all platforms
if(WITH_PYTHON)
# No way to set py35, remove for now.
# find_package(PythonLibs)
# Use our own instead, since without py is such a rare case,
# require this package
# XXX Linking errors with debian static python :/
# find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
endif()
if(WITH_IMAGE_OPENEXR)
find_package_wrapper(OpenEXR) # our own module
if(NOT OPENEXR_FOUND)
set(WITH_IMAGE_OPENEXR OFF)
endif()
endif()
if(WITH_IMAGE_OPENJPEG)
find_package_wrapper(OpenJPEG)
if(NOT OPENJPEG_FOUND)
set(WITH_IMAGE_OPENJPEG OFF)
endif()
endif()
if(WITH_IMAGE_TIFF)
# XXX Linking errors with debian static tiff :/
# find_package_wrapper(TIFF)
find_package(TIFF)
if(NOT TIFF_FOUND)
set(WITH_IMAGE_TIFF OFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_SDL)
if(WITH_SDL_DYNLOAD)
set(SDL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extern/sdlew/include/SDL2")
set(SDL_LIBRARY)
else()
find_package_wrapper(SDL2)
if(SDL2_FOUND)
# Use same names for both versions of SDL until we move to 2.x.
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
set(SDL_LIBRARY "${SDL2_LIBRARY}")
set(SDL_FOUND "${SDL2_FOUND}")
else()
find_package_wrapper(SDL)
endif()
mark_as_advanced(
SDL_INCLUDE_DIR
SDL_LIBRARY
)
# unset(SDLMAIN_LIBRARY CACHE)
if(NOT SDL_FOUND)
set(WITH_SDL OFF)
endif()
endif()
endif()
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Codecs
if(WITH_CODEC_SNDFILE)
find_package_wrapper(SndFile)
if(NOT SNDFILE_FOUND)
set(WITH_CODEC_SNDFILE OFF)
endif()
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
mark_as_advanced(FFMPEG)
# lame, but until we have proper find module for ffmpeg
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
if(EXISTS "${FFMPEG}/include/ffmpeg/")
list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
endif()
# end lameness
mark_as_advanced(FFMPEG_LIBRARIES)
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_FFTW3)
find_package_wrapper(Fftw3)
if(NOT FFTW3_FOUND)
set(WITH_FFTW3 OFF)
endif()
endif()
if(WITH_OPENCOLLADA)
find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
find_package_wrapper(XML2)
find_package_wrapper(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
endif()
if(WITH_MEM_JEMALLOC)
find_package_wrapper(JeMalloc)
if(NOT JEMALLOC_FOUND)
set(WITH_MEM_JEMALLOC OFF)
endif()
endif()
if(WITH_INPUT_NDOF)
find_package_wrapper(Spacenav)
if(SPACENAV_FOUND)
# use generic names within blenders buildsystem.
set(NDOF_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIRS})
set(NDOF_LIBRARIES ${SPACENAV_LIBRARIES})
else()
set(WITH_INPUT_NDOF OFF)
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
if(NOT OSL_ROOT)
set(OSL_ROOT ${CYCLES_OSL})
endif()
find_package_wrapper(OpenShadingLanguage)
if(OSL_FOUND)
if(${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6")
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
# otherwise LLVM is missing the osl_allocate_closure_component function
set(OSL_LIBRARIES
${OSL_OSLCOMP_LIBRARY}
-Wl,--whole-archive ${OSL_OSLEXEC_LIBRARY}
-Wl,--no-whole-archive ${OSL_OSLQUERY_LIBRARY}
)
endif()
else()
message(STATUS "OSL not found, disabling it from Cycles")
set(WITH_CYCLES_OSL OFF)
endif()
endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
find_package_wrapper(TBB)
if(NOT OPENVDB_FOUND OR NOT TBB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found, disabling it")
endif()
endif()
if(WITH_ALEMBIC)
find_package_wrapper(Alembic)
if(WITH_ALEMBIC_HDF5)
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
find_package_wrapper(HDF5)
endif()
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
set(WITH_ALEMBIC OFF)
set(WITH_ALEMBIC_HDF5 OFF)
endif()
endif()
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
if(WITH_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
set(Boost_USE_MULTITHREADED ON)
set(__boost_packages filesystem regex thread date_time)
if(WITH_CYCLES_OSL)
if(NOT (${OSL_LIBRARY_VERSION_MAJOR} EQUAL "1" AND ${OSL_LIBRARY_VERSION_MINOR} LESS "6"))
list(APPEND __boost_packages wave)
else()
endif()
endif()
if(WITH_INTERNATIONAL)
list(APPEND __boost_packages locale)
endif()
if(WITH_CYCLES_NETWORK)
list(APPEND __boost_packages serialization)
endif()
if(WITH_OPENVDB)
list(APPEND __boost_packages iostreams)
endif()
list(APPEND __boost_packages system)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
# try to find non-multithreaded if -mt not found, this flag
# doesn't matter for us, it has nothing to do with thread
# safety, but keep it to not disturb build setups
set(Boost_USE_MULTITHREADED OFF)
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
endif()
unset(__boost_packages)
if(Boost_USE_STATIC_LIBS AND WITH_BOOST_ICU)
find_package(IcuLinux)
endif()
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
endif()
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
find_package_wrapper(OpenImageIO)
if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
find_package_wrapper(PugiXML)
else()
set(PUGIXML_INCLUDE_DIR "${OPENIMAGEIO_INCLUDE_DIR/OpenImageIO}")
set(PUGIXML_LIBRARIES "")
endif()
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO_LIBRARIES}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
)
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENIMAGEIO_DEFINITIONS "")
if(WITH_IMAGE_TIFF)
list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
endif()
if(WITH_IMAGE_OPENEXR)
list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
endif()
if(NOT OPENIMAGEIO_FOUND)
set(WITH_OPENIMAGEIO OFF)
message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
endif()
endif()
if(WITH_OPENCOLORIO)
find_package_wrapper(OpenColorIO)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENCOLORIO_DEFINITIONS)
if(NOT OPENCOLORIO_FOUND)
set(WITH_OPENCOLORIO OFF)
message(STATUS "OpenColorIO not found")
endif()
endif()
if(WITH_LLVM)
find_package_wrapper(LLVM)
if(NOT LLVM_FOUND)
set(WITH_LLVM OFF)
message(STATUS "LLVM not found")
endif()
endif()
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
# Fix for conflict with Mesa llvmpipe
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBRARIES})
set(OPENSUBDIV_LIBPATH) # TODO, remove and reference the absolute path everywhere
if(NOT OPENSUBDIV_FOUND)
set(WITH_OPENSUBDIV OFF)
set(WITH_CYCLES_OPENSUBDIV OFF)
message(STATUS "OpenSubdiv not found")
endif()
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
find_package(Threads REQUIRED)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_THREAD_LIBS_INIT})
# used by other platforms
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if(CMAKE_DL_LIBS)
list(APPEND PLATFORM_LINKLIBS ${CMAKE_DL_LIBS})
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(NOT WITH_PYTHON_MODULE)
# binreloc is linux only
set(BINRELOC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/binreloc/include)
set(WITH_BINRELOC ON)
endif()
endif()
# lfs on glibc, all compilers should use
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
# GNU Compiler
if(CMAKE_COMPILER_IS_GNUCC)
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
if(WITH_LINKER_GOLD)
execute_process(
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
unset(LD_VERSION)
endif()
# CLang is the same as GCC for now.
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
# Solaris CC
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro")
set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
# Intel C++ Compiler
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
# think these next two are broken
find_program(XIAR xiar)
if(XIAR)
set(CMAKE_AR "${XIAR}")
endif()
mark_as_advanced(XIAR)
find_program(XILD xild)
if(XILD)
set(CMAKE_LINKER "${XILD}")
endif()
mark_as_advanced(XILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
# set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
endif()

View File

@@ -0,0 +1,87 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows.
add_definitions(-DWIN32)
if(MSVC)
include(platform_win32_msvc)
elseif(CMAKE_COMPILER_IS_GNUCC)
include(platform_win32_mingw)
endif()
# Things common to both mingw and MSVC should go here
set(WINTAB_INC ${LIBDIR}/wintab/include)
if(WITH_OPENAL)
set(OPENAL ${LIBDIR}/openal)
set(OPENALDIR ${LIBDIR}/openal)
set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
if(MSVC)
set(OPENAL_LIBRARY openal32)
else()
set(OPENAL_LIBRARY wrap_oal)
endif()
set(OPENAL_LIBPATH ${OPENAL}/lib)
endif()
if(WITH_CODEC_SNDFILE)
set(SNDFILE ${LIBDIR}/sndfile)
set(SNDFILE_INCLUDE_DIRS ${SNDFILE}/include)
set(SNDFILE_LIBRARIES libsndfile-1)
set(SNDFILE_LIBPATH ${SNDFILE}/lib) # TODO, deprecate
endif()
if(WITH_RAYOPTIMIZATION AND SUPPORT_SSE_BUILD)
add_definitions(-D__SSE__ -D__MMX__)
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_EXEC_DEBUG NAMES oslexec_d PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
list(APPEND OSL_LIBRARIES
optimized ${OSL_LIB_COMP}
optimized ${OSL_LIB_EXEC}
optimized ${OSL_LIB_QUERY}
debug ${OSL_LIB_EXEC_DEBUG}
debug ${OSL_LIB_COMP_DEBUG}
debug ${OSL_LIB_QUERY_DEBUG}
)
find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
else()
message(STATUS "OSL not found")
set(WITH_CYCLES_OSL OFF)
endif()
endif()

View File

@@ -0,0 +1,302 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows when compiling with MinGW.
# keep GCC specific stuff here
include(CheckCSourceCompiles)
# Setup 64bit and 64bit windows systems
CHECK_C_SOURCE_COMPILES("
#ifndef __MINGW64__
#error
#endif
int main(void) { return 0; }
"
WITH_MINGW64
)
if(NOT DEFINED LIBDIR)
if(WITH_MINGW64)
message(STATUS "Compiling for 64 bit with MinGW-w64.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
else()
message(STATUS "Compiling for 32 bit with MinGW-w32.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
if(WITH_RAYOPTIMIZATION)
message(WARNING "MinGW-w32 is known to be unstable with 'WITH_RAYOPTIMIZATION' option enabled.")
endif()
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
endif()
list(APPEND PLATFORM_LINKLIBS
-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32
-lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -ldbghelp
)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS -limm32)
endif()
set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
if(WITH_MINGW64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
list(APPEND PLATFORM_LINKLIBS -lpthread)
add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
endif()
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
add_definitions(-DFREE_WINDOWS)
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
if(WITH_MINGW64)
set(JPEG_LIBRARIES jpeg)
else()
set(JPEG_LIBRARIES libjpeg)
endif()
set(PNG_LIBRARIES png)
set(ZLIB ${LIBDIR}/zlib)
set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
set(ZLIB_LIBPATH ${ZLIB}/lib)
set(ZLIB_LIBRARIES z)
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
# comes with own pthread library
if(NOT WITH_MINGW64)
set(PTHREADS ${LIBDIR}/pthreads)
#set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
set(PTHREADS_LIBPATH ${PTHREADS}/lib)
set(PTHREADS_LIBRARIES pthreadGC2)
endif()
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
set(FREETYPE_LIBPATH ${FREETYPE}/lib)
set(FREETYPE_LIBRARY freetype)
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_LIBRARIES fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
${OPENCOLLADA}/include/opencollada/COLLADAFramework
${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
)
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib/opencollada)
set(OPENCOLLADA_LIBRARIES
OpenCOLLADAStreamWriter
OpenCOLLADASaxFrameworkLoader
OpenCOLLADAFramework
OpenCOLLADABaseUtils
GeneratedSaxParser
UTF MathMLSolver buffer ftoa xml
)
set(PCRE_LIBRARIES pcre)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg)
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
if(WITH_MINGW64)
set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
else()
set(FFMPEG_LIBRARIES avcodec-55 avformat-55 avdevice-55 avutil-52 swscale-2)
endif()
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
endif()
if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
endif()
if(WITH_IMAGE_TIFF)
set(TIFF ${LIBDIR}/tiff)
set(TIFF_LIBRARY tiff)
set(TIFF_INCLUDE_DIR ${TIFF}/include)
set(TIFF_LIBPATH ${TIFF}/lib)
endif()
if(WITH_JACK)
set(JACK ${LIBDIR}/jack)
set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
set(JACK_LIBRARIES jack)
set(JACK_LIBPATH ${JACK}/lib)
# TODO, gives linking errors, force off
set(WITH_JACK OFF)
endif()
if(WITH_PYTHON)
# normally cached but not since we include them with blender
set(PYTHON_VERSION 3.5) # CACHE STRING)
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}mw.lib") # CACHE FILEPATH)
unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
endif()
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(WITH_MINGW64)
set(BOOST_POSTFIX "mgw47-mt-s-1_49")
set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
else()
set(BOOST_POSTFIX "mgw46-mt-s-1_49")
set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_49")
endif()
set(BOOST_LIBRARIES
optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
boost_regex-${BOOST_POSTFIX}
boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
boost_regex-${BOOST_DEBUG_POSTFIX}
boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized boost_locale-${BOOST_POSTFIX}
debug boost_locale-${BOOST_DEBUG_POSTFIX}
)
endif()
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized boost_wave-${BOOST_POSTFIX}
debug boost_wave-${BOOST_DEBUG_POSTFIX}
)
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
endif()
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_LIBPATH ${LLVM_ROOT_DIR}/lib)
# Explicitly set llvm lib order.
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
LLVMAsmParser LLVMAsmPrinter
LLVMBitReader LLVMBitWriter
LLVMDebugInfo LLVMExecutionEngine
LLVMInstCombine LLVMInstrumentation
LLVMInterpreter LLVMJIT
LLVMLinker LLVMMC
LLVMMCDisassembler LLVMMCJIT
LLVMMCParser LLVMObject
LLVMRuntimeDyld
LLVMSupport
LLVMTableGen LLVMTarget
LLVMTransformUtils LLVMVectorize
LLVMX86AsmParser LLVMX86AsmPrinter
LLVMX86CodeGen LLVMX86Desc
LLVMX86Disassembler LLVMX86Info
LLVMX86Utils LLVMipa
LLVMipo LLVMCore)
# imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
list(APPEND PLATFORM_LINKLIBS -limagehlp)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBRARY SDL)
set(SDL_LIBPATH ${SDL}/lib)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_ALEMBIC)
# TODO(sergey): For until someone drops by and compiles libraries for
# MinGW we allow users to compile their own Alembic library and use
# that via find_package(),
#
# Once precompiled libraries are there we'll use hardcoded locations.
find_package_wrapper(Alembic)
if(WITH_ALEMBIC_HDF5)
set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
find_package_wrapper(HDF5)
endif()
if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
set(WITH_ALEMBIC OFF)
set(WITH_ALEMBIC_HDF5 OFF)
endif()
endif()
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors
## for re-distribution, so users dont need mingw installed
# set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")

View File

@@ -0,0 +1,490 @@
# ***** 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.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
# Libraries configuration for Windows when compiling with MSVC.
macro(warn_hardcoded_paths package_name
)
if(WITH_WINDOWS_FIND_MODULES)
message(WARNING "Using HARDCODED ${package_name} locations")
endif(WITH_WINDOWS_FIND_MODULES)
endmacro()
macro(windows_find_package package_name
)
if(WITH_WINDOWS_FIND_MODULES)
find_package( ${package_name})
endif(WITH_WINDOWS_FIND_MODULES)
endmacro()
add_definitions(-DWIN32)
# Minimum MSVC Version
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
if(MSVC_VERSION EQUAL 1800)
set(_min_ver "18.0.31101")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
message(FATAL_ERROR
"Visual Studio 2013 (Update 4, ${_min_ver}) required, "
"found (${CMAKE_CXX_COMPILER_VERSION})")
endif()
endif()
if(MSVC_VERSION EQUAL 1900)
set(_min_ver "19.0.24210")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
message(FATAL_ERROR
"Visual Studio 2015 (Update 3, ${_min_ver}) required, "
"found (${CMAKE_CXX_COMPILER_VERSION})")
endif()
endif()
endif()
unset(_min_ver)
# needed for some MSVC installations
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
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
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp
)
if(WITH_INPUT_IME)
list(APPEND PLATFORM_LINKLIBS imm32)
endif()
add_definitions(
-D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-D_CONSOLE
-D_LIB
)
# MSVC11 needs _ALLOW_KEYWORD_MACROS to build
add_definitions(-D_ALLOW_KEYWORD_MACROS)
# We want to support Vista level ABI
add_definitions(-D_WIN32_WINNT=0x600)
# Make cmake find the msvc redistributables
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
# Ignore meaningless for us linker warnings.
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
# MSVC only, Mingw doesnt need
if(CMAKE_CL_64)
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
endif()
set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
if(NOT DEFINED LIBDIR)
# Setup 64bit and 64bit windows systems
if(CMAKE_CL_64)
message(STATUS "64 bit compiler detected.")
set(LIBDIR_BASE "win64")
else()
message(STATUS "32 bit compiler detected.")
set(LIBDIR_BASE "windows")
endif()
if(MSVC_VERSION EQUAL 1910)
message(STATUS "Visual Studio 2017 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
elseif(MSVC_VERSION EQUAL 1900)
message(STATUS "Visual Studio 2015 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14)
else()
message(STATUS "Visual Studio 2013 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc12)
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
endif()
# Add each of our libraries to our cmake_prefix_path so find_package() could work
file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
foreach(child ${children})
if(IS_DIRECTORY ${LIBDIR}/${child})
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
endif()
endforeach()
set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARIES ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_INCLUDE_DIR ${LIBDIR}/zlib/include)
set(ZLIB_LIBRARY ${LIBDIR}/zlib/lib/libz_st.lib)
set(ZLIB_DIR ${LIBDIR}/zlib)
windows_find_package(zlib) # we want to find before finding things that depend on it like png
windows_find_package(png)
if(NOT PNG_FOUND)
warn_hardcoded_paths(libpng)
set(PNG_PNG_INCLUDE_DIR ${LIBDIR}/png/include)
set(PNG_LIBRARIES libpng)
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIRS "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
endif()
set(JPEG_NAMES ${JPEG_NAMES} libjpeg)
windows_find_package(jpeg REQUIRED)
if(NOT JPEG_FOUND)
warn_hardcoded_paths(jpeg)
set(JPEG_INCLUDE_DIR ${LIBDIR}/jpeg/include)
set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
endif()
set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
set(FREETYPE ${LIBDIR}/freetype)
set(FREETYPE_INCLUDE_DIRS
${LIBDIR}/freetype/include
${LIBDIR}/freetype/include/freetype2
)
set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
windows_find_package(freetype REQUIRED)
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_LIBRARIES libfftw)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
set(FFTW3_LIBPATH ${FFTW3}/lib)
endif()
if(WITH_OPENCOLLADA)
set(OPENCOLLADA ${LIBDIR}/opencollada)
set(OPENCOLLADA_INCLUDE_DIRS
${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
${OPENCOLLADA}/include/opencollada/COLLADAFramework
${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
)
set(OPENCOLLADA_LIBRARIES
${OPENCOLLADA}/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAFramework.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADABaseUtils.lib
${OPENCOLLADA}/lib/opencollada/OpenCOLLADAStreamWriter.lib
${OPENCOLLADA}/lib/opencollada/MathMLSolver.lib
${OPENCOLLADA}/lib/opencollada/GeneratedSaxParser.lib
${OPENCOLLADA}/lib/opencollada/xml.lib
${OPENCOLLADA}/lib/opencollada/buffer.lib
${OPENCOLLADA}/lib/opencollada/ftoa.lib
)
if(NOT WITH_LLVM)
list(APPEND OPENCOLLADA_LIBRARIES ${OPENCOLLADA}/lib/opencollada/UTF.lib)
endif()
set(PCRE_LIBRARIES
${OPENCOLLADA}/lib/opencollada/pcre.lib
)
endif()
if(WITH_CODEC_FFMPEG)
set(FFMPEG_INCLUDE_DIRS
${LIBDIR}/ffmpeg/include
${LIBDIR}/ffmpeg/include/msvc
)
windows_find_package(FFMPEG)
if(NOT FFMPEG_FOUND)
warn_hardcoded_paths(ffmpeg)
set(FFMPEG_LIBRARY_VERSION 57)
set(FFMPEG_LIBRARY_VERSION_AVU 55)
set(FFMPEG_LIBRARIES
${LIBDIR}/ffmpeg/lib/avcodec.lib
${LIBDIR}/ffmpeg/lib/avformat.lib
${LIBDIR}/ffmpeg/lib/avdevice.lib
${LIBDIR}/ffmpeg/lib/avutil.lib
${LIBDIR}/ffmpeg/lib/swscale.lib
)
endif()
endif()
if(WITH_IMAGE_OPENEXR)
set(OPENEXR_ROOT_DIR ${LIBDIR}/openexr)
set(OPENEXR_VERSION "2.1")
windows_find_package(OPENEXR REQUIRED)
if(NOT OPENEXR_FOUND)
warn_hardcoded_paths(OpenEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES
optimized ${OPENEXR_LIBPATH}/Iex-2_2.lib
optimized ${OPENEXR_LIBPATH}/Half.lib
optimized ${OPENEXR_LIBPATH}/IlmImf-2_2.lib
optimized ${OPENEXR_LIBPATH}/Imath-2_2.lib
optimized ${OPENEXR_LIBPATH}/IlmThread-2_2.lib
debug ${OPENEXR_LIBPATH}/Iex-2_2_d.lib
debug ${OPENEXR_LIBPATH}/Half_d.lib
debug ${OPENEXR_LIBPATH}/IlmImf-2_2_d.lib
debug ${OPENEXR_LIBPATH}/Imath-2_2_d.lib
debug ${OPENEXR_LIBPATH}/IlmThread-2_2_d.lib
)
endif()
endif()
if(WITH_IMAGE_TIFF)
# Try to find tiff first then complain and set static and maybe wrong paths
windows_find_package(TIFF)
if(NOT TIFF_FOUND)
warn_hardcoded_paths(libtiff)
set(TIFF_LIBRARY ${LIBDIR}/tiff/lib/libtiff.lib)
set(TIFF_INCLUDE_DIR ${LIBDIR}/tiff/include)
endif()
endif()
if(WITH_JACK)
set(JACK_INCLUDE_DIRS
${LIBDIR}/jack/include/jack
${LIBDIR}/jack/include
)
set(JACK_LIBRARIES optimized ${LIBDIR}/jack/lib/libjack.lib debug ${LIBDIR}/jack/lib/libjack_d.lib)
endif()
if(WITH_PYTHON)
set(PYTHON_VERSION 3.5) # CACHE STRING)
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
# Use shared libs for vc2008 and vc2010 until we actually have vc2010 libs
set(PYTHON_LIBRARY ${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}.lib)
unset(_PYTHON_VERSION_NO_DOTS)
# Shared includes for both vc2008 and vc2010
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
endif()
if(WITH_BOOST)
if(WITH_CYCLES_OSL)
set(boost_extra_libs wave)
endif()
if(WITH_INTERNATIONAL)
list(APPEND boost_extra_libs locale)
endif()
if(WITH_OPENVDB)
list(APPEND boost_extra_libs iostreams)
endif()
set(Boost_USE_STATIC_RUNTIME ON) # prefix lib
set(Boost_USE_MULTITHREADED ON) # suffix -mt
set(Boost_USE_STATIC_LIBS ON) # suffix -s
if (WITH_WINDOWS_FIND_MODULES)
find_package(Boost COMPONENTS date_time filesystem thread regex system ${boost_extra_libs})
endif (WITH_WINDOWS_FIND_MODULES)
if(NOT Boost_FOUND)
warn_hardcoded_paths(BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(MSVC12)
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc120-mt-s-1_60.lib")
set(BOOST_DEBUG_POSTFIX "vc120-mt-sgd-1_60.lib")
else()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc140-mt-s-1_60.lib")
set(BOOST_DEBUG_POSTFIX "vc140-mt-sgd-1_60.lib")
endif()
set(BOOST_LIBRARIES
optimized libboost_date_time-${BOOST_POSTFIX}
optimized libboost_filesystem-${BOOST_POSTFIX}
optimized libboost_regex-${BOOST_POSTFIX}
optimized libboost_system-${BOOST_POSTFIX}
optimized libboost_thread-${BOOST_POSTFIX}
debug libboost_date_time-${BOOST_DEBUG_POSTFIX}
debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
debug libboost_regex-${BOOST_DEBUG_POSTFIX}
debug libboost_system-${BOOST_DEBUG_POSTFIX}
debug libboost_thread-${BOOST_DEBUG_POSTFIX}
)
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_wave-${BOOST_POSTFIX}
debug libboost_wave-${BOOST_DEBUG_POSTFIX})
endif()
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_locale-${BOOST_POSTFIX}
debug libboost_locale-${BOOST_DEBUG_POSTFIX})
endif()
else() # we found boost using find_package
set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
set(BOOST_LIBRARIES ${Boost_LIBRARIES})
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
endif()
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
windows_find_package(OpenImageIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OIIO_OPTIMIZED optimized OpenImageIO optimized OpenImageIO_Util)
set(OIIO_DEBUG debug OpenImageIO_d debug OpenImageIO_Util_d)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
add_definitions(-DOIIO_STATIC_BUILD)
add_definitions(-DOIIO_NO_SSE=1)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
foreach(LLVM_OPTIMIZED_LIB ${LLVM_LIBRARY_OPTIMIZED})
get_filename_component(LIBNAME ${LLVM_OPTIMIZED_LIB} ABSOLUTE)
list(APPEND LLVM_LIBS optimized ${LIBNAME})
endforeach(LLVM_OPTIMIZED_LIB)
file(GLOB LLVM_LIBRARY_DEBUG ${LLVM_ROOT_DIR}/debug/lib/*.lib)
foreach(LLVM_DEBUG_LIB ${LLVM_LIBRARY_DEBUG})
get_filename_component(LIBNAME ${LLVM_DEBUG_LIB} ABSOLUTE)
list(APPEND LLVM_LIBS debug ${LIBNAME})
endforeach(LLVM_DEBUG_LIB)
set(LLVM_LIBRARY ${LLVM_LIBS})
else()
message(WARNING "LLVM debug libs not present on this system. Using release libs for debug builds.")
set(LLVM_LIBRARY ${LLVM_LIBRARY_OPTIMIZED})
endif()
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
set(OPENCOLORIO_DEFINITIONS)
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_INCLUDE_DIRS ${OPENVDB}/include ${TBB_INCLUDE_DIR})
set(OPENVDB_LIBRARIES optimized openvdb debug openvdb_d ${TBB_LIBRARIES} ${BLOSC_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
endif()
if(WITH_ALEMBIC)
set(ALEMBIC ${LIBDIR}/alembic)
set(ALEMBIC_INCLUDE_DIR ${ALEMBIC}/include)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
set(LAPACK ${LIBDIR}/lapack)
# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
set(LAPACK_LIBPATH ${LAPACK}/lib)
set(LAPACK_LIBRARIES
${LIBDIR}/lapack/lib/libf2c.lib
${LIBDIR}/lapack/lib/clapack_nowrap.lib
${LIBDIR}/lapack/lib/BLAS_nowrap.lib
)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib)
find_package(OpenSubdiv)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBPATH ${SDL}/lib)
# MinGW TODO: Update MinGW to SDL2
if(NOT CMAKE_COMPILER_IS_GNUCC)
set(SDL_LIBRARY SDL2)
else()
set(SDL_LIBRARY SDL)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
set(AUDASPACE_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace.lib)
set(AUDASPACE_C_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_C_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-c.lib)
set(AUDASPACE_PY_INCLUDE_DIRS ${LIBDIR}/audaspace/include/audaspace)
set(AUDASPACE_PY_LIBRARIES ${LIBDIR}/audaspace/lib/audaspace-py.lib)
endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
#find signtool
SET(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
find_program(SIGNTOOL_EXE signtool
HINTS
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
"$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
"$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
)

View File

@@ -39,7 +39,7 @@ __all__ = (
"is_py",
"cmake_advanced_info",
"cmake_compiler_defines",
"project_name_get"
"project_name_get",
"init",
)
@@ -214,7 +214,12 @@ def cmake_advanced_info():
def cmake_cache_var(var):
cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"), encoding='utf-8')
lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
lines = [
l_strip for l in cache_file
for l_strip in (l.strip(),)
if l_strip
if not l_strip.startswith(("//", "#"))
]
cache_file.close()
for l in lines:

View File

@@ -23,7 +23,7 @@
__all__ = (
"build_info",
"SOURCE_DIR",
)
)
import sys

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# <pep8 compliant>

View File

@@ -2,11 +2,9 @@
# custom blender vars
blender_srcdir=$(dirname $startdir)"/../.."
# value may be formatted: 35042:35051M
blender_revision=$(svnversion $blender_srcdir | cut -d: -f2 | awk '{print $3}')
blender_version=$(grep "BLENDER_VERSION\s" $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
blender_version=$(grep "BLENDER_VERSION\s" $blender_srcdir/source/blender/blenkernel/BKE_blender_version.h | awk '{print $3}')
blender_version=$(expr $blender_version / 100).$(expr $blender_version % 100) # 256 -> 2.56
blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blender_srcdir/source/blender/blenkernel/BKE_blender.h)
blender_version_char=$(sed -ne 's/.*BLENDER_VERSION_CHAR.*\([a-z]\)$/\1/p' $blender_srcdir/source/blender/blenkernel/BKE_blender_version.h)
# blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | awk '{print $3}')
# map the version a -> 1
@@ -27,7 +25,9 @@ arch=('i686' 'x86_64')
url="www.blender.org"
license=('GPL')
groups=()
depends=('libjpeg' 'libpng' 'openjpeg' 'libtiff' 'openexr' 'python>=3.4' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'ffmpeg')
depends=('libjpeg' 'libpng' 'openjpeg' 'libtiff' 'openexr' 'python>=3.5'
'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl'
'libsndfile' 'ffmpeg')
makedepends=('cmake' 'git')
optdepends=()
provides=()

View File

@@ -6,10 +6,10 @@
BASE_DIR="$PWD"
blender_srcdir=$(dirname -- $0)/../..
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender.h" | awk '{print $3}')
blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}')
if [ "$blender_version_cycle" = "release" ] ; then
VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char

View File

@@ -187,7 +187,7 @@ The next table describes the information in the file-header.
</table>
<p>
<a href="http://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
<a href="https://en.wikipedia.org/wiki/Endianness">Endianness</a> addresses the way values are ordered in a sequence of bytes(see the <a href="#example-endianess">example</a> below):
</p>
<ul>

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.7x"
PROJECT_NUMBER = "V2.8x"
# 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
@@ -699,7 +699,7 @@ LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
@@ -1145,7 +1145,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1752,7 +1752,7 @@ LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#

View File

@@ -1,132 +0,0 @@
class IDGroup:
"""
The IDGroup Type
================
This type supports both iteration and the []
operator to get child ID properties.
You can also add new properties using the [] operator.
For example::
group['a float!'] = 0.0
group['an int!'] = 0
group['a string!'] = "hi!"
group['an array!'] = [0, 0, 1.0, 0]
group['a subgroup!] = {"float": 0.0, "an int": 1.0, "an array": [1, 2],
"another subgroup": {"a": 0.0, "str": "bleh"}}
Note that for arrays, the array type defaults to int unless a float is found
while scanning the template list; if any floats are found, then the whole
array is float. Note that double-precision floating point numbers are used for
python-created float ID properties and arrays (though the internal C api does
support single-precision floats, and the python code will read them).
You can also delete properties with the del operator. For example:
del group['property']
To get the type of a property, use the type() operator, for example::
if type(group['bleh']) == str: pass
To tell if the property is a group or array type, import the Blender.Types module and test
against IDGroupType and IDArrayType, like so::
from Blender.Types import IDGroupType, IDArrayType.
if type(group['bleghr']) == IDGroupType:
(do something)
@ivar name: The name of the property
@type name: string
"""
def pop(item):
"""
Pop an item from the group property.
@type item: string
@param item: The item name.
@rtype: can be dict, list, int, float or string.
@return: The removed property.
"""
def update(updatedict):
"""
Updates items in the dict, similar to normal python
dictionary method .update().
@type updatedict: dict
@param updatedict: A dict of simple types to derive updated/new IDProperties from.
@rtype: None
@return: None
"""
def keys():
"""
Returns a list of the keys in this property group.
@rtype: list of strings.
@return: a list of the keys in this property group.
"""
def values():
"""
Returns a list of the values in this property group.
Note that unless a value is itself a property group or an array, you
cannot change it by changing the values in this list, you must change them
in the parent property group.
For example,
group['some_property'] = new_value
. . .is correct, while,
values = group.values()
values[0] = new_value
. . .is wrong.
@rtype: list of strings.
@return: a list of the values in this property group.
"""
def iteritems():
"""
Implements the python dictionary iteritmes method.
For example::
for k, v in group.iteritems():
print "Property name: " + k
print "Property value: " + str(v)
@rtype: an iterator that spits out items of the form [key, value]
@return: an iterator.
"""
def convert_to_pyobject():
"""
Converts the entire property group to a purely python form.
@rtype: dict
@return: A python dictionary representing the property group
"""
class IDArray:
"""
The IDArray Type
================
@ivar type: returns the type of the array, can be either IDP_Int or IDP_Float
"""
def __getitem__(index):
pass
def __setitem__(index, value):
pass
def __len__():
pass

View File

@@ -4,7 +4,7 @@ Persistent Handler Example
By default handlers are freed when loading new files, in some cases you may
wan't the handler stay running across multiple files (when the handler is
part of an addon for example).
part of an add-on for example).
For this the :data:`bpy.app.handlers.persistent` decorator needs to be used.
"""

View File

@@ -5,7 +5,7 @@ Intro
.. warning::
Most of this object should only be useful if you actually manipulate i18n stuff from Python.
If you are a regular addon, you should only bother about :const:`contexts` member,
If you are a regular add-on, you should only bother about :const:`contexts` member,
and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
@@ -21,11 +21,11 @@ Intro
Then, call ``bpy.app.translations.register(__name__, your_dict)`` in your ``register()`` function, and
``bpy.app.translations.unregister(__name__)`` in your ``unregister()`` one.
The ``Manage UI translations`` addon has several functions to help you collect strings to translate, and
The ``Manage UI translations`` add-on has several functions to help you collect strings to translate, and
generate the needed python code (the translation dictionary), as well as optional intermediary po files
if you want some... See
`How to Translate Blender <http://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
`Using i18n in Blender Code <http://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
`How to Translate Blender <https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender>`_ and
`Using i18n in Blender Code <https://wiki.blender.org/index.php/Dev:Source/Interface/Internationalization>`_
for more info.
Module References

View File

@@ -1,10 +1,10 @@
bl_info = {
"name": "Example Addon Preferences",
"name": "Example Add-on Preferences",
"author": "Your Name Here",
"version": (1, 0),
"blender": (2, 65, 0),
"location": "SpaceBar Search -> Addon Preferences Example",
"description": "Example Addon",
"location": "SpaceBar Search -> Add-on Preferences Example",
"description": "Example Add-on",
"warning": "",
"wiki_url": "",
"tracker_url": "",
@@ -18,7 +18,7 @@ from bpy.props import StringProperty, IntProperty, BoolProperty
class ExampleAddonPreferences(AddonPreferences):
# this must match the addon name, use '__package__'
# this must match the add-on name, use '__package__'
# when defining this in a submodule of a python package.
bl_idname = __name__
@@ -37,7 +37,7 @@ class ExampleAddonPreferences(AddonPreferences):
def draw(self, context):
layout = self.layout
layout.label(text="This is a preferences view for our addon")
layout.label(text="This is a preferences view for our add-on")
layout.prop(self, "filepath")
layout.prop(self, "number")
layout.prop(self, "boolean")
@@ -46,7 +46,7 @@ class ExampleAddonPreferences(AddonPreferences):
class OBJECT_OT_addon_prefs_example(Operator):
"""Display example preferences"""
bl_idname = "object.addon_prefs_example"
bl_label = "Addon Preferences Example"
bl_label = "Add-on Preferences Example"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):

View File

@@ -2,9 +2,9 @@
Extending Menus
+++++++++++++++
When creating menus for addons you can't reference menus in Blender's default
scripts.
Instead, the addon can add menu items to existing menus.
When creating menus for add-ons you can't reference menus
in Blender's default scripts.
Instead, the add-on can add menu items to existing menus.
The function menu_draw acts like :class:`Menu.draw`.
"""

View File

@@ -13,7 +13,7 @@ be animated, accessed from the user interface and from python.
definitions are not, this means whenever you load blender the class needs
to be registered too.
This is best done by creating an addon which loads on startup and registers
This is best done by creating an add-on which loads on startup and registers
your properties.
.. note::

View File

@@ -49,7 +49,7 @@ vec2d[:] = vec3d[:2]
# Vectors support 'swizzle' operations
# See http://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
# See https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)
vec.xyz = vec.zyx
vec.xy = vec4d.zw
vec.xyz = vec4d.wzz

View File

@@ -1033,7 +1033,7 @@ Texture classes
:type: bool
.. method:: refresh(refresh_source=True, timestamp=-1.0)
.. method:: refresh(refresh_source, timestamp=-1.0)
Refresh texture from source.

View File

@@ -405,7 +405,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experemental and may be removed (but probably wont be).
This attribute is experimental and may be removed (but probably wont be).
.. note::
@@ -419,7 +419,7 @@ base class --- :class:`SCA_IObject`
.. note::
This attribute is experemental and may be removed (but probably wont be).
This attribute is experimental and may be removed (but probably wont be).
.. note::
@@ -453,7 +453,7 @@ base class --- :class:`SCA_IObject`
.. attribute:: childrenRecursive
all children of this object including childrens children, (read-only).
all children of this object including children's children, (read-only).
:type: :class:`CListValue` of :class:`KX_GameObject`'s
@@ -536,7 +536,7 @@ base class --- :class:`SCA_IObject`
.. method:: getAxisVect(vect)
Returns the axis vector rotates by the objects worldspace orientation.
Returns the axis vector rotates by the object's worldspace orientation.
This is the equivalent of multiplying the vector by the orientation matrix.
:arg vect: a vector to align the axis.
@@ -596,7 +596,7 @@ base class --- :class:`SCA_IObject`
Gets the game object's linear velocity.
This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
This method returns the game object's velocity through it's center of mass, ie no angular velocity component.
:arg local:
* False: you get the "global" velocity ie: relative to world orientation.
@@ -609,7 +609,7 @@ base class --- :class:`SCA_IObject`
Sets the game object's linear velocity.
This method sets game object's velocity through it's centre of mass,
This method sets game object's velocity through it's center of mass,
ie no angular velocity component.
This requires a dynamic object.
@@ -814,7 +814,7 @@ base class --- :class:`SCA_IObject`
# do something
pass
The face paremeter determines the orientation of the normal.
The face parameter determines the orientation of the normal.
* 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
* 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
@@ -911,7 +911,7 @@ base class --- :class:`SCA_IObject`
.. note::
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
The gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as the Subdivision Surface modifier).
.. warning::
@@ -919,7 +919,7 @@ base class --- :class:`SCA_IObject`
.. warning::
If the object is a part of a combound object it will fail (parent or child)
If the object is a part of a compound object it will fail (parent or child)
.. warning::

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ The features exposed closely follow the C API,
giving python access to the functions used by blenders own mesh editing tools.
For an overview of BMesh data types and how they reference each other see:
`BMesh Design Document <http://wiki.blender.org/index.php/Dev:2.6/Source/Modeling/BMesh/Design>`_ .
`BMesh Design Document <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`_ .
.. note::
@@ -31,13 +31,12 @@ For an overview of BMesh data types and how they reference each other see:
**Disk** and **Radial** data is not exposed by the python api since this is for internal use only.
.. warning::
TODO items are...
.. warning:: TODO items are...
* add access to BMesh **walkers**
* add custom-data manipulation functions add/remove/rename.
Example Script
--------------

View File

@@ -204,7 +204,7 @@ Lets say we want to access the texture of a brush via Python, to adjust its ``co
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
*Notice the texture button its self doesn't have very useful links (you can check the tooltips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties button select the Texture context.

View File

@@ -18,7 +18,7 @@ amongst our own scripts and make it easier to use python scripts from other proj
Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender.
This style guide is known as pep8 and can be found `here <http://www.python.org/dev/peps/pep-0008>`_
This style guide is known as pep8 and can be found `here <https://www.python.org/dev/peps/pep-0008/>`_
A brief listing of pep8 criteria.
@@ -316,7 +316,7 @@ use to join a list of strings (the list may be temporary). In the following exam
Join is fastest on many strings,
`string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`__
`string formatting <https://wiki.blender.org/index.php/Dev:Source/Modeling/BMesh/Design>`__
is quite fast too (better for converting data types). String arithmetic is slowest.

View File

@@ -1,3 +1,4 @@
*******
Gotchas
*******
@@ -38,7 +39,6 @@ but some operators are more picky about when they run.
In most cases you can figure out what context an operator needs
simply be seeing how it's used in Blender and thinking about what it does.
Unfortunately if you're still stuck - the only way to **really** know
whats going on is to read the source code for the poll function and see what its checking.
@@ -82,7 +82,6 @@ it should be reported to the bug tracker.
Stale Data
==========
No updates after setting values
-------------------------------
@@ -174,8 +173,8 @@ In this situation you can...
.. _info_gotcha_mesh_faces:
NGons and Tessellation Faces
============================
N-Gons and Tessellation Faces
=============================
Since 2.63 NGons are supported, this adds some complexity
since in some cases you need to access triangles/quads still (some exporters for example).
@@ -509,7 +508,7 @@ Unicode Problems
Python supports many different encodings so there is nothing stopping you from
writing a script in ``latin1`` or ``iso-8859-15``.
See `pep-0263 <http://www.python.org/dev/peps/pep-0263/>`_
See `pep-0263 <https://www.python.org/dev/peps/pep-0263/>`_
However this complicates matters for Blender's Python API because ``.blend`` files don't have an explicit encoding.
@@ -657,7 +656,7 @@ Here are some general hints to avoid running into these problems.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
See the `faulthandler docs <https://docs.python.org/dev/library/faulthandler.html>`_.
While the crash may be in Blenders C/C++ code,
this can help a lot to track down the area of the script that causes the crash.

View File

@@ -19,7 +19,7 @@ This is a typical Python environment so tutorials on how to write Python scripts
will work running the scripts in Blender too.
Blender provides the :mod:`bpy` module to the Python interpreter.
This module can be imported in a script and gives access to Blender data, classes, and functions.
Scripts that deal with Blender data will need to import this module.
Scripts that deal with Blender data will need to import this module.
Here is a simple example of moving a vertex of the object named **Cube**:
@@ -43,8 +43,7 @@ scene manipulation, automation, defining your own toolset and customization.
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
The exact location of this directory depends on your installation.
`See the directory layout docs
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
See the :ref:`directory layout docs <blender_manual:getting-started_installing-config-directories>`.
Script Loading
@@ -77,22 +76,22 @@ To run as modules:
- The obvious way, ``import some_module`` command from the text window or interactive console.
- Open as a text block and tick "Register" option, this will load with the blend file.
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
- define as an addon, enabling the addon will load it as a Python module.
- define as an add-on, enabling the add-on will load it as a Python module.
Addons
------
Add-ons
-------
Some of Blenders functionality is best kept optional,
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
alongside scripts loaded at startup we have add-ons which are kept in their own directory ``scripts/addons``,
and only load on startup if selected from the user preferences.
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
The only difference between add-ons and built-in Python modules is that add-ons must contain a ``bl_info``
variable which Blender uses to read metadata such as name, author, category and URL.
The user preferences addon listing uses **bl_info** to display information about each addon.
The User Preferences add-on listing uses **bl_info** to display information about each add-on.
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
`See Add-ons <https://wiki.blender.org/index.php/Dev:Py/Scripts/Guidelines/Addons>`__
for details on the ``bl_info`` dictionary.
@@ -214,7 +213,7 @@ A simple Blender/Python module can look like this:
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()
@@ -223,7 +222,7 @@ These functions usually appear at the bottom of the script containing class regi
You can also use them for internal purposes setting up data for your own tools but take care
since register won't re-run when a new blend file is loaded.
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
The register/unregister calls are used so it's possible to toggle add-ons and reload scripts while Blender runs.
If the register calls were placed in the body of the script, registration would be called on import,
meaning there would be no distinction between importing a module or loading its classes into Blender.
@@ -328,7 +327,7 @@ Say you want to store material settings for a custom engine.
.. note::
*The class must be registered before being used in a property, failing to do so will raise an error:*
``ValueError: bpy_struct "Material" registration error: my_custom_props could not register``
@@ -430,4 +429,3 @@ Calling these operators:
>>> bpy.ops.object.operator_2()
Hello World OBJECT_OT_operator_2
{'FINISHED'}

View File

@@ -51,8 +51,7 @@ A quick list of helpful things to know before starting:
| ``scripts/startup/bl_operators`` for operators.
Exact location depends on platform, see:
`Configuration and Data Paths
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__.
:ref:`Configuration and Data Paths <blender_manual:getting-started_installing-config-directories>`.
Running Scripts

View File

@@ -27,7 +27,7 @@ There are 3 main uses for the terminal, these are:
.. note::
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the help menu.
@@ -306,7 +306,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 <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
`Building Blender as a Python module <https://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
Python Safety (Build Option)

View File

@@ -1,6 +1,6 @@
Addon Tutorial
##############
Add-on Tutorial
###############
************
Introduction
@@ -36,6 +36,7 @@ Suggested reading before starting this tutorial.
To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal,
see :ref:`Use The Terminal <use_the_terminal>`.
Documentation Links
===================
@@ -46,51 +47,48 @@ While going through the tutorial you may want to look into our reference documen
- :mod:`bpy.context` api reference. -
*Handy to have a list of available items your script may operate on.*
- :class:`bpy.types.Operator`. -
*The following addons define operators, these docs give details and more examples of operators.*
*The following add-ons define operators, these docs give details and more examples of operators.*
******
Addons
******
*******
Add-ons
*******
What is an Add-on?
==================
What is an Addon?
=================
An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful
An add-on is simply a Python module with some additional requirements so Blender can display it in a list with useful
information.
To give an example, here is the simplest possible addon.
To give an example, here is the simplest possible add-on.
.. code-block:: python
bl_info = {"name": "My Test Addon", "category": "Object"}
bl_info = {"name": "My Test Add-on", "category": "Object"}
def register():
print("Hello World")
def unregister():
print("Goodbye World")
- ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
user preferences addon list.
- ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
activating the addon.
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
- ``bl_info`` is a dictionary containing add-on metadata such as the title,
version and author to be displayed in the user preferences add-on list.
- ``register`` is a function which only runs when enabling the add-on,
this means the module can be loaded without activating the add-on.
- ``unregister`` is a function to unload anything setup by ``register``, this is called when the add-on is disabled.
Notice this add-on does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
This is a contrived example of an add-on that serves to illustrate the point
that the base requirements of an add-on are simple.
This is a contrived example of an addon that serves to illustrate the point
that the base requirements of an addon are simple.
An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
An add-on will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
when executed from the text editor or even the interactive console - there is nothing inherently different about an
addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
add-on that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
script to access.
So an addon is just a way to encapsulate a Python module in a way a user can easily utilize.
So an add-on is just a way to encapsulate a Python module in a way a user can easily utilize.
.. note::
@@ -99,14 +97,14 @@ So an addon is just a way to encapsulate a Python module in a way a user can eas
Messages will be printed when enabling and disabling.
Your First Addon
================
Your First Add-on
=================
The simplest possible addon above was useful as an example but not much else.
This next addon is simple but shows how to integrate a script into Blender using an ``Operator``
The simplest possible add-on above is useful as an example but not much else.
This next add-on is simple but shows how to integrate a script into Blender using an ``Operator``
which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts.
For the first example we'll make a script that simply moves all objects in a scene.
For the first example we will make a script that simply moves all objects in a scene.
Write The Script
@@ -123,20 +121,14 @@ Add the following script to the text editor in Blender.
obj.location.x += 1.0
.. image:: run_script.png
:width: 924px
:align: center
:height: 574px
:alt: Run Script button
Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit.
Next we'll make this script into an addon.
Click the :ref:`Run Script button <blender_manual:editors-text-run-script>`,
all objects in the active scene are moved by 1.0 Blender unit.
Write the Addon (Simple)
------------------------
Write the Add-on (Simple)
-------------------------
This addon takes the body of the script above, and adds them to an operator's ``execute()`` function.
This add-on takes the body of the script above, and adds them to an operator's ``execute()`` function.
.. code-block:: python
@@ -173,7 +165,7 @@ This addon takes the body of the script above, and adds them to an operator's ``
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
# to test the add-on without having to install it.
if __name__ == "__main__":
register()
@@ -206,33 +198,33 @@ Do this by pressing :kbd:`Spacebar` to bring up the operator search dialog and t
The objects should move as before.
*Keep this addon open in Blender for the next step - Installing.*
*Keep this add-on open in Blender for the next step - Installing.*
Install The Addon
-----------------
Install The Add-on
------------------
Once you have your addon within in Blender's text editor,
Once you have your add-on within in Blender's text editor,
you will want to be able to install it so it can be enabled in the user preferences to load on startup.
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
Even though the add-on above is a test, lets go through the steps anyway so you know how to do it for later.
To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming
To install the Blender text as an add-on you will first have to save it to disk, take care to obey the naming
restrictions that apply to Python modules and end with a ``.py`` extension.
Once the file is on disk, you can install it as you would for an addon downloaded online.
Once the file is on disk, you can install it as you would for an add-on downloaded online.
Open the user :menuselection:`File -> User Preferences`,
Select the *Addon* section, press *Install Addon...* and select the file.
Open the user :menuselection:`File --> User Preferences`,
Select the *Add-on* section, press *Install Add-on...* and select the file.
Now the addon will be listed and you can enable it by pressing the check-box,
Now the add-on will be listed and you can enable it by pressing the check-box,
if you want it to be enabled on restart, press *Save as Default*.
.. note::
The destination of the addon depends on your Blender configuration.
When installing an addon the source and destination path are printed in the console.
You can also find addon path locations by running this in the Python console.
The destination of the add-on depends on your Blender configuration.
When installing an add-on the source and destination path are printed in the console.
You can also find add-on path locations by running this in the Python console.
.. code-block:: python
@@ -240,20 +232,20 @@ if you want it to be enabled on restart, press *Save as Default*.
print(addon_utils.paths())
More is written on this topic here:
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
:ref:`Directory Layout <blender_manual:getting-started_installing-config-directories>`.
Your Second Addon
=================
Your Second Add-on
==================
For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a
For our second add-on, we will focus on object instancing - this is - to make linked copies of an object in a
similar way to what you may have seen with the array modifier.
Write The Script
----------------
As before, first we will start with a script, develop it, then convert into an addon.
As before, first we will start with a script, develop it, then convert into an add-on.
.. code-block:: python
@@ -324,17 +316,17 @@ allows vectors to be multiplied by numbers and matrices.
If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions
such as getting the angle between vectors, cross product, dot products
as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and
as well as more advanced functions in :mod:`mathutils.geometry` such as zier Spline interpolation and
ray-triangle intersection.
For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and
For now we will focus on making this script an add-on, but its good to know that this 3D math module is available and
can help you with more advanced functionality later on.
Write the Addon
---------------
Write the Add-on
----------------
The first step is to convert the script as-is into an addon.
The first step is to convert the script as-is into an add-on.
.. code-block:: python
@@ -381,7 +373,7 @@ The first step is to convert the script as-is into an addon.
register()
Everything here has been covered in the previous steps, you may want to try run the addon still
Everything here has been covered in the previous steps, you may want to try run the add-on still
and consider what could be done to make it more useful.
@@ -434,7 +426,7 @@ however the link above includes examples of more advanced property usage.
Menu Item
^^^^^^^^^
Addons can add to the user interface of existing panels, headers and menus defined in Python.
Add-ons can add to the user interface of existing panels, headers and menus defined in Python.
For this example we'll add to an existing menu.
@@ -464,7 +456,7 @@ For docs on extending menus see: :doc:`bpy.types.Menu`.
Keymap
^^^^^^
In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps.
In Blender, add-ons have their own keymaps so as not to interfere with Blenders built in key-maps.
In the example below, a new object-mode :class:`bpy.types.KeyMap` is added,
then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator,
@@ -502,7 +494,7 @@ this allows you to have multiple keys accessing the same operator with different
.. note::
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure add-ons won't
overwrite each others keymaps, At least take care when assigning keys that they don't
conflict with important functionality within Blender.
@@ -606,14 +598,14 @@ After selecting it from the menu, you can choose how many instance of the cube y
.. note::
Directly executing the script multiple times will add the menu each time too.
While not useful behavior, theres nothing to worry about since addons won't register them selves multiple
While not useful behavior, theres nothing to worry about since add-ons won't register them selves multiple
times when enabled through the user preferences.
Conclusions
===========
Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
Add-ons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
for others to use.
While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without
@@ -636,8 +628,8 @@ Here are some sites you might like to check on after completing this tutorial.
*For more background details on Blender/Python integration.*
- `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
*Great info for those who are still learning Python.*
- `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
- `Blender Development (Wiki) <https://wiki.blender.org/index.php/Dev:Contents>`_ -
*Blender Development, general information and helpful links.*
- `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
- `Blender Artists (Coding Section) <https://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
*forum where people ask Python development questions*

View File

@@ -27,7 +27,7 @@ output from this tool should be added into "doc/python_api/rst/change_log.rst"
blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
# create changelog
blender --background --python doc/python_api/sphinx_changelog_gen.py -- \
blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
--api_from blender_2_63_0.py \
--api_to blender_2_64_0.py \
--api_out changes.rst
@@ -48,7 +48,8 @@ python doc/python_api/sphinx_changelog_gen.py -- \
'''
{"module.name":
{"parent.class":
{"basic_type", "member_name": ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
{"basic_type", "member_name":
("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
}, ...
}
'''
@@ -99,34 +100,34 @@ def api_dump():
prop_range = None
dump_class[prop_id] = (
"prop_rna", # basic_type
prop.name, # name
prop_type, # type
prop_range, # range
prop_length, # length
prop.default, # default
prop.description, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"prop_rna", # basic_type
prop.name, # name
prop_type, # type
prop_range, # range
prop_length, # length
prop.default, # default
prop.description, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
del props
# python props, tricky since we dont know much about them.
for prop_id, attr in struct_info.get_py_properties():
dump_class[prop_id] = (
"prop_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"prop_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
Ellipsis, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
# kludge func -> props
funcs = [(func.identifier, func) for func in struct_info.functions]
@@ -137,17 +138,17 @@ def api_dump():
func_args_type = tuple([prop.type for prop in func.args])
dump_class[func_id] = (
"func_rna", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
func.description, # descr
func_args_ids, # f_args
func_args_type, # f_arg_types
func_ret_types, # f_ret_types
)
"func_rna", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
func.description, # descr
func_args_ids, # f_args
func_args_type, # f_arg_types
func_ret_types, # f_ret_types
)
del funcs
# kludge func -> props
@@ -158,17 +159,17 @@ def api_dump():
func_args_ids = tuple(inspect.getargspec(attr).args)
dump_class[func_id] = (
"func_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
func_args_ids, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
"func_py", # basic_type
Ellipsis, # name
Ellipsis, # type
Ellipsis, # range
Ellipsis, # length
Ellipsis, # default
attr.__doc__, # descr
func_args_ids, # f_args
Ellipsis, # f_arg_types
Ellipsis, # f_ret_types
)
del funcs
import pprint
@@ -330,21 +331,25 @@ def main():
# When --help or no args are given, print this help
usage_text = "Run blender in background mode with this script: "
"blender --background --python %s -- [options]" % os.path.basename(__file__)
"blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__)
epilog = "Run this before releases"
parser = argparse.ArgumentParser(description=usage_text, epilog=epilog)
parser.add_argument("--dump", dest="dump", action='store_true',
help="When set the api will be dumped into blender_version.py")
parser.add_argument(
"--dump", dest="dump", action='store_true',
help="When set the api will be dumped into blender_version.py")
parser.add_argument("--api_from", dest="api_from", metavar='FILE',
help="File to compare from (previous version)")
parser.add_argument("--api_to", dest="api_to", metavar='FILE',
help="File to compare from (current)")
parser.add_argument("--api_out", dest="api_out", metavar='FILE',
help="Output sphinx changelog")
parser.add_argument(
"--api_from", dest="api_from", metavar='FILE',
help="File to compare from (previous version)")
parser.add_argument(
"--api_to", dest="api_to", metavar='FILE',
help="File to compare from (current)")
parser.add_argument(
"--api_out", dest="api_out", metavar='FILE',
help="Output sphinx changelog")
args = parser.parse_args(argv) # In this example we wont use the args

View File

@@ -24,18 +24,18 @@ SCRIPT_HELP_MSG = """
API dump in RST files
---------------------
Run this script from blenders root path once you have compiled blender
Run this script from Blender's root path once you have compiled Blender
./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py
blender --background --factory-startup -noaudio --python doc/python_api/sphinx_doc_gen.py
This will generate python files in doc/python_api/sphinx-in/
providing ./blender.bin is or links to the blender executable
providing ./blender is or links to the blender executable
To choose sphinx-in directory:
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
For quick builds:
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
Sphinx: HTML generation
@@ -46,8 +46,6 @@ Sphinx: HTML generation
cd doc/python_api
sphinx-build sphinx-in sphinx-out
This requires sphinx 1.0.7 to be installed.
Sphinx: PDF generation
----------------------
@@ -61,14 +59,14 @@ Sphinx: PDF generation
"""
try:
import bpy # blender module
import bpy # Blender module
except ImportError:
print("\nERROR: this script must run from inside Blender")
print(SCRIPT_HELP_MSG)
import sys
sys.exit()
import rna_info # blender module
import rna_info # Blender module
def rna_info_BuildRNAInfo_cache():
@@ -86,7 +84,7 @@ import shutil
import logging
from platform import platform
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
PLATFORM = platform().split('-')[0].lower() # 'linux', 'darwin', 'windows'
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
@@ -181,15 +179,13 @@ def handle_args():
dest="log",
default=False,
action='store_true',
help=(
"Log the output of the api dump and sphinx|latex "
"warnings and errors (default=False).\n"
"If given, save logs in:\n"
"* OUTPUT_DIR/.bpy.log\n"
"* OUTPUT_DIR/.sphinx-build.log\n"
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
"* OUTPUT_DIR/.latex_make.log",
),
help="Log the output of the api dump and sphinx|latex "
"warnings and errors (default=False).\n"
"If given, save logs in:\n"
"* OUTPUT_DIR/.bpy.log\n"
"* OUTPUT_DIR/.sphinx-build.log\n"
"* OUTPUT_DIR/.sphinx-build_pdf.log\n"
"* OUTPUT_DIR/.latex_make.log",
required=False)
# parse only the args passed after '--'
@@ -210,12 +206,12 @@ BPY_LOGGER.setLevel(logging.DEBUG)
"""
# for quick rebuilds
rm -rf /b/doc/python_api/sphinx-* && \
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
or
./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
./blender -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
"""
# Switch for quick testing so doc-builds don't take so long
@@ -224,12 +220,12 @@ if not ARGS.partial:
FILTER_BPY_OPS = None
FILTER_BPY_TYPES = None
EXCLUDE_INFO_DOCS = False
EXCLUDE_MODULES = ()
EXCLUDE_MODULES = []
else:
# can manually edit this too:
#FILTER_BPY_OPS = ("import.scene", ) # allow
#FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
# FILTER_BPY_OPS = ("import.scene", ) # allow
# FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow
EXCLUDE_INFO_DOCS = True
EXCLUDE_MODULES = [
"aud",
@@ -262,6 +258,7 @@ else:
"bpy_extras",
"gpu",
"gpu.offscreen",
"idprop.types",
"mathutils",
"mathutils.bvhtree",
"mathutils.geometry",
@@ -275,7 +272,7 @@ else:
"freestyle.shaders",
"freestyle.types",
"freestyle.utils",
]
]
# ------
# Filter
@@ -301,7 +298,9 @@ else:
del m
del fnmatch
BPY_LOGGER.debug("Partial Doc Build, Skipping: %s\n" % "\n ".join(sorted(EXCLUDE_MODULES)))
BPY_LOGGER.debug(
"Partial Doc Build, Skipping: %s\n" %
"\n ".join(sorted(EXCLUDE_MODULES)))
#
# done filtering
@@ -311,19 +310,21 @@ try:
__import__("aud")
except ImportError:
BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
EXCLUDE_MODULES.append("aud")
try:
__import__("freestyle")
except ImportError:
BPY_LOGGER.debug("Warning: Built without 'freestyle' module, docs incomplete...")
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["freestyle",
"freestyle.chainingiterators",
"freestyle.functions",
"freestyle.predicates",
"freestyle.shaders",
"freestyle.types",
"freestyle.utils"]
EXCLUDE_MODULES.extend([
"freestyle",
"freestyle.chainingiterators",
"freestyle.functions",
"freestyle.predicates",
"freestyle.shaders",
"freestyle.types",
"freestyle.utils",
])
# Source files we use, and need to copy to the OUTPUT_DIR
# to have working out-of-source builds.
@@ -340,7 +341,7 @@ EXTRA_SOURCE_FILES = (
"../examples/bge.texture.py",
"../examples/bmesh.ops.1.py",
"../examples/bpy.app.translations.py",
)
)
# examples
@@ -357,52 +358,59 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
# extra info, not api reference docs
# stored in ./rst/info_*
INFO_DOCS = (
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"),
("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"),
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
)
("info_quickstart.rst",
"Blender/Python Quickstart: new to Blender/scripting and want to get your feet wet?"),
("info_overview.rst",
"Blender/Python API Overview: a more complete explanation of Python integration"),
("info_tutorial_addon.rst",
"Blender/Python Add-on Tutorial: a step by step guide on how to write an add-on from scratch"),
("info_api_reference.rst",
"Blender/Python API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst",
"Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst",
"Tips and Tricks: Hints to help you while writing scripts for Blender"),
("info_gotcha.rst",
"Gotcha's: some of the problems you may come up against when writing scripts"),
)
# only support for properties atm.
RNA_BLACKLIST = {
# XXX messes up PDF!, really a bug but for now just workaround.
"UserPreferencesSystem": {"language", }
}
}
MODULE_GROUPING = {
"bmesh.types": (
("Base Mesh Type", '-'),
"BMesh",
("Mesh Elements", '-'),
"BMVert",
"BMEdge",
"BMFace",
"BMLoop",
("Sequence Accessors", '-'),
"BMElemSeq",
"BMVertSeq",
"BMEdgeSeq",
"BMFaceSeq",
"BMLoopSeq",
"BMIter",
("Selection History", '-'),
"BMEditSelSeq",
"BMEditSelIter",
("Custom-Data Layer Access", '-'),
"BMLayerAccessVert",
"BMLayerAccessEdge",
"BMLayerAccessFace",
"BMLayerAccessLoop",
"BMLayerCollection",
"BMLayerItem",
("Custom-Data Layer Types", '-'),
"BMLoopUV",
"BMDeformVert"
)
}
("Base Mesh Type", '-'),
"BMesh",
("Mesh Elements", '-'),
"BMVert",
"BMEdge",
"BMFace",
"BMLoop",
("Sequence Accessors", '-'),
"BMElemSeq",
"BMVertSeq",
"BMEdgeSeq",
"BMFaceSeq",
"BMLoopSeq",
"BMIter",
("Selection History", '-'),
"BMEditSelSeq",
"BMEditSelIter",
("Custom-Data Layer Access", '-'),
"BMLayerAccessVert",
"BMLayerAccessEdge",
"BMLayerAccessFace",
"BMLayerAccessLoop",
"BMLayerCollection",
"BMLayerItem",
("Custom-Data Layer Types", '-'),
"BMLoopUV",
"BMDeformVert"
)
}
# --------------------configure compile time options----------------------------
@@ -410,7 +418,7 @@ MODULE_GROUPING = {
blender_version_strings = [str(v) for v in bpy.app.version]
# converting bytes to strings, due to #30154
# converting bytes to strings, due to T30154
BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8')
BLENDER_DATE = str(bpy.app.build_date, 'utf_8')
@@ -478,10 +486,10 @@ MethodDescriptorType = type(dict.get)
GetSetDescriptorType = type(int.real)
StaticMethodType = type(staticmethod(lambda: None))
from types import (
MemberDescriptorType,
MethodType,
FunctionType,
)
MemberDescriptorType,
MethodType,
FunctionType,
)
_BPY_STRUCT_FAKE = "bpy_struct"
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
@@ -501,7 +509,7 @@ escape_rst.trans = str.maketrans({
"|": "\\|",
"*": "\\*",
"\\": "\\\\",
})
})
def is_struct_seq(value):
@@ -746,7 +754,7 @@ def py_c_func2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_
def pyprop2sphinx(ident, fw, identifier, py_prop):
'''
python property to sphinx
Python property to sphinx
'''
# readonly properties use "data" directive, variables use "attribute" directive
if py_prop.fset is None:
@@ -846,7 +854,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
# naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
# type_name is only used for examples and messages
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1] # "<class 'bpy.app.handlers'>" --> bpy.app.handlers
# "<class 'bpy.app.handlers'>" --> bpy.app.handlers
type_name = str(type(module)).strip("<>").split(" ", 1)[-1][1:-1]
if type(descr) == types.GetSetDescriptorType:
py_descr2sphinx("", fw, descr, module_name, type_name, key)
attribute_set.add(key)
@@ -907,7 +916,8 @@ def pymodule2sphinx(basepath, module_name, module, title):
for attribute, value, value_type in module_dir_value_type:
if value_type == FunctionType:
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
# both the same at the moment but to be future proof
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}:
# note: can't get args from these, so dump the string as is
# this means any module used like this must have fully formatted docstrings.
py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
@@ -973,7 +983,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
if type(descr) == ClassMethodDescriptorType:
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
# needed for pure python classes
# needed for pure Python classes
for key, descr in descr_items:
if type(descr) == FunctionType:
pyfunc2sphinx(" ", fw, module_name, type_name, key, descr, is_class=True)
@@ -996,12 +1006,15 @@ def pymodule2sphinx(basepath, module_name, module, title):
file.close()
# Changes in blender will force errors here
# Changes in Blender will force errors here
context_type_map = {
"active_base": ("ObjectBase", False),
"active_bone": ("EditBone", False),
"active_gpencil_frame": ("GreasePencilLayer", True),
"active_gpencil_layer": ("GPencilLayer", True),
"active_gpencil_brush": ("GPencilSculptBrush", False),
"active_gpencil_palette": ("GPencilPalette", True),
"active_gpencil_palettecolor": ("GPencilPaletteColor", True),
"active_node": ("Node", False),
"active_object": ("Object", False),
"active_operator": ("Operator", False),
@@ -1084,9 +1097,10 @@ def pycontext2sphinx(basepath):
fw(title_string("Context Access (bpy.context)", "="))
fw(".. module:: bpy.context\n")
fw("\n")
fw("The context members available depend on the area of blender which is currently being accessed.\n")
fw("The context members available depend on the area of Blender which is currently being accessed.\n")
fw("\n")
fw("Note that all context values are readonly, but may be modified through the data api or by running operators\n\n")
fw("Note that all context values are readonly,\n")
fw("but may be modified through the data api or by running operators\n\n")
def write_contex_cls():
@@ -1109,7 +1123,8 @@ def pycontext2sphinx(basepath):
if prop.identifier in struct_blacklist:
continue
type_descr = prop.get_type_description(class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
type_descr = prop.get_type_description(
class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID)
fw(".. data:: %s\n\n" % prop.identifier)
if prop.description:
fw(" %s\n\n" % prop.description)
@@ -1129,7 +1144,7 @@ def pycontext2sphinx(basepath):
del write_contex_cls
# end
# nasty, get strings directly from blender because there is no other way to get it
# nasty, get strings directly from Blender because there is no other way to get it
import ctypes
context_strings = (
@@ -1165,7 +1180,9 @@ def pycontext2sphinx(basepath):
# for member in sorted(unique):
# print(' "%s": ("", False),' % member)
if len(context_type_map) > len(unique):
raise Exception("Some types are not used: %s" % str([member for member in context_type_map if member not in unique]))
raise Exception(
"Some types are not used: %s" %
str([member for member in context_type_map if member not in unique]))
else:
pass # will have raised an error above
@@ -1244,11 +1261,11 @@ def pyrna2sphinx(basepath):
fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr))
def write_struct(struct):
#if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
# return
# if not struct.identifier.startswith("Sc") and not struct.identifier.startswith("I"):
# return
#if not struct.identifier == "Object":
# return
# if not struct.identifier == "Object":
# return
filepath = os.path.join(basepath, "bpy.types.%s.rst" % struct.identifier)
file = open(filepath, "w", encoding="utf-8")
@@ -1289,7 +1306,11 @@ def pyrna2sphinx(basepath):
fw(", ".join((":class:`%s`" % base_id) for base_id in base_ids))
fw("\n\n")
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
subclass_ids = [
s.identifier for s in structs.values()
if s.base is struct
if not rna_info.rna_id_ignore(s.identifier)
]
subclass_ids.sort()
if subclass_ids:
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
@@ -1340,7 +1361,7 @@ def pyrna2sphinx(basepath):
fw(" :type: %s\n\n" % type_descr)
# python attributes
# Python attributes
py_properties = struct.get_py_properties()
py_prop = None
for identifier, py_prop in py_properties:
@@ -1350,7 +1371,8 @@ def pyrna2sphinx(basepath):
for func in struct.functions:
args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args)
fw(" .. %s:: %s(%s)\n\n" % ("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
fw(" .. %s:: %s(%s)\n\n" %
("classmethod" if func.is_classmethod else "method", func.identifier, args_str))
fw(" %s\n\n" % func.description)
for prop in func.args:
@@ -1361,8 +1383,10 @@ def pyrna2sphinx(basepath):
elif func.return_values: # multiple return values
fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values))
for prop in func.return_values:
# TODO, pyrna_enum2sphinx for multiple return values... actually dont think we even use this but still!!!
type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
# TODO, pyrna_enum2sphinx for multiple return values... actually dont
# think we even use this but still!!!
type_descr = prop.get_type_description(
as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID)
descr = prop.description
if not descr:
descr = prop.name
@@ -1375,7 +1399,7 @@ def pyrna2sphinx(basepath):
fw("\n")
# python methods
# Python methods
py_funcs = struct.get_py_functions()
py_func = None
@@ -1398,7 +1422,10 @@ def pyrna2sphinx(basepath):
del lines[:]
if _BPY_STRUCT_FAKE:
descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
descr_items = [
(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items())
if not key.startswith("__")
]
if _BPY_STRUCT_FAKE:
for key, descr in descr_items:
@@ -1494,19 +1521,28 @@ def pyrna2sphinx(basepath):
fw("\n")
if use_subclasses:
subclass_ids = [s.identifier for s in structs.values() if s.base is None if not rna_info.rna_id_ignore(s.identifier)]
subclass_ids = [
s.identifier for s in structs.values()
if s.base is None
if not rna_info.rna_id_ignore(s.identifier)
]
if subclass_ids:
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in sorted(subclass_ids)) + "\n\n")
fw(".. class:: %s\n\n" % class_name)
fw(" %s\n\n" % descr_str)
fw(" .. note::\n\n")
fw(" Note that bpy.types.%s is not actually available from within blender, it only exists for the purpose of documentation.\n\n" % class_name)
fw(" Note that bpy.types.%s is not actually available from within Blender,\n"
" it only exists for the purpose of documentation.\n\n" % class_name)
descr_items = [(key, descr) for key, descr in sorted(class_value.__dict__.items()) if not key.startswith("__")]
descr_items = [
(key, descr) for key, descr in sorted(class_value.__dict__.items())
if not key.startswith("__")
]
for key, descr in descr_items:
if type(descr) == MethodDescriptorType: # GetSetDescriptorType, GetSetDescriptorType's are not documented yet
# GetSetDescriptorType, GetSetDescriptorType's are not documented yet
if type(descr) == MethodDescriptorType:
py_descr2sphinx(" ", fw, descr, "bpy.types", class_name, key)
for key, descr in descr_items:
@@ -1517,17 +1553,21 @@ def pyrna2sphinx(basepath):
# write fake classes
if _BPY_STRUCT_FAKE:
class_value = bpy.types.Struct.__bases__[0]
fake_bpy_type(class_value, _BPY_STRUCT_FAKE, "built-in base class for all classes in bpy.types.", use_subclasses=True)
fake_bpy_type(
class_value, _BPY_STRUCT_FAKE,
"built-in base class for all classes in bpy.types.", use_subclasses=True)
if _BPY_PROP_COLLECTION_FAKE:
class_value = bpy.data.objects.__class__
fake_bpy_type(class_value, _BPY_PROP_COLLECTION_FAKE, "built-in class used for all collections.", use_subclasses=False)
fake_bpy_type(
class_value, _BPY_PROP_COLLECTION_FAKE,
"built-in class used for all collections.", use_subclasses=False)
# operators
def write_ops():
API_BASEURL = "http://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
API_BASEURL_ADDON = "http://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts"
API_BASEURL_ADDON_CONTRIB = "http://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts"
API_BASEURL = "https://developer.blender.org/diffusion/B/browse/master/release/scripts "
API_BASEURL_ADDON = "https://developer.blender.org/diffusion/BA"
API_BASEURL_ADDON_CONTRIB = "https://developer.blender.org/diffusion/BAC"
op_modules = {}
for op in ops.values():
@@ -1592,6 +1632,9 @@ def write_sphinx_conf_py(basepath):
file = open(filepath, "w", encoding="utf-8")
fw = file.write
fw("import sys, os\n\n")
fw("extensions = ['sphinx.ext.intersphinx']\n\n")
fw("intersphinx_mapping = {'blender_manual': ('https://docs.blender.org/manual/en/dev/', None)}\n\n")
fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
@@ -1603,16 +1646,21 @@ def write_sphinx_conf_py(basepath):
if ARGS.sphinx_theme == "blender-org":
fw("html_theme_path = ['../']\n")
# copied with the theme, exclude else we get an error [#28873]
# copied with the theme, exclude else we get an error [T28873]
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
# not helpful since the source is generated, adds to upload size.
fw("html_copy_source = False\n")
fw("html_show_sphinx = False\n")
fw("html_split_index = True\n")
fw("\n")
# needed for latex, pdf gen
fw("latex_elements = {\n")
fw(" 'papersize': 'a4paper',\n")
fw("}\n\n")
fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
fw("latex_paper_size = 'a4paper'\n")
file.close()
@@ -1633,11 +1681,13 @@ def write_rst_contents(basepath):
fw(title_string("Blender Documentation Contents", "%", double=True))
fw("\n")
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" % (BLENDER_VERSION_DOTS, BLENDER_DATE))
fw("Welcome, this document is an API reference for Blender %s, built %s.\n" %
(BLENDER_VERSION_DOTS, BLENDER_DATE))
fw("\n")
# fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" % BLENDER_ZIP_FILENAME)
fw("This site can be downloaded for offline use `Download the full Documentation (zipped HTML files) <%s>`_\n" %
BLENDER_ZIP_FILENAME)
fw("\n")
@@ -1670,7 +1720,7 @@ def write_rst_contents(basepath):
# C modules
"bpy.props",
)
)
for mod in app_modules:
if mod not in EXCLUDE_MODULES:
@@ -1691,9 +1741,10 @@ def write_rst_contents(basepath):
"freestyle", "bgl", "blf",
"gpu", "gpu.offscreen",
"aud", "bpy_extras",
"idprop.types",
# bmesh, submodules are in own page
"bmesh",
)
)
for mod in standalone_modules:
if mod not in EXCLUDE_MODULES:
@@ -1731,7 +1782,8 @@ def write_rst_contents(basepath):
fw(" * mesh creation and editing functions\n")
fw(" \n")
fw(" These parts of the API are relatively stable and are unlikely to change significantly\n")
fw(" * data API, access to attributes of blender data such as mesh verts, material color, timeline frames and scene objects\n")
fw(" * data API, access to attributes of Blender data such as mesh verts, material color,\n")
fw(" timeline frames and scene objects\n")
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
fw(" * render engine integration\n")
fw(" * modules: bgl, mathutils & game engine.\n")
@@ -1803,11 +1855,11 @@ def write_rst_data(basepath):
fw(title_string("Data Access (bpy.data)", "="))
fw(".. module:: bpy\n")
fw("\n")
fw("This module is used for all blender/python access.\n")
fw("This module is used for all Blender/Python access.\n")
fw("\n")
fw(".. data:: data\n")
fw("\n")
fw(" Access to blenders internal data\n")
fw(" Access to Blender's internal data\n")
fw("\n")
fw(" :type: :class:`bpy.types.BlendData`\n")
fw("\n")
@@ -1822,37 +1874,38 @@ def write_rst_importable_modules(basepath):
Write the rst files of importable modules
'''
importable_modules = {
# python_modules
"bpy.path" : "Path Utilities",
"bpy.utils" : "Utilities",
"bpy_extras" : "Extra Utilities",
# Python_modules
"bpy.path": "Path Utilities",
"bpy.utils": "Utilities",
"bpy_extras": "Extra Utilities",
# C_modules
"aud" : "Audio System",
"blf" : "Font Drawing",
"gpu.offscreen" : "GPU Off-Screen Buffer",
"bmesh" : "BMesh Module",
"bmesh.types" : "BMesh Types",
"bmesh.utils" : "BMesh Utilities",
"bmesh.geometry" : "BMesh Geometry Utilities",
"bpy.app" : "Application Data",
"bpy.app.handlers" : "Application Handlers",
"bpy.app.translations" : "Application Translations",
"bpy.props" : "Property Definitions",
"mathutils" : "Math Types & Utilities",
"mathutils.geometry" : "Geometry Utilities",
"mathutils.bvhtree" : "BVHTree Utilities",
"mathutils.kdtree" : "KDTree Utilities",
"aud": "Audio System",
"blf": "Font Drawing",
"gpu.offscreen": "GPU Off-Screen Buffer",
"bmesh": "BMesh Module",
"bmesh.types": "BMesh Types",
"bmesh.utils": "BMesh Utilities",
"bmesh.geometry": "BMesh Geometry Utilities",
"bpy.app": "Application Data",
"bpy.app.handlers": "Application Handlers",
"bpy.app.translations": "Application Translations",
"bpy.props": "Property Definitions",
"idprop.types": "ID Property Access",
"mathutils": "Math Types & Utilities",
"mathutils.geometry": "Geometry Utilities",
"mathutils.bvhtree": "BVHTree Utilities",
"mathutils.kdtree": "KDTree Utilities",
"mathutils.interpolate": "Interpolation Utilities",
"mathutils.noise" : "Noise Utilities",
"freestyle" : "Freestyle Module",
"freestyle.types" : "Freestyle Types",
"freestyle.predicates" : "Freestyle Predicates",
"freestyle.functions" : "Freestyle Functions",
"freestyle.chainingiterators" : "Freestyle Chaining Iterators",
"freestyle.shaders" : "Freestyle Shaders",
"freestyle.utils" : "Freestyle Utilities",
}
"mathutils.noise": "Noise Utilities",
"freestyle": "Freestyle Module",
"freestyle.types": "Freestyle Types",
"freestyle.predicates": "Freestyle Predicates",
"freestyle.functions": "Freestyle Functions",
"freestyle.chainingiterators": "Freestyle Chaining Iterators",
"freestyle.shaders": "Freestyle Shaders",
"freestyle.utils": "Freestyle Utilities",
}
for mod_name, mod_descr in importable_modules.items():
if mod_name not in EXCLUDE_MODULES:
module = __import__(mod_name,
@@ -1867,7 +1920,7 @@ def copy_handwritten_rsts(basepath):
for info, info_desc in INFO_DOCS:
shutil.copy2(os.path.join(RST_DIR, info), basepath)
# TODO put this docs in blender's code and use import as per modules above
# TODO put this docs in Blender's code and use import as per modules above
handwritten_modules = [
"bge.logic",
"bge.render",

View File

@@ -0,0 +1,186 @@
#!/usr/bin/env python3
# ##### 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.
#
# Contributor(s): Bastien Montagne
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
This is a helper script to generate Blender Python API documentation (using Sphinx), and update server data using rsync.
You'll need to specify your user login and password, obviously.
Example usage:
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
"""
import os
import shutil
import subprocess
import sys
import tempfile
import zipfile
DEFAULT_RSYNC_SERVER = "docs.blender.org"
DEFAULT_RSYNC_ROOT = "/api/"
DEFAULT_SYMLINK_ROOT = "/data/www/vhosts/docs.blender.org/api"
def argparse_create():
import argparse
global __doc__
# When --help or no args are given, print this help
usage_text = __doc__
parser = argparse.ArgumentParser(description=usage_text,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument(
"--mirror", dest="mirror_dir",
metavar='PATH', required=True,
help="Path to local rsync mirror of api doc server")
parser.add_argument(
"--source", dest="source_dir",
metavar='PATH', required=True,
help="Path to Blender git repository")
parser.add_argument(
"--blender", dest="blender",
metavar='PATH', required=True,
help="Path to Blender executable")
parser.add_argument(
"--rsync-server", dest="rsync_server", default=DEFAULT_RSYNC_SERVER,
metavar='RSYNCSERVER', type=str, required=False,
help=("rsync server address"))
parser.add_argument(
"--rsync-root", dest="rsync_root", default=DEFAULT_RSYNC_ROOT,
metavar='RSYNCROOT', type=str, required=False,
help=("Root path of API doc on rsync server"))
parser.add_argument(
"--user", dest="user",
metavar='USER', type=str, required=True,
help=("User to login on rsync server"))
parser.add_argument(
"--password", dest="password",
metavar='PASSWORD', type=str, required=True,
help=("Password to login on rsync server"))
return parser
def main():
# ----------
# Parse Args
args = argparse_create().parse_args()
rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
# I) Update local mirror using rsync.
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
with tempfile.TemporaryDirectory() as tmp_dir:
# II) Generate doc source in temp dir.
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
"--output", tmp_dir)
subprocess.run(doc_gen_cmd)
# III) Get Blender version info.
blenver = blenver_zip = ""
getver_file = os.path.join(tmp_dir, "blendver.txt")
getver_script = (""
"import sys, bpy\n"
"with open(sys.argv[-1], 'w') as f:\n"
" f.write('%d_%d%s_release\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if bpy.app.version_cycle in {'rc', 'release'} else '%d_%d_%d\\n' % bpy.app.version)\n"
" f.write('%d_%d_%d' % bpy.app.version)\n")
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
"--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd)
with open(getver_file) as f:
blenver, blenver_zip = f.read().split("\n")
os.remove(getver_file)
# IV) Build doc.
curr_dir = os.getcwd()
os.chdir(tmp_dir)
sphinx_cmd = ("sphinx-build", "-b", "html", "sphinx-in", "sphinx-out")
subprocess.run(sphinx_cmd)
shutil.rmtree(os.path.join("sphinx-out", ".doctrees"))
os.chdir(curr_dir)
# V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
api_name = "blender_python_api_%s" % blenver
api_dir = os.path.join(args.mirror_dir, api_name)
if os.path.exists(api_dir):
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_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):
for filename in filenames:
filepath = os.path.join(dirname, filename)
zip_filepath = os.path.join(zip_name, os.path.relpath(filepath, api_dir))
zf.write(filepath, arcname=zip_filepath)
os.rename(zip_path, os.path.join(api_dir, "%s.zip" % zip_name))
# VII) Create symlinks and html redirects.
#~ os.symlink(os.path.join(DEFAULT_SYMLINK_ROOT, api_name, "contents.html"), os.path.join(api_dir, "index.html"))
os.symlink("./contents.html", os.path.join(api_dir, "index.html"))
if blenver.endswith("release"):
symlink = os.path.join(args.mirror_dir, "blender_python_api_current")
os.remove(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)
else:
symlink = os.path.join(args.mirror_dir, "blender_python_api_master")
os.remove(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)
# VIII) Upload (first do a dry-run so user can ensure everything is OK).
print("Doc generated in local mirror %s, please check it before uploading "
"(hit [Enter] to continue, [Ctrl-C] to exit):" % api_dir)
sys.stdin.read(1)
rsync_mirror_cmd = ("rsync", "--dry-run", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
print("Rsync upload simulated, please check every thing is OK (hit [Enter] to continue, [Ctrl-C] to exit):")
sys.stdin.read(1)
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", args.mirror_dir, rsync_base)
subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
if __name__ == "__main__":
main()

View File

@@ -29,6 +29,14 @@ add_subdirectory(curve_fit_nd)
# Otherwise we get warnings here that we cant fix in external projects
remove_strict_flags()
# Not a strict flag, but noisy for code we don't maintain
if(CMAKE_COMPILER_IS_GNUCC)
remove_cc_flag(
"-Wmisleading-indentation"
)
endif()
add_subdirectory(rangetree)
add_subdirectory(wcwidth)
@@ -97,6 +105,7 @@ endif()
if(WITH_GTESTS)
add_subdirectory(gtest)
add_subdirectory(gmock)
endif()
if(WITH_SDL AND WITH_SDL_DYNLOAD)

View File

@@ -77,7 +77,7 @@ namespace std {
void resize(size_type new_size)
{ resize(new_size, T()); }
#if defined(_VECTOR_)
#if defined(_VECTOR_) && (_MSC_VER<1910)
// workaround MSVC std::vector implementation
void resize(size_type new_size, const value_type& x)
{
@@ -110,7 +110,7 @@ namespace std {
vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
}
#else
// either GCC 4.1 or non-GCC
// either GCC 4.1, MSVC2017 or non-GCC
// default implementation which should always work.
void resize(size_type new_size, const value_type& x)
{

View File

@@ -151,8 +151,8 @@ static btScalar EdgeSeparation(const btBox2dShape* poly1, const btTransform& xf1
int index = 0;
btScalar minDot = BT_LARGE_FLOAT;
if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);
if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);
btVector3 v1 = b2Mul(xf1, vertices1[edge1]);
btVector3 v2 = b2Mul(xf2, vertices2[index]);
@@ -174,9 +174,9 @@ static btScalar FindMaxSeparation(int* edgeIndex,
// Find edge normal on poly1 that has the largest projection onto d.
int edge = 0;
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
// Get the separation for the edge normal.
btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2);

View File

@@ -232,8 +232,8 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
m_compoundShapeRevision = compoundShape->getUpdateRevision();
}
if (m_childCollisionAlgorithms.size()==0)
return;
if (m_childCollisionAlgorithms.size()==0)
return;
const btDbvt* tree = compoundShape->getDynamicAabbTree();
//use a dynamic aabb tree to cull potential child-overlaps

View File

@@ -73,10 +73,12 @@ set(SRC
internal/ceres/file.cc
internal/ceres/generated/partitioned_matrix_view_d_d_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_problem.cc
internal/ceres/gradient_problem_solver.cc
internal/ceres/implicit_schur_complement.cc
internal/ceres/is_close.cc
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/lapack.cc
internal/ceres/levenberg_marquardt_strategy.cc
@@ -116,6 +118,7 @@ set(SRC
internal/ceres/triplet_sparse_matrix.cc
internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_strategy.cc
internal/ceres/types.cc
internal/ceres/wall_time.cc
@@ -204,6 +207,7 @@ set(SRC
internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/is_close.h
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.h
internal/ceres/levenberg_marquardt_strategy.h
@@ -248,6 +252,7 @@ set(SRC
internal/ceres/triplet_sparse_matrix.h
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.h
internal/ceres/visibility_based_preconditioner.h
internal/ceres/wall_time.h

1035
extern/ceres/ChangeLog vendored

File diff suppressed because it is too large Load Diff

View File

@@ -173,26 +173,5 @@ if(WITH_OPENMP)
)
endif()
TEST_UNORDERED_MAP_SUPPORT()
if(HAVE_STD_UNORDERED_MAP_HEADER)
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
add_definitions(-DCERES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_UNORDERED_MAP)
else()
add_definitions(-DCERES_NO_UNORDERED_MAP)
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
EOF

View File

@@ -149,6 +149,7 @@ internal/ceres/generated/schur_eliminator_4_4_d.cc
internal/ceres/generated/schur_eliminator_d_d_d.cc
internal/ceres/generate_eliminator_specialization.py
internal/ceres/generate_partitioned_matrix_view_specializations.py
internal/ceres/gradient_checker.cc
internal/ceres/gradient_checking_cost_function.cc
internal/ceres/gradient_checking_cost_function.h
internal/ceres/gradient_problem.cc
@@ -160,6 +161,8 @@ internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.cc
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/is_close.cc
internal/ceres/is_close.h
internal/ceres/iterative_schur_complement_solver.cc
internal/ceres/iterative_schur_complement_solver.h
internal/ceres/lapack.cc
@@ -243,6 +246,8 @@ internal/ceres/trust_region_minimizer.cc
internal/ceres/trust_region_minimizer.h
internal/ceres/trust_region_preprocessor.cc
internal/ceres/trust_region_preprocessor.h
internal/ceres/trust_region_step_evaluator.cc
internal/ceres/trust_region_step_evaluator.h
internal/ceres/trust_region_strategy.cc
internal/ceres/trust_region_strategy.h
internal/ceres/types.cc

View File

@@ -130,7 +130,8 @@ class CostFunctionToFunctor {
const int num_parameter_blocks =
(N0 > 0) + (N1 > 0) + (N2 > 0) + (N3 > 0) + (N4 > 0) +
(N5 > 0) + (N6 > 0) + (N7 > 0) + (N8 > 0) + (N9 > 0);
CHECK_EQ(parameter_block_sizes.size(), num_parameter_blocks);
CHECK_EQ(static_cast<int>(parameter_block_sizes.size()),
num_parameter_blocks);
CHECK_EQ(N0, parameter_block_sizes[0]);
if (parameter_block_sizes.size() > 1) CHECK_EQ(N1, parameter_block_sizes[1]); // NOLINT

View File

@@ -357,6 +357,28 @@ class CERES_EXPORT Covariance {
const double*> >& covariance_blocks,
Problem* problem);
// Compute a part of the covariance matrix.
//
// The vector parameter_blocks contains the parameter blocks that
// are used for computing the covariance matrix. From this vector
// all covariance pairs are generated. This allows the covariance
// estimation algorithm to only compute and store these blocks.
//
// parameter_blocks cannot contain duplicates. Bad things will
// happen if they do.
//
// Note that the list of covariance_blocks is only used to determine
// what parts of the covariance matrix are computed. The full
// Jacobian is used to do the computation, i.e. they do not have an
// impact on what part of the Jacobian is used for computation.
//
// The return value indicates the success or failure of the
// covariance computation. Please see the documentation for
// Covariance::Options for more on the conditions under which this
// function returns false.
bool Compute(const std::vector<const double*>& parameter_blocks,
Problem* problem);
// Return the block of the cross-covariance matrix corresponding to
// parameter_block1 and parameter_block2.
//
@@ -394,6 +416,40 @@ class CERES_EXPORT Covariance {
const double* parameter_block2,
double* covariance_block) const;
// Return the covariance matrix corresponding to all parameter_blocks.
//
// Compute must be called before calling GetCovarianceMatrix and all
// parameter_blocks must have been present in the vector
// parameter_blocks when Compute was called. Otherwise
// GetCovarianceMatrix returns false.
//
// covariance_matrix must point to a memory location that can store
// the size of the covariance matrix. The covariance matrix will be
// a square matrix whose row and column count is equal to the sum of
// the sizes of the individual parameter blocks. The covariance
// matrix will be a row-major matrix.
bool GetCovarianceMatrix(const std::vector<const double *> &parameter_blocks,
double *covariance_matrix);
// Return the covariance matrix corresponding to parameter_blocks
// in the tangent space if a local parameterization is associated
// with one of the parameter blocks else returns the covariance
// matrix in the ambient space.
//
// Compute must be called before calling GetCovarianceMatrix and all
// parameter_blocks must have been present in the vector
// parameters_blocks when Compute was called. Otherwise
// GetCovarianceMatrix returns false.
//
// covariance_matrix must point to a memory location that can store
// the size of the covariance matrix. The covariance matrix will be
// a square matrix whose row and column count is equal to the sum of
// the sizes of the tangent spaces of the individual parameter
// blocks. The covariance matrix will be a row-major matrix.
bool GetCovarianceMatrixInTangentSpace(
const std::vector<const double*>& parameter_blocks,
double* covariance_matrix);
private:
internal::scoped_ptr<internal::CovarianceImpl> impl_;
};

View File

@@ -85,22 +85,6 @@ class DynamicNumericDiffCostFunction : public CostFunction {
options_(options) {
}
// Deprecated. New users should avoid using this constructor. Instead, use the
// constructor with NumericDiffOptions.
DynamicNumericDiffCostFunction(
const CostFunctor* functor,
Ownership ownership,
double relative_step_size)
: functor_(functor),
ownership_(ownership),
options_() {
LOG(WARNING) << "This constructor is deprecated and will be removed in "
"a future version. Please use the NumericDiffOptions "
"constructor instead.";
options_.relative_step_size = relative_step_size;
}
virtual ~DynamicNumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();
@@ -138,19 +122,19 @@ class DynamicNumericDiffCostFunction : public CostFunction {
std::vector<double> parameters_copy(parameters_size);
std::vector<double*> parameters_references_copy(block_sizes.size());
parameters_references_copy[0] = &parameters_copy[0];
for (int block = 1; block < block_sizes.size(); ++block) {
for (size_t block = 1; block < block_sizes.size(); ++block) {
parameters_references_copy[block] = parameters_references_copy[block - 1]
+ block_sizes[block - 1];
}
// Copy the parameters into the local temp space.
for (int block = 0; block < block_sizes.size(); ++block) {
for (size_t block = 0; block < block_sizes.size(); ++block) {
memcpy(parameters_references_copy[block],
parameters[block],
block_sizes[block] * sizeof(*parameters[block]));
}
for (int block = 0; block < block_sizes.size(); ++block) {
for (size_t block = 0; block < block_sizes.size(); ++block) {
if (jacobians[block] != NULL &&
!NumericDiff<CostFunctor, method, DYNAMIC,
DYNAMIC, DYNAMIC, DYNAMIC, DYNAMIC, DYNAMIC,

View File

@@ -27,194 +27,121 @@
// POSSIBILITY OF SUCH DAMAGE.
// Copyright 2007 Google Inc. All Rights Reserved.
//
// Author: wjr@google.com (William Rucklidge)
//
// This file contains a class that exercises a cost function, to make sure
// that it is computing reasonable derivatives. It compares the Jacobians
// computed by the cost function with those obtained by finite
// differences.
// Authors: wjr@google.com (William Rucklidge),
// keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
#ifndef CERES_PUBLIC_GRADIENT_CHECKER_H_
#define CERES_PUBLIC_GRADIENT_CHECKER_H_
#include <cstddef>
#include <algorithm>
#include <vector>
#include <string>
#include "ceres/cost_function.h"
#include "ceres/dynamic_numeric_diff_cost_function.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/internal/macros.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/numeric_diff_cost_function.h"
#include "ceres/local_parameterization.h"
#include "glog/logging.h"
namespace ceres {
// An object that exercises a cost function, to compare the answers that it
// gives with derivatives estimated using finite differencing.
// GradientChecker compares the Jacobians returned by a cost function against
// derivatives estimated using finite differencing.
//
// The only likely usage of this is for testing.
// The condition enforced is that
//
// (J_actual(i, j) - J_numeric(i, j))
// ------------------------------------ < relative_precision
// max(J_actual(i, j), J_numeric(i, j))
//
// where J_actual(i, j) is the jacobian as computed by the supplied cost
// function (by the user) multiplied by the local parameterization Jacobian
// and J_numeric is the jacobian as computed by finite differences, multiplied
// by the local parameterization Jacobian as well.
//
// How to use: Fill in an array of pointers to parameter blocks for your
// CostFunction, and then call Probe(). Check that the return value is
// 'true'. See prober_test.cc for an example.
//
// This is templated similarly to NumericDiffCostFunction, as it internally
// uses that.
template <typename CostFunctionToProbe,
int M = 0, int N0 = 0, int N1 = 0, int N2 = 0, int N3 = 0, int N4 = 0>
// CostFunction, and then call Probe(). Check that the return value is 'true'.
class GradientChecker {
public:
// Here we stash some results from the probe, for later
// inspection.
struct GradientCheckResults {
// Computed cost.
Vector cost;
// This will not take ownership of the cost function or local
// parameterizations.
//
// function: The cost function to probe.
// local_parameterization: A vector of local parameterizations for each
// parameter. May be NULL or contain NULL pointers to indicate that the
// respective parameter does not have a local parameterization.
// options: Options to use for numerical differentiation.
GradientChecker(
const CostFunction* function,
const std::vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options);
// The sizes of these matrices are dictated by the cost function's
// parameter and residual block sizes. Each vector's length will
// term->parameter_block_sizes().size(), and each matrix is the
// Jacobian of the residual with respect to the corresponding parameter
// block.
// Contains results from a call to Probe for later inspection.
struct ProbeResults {
// The return value of the cost function.
bool return_value;
// Computed residual vector.
Vector residuals;
// The sizes of the Jacobians below are dictated by the cost function's
// parameter block size and residual block sizes. If a parameter block
// has a local parameterization associated with it, the size of the "local"
// Jacobian will be determined by the local parameterization dimension and
// residual block size, otherwise it will be identical to the regular
// Jacobian.
// Derivatives as computed by the cost function.
std::vector<Matrix> term_jacobians;
std::vector<Matrix> jacobians;
// Derivatives as computed by finite differencing.
std::vector<Matrix> finite_difference_jacobians;
// Derivatives as computed by the cost function in local space.
std::vector<Matrix> local_jacobians;
// Infinity-norm of term_jacobians - finite_difference_jacobians.
double error_jacobians;
// Derivatives as computed by nuerical differentiation in local space.
std::vector<Matrix> numeric_jacobians;
// Derivatives as computed by nuerical differentiation in local space.
std::vector<Matrix> local_numeric_jacobians;
// Contains the maximum relative error found in the local Jacobians.
double maximum_relative_error;
// If an error was detected, this will contain a detailed description of
// that error.
std::string error_log;
};
// Checks the Jacobian computed by a cost function.
// Call the cost function, compute alternative Jacobians using finite
// differencing and compare results. If local parameterizations are given,
// the Jacobians will be multiplied by the local parameterization Jacobians
// before performing the check, which effectively means that all errors along
// the null space of the local parameterization will be ignored.
// Returns false if the Jacobians don't match, the cost function return false,
// or if the cost function returns different residual when called with a
// Jacobian output argument vs. calling it without. Otherwise returns true.
//
// probe_point: The parameter values at which to probe.
// error_tolerance: A threshold for the infinity-norm difference
// between the Jacobians. If the Jacobians differ by more than
// this amount, then the probe fails.
//
// term: The cost function to test. Not retained after this call returns.
//
// results: On return, the two Jacobians (and other information)
// will be stored here. May be NULL.
// parameters: The parameter values at which to probe.
// relative_precision: A threshold for the relative difference between the
// Jacobians. If the Jacobians differ by more than this amount, then the
// probe fails.
// results: On return, the Jacobians (and other information) will be stored
// here. May be NULL.
//
// Returns true if no problems are detected and the difference between the
// Jacobians is less than error_tolerance.
static bool Probe(double const* const* probe_point,
double error_tolerance,
CostFunctionToProbe *term,
GradientCheckResults* results) {
CHECK_NOTNULL(probe_point);
CHECK_NOTNULL(term);
LOG(INFO) << "-------------------- Starting Probe() --------------------";
// We need a GradientCheckeresults, whether or not they supplied one.
internal::scoped_ptr<GradientCheckResults> owned_results;
if (results == NULL) {
owned_results.reset(new GradientCheckResults);
results = owned_results.get();
}
// Do a consistency check between the term and the template parameters.
CHECK_EQ(M, term->num_residuals());
const int num_residuals = M;
const std::vector<int32>& block_sizes = term->parameter_block_sizes();
const int num_blocks = block_sizes.size();
CHECK_LE(num_blocks, 5) << "Unable to test functions that take more "
<< "than 5 parameter blocks";
if (N0) {
CHECK_EQ(N0, block_sizes[0]);
CHECK_GE(num_blocks, 1);
} else {
CHECK_LT(num_blocks, 1);
}
if (N1) {
CHECK_EQ(N1, block_sizes[1]);
CHECK_GE(num_blocks, 2);
} else {
CHECK_LT(num_blocks, 2);
}
if (N2) {
CHECK_EQ(N2, block_sizes[2]);
CHECK_GE(num_blocks, 3);
} else {
CHECK_LT(num_blocks, 3);
}
if (N3) {
CHECK_EQ(N3, block_sizes[3]);
CHECK_GE(num_blocks, 4);
} else {
CHECK_LT(num_blocks, 4);
}
if (N4) {
CHECK_EQ(N4, block_sizes[4]);
CHECK_GE(num_blocks, 5);
} else {
CHECK_LT(num_blocks, 5);
}
results->term_jacobians.clear();
results->term_jacobians.resize(num_blocks);
results->finite_difference_jacobians.clear();
results->finite_difference_jacobians.resize(num_blocks);
internal::FixedArray<double*> term_jacobian_pointers(num_blocks);
internal::FixedArray<double*>
finite_difference_jacobian_pointers(num_blocks);
for (int i = 0; i < num_blocks; i++) {
results->term_jacobians[i].resize(num_residuals, block_sizes[i]);
term_jacobian_pointers[i] = results->term_jacobians[i].data();
results->finite_difference_jacobians[i].resize(
num_residuals, block_sizes[i]);
finite_difference_jacobian_pointers[i] =
results->finite_difference_jacobians[i].data();
}
results->cost.resize(num_residuals, 1);
CHECK(term->Evaluate(probe_point, results->cost.data(),
term_jacobian_pointers.get()));
NumericDiffCostFunction<CostFunctionToProbe, CENTRAL, M, N0, N1, N2, N3, N4>
numeric_term(term, DO_NOT_TAKE_OWNERSHIP);
CHECK(numeric_term.Evaluate(probe_point, results->cost.data(),
finite_difference_jacobian_pointers.get()));
results->error_jacobians = 0;
for (int i = 0; i < num_blocks; i++) {
Matrix jacobian_difference = results->term_jacobians[i] -
results->finite_difference_jacobians[i];
results->error_jacobians =
std::max(results->error_jacobians,
jacobian_difference.lpNorm<Eigen::Infinity>());
}
LOG(INFO) << "========== term-computed derivatives ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "term_computed block " << i;
LOG(INFO) << "\n" << results->term_jacobians[i];
}
LOG(INFO) << "========== finite-difference derivatives ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "finite_difference block " << i;
LOG(INFO) << "\n" << results->finite_difference_jacobians[i];
}
LOG(INFO) << "========== difference ==========";
for (int i = 0; i < num_blocks; i++) {
LOG(INFO) << "difference block " << i;
LOG(INFO) << (results->term_jacobians[i] -
results->finite_difference_jacobians[i]);
}
LOG(INFO) << "||difference|| = " << results->error_jacobians;
return results->error_jacobians < error_tolerance;
}
bool Probe(double const* const* parameters,
double relative_precision,
ProbeResults* results) const;
private:
CERES_DISALLOW_IMPLICIT_CONSTRUCTORS(GradientChecker);
std::vector<const LocalParameterization*> local_parameterizations_;
const CostFunction* function_;
internal::scoped_ptr<CostFunction> finite_diff_cost_function_;
};
} // namespace ceres

View File

@@ -33,9 +33,8 @@
// This file needs to compile as c code.
#ifdef __cplusplus
#include <cstddef>
#include "ceres/internal/config.h"
#if defined(CERES_TR1_MEMORY_HEADER)
#include <tr1/memory>
#else
@@ -50,6 +49,25 @@ using std::tr1::shared_ptr;
using std::shared_ptr;
#endif
// We allocate some Eigen objects on the stack and other places they
// might not be aligned to 16-byte boundaries. If we have C++11, we
// can specify their alignment anyway, and thus can safely enable
// vectorization on those matrices; in C++99, we are out of luck. Figure out
// what case we're in and write macros that do the right thing.
#ifdef CERES_USE_CXX11
namespace port_constants {
static constexpr size_t kMaxAlignBytes =
// Work around a GCC 4.8 bug
// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56019) where
// std::max_align_t is misplaced.
#if defined (__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 8
alignof(::max_align_t);
#else
alignof(std::max_align_t);
#endif
} // namespace port_constants
#endif
} // namespace ceres
#endif // __cplusplus

View File

@@ -69,7 +69,7 @@ struct CERES_EXPORT IterationSummary {
// Step was numerically valid, i.e., all values are finite and the
// step reduces the value of the linearized model.
//
// Note: step_is_valid is false when iteration = 0.
// Note: step_is_valid is always true when iteration = 0.
bool step_is_valid;
// Step did not reduce the value of the objective function
@@ -77,7 +77,7 @@ struct CERES_EXPORT IterationSummary {
// acceptance criterion used by the non-monotonic trust region
// algorithm.
//
// Note: step_is_nonmonotonic is false when iteration = 0;
// Note: step_is_nonmonotonic is always false when iteration = 0;
bool step_is_nonmonotonic;
// Whether or not the minimizer accepted this step or not. If the
@@ -89,7 +89,7 @@ struct CERES_EXPORT IterationSummary {
// relative decrease is not sufficient, the algorithm may accept the
// step and the step is declared successful.
//
// Note: step_is_successful is false when iteration = 0.
// Note: step_is_successful is always true when iteration = 0.
bool step_is_successful;
// Value of the objective function.

View File

@@ -164,6 +164,7 @@
#include "Eigen/Core"
#include "ceres/fpclassify.h"
#include "ceres/internal/port.h"
namespace ceres {
@@ -227,21 +228,23 @@ struct Jet {
T a;
// The infinitesimal part.
//
// Note the Eigen::DontAlign bit is needed here because this object
// gets allocated on the stack and as part of other arrays and
// structs. Forcing the right alignment there is the source of much
// pain and suffering. Even if that works, passing Jets around to
// functions by value has problems because the C++ ABI does not
// guarantee alignment for function arguments.
//
// Setting the DontAlign bit prevents Eigen from using SSE for the
// various operations on Jets. This is a small performance penalty
// since the AutoDiff code will still expose much of the code as
// statically sized loops to the compiler. But given the subtle
// issues that arise due to alignment, especially when dealing with
// multiple platforms, it seems to be a trade off worth making.
// We allocate Jets on the stack and other places they
// might not be aligned to 16-byte boundaries. If we have C++11, we
// can specify their alignment anyway, and thus can safely enable
// vectorization on those matrices; in C++99, we are out of luck. Figure out
// what case we're in and do the right thing.
#ifndef CERES_USE_CXX11
// fall back to safe version:
Eigen::Matrix<T, N, 1, Eigen::DontAlign> v;
#else
static constexpr bool kShouldAlignMatrix =
16 <= ::ceres::port_constants::kMaxAlignBytes;
static constexpr int kAlignHint = kShouldAlignMatrix ?
Eigen::AutoAlign : Eigen::DontAlign;
static constexpr size_t kAlignment = kShouldAlignMatrix ? 16 : 1;
alignas(kAlignment) Eigen::Matrix<T, N, 1, kAlignHint> v;
#endif
};
// Unary +
@@ -388,6 +391,8 @@ inline double atan (double x) { return std::atan(x); }
inline double sinh (double x) { return std::sinh(x); }
inline double cosh (double x) { return std::cosh(x); }
inline double tanh (double x) { return std::tanh(x); }
inline double floor (double x) { return std::floor(x); }
inline double ceil (double x) { return std::ceil(x); }
inline double pow (double x, double y) { return std::pow(x, y); }
inline double atan2(double y, double x) { return std::atan2(y, x); }
@@ -482,10 +487,51 @@ Jet<T, N> tanh(const Jet<T, N>& f) {
return Jet<T, N>(tanh_a, tmp * f.v);
}
// The floor function should be used with extreme care as this operation will
// result in a zero derivative which provides no information to the solver.
//
// floor(a + h) ~= floor(a) + 0
template <typename T, int N> inline
Jet<T, N> floor(const Jet<T, N>& f) {
return Jet<T, N>(floor(f.a));
}
// The ceil function should be used with extreme care as this operation will
// result in a zero derivative which provides no information to the solver.
//
// ceil(a + h) ~= ceil(a) + 0
template <typename T, int N> inline
Jet<T, N> ceil(const Jet<T, N>& f) {
return Jet<T, N>(ceil(f.a));
}
// Bessel functions of the first kind with integer order equal to 0, 1, n.
inline double BesselJ0(double x) { return j0(x); }
inline double BesselJ1(double x) { return j1(x); }
inline double BesselJn(int n, double x) { return jn(n, x); }
//
// Microsoft has deprecated the j[0,1,n]() POSIX Bessel functions in favour of
// _j[0,1,n](). Where available on MSVC, use _j[0,1,n]() to avoid deprecated
// function errors in client code (the specific warning is suppressed when
// Ceres itself is built).
inline double BesselJ0(double x) {
#if defined(_MSC_VER) && defined(_j0)
return _j0(x);
#else
return j0(x);
#endif
}
inline double BesselJ1(double x) {
#if defined(_MSC_VER) && defined(_j1)
return _j1(x);
#else
return j1(x);
#endif
}
inline double BesselJn(int n, double x) {
#if defined(_MSC_VER) && defined(_jn)
return _jn(n, x);
#else
return jn(n, x);
#endif
}
// For the formulae of the derivatives of the Bessel functions see the book:
// Olver, Lozier, Boisvert, Clark, NIST Handbook of Mathematical Functions,
@@ -743,7 +789,15 @@ template<typename T, int N> inline Jet<T, N> ei_pow (const Jet<T, N>& x,
// strange compile errors.
template <typename T, int N>
inline std::ostream &operator<<(std::ostream &s, const Jet<T, N>& z) {
return s << "[" << z.a << " ; " << z.v.transpose() << "]";
s << "[" << z.a << " ; ";
for (int i = 0; i < N; ++i) {
s << z.v[i];
if (i != N - 1) {
s << ", ";
}
}
s << "]";
return s;
}
} // namespace ceres
@@ -757,6 +811,7 @@ struct NumTraits<ceres::Jet<T, N> > {
typedef ceres::Jet<T, N> Real;
typedef ceres::Jet<T, N> NonInteger;
typedef ceres::Jet<T, N> Nested;
typedef ceres::Jet<T, N> Literal;
static typename ceres::Jet<T, N> dummy_precision() {
return ceres::Jet<T, N>(1e-12);
@@ -777,6 +832,21 @@ struct NumTraits<ceres::Jet<T, N> > {
HasFloatingPoint = 1,
RequireInitialization = 1
};
template<bool Vectorized>
struct Div {
enum {
#if defined(EIGEN_VECTORIZE_AVX)
AVX = true,
#else
AVX = false,
#endif
// Assuming that for Jets, division is as expensive as
// multiplication.
Cost = 3
};
};
};
} // namespace Eigen

View File

@@ -211,6 +211,28 @@ class CERES_EXPORT QuaternionParameterization : public LocalParameterization {
virtual int LocalSize() const { return 3; }
};
// Implements the quaternion local parameterization for Eigen's representation
// of the quaternion. Eigen uses a different internal memory layout for the
// elements of the quaternion than what is commonly used. Specifically, Eigen
// stores the elements in memory as [x, y, z, w] where the real part is last
// whereas it is typically stored first. Note, when creating an Eigen quaternion
// through the constructor the elements are accepted in w, x, y, z order. Since
// Ceres operates on parameter blocks which are raw double pointers this
// difference is important and requires a different parameterization.
//
// Plus(x, delta) = [sin(|delta|) delta / |delta|, cos(|delta|)] * x
// with * being the quaternion multiplication operator.
class EigenQuaternionParameterization : public ceres::LocalParameterization {
public:
virtual ~EigenQuaternionParameterization() {}
virtual bool Plus(const double* x,
const double* delta,
double* x_plus_delta) const;
virtual bool ComputeJacobian(const double* x,
double* jacobian) const;
virtual int GlobalSize() const { return 4; }
virtual int LocalSize() const { return 3; }
};
// This provides a parameterization for homogeneous vectors which are commonly
// used in Structure for Motion problems. One example where they are used is

View File

@@ -206,29 +206,6 @@ class NumericDiffCostFunction
}
}
// Deprecated. New users should avoid using this constructor. Instead, use the
// constructor with NumericDiffOptions.
NumericDiffCostFunction(CostFunctor* functor,
Ownership ownership,
int num_residuals,
const double relative_step_size)
:functor_(functor),
ownership_(ownership),
options_() {
LOG(WARNING) << "This constructor is deprecated and will be removed in "
"a future version. Please use the NumericDiffOptions "
"constructor instead.";
if (kNumResiduals == DYNAMIC) {
SizedCostFunction<kNumResiduals,
N0, N1, N2, N3, N4,
N5, N6, N7, N8, N9>
::set_num_residuals(num_residuals);
}
options_.relative_step_size = relative_step_size;
}
~NumericDiffCostFunction() {
if (ownership_ != TAKE_OWNERSHIP) {
functor_.release();

View File

@@ -309,6 +309,9 @@ class CERES_EXPORT Problem {
// Allow the indicated parameter block to vary during optimization.
void SetParameterBlockVariable(double* values);
// Returns true if a parameter block is set constant, and false otherwise.
bool IsParameterBlockConstant(double* values) const;
// Set the local parameterization for one of the parameter blocks.
// The local_parameterization is owned by the Problem by default. It
// is acceptable to set the same parameterization for multiple
@@ -461,6 +464,10 @@ class CERES_EXPORT Problem {
// parameter block has a local parameterization, then it contributes
// "LocalSize" entries to the gradient vector (and the number of
// columns in the jacobian).
//
// Note 3: This function cannot be called while the problem is being
// solved, for example it cannot be called from an IterationCallback
// at the end of an iteration during a solve.
bool Evaluate(const EvaluateOptions& options,
double* cost,
std::vector<double>* residuals,

View File

@@ -48,7 +48,6 @@
#include <algorithm>
#include <cmath>
#include <limits>
#include "glog/logging.h"
namespace ceres {
@@ -418,7 +417,6 @@ template <typename T>
inline void EulerAnglesToRotationMatrix(const T* euler,
const int row_stride_parameter,
T* R) {
CHECK_EQ(row_stride_parameter, 3);
EulerAnglesToRotationMatrix(euler, RowMajorAdapter3x3(R));
}
@@ -496,7 +494,6 @@ void QuaternionToRotation(const T q[4],
QuaternionToScaledRotation(q, R);
T normalizer = q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3];
CHECK_NE(normalizer, T(0));
normalizer = T(1) / normalizer;
for (int i = 0; i < 3; ++i) {

View File

@@ -134,7 +134,7 @@ class CERES_EXPORT Solver {
trust_region_problem_dump_format_type = TEXTFILE;
check_gradients = false;
gradient_check_relative_precision = 1e-8;
numeric_derivative_relative_step_size = 1e-6;
gradient_check_numeric_derivative_relative_step_size = 1e-6;
update_state_every_iteration = false;
}
@@ -701,12 +701,22 @@ class CERES_EXPORT Solver {
// this number, then the jacobian for that cost term is dumped.
double gradient_check_relative_precision;
// Relative shift used for taking numeric derivatives. For finite
// differencing, each dimension is evaluated at slightly shifted
// values; for the case of central difference, this is what gets
// evaluated:
// WARNING: This option only applies to the to the numeric
// differentiation used for checking the user provided derivatives
// when when Solver::Options::check_gradients is true. If you are
// using NumericDiffCostFunction and are interested in changing
// the step size for numeric differentiation in your cost
// function, please have a look at
// include/ceres/numeric_diff_options.h.
//
// delta = numeric_derivative_relative_step_size;
// Relative shift used for taking numeric derivatives when
// Solver::Options::check_gradients is true.
//
// For finite differencing, each dimension is evaluated at
// slightly shifted values; for the case of central difference,
// this is what gets evaluated:
//
// delta = gradient_check_numeric_derivative_relative_step_size;
// f_initial = f(x)
// f_forward = f((1 + delta) * x)
// f_backward = f((1 - delta) * x)
@@ -723,7 +733,7 @@ class CERES_EXPORT Solver {
// theory a good choice is sqrt(eps) * x, which for doubles means
// about 1e-8 * x. However, I have found this number too
// optimistic. This number should be exposed for users to change.
double numeric_derivative_relative_step_size;
double gradient_check_numeric_derivative_relative_step_size;
// If true, the user's parameter blocks are updated at the end of
// every Minimizer iteration, otherwise they are updated when the
@@ -801,6 +811,13 @@ class CERES_EXPORT Solver {
// Number of times inner iterations were performed.
int num_inner_iteration_steps;
// Total number of iterations inside the line search algorithm
// across all invocations. We call these iterations "steps" to
// distinguish them from the outer iterations of the line search
// and trust region minimizer algorithms which call the line
// search algorithm as a subroutine.
int num_line_search_steps;
// All times reported below are wall times.
// When the user calls Solve, before the actual optimization

View File

@@ -32,7 +32,7 @@
#define CERES_PUBLIC_VERSION_H_
#define CERES_VERSION_MAJOR 1
#define CERES_VERSION_MINOR 11
#define CERES_VERSION_MINOR 12
#define CERES_VERSION_REVISION 0
// Classic CPP stringifcation; the extra level of indirection allows the

View File

@@ -46,6 +46,7 @@ namespace internal {
using std::make_pair;
using std::pair;
using std::vector;
using std::adjacent_find;
void CompressedRowJacobianWriter::PopulateJacobianRowAndColumnBlockVectors(
const Program* program, CompressedRowSparseMatrix* jacobian) {
@@ -140,12 +141,21 @@ SparseMatrix* CompressedRowJacobianWriter::CreateJacobian() const {
// Sort the parameters by their position in the state vector.
sort(parameter_indices.begin(), parameter_indices.end());
CHECK(unique(parameter_indices.begin(), parameter_indices.end()) ==
parameter_indices.end())
<< "Ceres internal error: "
<< "Duplicate parameter blocks detected in a cost function. "
<< "This should never happen. Please report this to "
<< "the Ceres developers.";
if (adjacent_find(parameter_indices.begin(), parameter_indices.end()) !=
parameter_indices.end()) {
std::string parameter_block_description;
for (int j = 0; j < num_parameter_blocks; ++j) {
ParameterBlock* parameter_block = residual_block->parameter_blocks()[j];
parameter_block_description +=
parameter_block->ToString() + "\n";
}
LOG(FATAL) << "Ceres internal error: "
<< "Duplicate parameter blocks detected in a cost function. "
<< "This should never happen. Please report this to "
<< "the Ceres developers.\n"
<< "Residual Block: " << residual_block->ToString() << "\n"
<< "Parameter Blocks: " << parameter_block_description;
}
// Update the row indices.
const int num_residuals = residual_block->NumResiduals();

View File

@@ -38,6 +38,7 @@
namespace ceres {
using std::make_pair;
using std::pair;
using std::vector;
@@ -54,6 +55,12 @@ bool Covariance::Compute(
return impl_->Compute(covariance_blocks, problem->problem_impl_.get());
}
bool Covariance::Compute(
const vector<const double*>& parameter_blocks,
Problem* problem) {
return impl_->Compute(parameter_blocks, problem->problem_impl_.get());
}
bool Covariance::GetCovarianceBlock(const double* parameter_block1,
const double* parameter_block2,
double* covariance_block) const {
@@ -73,4 +80,20 @@ bool Covariance::GetCovarianceBlockInTangentSpace(
covariance_block);
}
bool Covariance::GetCovarianceMatrix(
const vector<const double*>& parameter_blocks,
double* covariance_matrix) {
return impl_->GetCovarianceMatrixInTangentOrAmbientSpace(parameter_blocks,
true, // ambient
covariance_matrix);
}
bool Covariance::GetCovarianceMatrixInTangentSpace(
const std::vector<const double *>& parameter_blocks,
double *covariance_matrix) {
return impl_->GetCovarianceMatrixInTangentOrAmbientSpace(parameter_blocks,
false, // tangent
covariance_matrix);
}
} // namespace ceres

View File

@@ -36,6 +36,8 @@
#include <algorithm>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <utility>
#include <vector>
@@ -43,6 +45,7 @@
#include "Eigen/SparseQR"
#include "Eigen/SVD"
#include "ceres/collections_port.h"
#include "ceres/compressed_col_sparse_matrix_utils.h"
#include "ceres/compressed_row_sparse_matrix.h"
#include "ceres/covariance.h"
@@ -51,6 +54,7 @@
#include "ceres/map_util.h"
#include "ceres/parameter_block.h"
#include "ceres/problem_impl.h"
#include "ceres/residual_block.h"
#include "ceres/suitesparse.h"
#include "ceres/wall_time.h"
#include "glog/logging.h"
@@ -61,6 +65,7 @@ namespace internal {
using std::make_pair;
using std::map;
using std::pair;
using std::sort;
using std::swap;
using std::vector;
@@ -86,8 +91,38 @@ CovarianceImpl::CovarianceImpl(const Covariance::Options& options)
CovarianceImpl::~CovarianceImpl() {
}
template <typename T> void CheckForDuplicates(vector<T> blocks) {
sort(blocks.begin(), blocks.end());
typename vector<T>::iterator it =
std::adjacent_find(blocks.begin(), blocks.end());
if (it != blocks.end()) {
// In case there are duplicates, we search for their location.
map<T, vector<int> > blocks_map;
for (int i = 0; i < blocks.size(); ++i) {
blocks_map[blocks[i]].push_back(i);
}
std::ostringstream duplicates;
while (it != blocks.end()) {
duplicates << "(";
for (int i = 0; i < blocks_map[*it].size() - 1; ++i) {
duplicates << blocks_map[*it][i] << ", ";
}
duplicates << blocks_map[*it].back() << ")";
it = std::adjacent_find(it + 1, blocks.end());
if (it < blocks.end()) {
duplicates << " and ";
}
}
LOG(FATAL) << "Covariance::Compute called with duplicate blocks at "
<< "indices " << duplicates.str();
}
}
bool CovarianceImpl::Compute(const CovarianceBlocks& covariance_blocks,
ProblemImpl* problem) {
CheckForDuplicates<pair<const double*, const double*> >(covariance_blocks);
problem_ = problem;
parameter_block_to_row_index_.clear();
covariance_matrix_.reset(NULL);
@@ -97,6 +132,20 @@ bool CovarianceImpl::Compute(const CovarianceBlocks& covariance_blocks,
return is_valid_;
}
bool CovarianceImpl::Compute(const vector<const double*>& parameter_blocks,
ProblemImpl* problem) {
CheckForDuplicates<const double*>(parameter_blocks);
CovarianceBlocks covariance_blocks;
for (int i = 0; i < parameter_blocks.size(); ++i) {
for (int j = i; j < parameter_blocks.size(); ++j) {
covariance_blocks.push_back(make_pair(parameter_blocks[i],
parameter_blocks[j]));
}
}
return Compute(covariance_blocks, problem);
}
bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
const double* original_parameter_block1,
const double* original_parameter_block2,
@@ -120,9 +169,17 @@ bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
ParameterBlock* block2 =
FindOrDie(parameter_map,
const_cast<double*>(original_parameter_block2));
const int block1_size = block1->Size();
const int block2_size = block2->Size();
MatrixRef(covariance_block, block1_size, block2_size).setZero();
const int block1_local_size = block1->LocalSize();
const int block2_local_size = block2->LocalSize();
if (!lift_covariance_to_ambient_space) {
MatrixRef(covariance_block, block1_local_size, block2_local_size)
.setZero();
} else {
MatrixRef(covariance_block, block1_size, block2_size).setZero();
}
return true;
}
@@ -240,6 +297,94 @@ bool CovarianceImpl::GetCovarianceBlockInTangentOrAmbientSpace(
return true;
}
bool CovarianceImpl::GetCovarianceMatrixInTangentOrAmbientSpace(
const vector<const double*>& parameters,
bool lift_covariance_to_ambient_space,
double* covariance_matrix) const {
CHECK(is_computed_)
<< "Covariance::GetCovarianceMatrix called before Covariance::Compute";
CHECK(is_valid_)
<< "Covariance::GetCovarianceMatrix called when Covariance::Compute "
<< "returned false.";
const ProblemImpl::ParameterMap& parameter_map = problem_->parameter_map();
// For OpenMP compatibility we need to define these vectors in advance
const int num_parameters = parameters.size();
vector<int> parameter_sizes;
vector<int> cum_parameter_size;
parameter_sizes.reserve(num_parameters);
cum_parameter_size.resize(num_parameters + 1);
cum_parameter_size[0] = 0;
for (int i = 0; i < num_parameters; ++i) {
ParameterBlock* block =
FindOrDie(parameter_map, const_cast<double*>(parameters[i]));
if (lift_covariance_to_ambient_space) {
parameter_sizes.push_back(block->Size());
} else {
parameter_sizes.push_back(block->LocalSize());
}
}
std::partial_sum(parameter_sizes.begin(), parameter_sizes.end(),
cum_parameter_size.begin() + 1);
const int max_covariance_block_size =
*std::max_element(parameter_sizes.begin(), parameter_sizes.end());
const int covariance_size = cum_parameter_size.back();
// Assemble the blocks in the covariance matrix.
MatrixRef covariance(covariance_matrix, covariance_size, covariance_size);
const int num_threads = options_.num_threads;
scoped_array<double> workspace(
new double[num_threads * max_covariance_block_size *
max_covariance_block_size]);
bool success = true;
// The collapse() directive is only supported in OpenMP 3.0 and higher. OpenMP
// 3.0 was released in May 2008 (hence the version number).
#if _OPENMP >= 200805
# pragma omp parallel for num_threads(num_threads) schedule(dynamic) collapse(2)
#else
# pragma omp parallel for num_threads(num_threads) schedule(dynamic)
#endif
for (int i = 0; i < num_parameters; ++i) {
for (int j = 0; j < num_parameters; ++j) {
// The second loop can't start from j = i for compatibility with OpenMP
// collapse command. The conditional serves as a workaround
if (j >= i) {
int covariance_row_idx = cum_parameter_size[i];
int covariance_col_idx = cum_parameter_size[j];
int size_i = parameter_sizes[i];
int size_j = parameter_sizes[j];
#ifdef CERES_USE_OPENMP
int thread_id = omp_get_thread_num();
#else
int thread_id = 0;
#endif
double* covariance_block =
workspace.get() +
thread_id * max_covariance_block_size * max_covariance_block_size;
if (!GetCovarianceBlockInTangentOrAmbientSpace(
parameters[i], parameters[j], lift_covariance_to_ambient_space,
covariance_block)) {
success = false;
}
covariance.block(covariance_row_idx, covariance_col_idx,
size_i, size_j) =
MatrixRef(covariance_block, size_i, size_j);
if (i != j) {
covariance.block(covariance_col_idx, covariance_row_idx,
size_j, size_i) =
MatrixRef(covariance_block, size_i, size_j).transpose();
}
}
}
}
return success;
}
// Determine the sparsity pattern of the covariance matrix based on
// the block pairs requested by the user.
bool CovarianceImpl::ComputeCovarianceSparsity(
@@ -252,18 +397,28 @@ bool CovarianceImpl::ComputeCovarianceSparsity(
vector<double*> all_parameter_blocks;
problem->GetParameterBlocks(&all_parameter_blocks);
const ProblemImpl::ParameterMap& parameter_map = problem->parameter_map();
HashSet<ParameterBlock*> parameter_blocks_in_use;
vector<ResidualBlock*> residual_blocks;
problem->GetResidualBlocks(&residual_blocks);
for (int i = 0; i < residual_blocks.size(); ++i) {
ResidualBlock* residual_block = residual_blocks[i];
parameter_blocks_in_use.insert(residual_block->parameter_blocks(),
residual_block->parameter_blocks() +
residual_block->NumParameterBlocks());
}
constant_parameter_blocks_.clear();
vector<double*>& active_parameter_blocks =
evaluate_options_.parameter_blocks;
active_parameter_blocks.clear();
for (int i = 0; i < all_parameter_blocks.size(); ++i) {
double* parameter_block = all_parameter_blocks[i];
ParameterBlock* block = FindOrDie(parameter_map, parameter_block);
if (block->IsConstant()) {
constant_parameter_blocks_.insert(parameter_block);
} else {
if (!block->IsConstant() && (parameter_blocks_in_use.count(block) > 0)) {
active_parameter_blocks.push_back(parameter_block);
} else {
constant_parameter_blocks_.insert(parameter_block);
}
}
@@ -386,8 +541,8 @@ bool CovarianceImpl::ComputeCovarianceValues() {
switch (options_.algorithm_type) {
case DENSE_SVD:
return ComputeCovarianceValuesUsingDenseSVD();
#ifndef CERES_NO_SUITESPARSE
case SUITE_SPARSE_QR:
#ifndef CERES_NO_SUITESPARSE
return ComputeCovarianceValuesUsingSuiteSparseQR();
#else
LOG(ERROR) << "SuiteSparse is required to use the "
@@ -624,7 +779,10 @@ bool CovarianceImpl::ComputeCovarianceValuesUsingDenseSVD() {
if (automatic_truncation) {
break;
} else {
LOG(ERROR) << "Cholesky factorization of J'J is not reliable. "
LOG(ERROR) << "Error: Covariance matrix is near rank deficient "
<< "and the user did not specify a non-zero"
<< "Covariance::Options::null_space_rank "
<< "to enable the computation of a Pseudo-Inverse. "
<< "Reciprocal condition number: "
<< singular_value_ratio * singular_value_ratio << " "
<< "min_reciprocal_condition_number: "

View File

@@ -55,12 +55,21 @@ class CovarianceImpl {
const double*> >& covariance_blocks,
ProblemImpl* problem);
bool Compute(
const std::vector<const double*>& parameter_blocks,
ProblemImpl* problem);
bool GetCovarianceBlockInTangentOrAmbientSpace(
const double* parameter_block1,
const double* parameter_block2,
bool lift_covariance_to_ambient_space,
double* covariance_block) const;
bool GetCovarianceMatrixInTangentOrAmbientSpace(
const std::vector<const double*>& parameters,
bool lift_covariance_to_ambient_space,
double *covariance_matrix) const;
bool ComputeCovarianceSparsity(
const std::vector<std::pair<const double*,
const double*> >& covariance_blocks,

View File

@@ -0,0 +1,276 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: wjr@google.com (William Rucklidge),
// keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
#include "ceres/gradient_checker.h"
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include "ceres/is_close.h"
#include "ceres/stringprintf.h"
#include "ceres/types.h"
namespace ceres {
using internal::IsClose;
using internal::StringAppendF;
using internal::StringPrintf;
using std::string;
using std::vector;
namespace {
// Evaluate the cost function and transform the returned Jacobians to
// the local space of the respective local parameterizations.
bool EvaluateCostFunction(
const ceres::CostFunction* function,
double const* const * parameters,
const std::vector<const ceres::LocalParameterization*>&
local_parameterizations,
Vector* residuals,
std::vector<Matrix>* jacobians,
std::vector<Matrix>* local_jacobians) {
CHECK_NOTNULL(residuals);
CHECK_NOTNULL(jacobians);
CHECK_NOTNULL(local_jacobians);
const vector<int32>& block_sizes = function->parameter_block_sizes();
const int num_parameter_blocks = block_sizes.size();
// Allocate Jacobian matrices in local space.
local_jacobians->resize(num_parameter_blocks);
vector<double*> local_jacobian_data(num_parameter_blocks);
for (int i = 0; i < num_parameter_blocks; ++i) {
int block_size = block_sizes.at(i);
if (local_parameterizations.at(i) != NULL) {
block_size = local_parameterizations.at(i)->LocalSize();
}
local_jacobians->at(i).resize(function->num_residuals(), block_size);
local_jacobians->at(i).setZero();
local_jacobian_data.at(i) = local_jacobians->at(i).data();
}
// Allocate Jacobian matrices in global space.
jacobians->resize(num_parameter_blocks);
vector<double*> jacobian_data(num_parameter_blocks);
for (int i = 0; i < num_parameter_blocks; ++i) {
jacobians->at(i).resize(function->num_residuals(), block_sizes.at(i));
jacobians->at(i).setZero();
jacobian_data.at(i) = jacobians->at(i).data();
}
// Compute residuals & jacobians.
CHECK_NE(0, function->num_residuals());
residuals->resize(function->num_residuals());
residuals->setZero();
if (!function->Evaluate(parameters, residuals->data(),
jacobian_data.data())) {
return false;
}
// Convert Jacobians from global to local space.
for (size_t i = 0; i < local_jacobians->size(); ++i) {
if (local_parameterizations.at(i) == NULL) {
local_jacobians->at(i) = jacobians->at(i);
} else {
int global_size = local_parameterizations.at(i)->GlobalSize();
int local_size = local_parameterizations.at(i)->LocalSize();
CHECK_EQ(jacobians->at(i).cols(), global_size);
Matrix global_J_local(global_size, local_size);
local_parameterizations.at(i)->ComputeJacobian(
parameters[i], global_J_local.data());
local_jacobians->at(i) = jacobians->at(i) * global_J_local;
}
}
return true;
}
} // namespace
GradientChecker::GradientChecker(
const CostFunction* function,
const vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options) :
function_(function) {
CHECK_NOTNULL(function);
if (local_parameterizations != NULL) {
local_parameterizations_ = *local_parameterizations;
} else {
local_parameterizations_.resize(function->parameter_block_sizes().size(),
NULL);
}
DynamicNumericDiffCostFunction<CostFunction, CENTRAL>*
finite_diff_cost_function =
new DynamicNumericDiffCostFunction<CostFunction, CENTRAL>(
function, DO_NOT_TAKE_OWNERSHIP, options);
finite_diff_cost_function_.reset(finite_diff_cost_function);
const vector<int32>& parameter_block_sizes =
function->parameter_block_sizes();
const int num_parameter_blocks = parameter_block_sizes.size();
for (int i = 0; i < num_parameter_blocks; ++i) {
finite_diff_cost_function->AddParameterBlock(parameter_block_sizes[i]);
}
finite_diff_cost_function->SetNumResiduals(function->num_residuals());
}
bool GradientChecker::Probe(double const* const * parameters,
double relative_precision,
ProbeResults* results_param) const {
int num_residuals = function_->num_residuals();
// Make sure that we have a place to store results, no matter if the user has
// provided an output argument.
ProbeResults* results;
ProbeResults results_local;
if (results_param != NULL) {
results = results_param;
results->residuals.resize(0);
results->jacobians.clear();
results->numeric_jacobians.clear();
results->local_jacobians.clear();
results->local_numeric_jacobians.clear();
results->error_log.clear();
} else {
results = &results_local;
}
results->maximum_relative_error = 0.0;
results->return_value = true;
// Evaluate the derivative using the user supplied code.
vector<Matrix>& jacobians = results->jacobians;
vector<Matrix>& local_jacobians = results->local_jacobians;
if (!EvaluateCostFunction(function_, parameters, local_parameterizations_,
&results->residuals, &jacobians, &local_jacobians)) {
results->error_log = "Function evaluation with Jacobians failed.";
results->return_value = false;
}
// Evaluate the derivative using numeric derivatives.
vector<Matrix>& numeric_jacobians = results->numeric_jacobians;
vector<Matrix>& local_numeric_jacobians = results->local_numeric_jacobians;
Vector finite_diff_residuals;
if (!EvaluateCostFunction(finite_diff_cost_function_.get(), parameters,
local_parameterizations_, &finite_diff_residuals,
&numeric_jacobians, &local_numeric_jacobians)) {
results->error_log += "\nFunction evaluation with numerical "
"differentiation failed.";
results->return_value = false;
}
if (!results->return_value) {
return false;
}
for (int i = 0; i < num_residuals; ++i) {
if (!IsClose(
results->residuals[i],
finite_diff_residuals[i],
relative_precision,
NULL,
NULL)) {
results->error_log = "Function evaluation with and without Jacobians "
"resulted in different residuals.";
LOG(INFO) << results->residuals.transpose();
LOG(INFO) << finite_diff_residuals.transpose();
return false;
}
}
// See if any elements have relative error larger than the threshold.
int num_bad_jacobian_components = 0;
double& worst_relative_error = results->maximum_relative_error;
worst_relative_error = 0;
// Accumulate the error message for all the jacobians, since it won't get
// output if there are no bad jacobian components.
string error_log;
for (int k = 0; k < function_->parameter_block_sizes().size(); k++) {
StringAppendF(&error_log,
"========== "
"Jacobian for " "block %d: (%ld by %ld)) "
"==========\n",
k,
static_cast<long>(local_jacobians[k].rows()),
static_cast<long>(local_jacobians[k].cols()));
// The funny spacing creates appropriately aligned column headers.
error_log +=
" block row col user dx/dy num diff dx/dy "
"abs error relative error parameter residual\n";
for (int i = 0; i < local_jacobians[k].rows(); i++) {
for (int j = 0; j < local_jacobians[k].cols(); j++) {
double term_jacobian = local_jacobians[k](i, j);
double finite_jacobian = local_numeric_jacobians[k](i, j);
double relative_error, absolute_error;
bool bad_jacobian_entry =
!IsClose(term_jacobian,
finite_jacobian,
relative_precision,
&relative_error,
&absolute_error);
worst_relative_error = std::max(worst_relative_error, relative_error);
StringAppendF(&error_log,
"%6d %4d %4d %17g %17g %17g %17g %17g %17g",
k, i, j,
term_jacobian, finite_jacobian,
absolute_error, relative_error,
parameters[k][j],
results->residuals[i]);
if (bad_jacobian_entry) {
num_bad_jacobian_components++;
StringAppendF(
&error_log,
" ------ (%d,%d,%d) Relative error worse than %g",
k, i, j, relative_precision);
}
error_log += "\n";
}
}
}
// Since there were some bad errors, dump comprehensive debug info.
if (num_bad_jacobian_components) {
string header = StringPrintf("\nDetected %d bad Jacobian component(s). "
"Worst relative error was %g.\n",
num_bad_jacobian_components,
worst_relative_error);
results->error_log = header + "\n" + error_log;
return false;
}
return true;
}
} // namespace ceres

View File

@@ -26,7 +26,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: keir@google.com (Keir Mierle)
// Authors: keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
#include "ceres/gradient_checking_cost_function.h"
@@ -36,7 +37,7 @@
#include <string>
#include <vector>
#include "ceres/cost_function.h"
#include "ceres/gradient_checker.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/scoped_ptr.h"
#include "ceres/parameter_block.h"
@@ -59,55 +60,25 @@ using std::vector;
namespace {
// True if x and y have an absolute relative difference less than
// relative_precision and false otherwise. Stores the relative and absolute
// difference in relative/absolute_error if non-NULL.
bool IsClose(double x, double y, double relative_precision,
double *relative_error,
double *absolute_error) {
double local_absolute_error;
double local_relative_error;
if (!absolute_error) {
absolute_error = &local_absolute_error;
}
if (!relative_error) {
relative_error = &local_relative_error;
}
*absolute_error = abs(x - y);
*relative_error = *absolute_error / max(abs(x), abs(y));
if (x == 0 || y == 0) {
// If x or y is exactly zero, then relative difference doesn't have any
// meaning. Take the absolute difference instead.
*relative_error = *absolute_error;
}
return abs(*relative_error) < abs(relative_precision);
}
class GradientCheckingCostFunction : public CostFunction {
public:
GradientCheckingCostFunction(const CostFunction* function,
const NumericDiffOptions& options,
double relative_precision,
const string& extra_info)
GradientCheckingCostFunction(
const CostFunction* function,
const std::vector<const LocalParameterization*>* local_parameterizations,
const NumericDiffOptions& options,
double relative_precision,
const string& extra_info,
GradientCheckingIterationCallback* callback)
: function_(function),
gradient_checker_(function, local_parameterizations, options),
relative_precision_(relative_precision),
extra_info_(extra_info) {
DynamicNumericDiffCostFunction<CostFunction, CENTRAL>*
finite_diff_cost_function =
new DynamicNumericDiffCostFunction<CostFunction, CENTRAL>(
function,
DO_NOT_TAKE_OWNERSHIP,
options);
extra_info_(extra_info),
callback_(callback) {
CHECK_NOTNULL(callback_);
const vector<int32>& parameter_block_sizes =
function->parameter_block_sizes();
for (int i = 0; i < parameter_block_sizes.size(); ++i) {
finite_diff_cost_function->AddParameterBlock(parameter_block_sizes[i]);
}
*mutable_parameter_block_sizes() = parameter_block_sizes;
set_num_residuals(function->num_residuals());
finite_diff_cost_function->SetNumResiduals(num_residuals());
finite_diff_cost_function_.reset(finite_diff_cost_function);
}
virtual ~GradientCheckingCostFunction() { }
@@ -120,133 +91,92 @@ class GradientCheckingCostFunction : public CostFunction {
return function_->Evaluate(parameters, residuals, NULL);
}
int num_residuals = function_->num_residuals();
GradientChecker::ProbeResults results;
bool okay = gradient_checker_.Probe(parameters,
relative_precision_,
&results);
// Make space for the jacobians of the two methods.
const vector<int32>& block_sizes = function_->parameter_block_sizes();
vector<Matrix> term_jacobians(block_sizes.size());
vector<Matrix> finite_difference_jacobians(block_sizes.size());
vector<double*> term_jacobian_pointers(block_sizes.size());
vector<double*> finite_difference_jacobian_pointers(block_sizes.size());
for (int i = 0; i < block_sizes.size(); i++) {
term_jacobians[i].resize(num_residuals, block_sizes[i]);
term_jacobian_pointers[i] = term_jacobians[i].data();
finite_difference_jacobians[i].resize(num_residuals, block_sizes[i]);
finite_difference_jacobian_pointers[i] =
finite_difference_jacobians[i].data();
}
// Evaluate the derivative using the user supplied code.
if (!function_->Evaluate(parameters,
residuals,
&term_jacobian_pointers[0])) {
LOG(WARNING) << "Function evaluation failed.";
// If the cost function returned false, there's nothing we can say about
// the gradients.
if (results.return_value == false) {
return false;
}
// Evaluate the derivative using numeric derivatives.
finite_diff_cost_function_->Evaluate(
parameters,
residuals,
&finite_difference_jacobian_pointers[0]);
// Copy the residuals.
const int num_residuals = function_->num_residuals();
MatrixRef(residuals, num_residuals, 1) = results.residuals;
// See if any elements have relative error larger than the threshold.
int num_bad_jacobian_components = 0;
double worst_relative_error = 0;
// Accumulate the error message for all the jacobians, since it won't get
// output if there are no bad jacobian components.
string m;
// Copy the original jacobian blocks into the jacobians array.
const vector<int32>& block_sizes = function_->parameter_block_sizes();
for (int k = 0; k < block_sizes.size(); k++) {
// Copy the original jacobian blocks into the jacobians array.
if (jacobians[k] != NULL) {
MatrixRef(jacobians[k],
term_jacobians[k].rows(),
term_jacobians[k].cols()) = term_jacobians[k];
}
StringAppendF(&m,
"========== "
"Jacobian for " "block %d: (%ld by %ld)) "
"==========\n",
k,
static_cast<long>(term_jacobians[k].rows()),
static_cast<long>(term_jacobians[k].cols()));
// The funny spacing creates appropriately aligned column headers.
m += " block row col user dx/dy num diff dx/dy "
"abs error relative error parameter residual\n";
for (int i = 0; i < term_jacobians[k].rows(); i++) {
for (int j = 0; j < term_jacobians[k].cols(); j++) {
double term_jacobian = term_jacobians[k](i, j);
double finite_jacobian = finite_difference_jacobians[k](i, j);
double relative_error, absolute_error;
bool bad_jacobian_entry =
!IsClose(term_jacobian,
finite_jacobian,
relative_precision_,
&relative_error,
&absolute_error);
worst_relative_error = max(worst_relative_error, relative_error);
StringAppendF(&m, "%6d %4d %4d %17g %17g %17g %17g %17g %17g",
k, i, j,
term_jacobian, finite_jacobian,
absolute_error, relative_error,
parameters[k][j],
residuals[i]);
if (bad_jacobian_entry) {
num_bad_jacobian_components++;
StringAppendF(
&m, " ------ (%d,%d,%d) Relative error worse than %g",
k, i, j, relative_precision_);
}
m += "\n";
}
results.jacobians[k].rows(),
results.jacobians[k].cols()) = results.jacobians[k];
}
}
// Since there were some bad errors, dump comprehensive debug info.
if (num_bad_jacobian_components) {
string header = StringPrintf("Detected %d bad jacobian component(s). "
"Worst relative error was %g.\n",
num_bad_jacobian_components,
worst_relative_error);
if (!extra_info_.empty()) {
header += "Extra info for this residual: " + extra_info_ + "\n";
}
LOG(WARNING) << "\n" << header << m;
if (!okay) {
std::string error_log = "Gradient Error detected!\nExtra info for "
"this residual: " + extra_info_ + "\n" + results.error_log;
callback_->SetGradientErrorDetected(error_log);
}
return true;
}
private:
const CostFunction* function_;
internal::scoped_ptr<CostFunction> finite_diff_cost_function_;
GradientChecker gradient_checker_;
double relative_precision_;
string extra_info_;
GradientCheckingIterationCallback* callback_;
};
} // namespace
CostFunction *CreateGradientCheckingCostFunction(
const CostFunction *cost_function,
GradientCheckingIterationCallback::GradientCheckingIterationCallback()
: gradient_error_detected_(false) {
}
CallbackReturnType GradientCheckingIterationCallback::operator()(
const IterationSummary& summary) {
if (gradient_error_detected_) {
LOG(ERROR)<< "Gradient error detected. Terminating solver.";
return SOLVER_ABORT;
}
return SOLVER_CONTINUE;
}
void GradientCheckingIterationCallback::SetGradientErrorDetected(
std::string& error_log) {
mutex_.Lock();
gradient_error_detected_ = true;
error_log_ += "\n" + error_log;
mutex_.Unlock();
}
CostFunction* CreateGradientCheckingCostFunction(
const CostFunction* cost_function,
const std::vector<const LocalParameterization*>* local_parameterizations,
double relative_step_size,
double relative_precision,
const string& extra_info) {
const std::string& extra_info,
GradientCheckingIterationCallback* callback) {
NumericDiffOptions numeric_diff_options;
numeric_diff_options.relative_step_size = relative_step_size;
return new GradientCheckingCostFunction(cost_function,
local_parameterizations,
numeric_diff_options,
relative_precision,
extra_info);
relative_precision, extra_info,
callback);
}
ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision) {
ProblemImpl* CreateGradientCheckingProblemImpl(
ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision,
GradientCheckingIterationCallback* callback) {
CHECK_NOTNULL(callback);
// We create new CostFunctions by wrapping the original CostFunction
// in a gradient checking CostFunction. So its okay for the
// ProblemImpl to take ownership of it and destroy it. The
@@ -260,6 +190,9 @@ ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
gradient_checking_problem_options.local_parameterization_ownership =
DO_NOT_TAKE_OWNERSHIP;
NumericDiffOptions numeric_diff_options;
numeric_diff_options.relative_step_size = relative_step_size;
ProblemImpl* gradient_checking_problem_impl = new ProblemImpl(
gradient_checking_problem_options);
@@ -294,19 +227,26 @@ ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
string extra_info = StringPrintf(
"Residual block id %d; depends on parameters [", i);
vector<double*> parameter_blocks;
vector<const LocalParameterization*> local_parameterizations;
parameter_blocks.reserve(residual_block->NumParameterBlocks());
local_parameterizations.reserve(residual_block->NumParameterBlocks());
for (int j = 0; j < residual_block->NumParameterBlocks(); ++j) {
ParameterBlock* parameter_block = residual_block->parameter_blocks()[j];
parameter_blocks.push_back(parameter_block->mutable_user_state());
StringAppendF(&extra_info, "%p", parameter_block->mutable_user_state());
extra_info += (j < residual_block->NumParameterBlocks() - 1) ? ", " : "]";
local_parameterizations.push_back(problem_impl->GetParameterization(
parameter_block->mutable_user_state()));
}
// Wrap the original CostFunction in a GradientCheckingCostFunction.
CostFunction* gradient_checking_cost_function =
CreateGradientCheckingCostFunction(residual_block->cost_function(),
relative_step_size,
relative_precision,
extra_info);
new GradientCheckingCostFunction(residual_block->cost_function(),
&local_parameterizations,
numeric_diff_options,
relative_precision,
extra_info,
callback);
// The const_cast is necessary because
// ProblemImpl::AddResidualBlock can potentially take ownership of

View File

@@ -26,7 +26,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: keir@google.com (Keir Mierle)
// Authors: keir@google.com (Keir Mierle),
// dgossow@google.com (David Gossow)
#ifndef CERES_INTERNAL_GRADIENT_CHECKING_COST_FUNCTION_H_
#define CERES_INTERNAL_GRADIENT_CHECKING_COST_FUNCTION_H_
@@ -34,50 +35,76 @@
#include <string>
#include "ceres/cost_function.h"
#include "ceres/iteration_callback.h"
#include "ceres/local_parameterization.h"
#include "ceres/mutex.h"
namespace ceres {
namespace internal {
class ProblemImpl;
// Creates a CostFunction that checks the jacobians that cost_function computes
// with finite differences. Bad results are logged; required precision is
// controlled by relative_precision and the numeric differentiation step size is
// controlled with relative_step_size. See solver.h for a better explanation of
// relative_step_size. Caller owns result.
//
// The condition enforced is that
//
// (J_actual(i, j) - J_numeric(i, j))
// ------------------------------------ < relative_precision
// max(J_actual(i, j), J_numeric(i, j))
//
// where J_actual(i, j) is the jacobian as computed by the supplied cost
// function (by the user) and J_numeric is the jacobian as computed by finite
// differences.
//
// Note: This is quite inefficient and is intended only for debugging.
// Callback that collects information about gradient checking errors, and
// will abort the solve as soon as an error occurs.
class GradientCheckingIterationCallback : public IterationCallback {
public:
GradientCheckingIterationCallback();
// Will return SOLVER_CONTINUE until a gradient error has been detected,
// then return SOLVER_ABORT.
virtual CallbackReturnType operator()(const IterationSummary& summary);
// Notify this that a gradient error has occurred (thread safe).
void SetGradientErrorDetected(std::string& error_log);
// Retrieve error status (not thread safe).
bool gradient_error_detected() const { return gradient_error_detected_; }
const std::string& error_log() const { return error_log_; }
private:
bool gradient_error_detected_;
std::string error_log_;
// Mutex protecting member variables.
ceres::internal::Mutex mutex_;
};
// Creates a CostFunction that checks the Jacobians that cost_function computes
// with finite differences. This API is only intended for unit tests that intend
// to check the functionality of the GradientCheckingCostFunction
// implementation directly.
CostFunction* CreateGradientCheckingCostFunction(
const CostFunction* cost_function,
const std::vector<const LocalParameterization*>* local_parameterizations,
double relative_step_size,
double relative_precision,
const std::string& extra_info);
const std::string& extra_info,
GradientCheckingIterationCallback* callback);
// Create a new ProblemImpl object from the input problem_impl, where
// each CostFunctions in problem_impl are wrapped inside a
// GradientCheckingCostFunctions. This gives us a ProblemImpl object
// which checks its derivatives against estimates from numeric
// differentiation everytime a ResidualBlock is evaluated.
// Create a new ProblemImpl object from the input problem_impl, where all
// cost functions are wrapped so that each time their Evaluate method is called,
// an additional check is performed that compares the Jacobians computed by
// the original cost function with alternative Jacobians computed using
// numerical differentiation. If local parameterizations are given for any
// parameters, the Jacobians will be compared in the local space instead of the
// ambient space. For details on the gradient checking procedure, see the
// documentation of the GradientChecker class. If an error is detected in any
// iteration, the respective cost function will notify the
// GradientCheckingIterationCallback.
//
// The caller owns the returned ProblemImpl object.
//
// Note: This is quite inefficient and is intended only for debugging.
//
// relative_step_size and relative_precision are parameters to control
// the numeric differentiation and the relative tolerance between the
// jacobian computed by the CostFunctions in problem_impl and
// jacobians obtained by numerically differentiating them. For more
// details see the documentation for
// CreateGradientCheckingCostFunction above.
ProblemImpl* CreateGradientCheckingProblemImpl(ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision);
// jacobians obtained by numerically differentiating them. See the
// documentation of 'numeric_derivative_relative_step_size' in solver.h for a
// better explanation.
ProblemImpl* CreateGradientCheckingProblemImpl(
ProblemImpl* problem_impl,
double relative_step_size,
double relative_precision,
GradientCheckingIterationCallback* callback);
} // namespace internal
} // namespace ceres

View File

@@ -84,6 +84,12 @@ Solver::Options GradientProblemSolverOptionsToSolverOptions(
} // namespace
bool GradientProblemSolver::Options::IsValid(std::string* error) const {
const Solver::Options solver_options =
GradientProblemSolverOptionsToSolverOptions(*this);
return solver_options.IsValid(error);
}
GradientProblemSolver::~GradientProblemSolver() {
}
@@ -99,8 +105,6 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options,
using internal::SetSummaryFinalCost;
double start_time = WallTimeInSeconds();
Solver::Options solver_options =
GradientProblemSolverOptionsToSolverOptions(options);
*CHECK_NOTNULL(summary) = Summary();
summary->num_parameters = problem.NumParameters();
@@ -112,14 +116,16 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options,
summary->nonlinear_conjugate_gradient_type = options.nonlinear_conjugate_gradient_type; // NOLINT
// Check validity
if (!solver_options.IsValid(&summary->message)) {
if (!options.IsValid(&summary->message)) {
LOG(ERROR) << "Terminating: " << summary->message;
return;
}
// Assuming that the parameter blocks in the program have been
Minimizer::Options minimizer_options;
minimizer_options = Minimizer::Options(solver_options);
// TODO(sameeragarwal): This is a bit convoluted, we should be able
// to convert to minimizer options directly, but this will do for
// now.
Minimizer::Options minimizer_options =
Minimizer::Options(GradientProblemSolverOptionsToSolverOptions(options));
minimizer_options.evaluator.reset(new GradientProblemEvaluator(problem));
scoped_ptr<IterationCallback> logging_callback;

59
extern/ceres/internal/ceres/is_close.cc vendored Normal file
View File

@@ -0,0 +1,59 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle), dgossow@google.com (David Gossow)
#include "ceres/is_close.h"
#include <algorithm>
#include <cmath>
namespace ceres {
namespace internal {
bool IsClose(double x, double y, double relative_precision,
double *relative_error,
double *absolute_error) {
double local_absolute_error;
double local_relative_error;
if (!absolute_error) {
absolute_error = &local_absolute_error;
}
if (!relative_error) {
relative_error = &local_relative_error;
}
*absolute_error = std::fabs(x - y);
*relative_error = *absolute_error / std::max(std::fabs(x), std::fabs(y));
if (x == 0 || y == 0) {
// If x or y is exactly zero, then relative difference doesn't have any
// meaning. Take the absolute difference instead.
*relative_error = *absolute_error;
}
return *relative_error < std::fabs(relative_precision);
}
} // namespace internal
} // namespace ceres

51
extern/ceres/internal/ceres/is_close.h vendored Normal file
View File

@@ -0,0 +1,51 @@
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2016 Google Inc. All rights reserved.
// http://ceres-solver.org/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Authors: keir@google.com (Keir Mierle), dgossow@google.com (David Gossow)
//
// Utility routine for comparing two values.
#ifndef CERES_INTERNAL_IS_CLOSE_H_
#define CERES_INTERNAL_IS_CLOSE_H_
namespace ceres {
namespace internal {
// Returns true if x and y have a relative (unsigned) difference less than
// relative_precision and false otherwise. Stores the relative and absolute
// difference in relative/absolute_error if non-NULL. If one of the two values
// is exactly zero, the absolute difference will be compared, and relative_error
// will be set to the absolute difference.
bool IsClose(double x,
double y,
double relative_precision,
double *relative_error,
double *absolute_error);
} // namespace internal
} // namespace ceres
#endif // CERES_INTERNAL_IS_CLOSE_H_

View File

@@ -191,6 +191,7 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
options.line_search_sufficient_curvature_decrease;
line_search_options.max_step_expansion =
options.max_line_search_step_expansion;
line_search_options.is_silent = options.is_silent;
line_search_options.function = &line_search_function;
scoped_ptr<LineSearch>
@@ -341,10 +342,12 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
"as the step was valid when it was selected by the line search.";
LOG_IF(WARNING, is_not_silent) << "Terminating: " << summary->message;
break;
} else if (!Evaluate(evaluator,
x_plus_delta,
&current_state,
&summary->message)) {
}
if (!Evaluate(evaluator,
x_plus_delta,
&current_state,
&summary->message)) {
summary->termination_type = FAILURE;
summary->message =
"Step failed to evaluate. This should not happen as the step was "
@@ -352,15 +355,17 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
summary->message;
LOG_IF(WARNING, is_not_silent) << "Terminating: " << summary->message;
break;
} else {
x = x_plus_delta;
}
// Compute the norm of the step in the ambient space.
iteration_summary.step_norm = (x_plus_delta - x).norm();
x = x_plus_delta;
iteration_summary.gradient_max_norm = current_state.gradient_max_norm;
iteration_summary.gradient_norm = sqrt(current_state.gradient_squared_norm);
iteration_summary.cost_change = previous_state.cost - current_state.cost;
iteration_summary.cost = current_state.cost + summary->fixed_cost;
iteration_summary.step_norm = delta.norm();
iteration_summary.step_is_valid = true;
iteration_summary.step_is_successful = true;
iteration_summary.step_size = current_state.step_size;
@@ -376,6 +381,13 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options,
WallTimeInSeconds() - start_time
+ summary->preprocessor_time_in_seconds;
// Iterations inside the line search algorithm are considered
// 'steps' in the broader context, to distinguish these inner
// iterations from from the outer iterations of the line search
// minimizer. The number of line search steps is the total number
// of inner line search iterations (or steps) across the entire
// minimization.
summary->num_line_search_steps += line_search_summary.num_iterations;
summary->line_search_cost_evaluation_time_in_seconds +=
line_search_summary.cost_evaluation_time_in_seconds;
summary->line_search_gradient_evaluation_time_in_seconds +=

View File

@@ -30,6 +30,8 @@
#include "ceres/local_parameterization.h"
#include <algorithm>
#include "Eigen/Geometry"
#include "ceres/householder_vector.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/fixed_array.h"
@@ -87,28 +89,17 @@ bool IdentityParameterization::MultiplyByJacobian(const double* x,
}
SubsetParameterization::SubsetParameterization(
int size,
const vector<int>& constant_parameters)
: local_size_(size - constant_parameters.size()),
constancy_mask_(size, 0) {
CHECK_GT(constant_parameters.size(), 0)
<< "The set of constant parameters should contain at least "
<< "one element. If you do not wish to hold any parameters "
<< "constant, then do not use a SubsetParameterization";
int size, const vector<int>& constant_parameters)
: local_size_(size - constant_parameters.size()), constancy_mask_(size, 0) {
vector<int> constant = constant_parameters;
sort(constant.begin(), constant.end());
CHECK(unique(constant.begin(), constant.end()) == constant.end())
std::sort(constant.begin(), constant.end());
CHECK_GE(constant.front(), 0)
<< "Indices indicating constant parameter must be greater than zero.";
CHECK_LT(constant.back(), size)
<< "Indices indicating constant parameter must be less than the size "
<< "of the parameter block.";
CHECK(std::adjacent_find(constant.begin(), constant.end()) == constant.end())
<< "The set of constant parameters cannot contain duplicates";
CHECK_LT(constant_parameters.size(), size)
<< "Number of parameters held constant should be less "
<< "than the size of the parameter block. If you wish "
<< "to hold the entire parameter block constant, then a "
<< "efficient way is to directly mark it as constant "
<< "instead of using a LocalParameterization to do so.";
CHECK_GE(*min_element(constant.begin(), constant.end()), 0);
CHECK_LT(*max_element(constant.begin(), constant.end()), size);
for (int i = 0; i < constant_parameters.size(); ++i) {
constancy_mask_[constant_parameters[i]] = 1;
}
@@ -129,6 +120,10 @@ bool SubsetParameterization::Plus(const double* x,
bool SubsetParameterization::ComputeJacobian(const double* x,
double* jacobian) const {
if (local_size_ == 0) {
return true;
}
MatrixRef m(jacobian, constancy_mask_.size(), local_size_);
m.setZero();
for (int i = 0, j = 0; i < constancy_mask_.size(); ++i) {
@@ -143,6 +138,10 @@ bool SubsetParameterization::MultiplyByJacobian(const double* x,
const int num_rows,
const double* global_matrix,
double* local_matrix) const {
if (local_size_ == 0) {
return true;
}
for (int row = 0; row < num_rows; ++row) {
for (int col = 0, j = 0; col < constancy_mask_.size(); ++col) {
if (!constancy_mask_[col]) {
@@ -184,6 +183,39 @@ bool QuaternionParameterization::ComputeJacobian(const double* x,
return true;
}
bool EigenQuaternionParameterization::Plus(const double* x_ptr,
const double* delta,
double* x_plus_delta_ptr) const {
Eigen::Map<Eigen::Quaterniond> x_plus_delta(x_plus_delta_ptr);
Eigen::Map<const Eigen::Quaterniond> x(x_ptr);
const double norm_delta =
sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]);
if (norm_delta > 0.0) {
const double sin_delta_by_delta = sin(norm_delta) / norm_delta;
// Note, in the constructor w is first.
Eigen::Quaterniond delta_q(cos(norm_delta),
sin_delta_by_delta * delta[0],
sin_delta_by_delta * delta[1],
sin_delta_by_delta * delta[2]);
x_plus_delta = delta_q * x;
} else {
x_plus_delta = x;
}
return true;
}
bool EigenQuaternionParameterization::ComputeJacobian(const double* x,
double* jacobian) const {
jacobian[0] = x[3]; jacobian[1] = x[2]; jacobian[2] = -x[1]; // NOLINT
jacobian[3] = -x[2]; jacobian[4] = x[3]; jacobian[5] = x[0]; // NOLINT
jacobian[6] = x[1]; jacobian[7] = -x[0]; jacobian[8] = x[3]; // NOLINT
jacobian[9] = -x[0]; jacobian[10] = -x[1]; jacobian[11] = -x[2]; // NOLINT
return true;
}
HomogeneousVectorParameterization::HomogeneousVectorParameterization(int size)
: size_(size) {
CHECK_GT(size_, 1) << "The size of the homogeneous vector needs to be "
@@ -332,9 +364,9 @@ bool ProductParameterization::ComputeJacobian(const double* x,
if (!param->ComputeJacobian(x + x_cursor, buffer.get())) {
return false;
}
jacobian.block(x_cursor, delta_cursor, global_size, local_size)
= MatrixRef(buffer.get(), global_size, local_size);
delta_cursor += local_size;
x_cursor += global_size;
}

View File

@@ -67,7 +67,7 @@ FindOrDie(const Collection& collection,
// If the key is present in the map then the value associated with that
// key is returned, otherwise the value passed as a default is returned.
template <class Collection>
const typename Collection::value_type::second_type&
const typename Collection::value_type::second_type
FindWithDefault(const Collection& collection,
const typename Collection::value_type::first_type& key,
const typename Collection::value_type::second_type& value) {

View File

@@ -161,25 +161,34 @@ class ParameterBlock {
// does not take ownership of the parameterization.
void SetParameterization(LocalParameterization* new_parameterization) {
CHECK(new_parameterization != NULL) << "NULL parameterization invalid.";
// Nothing to do if the new parameterization is the same as the
// old parameterization.
if (new_parameterization == local_parameterization_) {
return;
}
CHECK(local_parameterization_ == NULL)
<< "Can't re-set the local parameterization; it leads to "
<< "ambiguous ownership. Current local parameterization is: "
<< local_parameterization_;
CHECK(new_parameterization->GlobalSize() == size_)
<< "Invalid parameterization for parameter block. The parameter block "
<< "has size " << size_ << " while the parameterization has a global "
<< "size of " << new_parameterization->GlobalSize() << ". Did you "
<< "accidentally use the wrong parameter block or parameterization?";
if (new_parameterization != local_parameterization_) {
CHECK(local_parameterization_ == NULL)
<< "Can't re-set the local parameterization; it leads to "
<< "ambiguous ownership.";
local_parameterization_ = new_parameterization;
local_parameterization_jacobian_.reset(
new double[local_parameterization_->GlobalSize() *
local_parameterization_->LocalSize()]);
CHECK(UpdateLocalParameterizationJacobian())
<< "Local parameterization Jacobian computation failed for x: "
<< ConstVectorRef(state_, Size()).transpose();
} else {
// Ignore the case that the parameterizations match.
}
CHECK_GT(new_parameterization->LocalSize(), 0)
<< "Invalid parameterization. Parameterizations must have a positive "
<< "dimensional tangent space.";
local_parameterization_ = new_parameterization;
local_parameterization_jacobian_.reset(
new double[local_parameterization_->GlobalSize() *
local_parameterization_->LocalSize()]);
CHECK(UpdateLocalParameterizationJacobian())
<< "Local parameterization Jacobian computation failed for x: "
<< ConstVectorRef(state_, Size()).transpose();
}
void SetUpperBound(int index, double upper_bound) {

View File

@@ -174,6 +174,10 @@ void Problem::SetParameterBlockVariable(double* values) {
problem_impl_->SetParameterBlockVariable(values);
}
bool Problem::IsParameterBlockConstant(double* values) const {
return problem_impl_->IsParameterBlockConstant(values);
}
void Problem::SetParameterization(
double* values,
LocalParameterization* local_parameterization) {

View File

@@ -249,10 +249,11 @@ ResidualBlock* ProblemImpl::AddResidualBlock(
// Check for duplicate parameter blocks.
vector<double*> sorted_parameter_blocks(parameter_blocks);
sort(sorted_parameter_blocks.begin(), sorted_parameter_blocks.end());
vector<double*>::const_iterator duplicate_items =
unique(sorted_parameter_blocks.begin(),
sorted_parameter_blocks.end());
if (duplicate_items != sorted_parameter_blocks.end()) {
const bool has_duplicate_items =
(std::adjacent_find(sorted_parameter_blocks.begin(),
sorted_parameter_blocks.end())
!= sorted_parameter_blocks.end());
if (has_duplicate_items) {
string blocks;
for (int i = 0; i < parameter_blocks.size(); ++i) {
blocks += StringPrintf(" %p ", parameter_blocks[i]);
@@ -572,6 +573,16 @@ void ProblemImpl::SetParameterBlockConstant(double* values) {
parameter_block->SetConstant();
}
bool ProblemImpl::IsParameterBlockConstant(double* values) const {
const ParameterBlock* parameter_block =
FindWithDefault(parameter_block_map_, values, NULL);
CHECK(parameter_block != NULL)
<< "Parameter block not found: " << values << ". You must add the "
<< "parameter block to the problem before it can be queried.";
return parameter_block->IsConstant();
}
void ProblemImpl::SetParameterBlockVariable(double* values) {
ParameterBlock* parameter_block =
FindWithDefault(parameter_block_map_, values, NULL);

Some files were not shown because too many files have changed in this diff Show More