Commit Graph

280 Commits

Author SHA1 Message Date
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
a3b0ba2871 Always init pointcache frame step to 1.
Note it was already the case for many simulations (cloth, rigidbody, etc.), just doing this
systematically in BKE_ptcache_add() now, will avoid us some recurring bug reports.
Advanced users will know when they can/have to raise this parameter!
2014-04-25 17:55:37 +02:00
2025e4cbb9 Code cleanup: quiet warnings & style 2014-04-13 11:26:31 +10:00
93ea10d8fb Fix for rigidbody treating the quat as a v3 with pointcache 2014-04-11 18:20:30 +10:00
35747ee3d5 Rename "BLI_cpu.h" to "BLI_system.h" and add to it BLI_getpid() helper.
There is not much sense to have a whole BLI file just to check SSE2 on CPUs...
So idea is to rename it to more generic "BLI_system", and add to it more system-related
utils, like e.g. an include helper for getpid(), which allows to hide unix/windows
internals from rest of the code...

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D439
2014-04-02 11:59:43 +02:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
aa3d88d34d Fix T35328: Disk caches of multiple particle systems on a single object overwrite each other
It was intended to work actually using particle cache's stack index
but this index might have been calculated incorrect in special case:

* With default cube scene, add particle system to the cube
* Add disk cache to the particle system
* Save file and reload it
* Add another particle system and enable disk cache

This would lead to two point caches with the same stack index of zero.
This happened because point cache indices list wasn't stored in the
.blend file so once you've reload your file blender doesn't know anything
about number or point caches used.

And what was even more confusing is that point cache indices list was
trying to be load from the file, but this failed because it wasn't in the
file.

This commit solves the root of the issue which is ability of producing
.blend file with two point caches using the same disk cache. This is
done by making it sure that point cache indices list is stored in the
.blend file. And also made it so disabling disk cache will tag it to
recalculate stack index.

Old broken files wouldn't magically start working, but fixing them is
rather simple manually by toggling Disk Cache option.

Reviewers: lukastoenne, brecht

CC: sergof

Differential Revision: https://developer.blender.org/D286
2014-02-05 23:46:10 +06:00
709041ed0b Threaded object update and EvaluationContext
Summary:
Made objects update happening from multiple threads. It is a task-based
scheduling system which uses current dependency graph for spawning new
tasks. This means threading happens on object level, but the system is
flexible enough for higher granularity.

Technical details:

- Uses task scheduler which was recently committed to trunk
  (that one which Brecht ported from Cycles).

- Added two utility functions to dependency graph:
  * DAG_threaded_update_begin, which is called to  initialize threaded
    objects update. It will also schedule root DAG node to the queue,
    hence starting evaluation process.

    Initialization will calculate how much parents are to be evaluation
    before current DAG node can be scheduled. This value is used by task
    threads for faster detecting which nodes might be scheduled.

  * DAG_threaded_update_handle_node_updated which is  called from task
    thread function when node was fully handled.

	This function decreases num_pending_parents of node children and
	schedules children with zero valency.

    As it might have become clear, task thread receives DAG nodes and
    decides which callback to call for it.

    Currently only BKE_object_handle_update is called for object nodes.

    In the future it'll call node->callback() from Ali's new DAG.

- This required adding some workarounds to the render pipeline.
  Mainly to stop using get_object_dm() from modifiers' apply callback.
  Such a call was only a workaround for dependency graph glitch when
  rendering scene with, say, boolean modifiers before displaying
  this scene.

  Such change moves workaround from one place to another, so overall
  hackentropy remains the same.

- Added paradigm of EvaluaitonContext. Currently it's more like just a
  more reliable replacement for G.is_rendering which fails in some
  circumstances.

  Future idea of this context is to also store all the local data needed
  for objects evaluation such as local time, Copy-on-Write data and so.

  There're two types of EvaluationContext:

  * Context used for viewport updated and owned by Main. In the future
    this context might be easily moved to Window or Screen to allo
    per-window/per-screen local time.

  * Context used by render engines to evaluate objects for render purposes.
    Render engine is an owner of this context.

  This context is passed to all object update routines.

Reviewers: brecht, campbellbarton

