Commit Graph

39997 Commits

Author SHA1 Message Date
Sergey Sharybin
4e9d469dfd Merging r57934 through r57953 from trunk into soc-2013-depsgraph_mt 2013-07-03 08:31:46 +00:00
Campbell Barton
905cb1639a update doxygen congfig and tweaks to warnings when running doxygen. 2013-07-03 04:47:50 +00:00
Campbell Barton
e60a33ba07 fix for own error in 57226, broke subsurf-uv 2013-07-02 21:47:42 +00:00
Campbell Barton
4848ca09c0 style cleanup 2013-07-02 20:36:52 +00:00
Sergey Sharybin
7c7a3f7879 Fix for dupli-groups update going wrong
Dupli-groups used to have special case for updating
which is BKE_group_handle_recalc_and_update. This
function calls BKE_object_handle_update for every
object in the group.

This isn't thread-safe, because object could be
updating in separate thread already. And what's
worse dependencies are not known for objects inside
the group, which makes it impossible to schedule
objects from the group in a safe way.

It's even impossible to schedule groups as different
tasks, because groups could share the same objects.

For now used simple but robust solution which is
updating dupli-groups in main thread, handling
groups one-by-one and updating objects from the
group one-by-one as well.

Will work on a proper solution for this later.
2013-07-02 19:23:23 +00:00
Sergey Sharybin
e4f7260bac Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now dtaa which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.
2013-07-02 19:23:19 +00:00
Sergey Sharybin
79c678be89 Fix issue when the same task gets added twice to the queue
Issue was caused by worker threads updating nodes valency
at the same time while we're filling the queue with "root"
nodes (leaf nodes which don't depend on others).
2013-07-02 19:23:12 +00:00
Sergey Sharybin
bae2a2c3b2 Added missing mutex lock around do_exit assignment in task scheduler
Without this lock it's possible that thread_wait_pop will stuck
at the point where it await for new task in the queue but in
fact exit was requested already.

This ended up in deadlock in some circumstances. Really random
because it totally depends on timings.
2013-07-02 19:23:09 +00:00
Sergey Sharybin
a03437cb1a Initial idea of running post-modifiers out of lock wasn't correct
The tihng here is: curve is getting modified by modifier stack
and then it's coordinates are restored. To be really safe we
need to do all this locked.
2013-07-02 19:23:06 +00:00
Sergey Sharybin
d50ff36d3d Add workaroud to make threaded object update stable
Added threading lock around unsafe part of do_makeDispListCurveTypes
(parts which touches Curve->bev and Curve->path). Namely it means
pre-tesselation modifiers, bevel, path and non-modified display
list will be calculated inside a locked thread.

Post-tessellation modifiers will eb calculated outside of locked
thread, which means heavy constructive or deformation modifiers
applying on tesselated spline will be nicely threaded.

This makes it possible to use threaded object update by default
in the branch, so everyone could start testing it.
2013-07-02 19:23:03 +00:00
Sergey Sharybin
41f0c137ba Get rid of a display list stored in Curve datablock
This display list was only used for texture space calculation,
and even there this display list was only used for bounding
box calulation.

Since we alreayd do have boundgind box in a curve datablock
there's no reason to duplicate non-modified display list
just to calculate bounding box later, let's just calculate
boundding box at the first point.

This makes code a little be more thread-safe but curves are
still not safe for threads at all because of bevel list and
path. That would be solved later.
2013-07-02 19:22:59 +00:00
Sergey Sharybin
6d9366b0a7 Always use ob->bb when drawing the curve types
It used to be a check for ob->bb ? ob->bb : cu->bb but
in fact it doesn't make sense and only makes code more
crappy.

Making displist for mballs and curves/surfaces/fonts
already ensures object has walid bounding box.
2013-07-02 19:22:55 +00:00
Sergey Sharybin
e607825f6b Replace mutex lock with spinlock in threaded object update
It's not so much happening inside the lock and using spin
lock instead of mutex lock will give some speedup due to
smaller latency of resuming the thread when mutex was locked.
2013-07-02 19:22:52 +00:00
Sergey Sharybin
06e2d967ae Simplify debug print macro in WM even system 2013-07-02 19:22:49 +00:00
Sergey Sharybin
f129393408 Put debug prints in threaded debug into G.debug & G_DEBUG check. 2013-07-02 19:22:46 +00:00
Sergey Sharybin
8c67e9d799 Merging r57925 through r57933 from trunk into soc-2013-depsgraph_mt 2013-07-02 19:18:10 +00:00
Brecht Van Lommel
a30dc7c74e Fix #35966: remesh modifier + particle use modifier stack option did not work
well together.
2013-07-02 19:17:34 +00:00
Brecht Van Lommel
d6c14ed855 Fix #35964: viewport render not updating with linking materials with ctrl+L. 2013-07-02 17:21:40 +00:00
Brecht Van Lommel
6449af5d38 Fix #35958: texture timeout with value 0 not preserved when saving user preferences. 2013-07-02 16:02:56 +00:00
Brecht Van Lommel
1a493533c3 Fix #35944: adding keyframes or drivers on image sequences offset did not work
for cycles image texture node.
2013-07-02 15:56:32 +00:00
Howard Trickey
994a937a97 Fix Bevel bug #34321, making bevel keep UVs contiguous when possible. 2013-07-02 13:18:56 +00:00
Brecht Van Lommel
08225cf670 Fix #35954: missing cycles viewport render update when changing the object
or material pass index.
2013-07-02 12:52:37 +00:00
Campbell Barton
418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
Campbell Barton
1f091fd234 add missing gpl headers 2013-07-02 09:47:22 +00:00
Campbell Barton
7e73b6b701 fix for error reading defaults from custom properties, would read out of bounds memory.
recent change to animsys r57904 exposed this error in some sintel files.
2013-07-02 08:06:45 +00:00
Sergey Sharybin
311d4e15ec Merging r57897 through r57924 from trunk into soc-2013-depsgraph_mt 2013-07-02 06:40:05 +00:00
Campbell Barton
83411dab07 fix for crash in demo-mode, caused by r51702 2013-07-02 05:54:28 +00:00
Campbell Barton
4c779f72f3 remove unused defines 2013-07-02 05:14:18 +00:00
Campbell Barton
b96aa8800e bump up openmp limit for release,
also remove 'Vertex ' prefix for items in the vertex menu.
2013-07-02 04:34:39 +00:00
Campbell Barton
d0ce73c548 fix [#35939] [Edit - Vertex mode] [Select]-[Mirror] did not returns right result. 2013-07-01 21:56:59 +00:00
Sergey Sharybin
ded22d7060 Replace stupid static balancing with task-based one
Initially i wanted to have some really simple and basic
threading scheduler and wrote one based on traversing
depsgraph in advance. But it ended up in some issues with
the single-pass traverse i did which didn't gather all
the dependencies actually.

That was for sure solvable, but it ended up in a bit of
time consuming thing and with huge help of Brecht's
patch it was faster just to write proper balancing.

But it's again really basic thing, which could be
easily changed depending on feedback and design decisions
from Joshua,

So for now it works in the following way:

- Currently DagNode is used for threaded evaluaiton,
  meaning traversing actually happens for DagNodes.

  This is easier than converting DAG to a graph where
  only objects are stored, but required adding one int
  field to DagNode for faster runtime checks.

  We could change this later when it'll be clear how
  and where we'll store evaluation data, but for now
  it work pretty ok.

- The new field is called "valency" and it's basically
  number of node parents which needs to be evaluated
  before the node itself could be evaluated.

- Nodes' valency is getting initialized before threading,
  and when node finished to update valency of it's childs
  is getting decreased by one. And if it happens so
  child's valency became zero, it's adding to task pool.

- There's thread lock around valency update, it'll be
  replaced with spinlock in nearest future.

- Another update runtime data is node color. White nodes
  represents objects, gray one non-objects.

  Currently it's needed to distinguish whether we need to
  call object_handle_update on node->ob or not. In the
  future it could be replaced with node->type to support
  granularity, meaning we then could update object data
  separately from object itself.

- Needed to add some public depsgraph functions to make
  it possible to traverse depsgraph without including
  depsgraph private header to other files.

This change doesn't make code anyhow more stable, but
solves update order issues noticed while working on
fixing underlying bugs.

Threaded update is still ifdef-ed for until curves and
armatures are considered thread-safe, which is next
step to be done.
2013-07-01 21:23:25 +00:00
Sergey Sharybin
e00f5d1c0a Task scheduler ported to C
Patch by Brecht, which in original version also
gets rid of ThreadedWorker in favor of new task
scheduler and ports some areas to it.

Kudos to Brecht for this work!
2013-07-01 21:23:20 +00:00
Campbell Barton
3d845b4a17 move api functions from r57909 into BKE. 2013-07-01 20:27:03 +00:00
Gaia Clary
11145c7c22 Restrict Weight Edit Panel to mesh/lattice Edit and Weight Paint vertex selection mode 2013-07-01 19:30:41 +00:00
Joshua Leung
472f746485 NLA Bugfix: When clicking on a channel name in the channel list while still in
tweakmode, this will now result in tweakmode being exited instead of going into
a weird limbo-land where channel selection has changed (but tweakmode is still
active but not drawn)
2013-07-01 14:58:59 +00:00
Brecht Van Lommel
e6830300b7 Fix incorrect GLSL bump mapping in editmode when the UV coordinates are
flipped, was not passing sign on to GLSL shader.
2013-07-01 14:49:08 +00:00
Joshua Leung
7a304c2d11 Bugfix [#35744] FCurve select changes on Graph Editor Resize
Selection state of F-Curves is lost when resizing the Graph Editor.

The problem was that SIPO_TEMP_NEEDCHANSYNC was getting set in the graph_init()
callback, which gets called everytime the view resizes, and not just the very
first time this happens. However, setting this flag forces the selection state
to the updated/pulled from the scene data.

In the past, it was necessary to set this flag so that we could force F-Curve
colors to get initialised correctly. However, things probably changed at some
point, so this behaviour is no longer needed. At worst now, opening a new graph
editor may not show F-Curve selection correctly synced with the viewport, though
that's easily worked around by reselecting whatever it is in the 3d view.
2013-07-01 14:14:21 +00:00
Joshua Leung
64bc3ce89a Bugfix [#35856] Bones gets scaled chaotically when during NLA Strip Blend In/Out
This was one of the consequences of r.57333 (i.e. influence shouldn't be ignored
on the first strip that animates a channel), as scale should really default to a
base value of 1 (instead of things being blended against 0 as per all other
properties). The end result was that bones were getting scaled to zero here when
the influence of their strip fell to zero.

Now, we use the RNA default values of properties to initialise their initial
values. This may/may not work well in all cases:
1) For properties which don't have the appropriate RNA defaults set, this will
be problematic. But, most properties people are likely to animate here I think
are already set up correctly.
2) It may not always be nice to have values "snapping back" to default values.
In this case, you should still be defining a strip at the bottom of your NLA
stack which defines what the appropriate rest poses *should* be for your shot.
2013-07-01 13:57:00 +00:00
Joshua Leung
72a5c1f007 Bugfix [#35887] Keyframes inserted at wrong time on offsetted NLA Strips when
using "Auto Keying" + "Insert Available Only"

Patch from Campbell.

The problem was that NLA offset/mapping correction was only done when no
destination action was supplied to insert_keyframe(). In most cases, this is not
a problem, since all normal keyframing goes through keyingset or the insert-
button operators, and these just pass action=NULL (since they're too lazy to
look it up). However, there is one situation where this bug gets triggered (the
specific combination of autokeyframing and "insert available only"), where the
caller of insert_keyframe() actually passed in an action (to prevent it from
creating one itself!).
2013-07-01 13:19:38 +00:00
Joshua Leung
4f3f95751a Bugfix [#35936] Can't create new vertex group when using Ctrl G menu
This was caused by r.57812

There were two problems here:
  1) vertex_group_vert_select_unlocked_poll()  had faulty logic which meant that
it always failed when there were no vgroups present yet - the final return
always just fell through
  2) Since the "Assign to New Groups" option was actually implemented using the
same operator as "Assign to Active Group" (just with an extra parameter set), if
the active group was locked, it was not possible to "Assign to New Group" (even
though a new group would not be locked).
2013-07-01 13:02:53 +00:00
Sergey Sharybin
b763876cae Made modifiers_getVirtualModifierList safe for threading
Move static variables to context filling in by this fcuntion
and owned by a callee function. This ensures no conflicts
between threads happens because of static variables used in
this function.

Also moved modifier types and virtual modifiers data to a
function called from creator. This is needed to be sure all
the information is properly initialied to the time when
threads starts to use this data.
2013-07-01 11:00:22 +00:00
Sergey Sharybin
16efede680 Merging r57816 through r57896 from trunk into soc-2013-depsgraph_mt 2013-07-01 09:07:21 +00:00
Sergey Sharybin
61d37cd47c Fix for Make Local -> All not working correct with multy-user datablocks
Make Local operator uses BKE_library_make_local function if all the
datablocks needs to be made local. And this function was calling
id_clear_lib_data for every datablock, which only clears library
data. But this function doesn't work correct for datablocks which
areshared by multiple users (this is also mentioned in comment
for this function).

This lead to situations when two datablocks shares the same runtime
data leading to crashes later. For example making everythig local in
scales cycles scene from durian ends up in a crash when toggling
rig edit mode.

Solved by using id_make_local instead of id_clear_lib_data, which
will ensure all the data are nicely expanded and made local.

Checked by Brecht, thanks fr the review!
2013-07-01 08:53:45 +00:00
Campbell Barton
0baec4cf2d fix [#35858] there were two bugs here, hidden faces were occluding in vertex selection mode. 2013-07-01 08:25:27 +00:00
Campbell Barton
e9208e99b7 bridge tool: calculate face normals before triangulating, own error when removing normal recalc from the bmesh operator.
also rename `Fill Grid` -> `Grid Fill` to match `Beauty Fill`
2013-07-01 07:15:12 +00:00
Campbell Barton
73d32fdcc2 add type checking assert in bmesh operator iterator. 2013-07-01 07:12:05 +00:00
Campbell Barton
6321f11f03 tweak to commit r57891, dont draw hidden faces/edges in editmode. 2013-07-01 01:25:21 +00:00
Campbell Barton
c729c5ab4b fix [#35911] Show weights not working with a weight edit modifier in edit mode 2013-07-01 00:42:44 +00:00
Campbell Barton
b3ceab896a add some missing members to opengl debug print, also use a macro to avoid passing each arg twice. 2013-06-30 23:50:17 +00:00
Campbell Barton
c9add22b5e opengl debug info, make GPU_state_print() only show values in arrays that are set. (was print 32 values every time) 2013-06-30 23:30:21 +00:00