Commit Graph

10283 Commits

Author SHA1 Message Date
ca2a14491e Fix T38196: Crash with smoke simulation
Issue was caused by KD tree being allocated with the wrong size.
2014-01-14 17:17:24 +06:00
ff98be83a9 Empties with Images draw type: add support for movies and image sequences
This adds an ImageUser to such empties with all the typical settings.

Reviewed By: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D108
2014-01-13 22:18:31 +01:00
c48c62a831 Code Cleanup: replace checks for ima->source with BKE_image_is_animated 2014-01-14 04:59:58 +11:00
5ad5883ce3 Fix crash happening on render after recent imbuf PERSISTENT flag 2014-01-13 20:25:42 +06:00
08981f3a91 Fix T37886: Material does no update when changing keyframes in dopesheet
It was a missing fcurve evaluation in scene update function which lead to
materials only being updated on frame change.

Added the same exception as we've got for the scene animation. It only
runs when there're materials tagged for the update, so wouldn't expect
speed regressions or so.
2014-01-13 19:02:23 +06:00
b1bb7d2ee0 Fix T38040: Crash after loading big image file in compositor
Issue was caused by cache limitor removing viewer image buffer
from the memory during compositing. Now made it so all viewer
images are persistent in the memory.

This solves the crash mentioned above and also makes it so
render/compo results are never lost.

Further tweaks are possible, but pretty much happy now, at
least no stoppers for work are there.
2014-01-13 18:47:15 +06:00
2ebe4f69a9 Compilation error fix and strict warning silence for previous commits 2014-01-13 16:33:18 +06:00
d01bb0b8b6 Avoid memcpy to self when validating UV layer name 2014-01-13 16:27:05 +06:00
881fb43878 Make bvhutil safe for multi-threaded usage
There were couple of reasons why it wasn't safe for usage from
multiple threads.

First of all, it was trying to cache BVH in derived mesh, which
wasn't safe because multiple threads might have requested BVH
tree and simultaneous reading and writing to the cache became a
big headache.

Solved this with RW lock so now access to BVH cache is safe.

Another issue is causes by the fact that it's not guaranteed
DM to have vert/edge/face arrays pre-allocated and when one
was calling functions like getVertDataArray() array could
have been allocated and marked as temporary. This is REALLY
bad, because NO ONE is ever allowed to modify data which
doesn't belong to him. This lead to situations when multiple
threads were using BVH tree and they run into race condition
with this temporary allocated arrays.

Now bvhtree owns allocated arrays and keeps track of them, so
no race condition happens with temporary data stored in the
derived mesh. This solved threading issues and likely wouldn't
introduce noticeable slowdown. Even when DM was keeping track
of this arrays, they were re-allocated on every BVH creation
anyway, because those arrays were temporary and were freed
with dm->release() call.

We might re-consider this a bit and make it so BVH trees are
allocated when DM itself is being allocated based on the DAG
layout, but that i'd consider an optimization and not something
we need to do 1st priority.

Fixes crash happening with 05_4g_track.blend from Mango after
the threaded object update landed to master.
2014-01-13 15:57:52 +06:00
bc989497de Fix T38139: Objects which are in cyclic dependency are not updated
Graph traversal which is based on counting parents which are still
to be updated fails in cases there are cycles in the graph.

If there are cyclic dependencies in the scene all the objects from
the cycles will be updated in a single thread now one by one. This
makes blender behave the same way as it was before multi-threaded
DAG landed to master.

This needed to tweak depsgraph a bit so now dag_check_cycle() sets
is_acyclic field of DAG forest if there are cycles in the graph.

TODO: It might be possible to save some time on evaluation when
      all the tagged objects were updated in multi-threaded DAG
      traversal.
2014-01-13 15:57:51 +06:00
e618d8238e Fix T38054: High CPU usage with many objects
This is a regression since threaded dependency graph landed to master.
Root of the issue goes to the loads of graph preparation being done
even if there's nothing to be updated.