Reviewed By: brecht

CC: lukastoenne

Differential Revision: https://developer.blender.org/D94
2013-12-26 17:24:42 +06:00
793b73edc2 Fix T37712: Point cache index lookup crashed with 0 points stored.
The BKE_ptcache_mem_index_find is using unsigned ints for binary search
"high" values - but this leads to integer overflow if the totpoint
number is 0 and causes invalid array access.
2013-12-09 11:06:23 +01:00
72cf50ed1e Related to #36532: show message in modifier when cloth point cache read fails,
for example due to a subsurf modifier preceding a cloth modifier.
2013-09-03 19:58:09 +00:00
8ef934c73f ghash/bli-listbase edits, rename BLI_ghash_pop -> BLI_ghash_popkey (since it takes a key as an arg and isnt popping any element from the hash as you might expect).
add BLI_pophead/tail, since getting the first element from a list and removing it is a common task.
2013-08-26 23:37:08 +00:00
9f1670cde6 Fix [#35541]: Point cache doesn't load existing frames from disk if cache file name is changed. 2013-08-02 16:39:50 +00:00
e2ece45fec fix for possible out of bounds read, printing a warning with pointcache header. 2013-07-27 09:19:03 +00:00
40d9ab1139 add missing break to space-buttons listener, also rewind own recent change (uiPopupBlockHandle.retvec size) 2013-07-25 12:46:20 +00:00
1dd7156c4c Fix #36058: Displace Modifier errors using a baked Image and displace baking inconsistency between 2.67/2.68RC and previous versions
This was in fact really nasty bug, caused by multitex_nodes
function using global variable R (which is a copy of current
renderer). this variable is not initialized to anything
meaningful for until first rendering (preview or final)
happened.

Since multitex_nodes might be used outside of render pipeline,
made it so whether CM is on or off as an argument to functions
multitex_ext_safe and multitex_ext. Now multitex_nodes() is
only shall be used for stuff happening from render pipeline!

Also needed to make some changes to other places, so all the
usages of texture sampling knows for the fact whether CM is
on or off.

And one more change is related on behavior of dispalcement,
wave, warp, weightvg modifiers and smoke. They'll be always
using CM off since texture is used for influence, not for
color.

It's rather bigger patch, but it's mostly straightforward
changes, which we really need to be done.

Reviewed by Brecht, thanks!
2013-07-15 14:47:58 +00:00
e8474d64f8 minor edit to bake printouts which could get mixed because of \r. 2013-04-12 12:03:56 +00:00
858ff6b696 Fix for [#34898] Typo in error message of mathutils.Vector
* Also fixed some more cases of "more then" -> "more than".
2013-04-07 15:09:06 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
7432924216 Smoke Bugfix /enhancement: Load pre 2.65 pointcaches.
Warning: Just make sure that you DON'T free the cache at any point. This patch can only display existing pointcaches from e.g. 2.64
2013-03-18 21:33:48 +00:00
01e9dae3dc code cleanup 2013-03-18 18:25:05 +00:00
b3ff0d6d2a Temp fix for stupid -Wformat-security issue.
Also makes more use of BLI_snprintf, and makes more consistent code acrross all "header strings" generation in transform.c.
2013-03-12 13:18:39 +00:00
eefee7a25e replace sprintf -> strcpy where its not needed. 2013-03-12 12:47:57 +00:00
c36f20a7d2 style cleanup 2013-03-08 04:00:06 +00:00
e39f05e5fa patch [#34103] fileops_1.patch
from Lawrence D'Oliveiro (ldo) 

Add comments and use of bool type in fileops.c
2013-03-05 03:53:22 +00:00
1039135965 More UI messages fixes... 2013-02-28 15:31:20 +00:00
c524b47912 Another huge bunch of UI translation fixes, mostly reported by Leon Cheung, Sv.Lockal, Gabriel Gazzán and Satoshi Yamasaki, thanks! 2013-02-17 13:56:49 +00:00
296444e1dc style cleanup: some warnigs & spelling. 2013-02-06 14:02:19 +00:00
69ddc5eb99 make bullet optional again 2013-01-23 07:26:39 +00:00
47c96081d0 rigidbody: Add rigid body constraints
Constraints connect two rigid bodies.
Depending on which constraint is used different degrees of freedom
are limited, e.g. a hinge constraint only allows the objects to rotate
around a common axis.

Constraints are implemented as individual objects and bahave similar to
rigid bodies in terms of adding/removing/validating.

The position and orientation of the constraint object is the pivot point
of the constraint.

Constraints have their own group in the rigid body world.

To make connecting rigid bodies easier, there is a "Connect" operator that
creates an empty objects with a rigid body constraint connecting the selected
objects to active.

Currently the following constraints are implemented:
* Fixed
* Point
* Hinge
* Slider
* Piston
* Generic

Note: constraint limits aren't animatable yet).
2013-01-23 05:56:56 +00:00
089cf12435 rigidbody: Add point cache support
Add read/write/interpolate functions.

In order to get rigid body point cache id from object it's now required to pass the
scene to BKE_ptcache_ids_from_object().

Rigid body cache is drawn in the orange color of the bullet logo.
2013-01-23 05:56:34 +00:00
8b8d4ba7ef sim: Remove "continue physics" code
This was left over from 2.4x days and is not used anymore.
Now simulations are always interactive.
2013-01-22 20:47:03 +00:00
f414d2980a code cleanup: remove some paranoid checks which would have crashed anyway earlier on.
Also some minor formatting.
2013-01-20 14:50:50 +00:00
e24443b79a style cleanup 2013-01-09 03:30:15 +00:00
682df047a0 style cleanup 2013-01-08 02:06:16 +00:00
857df8065f style cleanup 2012-12-28 14:19:05 +00:00
2a657345c7 Fix #33600: copying objects with point caches did not copy the external,
disk cache and lib path settings.
2012-12-18 14:05:54 +00:00
d2a741048a Fix #33353: Smoke color problems with adaptive domain
High resolution cache didn't always read all written data fields which caused colors to get messed up.
2012-11-30 11:01:14 +00:00
b867f9f17e style cleanup: comments & spelling 2012-11-18 01:22:31 +00:00
25591e958d style cleanup: tabs & whitespace 2012-11-03 15:35:03 +00:00
88a23b5327 Related to previous commit I did:
Removed checks for PTCACHE_QUICK_CACHE for exception handling. This to ensure normal
cache works as if old PTCACHE_QUICK_CACHE wasn't set.

Thanks Campbell for pointing at this!
2012-10-23 15:01:41 +00:00
d273ddfd4f Bugfix 30974
- Disabled "Quick Cache" option. It was causing ridiculous updates
  on the entire animation system for start-end frame on every user
  event causing changes here (like during transform). Worst was that you
  couldn't transform animated objects for that reason either.

  Most of the code is still there, waiting for a moment to revise it...

- Constraint "Follow Track" (marker) wasn't using inverse matrix code
  in transform, making it wacko to use (wrong pivot, crazyspace)
2012-10-23 14:07:32 +00:00
1767b65846 style cleanup: also rename bmesh_decimate.c --> bmesh_decimate_collapse.c 2012-10-23 03:38:26 +00:00
ddc2dbc2a4 style cleanup 2012-10-22 08:15:51 +00:00
d599b643b7 style cleanup: bge, switch statements mostly.
also left bmesh decimator on in previous commit.
2012-10-21 07:58:38 +00:00
f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
7deb8d8a26 code cleanup: spelling 2012-10-20 20:36:51 +00:00
bc8f602601 style cleanup 2012-10-20 18:46:57 +00:00
8e01b8959e style cleanup 2012-10-14 13:08:19 +00:00
cb634b9100 Google Summer of Code project: "Smoke Simulator Improvements & Fire".
Documentation & Test blend files:
------------------
http://wiki.blender.org/index.php/User:MiikaH/GSoC-2012-Smoke-Simulator-Improvements

Credits:
------------------
Miika Hamalainen (MiikaH): Student / Main programmer

Daniel Genrich (Genscher): Mentor / Programmer of merged patches from Smoke2 branch
Google: For Google Summer of Code 2012
2012-10-10 13:18:07 +00:00