Commit Graph

9884 Commits

Author SHA1 Message Date
6b51c27414 uiLists enhacements: dragresize and better GRID layout.
Many thanks to Brecht for the review!

* You can now drag-resize uiLists (in default or grid layouts).
** Note about "default" size: when you drag below minimal size of the uiList, it will automatically reset to automatic sizing (i.e. size between rows and maxrows, depending on the number of items to show). This often means (e.g. in Materials list with many mat slots) that the list will grow again to maxrows!

* Grid uiLists now have a customizable number of columns (previously it was a fixed value of 9), and they will respect the rows/maxrows settings as well (i.e. show a scrollbar when needed), instead of growing indefinitly!
2013-08-27 15:27:41 +00:00
defb8812a7 fix [#36301] Mirror modifier does not mirror vertex normals when there are no faces. 2013-08-27 02:25:15 +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
d11e419792 another header edit needed 2013-08-25 21:29:33 +00:00
bbce51d116 replace hashes with sets where possible. 2013-08-25 20:03:45 +00:00
1d5eff36f5 BKI_gset and EdgeSet api, use when hash values aren't used (reuses ghash internally without allocating space for the value). 2013-08-25 20:00:19 +00:00
e2bd3a4644 clearing the mempool can now keep more then a single element reserved. 2013-08-25 16:16:38 +00:00
09a52f18b6 ghash: reserve size when its known or can be guessed close enough.
also avoid allocs per node in pbvh_bmesh_node_limit_ensure()
2013-08-24 17:33:47 +00:00
585272fbcf cloth was using edgehash not quite correctly:
- was ordering vertex args unnecessarily.
- was adding the same edges multiple times into the edgehash.
2013-08-24 16:06:18 +00:00
1ba29c3a4a cloth spring building: replace MIN2/MAX2 in assignments with a function which orders on assignment. 2013-08-24 15:55:56 +00:00
2c556c2ef7 avoid double ghash lookup in sculpt map_insert_vert 2013-08-24 15:31:47 +00:00
25ffb79a0b use reserve argument for more edgehashs 2013-08-24 14:40:15 +00:00
8811e521c0 fix for leak in cloth modifier
- any error in cloth_build_springs wasn't freeing the edge-hash.
- was checking BLI_edgehash_haskey on matching vertices.
- was looping over setting NULL for all elements of a calloc'd array.
2013-08-24 14:32:43 +00:00
0b88b4fad7 when the size of an edgehash is known or can be guessed,
pass in the argument to reserve the size.
2013-08-24 13:47:57 +00:00
f320c5ae9e fix for leak in make_edges_mdata() if there were no edges to create,
also reserve the total number of edges in the hash when its created.
2013-08-24 13:13:29 +00:00
f2acb10b6b edge hash: take an arg for the guarded-malloc string (as ghash does) 2013-08-24 13:08:55 +00:00
b97334f992 add GPL header to treehash.c and add missing includes to cmake. 2013-08-24 03:17:28 +00:00
52eb61f84b Fix state losses for recursive outliner trees (e.g. datablocks editor)
In previous optimization in outliner I assumed that order in treehash was not important.
But testing outliner in datablocks mode revealed a problem: when user expands multiple recursive levels and then closes any element, it always closed the top level of recursion.
Now it should work fine with recursive trees.
Now treehash contains groups of elements indexed by (id,nr,type). Adding an element with the same (id,nr,type) results in appending it to existing group. No duplicates are possible in treehash.
This commit should also make lookups a little bit faster, because searching in small arrays by "used" is faster than searching in hashtable with duplicates by "id,nr,type,used".
2013-08-23 20:35:00 +00:00
6f26acb009 simplify dist_to_plane_v3 and add dist_squared_to_plane_v3 2013-08-23 15:19:20 +00:00
09ff49755f math api edits - replace point-normal form for a plane with dist_to_plane_v3()
also correct python mathutils api, was missing vector checks.
2013-08-23 14:37:22 +00:00
a31db0c7e9 rename recently added BLI_ghash_assign() -> BLI_ghash_reinsert() 2013-08-21 16:06:03 +00:00
dcddd32c45 Scultping: Growing the pbvh node container should use malloc instead of
calloc. Since we copy the first 1/1.3 part of the new array from the
existing nodes, only the rest 0.3/1.3 should be initialized to zero.
This should in theory cut down the times of occasional hangs with
dyntopo, since my guess is that it is caused by dynamic reallocations.
Maybe a linked list structure would help here? This is a bigger change
though, leaving as is for now.

Also, minor cleanup, delete duplicate ghash deletion and remove unneeded
commented code.
2013-08-21 15:21:56 +00:00
fca659252f code cleanup: bmesh duplicate functions
- avoid using an iterator when stepping around an edges radial loop.
- use naming constant with the rest of the bmesh operators.
2013-08-21 14:35:51 +00:00
d4b90378a7 Copying of nurbs shall happen after converting font to curves
Otherwise changing font settings wouldn't apply instantly.
2013-08-21 13:13:48 +00:00
ec902a44fd Need to set new curve's disp to NULL when duplicating. 2013-08-21 09:43:22 +00:00
9470754fd3 bmesh api cleanup, face creation args now accept an example face (as with vertex and edge),
also replace BM_face_create_quad_tri_v with BM_face_create_verts
2013-08-21 07:51:47 +00:00
785a67f396 Partial revert of recenr cu->disp merge commit
That ended up in tricky code trying to mimic depsgraph
branch behavior API-wise preserving texspace and bound
box calculation compatible with previous releases.

So for now bring cu->disp back to the trunk but keep
texpsace and boundbox APIs the same as in the branch.

This keeps texpsapce and boundbox behavior fully compatible
with previous releases and still makes API the same as
for meshes.
2013-08-21 07:40:19 +00:00
8937a8b839 use BM_CREATE_NOP arg rather then zero, with pointer and bool args in either side in some cases it gets a bit confusing.
also correct edge-rotate where bool->flag conversion worked by accident.
2013-08-21 05:39:46 +00:00
89c7cf1a49 style cleanup: also use ARRAY_HAS_ITEM macro for mempool check 2013-08-21 02:29:13 +00:00
aa10489a0d Fix [#36351] Changing the Frame Rate value doesnt adjust audio strip length.
Simply recalc sequence len for audio (and meta!) strips when modifying fps value. Note start, startofs and endofs are also updated, to try to keep final pos and length as consistent as possible.
2013-08-20 19:50:31 +00:00
017392d603 fix/workaround [#36519] Origin to Center of Mass" failes when faces have an area of zero 2013-08-20 09:42:18 +00:00
4095fac849 Fix crash caused by own commit to optimize out curvemapping
initialization. In sculpt mode, when using shift-click to switch to the
smooth brush it was possible to ommit initialization of curvemapping for
that brush.
2013-08-19 19:41:38 +00:00
9db32483f3 Minor optimization for paint systems, initialize the paint curve before
the stroke and skip checking for initialization each time we request the
curve value.
2013-08-19 19:04:39 +00:00
789ee1bfcc Dyntopo:
* Actually check if normal recalculation flags exists and set it when
splitting nodes in dyntopo. Right now, nodes that need GPU buffer update
will always get in the list to get their normals generated, but to avoid
a possible future breakage better do it right now.
* Avoid keeping deleted/removed vertices in vertex-to-node and unique
vertex hashes, since some checks rely on those and may go awry if these
still exist. Also they pollute the hashes, and may hurt performance
somewhat.
2013-08-19 17:37:21 +00:00
b8ce663706 Fix crash happening due to missing ob->curve_cache
It's a bit dumb to store render-time bevel list in
object's curve_cache, but that's how blender already
used to work for ages.

Proper fix is suspended for tomorrow :)
2013-08-19 14:22:02 +00:00
6f88dca9c3 Dyntopo:
Turn off pbvh normal update flag after recalculation, saves
recalculating normals every frame when not stroking the mesh.

For this to work reliably with undo we need to support original normals
in the bm_log (was marked as a TODO already in the code), so that
undoing avoids having invalid normals in the mesh (since we don't update
every frame anymore). This was added in this commit as well.

Also added some (disabled) quite paranoid checks in the bmesh valication
code for dyntopo hoping to catch the real normal update issue. No luck
there yet.
2013-08-19 14:08:59 +00:00
26c34fc29f Merge remained parts of r57520: use use_render argument rather than G.is_rendering 2013-08-19 11:04:32 +00:00
a4078c8c1a No static vars shall be in mballs now
No need in special hacks for this now :)
2013-08-19 11:04:28 +00:00
efa836531e Commit atomic operations file
Not currently used, but needed for some further changes
2013-08-19 10:44:18 +00:00
08c49d8a12 Use reentrant qsort() in particle codes
Particle system code used global variable to sort hair by orig index,
which is not safe for threading at all.

Replaced this with usage of reentrant version of qsort, which is
now implemented in BLI. It was moved from recast navigation code
to BLI, so more areas could use it (if needed).

--
svn merge -r59086:59087 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:40:47 +00:00
9f7961b6b1 Optimization and threading fix for shapekeys weights calculation
This commit fixes two different issues, which were caused by
how weights are being calculated for relative shapekeys.

Weights for key block used to saved in KeyBlock DNA structure,
which lead to situations when different objects could start
writing to the same weights array if they're sharing the same
key datablock.

Solved this in a way so weights are never stored in KeyBlock
and being passed to shapekeys routines as an array of pointers.
This way weights are still computed run-time (meaning they're
calculated before shapekey evaluation and freed afterwards).

This required some changes to GameEngine as well, to make it
never cache weights in the key blocks.

Another aspect of this commit makes it so weight for a given
vertex group is only computed once. So if multiple key blocks
are using the same influence vertex group, they'll share the
same exact weights array. This gave around 1.7x speedup in
test chinchilla file which is close enough to if we've been
caching weights permanently in DNA (test machine is dual-code
4 threads laptop, speedup measured in depsgraph_mt branch,
trunk might be not so much high speedup).

Some further speed is optimization possible, but it could be
done later as well.

Thanks Brecht for idea of how the things might be solved in
really clear way.

--
svn merge -r58786:58787  ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:36:39 +00:00
36ffc7accd Made armatures evaluation safe for threading
Apparently, some routines in armature deformation code
were using static arrays. This is probably just an
optimization thing, but it's very bad for threading.

Now made it so bbone matrices array is allocating in
callee function stack. This required exposing
MAX_BBONE_SUBDIV to an external API, This is not so
much crappy from code side, and it shall be the same
fast as before.

--
svn merge -r58278:58279 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:14:22 +00:00
c46cbc602e Make lattice deform safe for threading
Lattice deformation used to store some runtime data
inside of lattice datablock itself. It's something
which is REALLY bad. Ideally DNA shouldn't contain
and runtime data.

For now solved it in a way that initialization of
lattice deform will create a structure which contains
lattice object for which deformation is calculating
and that runtime data which used to be stored in
lattice datablock itself.

It works really fine for mesh deform modifier, but
there's still runtime data stored in particle system
DNA, It didn't look something easy to be solved, so
leaving this as-is for now.

--
svn merge -r58277:58278 -r58795:58796 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:11:48 +00:00
59dfb05c72 Make fonts safe(r) for threading
Getting vfont data wasn't safe for threading, because it
was modifying font data which is in bmain and could be
shared by multiple objects.

For now made it so getting vfont uses critical section,
meaning vfont->data is initializing from inside a locked
mutex.

--
svn merge -r58168:58169 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:02:18 +00:00
f030758515 Tag object-data level boundbox as invalid rather than freeing it
Object update used to free object-data level bounding box to trigger
it's re-calculation in the future. Such a freeing performed from
object update isn't thread-safe because mesh could be shared between
multiple objects.

Rather than freeing bounding box, tag it's as invalid, this is safe
from threading point of view and also prevents unnecessary memory
re-allocation.

Object-level bounding box is still reallocating, but think we could
change this easily in the future as well.

--
svn merge -r58154:58156 -r59258:59259 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:58:28 +00:00
2dcb1d7002 Remove unused bounding box from MetaBall
--
svn merge -r58150:58151 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:41:13 +00:00
7ef3f98de1 Made curves almost thread-safe
Now modifier stack wouldn't modify original curve's nurbs
and will operate on a copy of nurbs.

This makes it possible to process curve object update with
shared curve datablocks from multiple threads. There's no
big overhead for creating a copy of nurbs comparing to old
behavior which was allocating original vertex array and
apply coordinates on curve after all modifier are applied.

The only remained issue with curves is curve's bounding box
and texture space. It's not thread-safe, but it wouldn't
lead to crashes -- it just could lead to either memory
leak or wrong texture coordinates due to difference in
modifiers stacks of objects which shares the same curve.

--
svn merge -r57959:57961 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:36:40 +00:00
345fff872b Remove unused argument from utility curve functions
So far it was harmless, but with upcoming changes having this
argument could be confusing from logic point of view

--
svn merge -r57958:57959 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:29:51 +00:00
527ddb0a5b 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 data 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.

Actually, this commit also contains wrapping runtime curve
members into own structure

This allows easier assignment on file loading, keeps curve-
specific runtime data grouped and saves couple of bytes in
Object for non-curve types.

--
svn merge -r57938:57939 ^/branches/soc-2013-depsgraph_mt
svn merge -r57957:57958^/branches/soc-2013-depsgraph_mt
2013-08-19 09:25:24 +00:00
0312b18319 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 calculation.

Since we already do have bounding 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
bounding 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.

--
svn merge -r57939:57940 ^/branches/soc-2013-depsgraph_mt
2013-08-19 09:13:15 +00:00