The idea of this change is to use ID type recalc bits to determine
whether there're objects to be updated. Generally speaking, we now
check object and object data datablocks with DAG_id_type_tagged()
and if there's no such IDs tagged we skip the whole task pool creation
and so,

The only difficult aspect was that in some circumstances it was possible
that there are tagged objects but nothing in ID recalc bit fields.

There were several different circumstances when it was possible:

* When one assigns object->recalc flag directly DAG flush didn't
  set corresponding bits to ID recalc bits. Partially it is fixed
  by making it so flush will set bitfield, but also for object
  types there's no reason to assign recalc flag directly. Using
  generic DAG_id_type_tag works almost the same fast as direct
  assignment, ensures all the bitflags are set properly and for the
  long run it seems it's what we would actually want to.

* DAG_on_visible_update() didn't set recalc bits at all.

* Some areas were checking for object->recalc != 0, however it is was
  possible that object recalc flag contains PSYS_RECALC_CHILD which
  was never cleaned from there.

  No idea why would we need to assign such a flag when enabling
  scene simplification, this is to be investigated separately.

* It is possible that scene_update_post and frame_update_post handlers
  will modify objects. The issue is that DAG_ids_clear_recalc is called
  just after callbacks, which leaves objects with recalc flags but no
  corresponding bit in ID recalc bitfield. This leads to some kind of
  regression when using ID type tag fields to check whether there objects
  to be updated internally comparing threaded DAG with legacy one.

  For now let's have a workaround which will preserve tag for ID_OB
  if there're objects with OB_RECALC_ALL bits. This keeps behavior
  unchanged comparing with 2.69 release.
2014-01-13 15:57:51 +06:00
ce7e6cebf2 Remove direct displist creation from constraints
Since recent DAG commit for set scenes in DAG_on_visible_update()
it seems there're no longer issues with missing curve_cache after
file load.
2014-01-13 15:57:51 +06:00
f00f959d52 Remove direct displist creation from curve deform
This solves threading conflict which happens when having
multiple objects using Curve Deform modifier with the same
curve datablock. This conflict was caused by the fact that
curve_deform_verts() used to temporary override curve's
flags to make it path is there.

Actually, it was setting CU_FOLLOW flag temporary which
was only used where_on_path() (only in terms that this
temporary assignment only affected this function) but it
is now commented out for a while, so no reason to set
this flag temporary, If it's ever to be done, we'll need
to pass flags as an additional function argument.

For the path creation i've extended DegNode structure
which now holds extra bits which indicates what additional
data depending on the graph topology is to be evaluated.

Currently this is only used to indicate that curve needs
path to be evaluated regardless to cu->flag state. This
is so Curve Deform modifier is always happy.

In the future this flag might also be used to indicate
whether bmesh verts are to update (see recent commit to
3-vertex parent crash fix) or to indicate that the object
is the motherball etc.
2014-01-13 15:57:51 +06:00
f86fbc4ea3 Remove direct displist creation from BKE_vfont_to_curve_ex()
This goes back to ancient era again and such a call isn't
safe for threading and really DAG is to make it sure display
list for dependencies is always there.
2014-01-13 15:57:51 +06:00
b5592d86d6 Remove direct displist creation from bevel code
BKE_curve_bevel_make() is only used from object_handle_update()
friends and never called directly. This means if there's no
display list ready for the bevel object it's something wrong
happened with DAG.

In fact, this check goes back to ancient era and from tests
it appears this check is no longer needed.
2014-01-13 15:57:50 +06:00
ba15dd595f Remove direct displist creation from drawing code
It was some kind of workaround for DAG glitch in 2009
(commit hash 8c5c7ebb0) and according to the comment
was needed to make select outline show immediately.

After some tests it appears DAG behaves almost fine now
(just needed to make it so layer is flushed properly to
the set scene) and no reason to have rather confusing
call in the code.
2014-01-13 15:57:50 +06:00
717bf85545 Fix some harmless warnings that mostly appeared on MinGW64 2014-01-13 04:28:51 +02:00
fc39e895e9 Style Cleanup: whitespace 2014-01-12 22:27:55 +11:00
62aa004c25 Style Cleanup: whitespace 2014-01-12 22:05:24 +11:00
8952f58375 Add tangent space computation/access from RNA (i.e. python).
This simply mimics code used for loopnormals, to enable py scripts to generate and access (temporary)
a tangent 3D vector and bitangent sign for each loop. Together with the split normals, this allow
to recreate a complete tangent space for normal mapping (bitangent = bitangent_sign * cross(normal, tangent)).

Expects all faces to be tri or quads.

Reviewed By: Brecht, campbellbarton

Differential Revision: https://developer.blender.org/D185
2014-01-11 11:51:19 +01:00
9e1ca28589 Fix T38149: crash adding metaball with zero radius.
This incorrectly use abs(), that's for integers, not floats.
2014-01-10 20:53:39 +01:00
cc35ad2b3d Fix for random crash in localized node group freeing while tweaking
group default values.

This can happen when using value sliders for node group input values.
The localized copies were setting the "interface_type" runtime pointer
of the original tree to NULL instead of the new tree (which is created
on-the-fly in general). This type is used in RNA update functions
however, the original tree DNA should not be modified there.
2014-01-10 09:37:42 +01:00
3d10343888 Code cleanup: remove WIP code came from the GSoC branch
DAG node tagging was rather an experiment to make derived render working.
However, it ended up in a whole can of worms and need to be re-considered.
It is likely that regular object update tagging and scene update routines
are to be used for this.

Meanwhile no need to keep extra field in dag node. Would save us the whole
byte of the struct which we can use for other purposes meanwhile.
2014-01-10 01:23:49 +06:00
cc31722a41 Fix T38000: vertex parent crash due to threading issues
Issue is causes by vertex parent modifies original BMesh from
a multiple threads. Ideally this is to be done as a separate
update callback for mesh datablock, but it's not so much simple
now (would need to do some re-arranges to DAG which might conflict
with the work from Ali or will double amount of work we did).

So for now use simple solution with mutex lock.

Based on the patch from Campbell Barton with some fixes to make
changes really thread-safe.

Differential Revision: https://developer.blender.org/D168
2014-01-09 16:33:53 +06:00
1ea5c2a8e3 Fix remaining sculpt mode crash using multires modifier, similar cause
to previous sculpt fix (OpenGL access from thread with no context
bound). The fact that this has gone unnoticed so far means that people
are dyntopoing like crazy these days.
2014-01-09 04:28:17 +02:00
e47a41e3fc Code Cleanup: style 2014-01-09 11:44:59 +11:00
a0dbee6e93 Fix T38016: setting Object.matrix_world does not take bone parents into account. 2014-01-09 00:38:56 +01:00
aad731d51c Code cleanup: remove BKE_object_where_is_calc_simul function.
It doesn't make any sense anymore with the current depsgraph and probably was
not useful for a long time, just a leftover from the pre 2.04 game engine.
2014-01-09 00:17:18 +01:00
b243b4fe40 Fix for inorrect use of BLI_utf8_invalid_strip, add assert to prevent it happening again. 2014-01-08 14:46:06 +11:00
e23bcbbb6d Fix for crash in anim render: The callbacks in bMovieHandle are expected
to exist and accessed without prior NULL checks (with exception of
get_next_frame and get_movie_path). The callbacks are not reliably
initialized however if none of the video formats is enabled (AVI being
the default). Added stub functions now that ensure access to
bMovieHandle callbacks is safe and doesn't crash.
2014-01-07 15:18:37 +01:00
01df756bd1 Cycles Volume Render: scattering support.
This is done by adding a Volume Scatter node. In many cases you will want to
add together a Volume Absorption and Volume Scatter node with the same color
and density to get the expected results.

This should work with branched path tracing, mixing closures, overlapping
volumes, etc. However there's still various optimizations needed for sampling.
The main missing thing from the volume branch is the equiangular sampling for
homogeneous volumes.

The heterogeneous scattering code was arranged such that we can use a single
stratified random number for distance sampling, which gives less noise than
pseudo random numbers for each step. For volumes where the color is textured
there still seems to be something off, needs to be investigated.
2014-01-07 15:03:41 +01:00
b174e7b0b8 Fix for error in own recent commit 2014-01-08 00:57:58 +11:00
2328f94e1d Text3d: underline offset on curved path wasnt working right 2014-01-07 23:04:47 +11:00
54ebaad377 Text3d: Add support for underline characters with text-on-path 2014-01-07 20:19:20 +11:00
4a372102c7 Text3d: move text selection boxes from Curve to EditFont struct
resolves T38079
2014-01-07 17:12:24 +11:00
7f0239033b Text3d: font family dupli-objects now follow rotation of the curve path 2014-01-06 02:05:14 +11:00
5ff0d465ee Text3d: minor edits to the API, remove BKE_vfont_to_curve_nubase_ex 2014-01-06 01:49:21 +11:00
3b024d63fe Text3d: fix font family feature for unicode and correct tooltip 2014-01-06 01:37:19 +11:00
38bbd9c778 Text3d: paste additions
- Add paste from system clipboard which behaves like paste from file.
- Paste from file now replaces the selection rather then just adding to the end.
- Move paste operations into the 'Edit' menu.
- Added generic paste functions: font_paste_wchar, font_paste_utf8.
- Fix paste max length check not taking the selection length into account.
2014-01-06 00:39:13 +11:00
b0ab91c0a4 Code cleanup: fix type in malloc id string 2014-01-05 17:26:32 +06:00
a2bf25e8ff Fix crash when having multiple text objects sharing the same curve datablock
Issue was caused by BKE_vfont_to_curve() modifying curve->nurbs list which
gave threading issues.

Now added BKE_vfont_to_curve_nubase() which operates on a given nurbs list
base which is local in do_makeDispListCurveTypes().

By the looks of it it wouldn't give speed regression because previously it
also was creating nurbs for every font object sharing the same curve data.
2014-01-05 17:26:13 +06:00
ac3d33af73 Code cleanup: preprocessor indentation inside #ifdef block 2014-01-05 17:23:29 +06:00
99d050f88b Text3d: selection in editmode now follows rotated text along path 2014-01-05 22:20:33 +11:00
42bd5d7c80 Text3d: fix for smallcaps modifying the original text input in editmode.
Oversight in own recent commit to avoid allocating a new wchar_t array.
2014-01-05 21:15:25 +11:00
3eb818e53a Text3d: smallcaps wasnt working properly for text-on-path 2014-01-05 21:15:25 +11:00
4eed4b3bcd Text3d: remove sepchar, old feature which no longer has any UI access. 2014-01-05 21:15:24 +11:00
e20f357cc2 Text3d: error in own recent fix for thread safety 2014-01-05 21:15:24 +11:00
d9697bc145 Fix T38024 crash when rebuilding sculpt mode buffers.
Main issue here is that glBuf* calls were invoked from threads different than
main thread. This caused a crash (since those do not have a GL context active).

Fix here is twofold:
* add an ID buffer in buffer pool that handles pbvh buffers and is freed
from main thread when gpu_buffer_pool_free_unused is called.

* do not create glbuffers in derivedmesh creation routine, rather tag nodes
for update and create those in the draw function
(guaranteed to be called from main thread)

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D169
2014-01-05 04:58:27 +02:00
b9114cb609 UI: Use bool rather then int/short's where possible 2014-01-04 18:10:01 +11:00
e505203e8d Units: Add milligrams for mass
Avoids having small values displayed as "0kg".
2014-01-04 04:22:20 +01:00