Commit Graph

58097 Commits

Author SHA1 Message Date
Lukas Tönne
e7d2e5ffbc Extended RNA support for mesh customdata property layers.
Support for user-defined customdata layers (named int, float, string
layers) was limited to polygon customdata. This is not accessible in
cycles because only tessfaces are used there. Furthermore the polygon
attributes were simply described as MeshFloatProperty, MeshIntProperty,
MeshStringProperty, omitting the distinction by element type.

The patch only adds vertex attributes so far. However, the code now
explicitly defines polygon and vertex attributes, so adding edges, loops
and tessfaces is much easier should the need arise.

Problem is that the RNA definition, which is already much more
complicated than the basic DNA/BKE definition of custom properties, now
becomes extremely bloated and cumbersome. A simpler solution would be
preferable but may not be possible within the constraints of RNA.
2015-02-16 12:26:25 +01:00
Sergey Sharybin
9daac198f5 Cycles: Correction for C++11 compilation error after recent vector changes 2015-02-16 15:38:13 +05:00
Sybren A. Stüvel
9a10b208ba Ensure CMake finds SDL 2.0
CMake 2.8 doesn't search /usr/include/SDL2, which is the include directory
for SDL 2.x on Ubuntu Linux (and possibly others). This results in SDL 1.2
headers being found when WITH_SDL_DYNLOAD=OFF, and our shipped SDL 2.0
headers when WITH_SDL_DYNLOAD=ON. This patch ensures that in both
cases the correct SDL headers are used.

Reviewers: sergey, campbellbarton

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D1112
2015-02-16 09:27:50 +01:00
Campbell Barton
58652301de Vert/Edge Slide: better UV interpolation
Ignore faces which the sliding vert is outside of.
2015-02-16 18:49:18 +11:00
Campbell Barton
421d0f3bde Math Lib: add dist_signed_squared_to_corner_v3v3v3
Can be used to check if a point is inside the 2-planes defined by a face-corner.
2015-02-16 18:47:15 +11:00
Campbell Barton
81be1c7a21 Correct crash /w vertex slide with no faces
Error in recent commit
2015-02-16 13:41:46 +11:00
Campbell Barton
7975c0d35a cleanup: split VSE view-size into own function 2015-02-16 13:19:22 +11:00
Campbell Barton
5c747e7196 Fix T43681: VSE draw glitch with no-display
Missed clearning the backdrop
2015-02-16 13:05:59 +11:00
Campbell Barton
b1dbda143d BMesh: Connect path, use select order
Could connect a pair of verts previously,
now connect all vertices along the path, running a second time closes the loop.

Can also be used for without faces to connect edges between selected points.
2015-02-16 09:44:30 +11:00
Sergey Sharybin
e2573aea9b Compilation error fix for strict compiler flags 2015-02-15 23:12:54 +05:00
Sergey Sharybin
478d67e858 Cycles: Hopefully compilation error fix for OSX 2015-02-15 23:11:33 +05:00
Bastien Montagne
a98fc4f8f9 Fix T43671: Playing with Mix Factor of Data Transfer Modifier Is Overwritting Data of Base Mesh
The issue was actually affecting all data types that are not regular CDLayer ones, since by default
DerivedMesh references mesh data (verts, edges, etc. - modifying custom normals often implies
modifying edges' sarpness too).
Modfying edge/face sharpness etc. could directly affect the mesh in this case, **bad**!

So we detect whether we are copying data types that may affect non-CDlayers data, and whether
verts array of org dm is same as mesh one - in which case we copy the DM. This avoids
useless copying in most cases.

Note Edit Normals was quite obviously suffering the same issue.
2015-02-15 19:00:06 +01:00
Bastien Montagne
1c64543aef Cleanup of SpaceFile, from asset-experiments branch mostly.
Helps keeping diff with branch relevant and clean...
2015-02-15 16:35:42 +01:00
Bastien Montagne
f1ee11fcca Fix for previous commit, sorry for the noise. 2015-02-15 15:55:13 +01:00
Bastien Montagne
2e9105cc96 Cleanup: BLI_listdir (direntry): get rid of usage of raw malloc/free here.
No reason at all not to use MEM_xxx as everywhere else, especially confusing
when members of direntry **are** MEM_-allocated (relname, etc.)!
2015-02-15 15:07:48 +01:00
Joshua Leung
35567d563d Possible todo notes for more polished UI? 2015-02-16 01:21:48 +13:00
Joshua Leung
263518ec49 Outliner: "Purge All" function for Outliner in "Orphaned Datablocks" mode
Many users have been requesting a way to remove unused datablocks from the file/session
"without closing and reopening" Blender (or at least that's the impression I'm getting).

This commit adds a new operator (exposed as the "Purge All" button in the header of
the "Orphaned Datablocks" mode in the Outliner, which seems to be the logical
place for this) for doing so. It does so by wrapping up the save and "revert"
(i.e. reload the saved file from disk, without needing to quit Blender) operators
along with a confirmation prompt for good measure.

Caveats:
* Ultimately, we still cannot really cleanly delete any datablocks from the current
  session outright without reloading the file/data at some point. Thus, we do need
  to reload the file again before it can be used.
* This does mean that this operation is irreversible. Notably, Undo history is lost
  is doing this operation. Hence the warnings...   (Then again, undo/redo actually
  reloads the entire scene DB from memory, so it's not anything uncommon ;)

Other Notes:
* The addition of this operator brings this mode more into line with being a kind of
  "Trashcan" place, with this new operator being the manual "Empty Trash" button.
  If the "Orphaned Datablocks" name is too obscure, maybe we could rename this
  mode to "Trash" or something similar?
2015-02-16 01:21:47 +13:00
Joshua Leung
0688f6e012 Code Cleanup: Reshuffle libraries and orphaned datablocks views to a more appropriate place in the file 2015-02-16 01:21:46 +13:00
Joshua Leung
d0609d09e4 Outliner: Do not show RMB menu for "ID Base" entries 2015-02-16 01:21:45 +13:00
Joshua Leung
16689a1db0 Outliner: Use restriction columns in "Orphaned Datablocks" view to manage usercounts
When in "Orphaned Datablocks" mode, the restriction columns are used to display
usercount indicators and toggles to manage whether datablocks get saved or not.

* The first column shows an icon to indicate whether that datablock is going to get
  saved. A tick indicates the datablock will be saved, while a cross indicates the
  opposite. Clicking on this changes whether the datablock will get saved.

* The second column shows the usercount.

* The third column shows whether the datablock has a fake user.


Notes:
* The second and third columns are pretty much redundant (functionally speaking).
  While it is possible to also toggle fake users by clicking in the third column,
  its role here is more as information for power users (and hopefully to allow others
  to connect the relationship between the saved/not saved status and fake users)

* I'm not sure whether the use of the X here for the "not saved" state stands out enough
  to draw user's attention to items which are "in the danger zone".
2015-02-16 01:21:44 +13:00
Joshua Leung
030b0aab43 Outliner: Added new mode for displaying "orphaned" datablocks
Orphaned datablocks are those which have either:
* 0 users
* A "fake" user only

In the case of the former, they will be quietly discarded from the file on the next
save + reload. Hence, it is helpful to have a view where you can confirm which ones
fall into this category and might be worth saving.

We also include datablocks with a fake user only so that datablocks given a user
above can have that easily turned off again (in case the user makes a mistake).
Another benefit of showing these is that it become easier to remove fake users from
datablocks you no longer want retained without having to hunt for them.
2015-02-16 01:21:43 +13:00
Julian Eisel
0ff56ca2aa Revert/Remove "Auto View" Feature
Turned out that I misinterpreted the feature request, plus there are some
minor issues with the commit that would need to be corrected.
After all, I decided to just remove it again as it seems to not be really
useful for the users.
2015-02-15 04:29:11 +01:00
Campbell Barton
c439d14a9a missed this second last commit 2015-02-15 14:11:05 +11:00
Campbell Barton
fa2f7c69ac mathutils: Implement __hash__() functions
- all mathutils types
- only works on frozen data (so vectors can be used in sets/dict keys)
- uses same method as CPython, (matches hashing a tuple)

D1104 by @juicyfruit with own modifications
2015-02-15 14:02:08 +11:00
Campbell Barton
a9d979c8ef mathutils: add freeze() method, is_frozen attr
This allows you to make any mathutils object immutable.
2015-02-15 14:01:59 +11:00
Campbell Barton
ce85aef0d9 mathutils: remove redundant read callback 2015-02-15 13:46:47 +11:00
Campbell Barton
4feb77cf03 mathutils: avoid extra alloc for Vector.lerp 2015-02-15 13:46:47 +11:00
Campbell Barton
24f9ed0b34 Fix crash setting Euler.order to a non-string 2015-02-15 13:46:47 +11:00
Sybren A. Stüvel
bf157ce927 Fix T42919 & T42218: BGE: Python-driven armature animation got buggy
Due to changes in the way animation updates were handled,
BL_ArmatureObjects were no longer registering to KX_Scene as animated.

Moguri says: It might have been relying on the deformer update which
moved rom being called on every object in the render step. Now
armature deformers are only updated if they need to be.

Fix T42919 & Fix T42218
2015-02-15 02:00:56 +01:00
Sergey Sharybin
a83b2d3fd9 Cycles: Fix wrong attribute count calculation in prevous commit
The workaround for generated texture coordinates is to be done before
calculating number of elements for attribute, otherwise counter wouldn't
include those attributes.
2015-02-15 02:55:18 +05:00
Sergey Sharybin
1862fbf203 Cycles: Optimize memory usage when creating mesh attributes
The idea behind the change is to pre-allocate attribute arrays in advance,
which avoids re-allocation of arrays later for each of meshes being handled.

This reduces peak memory used by Cycles database from 1.3G to 0.9G for
victor.blend from Gooseberry.

It doesn't mean every file will benefit from this change since peak memory
usage is happening in the different places of the rendering code.

Also, unfortunately, attributes export might not cause the peak of render
preparation stage. That said, it's actually object_to_mesh() which causes
the memory to peak in the same test file. So we really need to optimize that
part first in order to get visible results for artists. But in any case it's
now quite easy to track hotspots in Cycles itself which is good.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
18937f6fb5 Cycles: Add ifdef switch to use blender's guardedalloc for vector allocation
It's actually a bad level call, but it's inside ifdef block and disabled by
default and only intended to be used for development purposes.

Main idea of this change is to combine statistics coming from Cycles and
Blender during scene synchronization step, to see if further changes are
actually reducing memory footprint.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
d0cc1180b0 Cycles: Add utility method to vector which totally frees memory used the vector
The method is called vector::free_memory(). Use with care since it'll invalidate
all the pointers to vector memory, all iterators and so on.

Currently unused, but might become handy when clearing unused data.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
aad96506c1 Cycles: Report system memory usage and peak after scene device update
This only happens when built with WITH_CYCLES_DEBUG flag, memory statistics
is coming from guarded STL allocator.
2015-02-15 02:01:48 +05:00
Sergey Sharybin
a445e49186 Cycles: Implement guarded allocator for STL classes
The commit implements a guarded allocator which can be used by STL classes
such as vectors, maps and so on. This allocator will keep track of current
and peak memory usage which then can be queried.

New code for allocator is only active when building Cycles with debug flag
(WITH_CYCLES_DEBUG) and doesn't distort regular builds too much.

Additionally now we're using own subclass of std::vector which allows us
to implement shrink_to_fit() method which would ensure capacity of the
vector is as big as it should be (without this making vector smaller will
still use all previous memory allocated).
2015-02-15 02:01:48 +05:00
Sergey Sharybin
01067fe51c Cycles: Replace own aligned allocator with system one
This replaces our own implementation of aligned malloc with system calls,
which depends on which operation system you're on.

This is probably really minor noticeable change, but in the same time it
might reduce amount of wasted memory.
2015-02-15 02:01:48 +05:00
Julian Eisel
24976dd29d Outliner: Toggle restrict buttons only for selectable child objects
D404 by @rupp with minor edits by me.
2015-02-14 21:54:31 +01:00
Thomas Dinges
354cf76803 Cleanup: Comment block for sse helpers. 2015-02-14 20:57:21 +01:00
Thomas Dinges
d979f39cf1 Cycles: Small improvement for volume render (decoupled)
Simplify branching here a bit, helps ~3% in volume_light_sampling.blend (Branched MIS scene).
2015-02-14 20:44:30 +01:00
Sergey Sharybin
2fad3132a3 Cycles: Fix compilation error of Cycles standalone with Libmv disabled 2015-02-14 21:33:14 +05:00
Lukas Tönne
db297e7ea3 Revert "Fix T43471, based on patch submitted by @sean_loh."
This reverts commit b2b54b0902045ec4f0c1a4cae3209be863878f5b.

The patch breaks particle distribution even in simple cases, not worth
doing this for keeping a hackish loophole open.
2015-02-14 16:40:57 +01:00
Campbell Barton
cfa1fd1c1f object drawing: only use halo-draw in object mode 2015-02-14 22:29:45 +11:00
Joshua Leung
dd6edac803 Bring copy/free operations into line with changes in previous commit 2015-02-15 00:06:19 +13:00
Joshua Leung
ec2ede4302 Bugfix: Referencing actions from Action Actuator was not setting a user
This reverts the change made in 8872cba7e956a9d9a840e55e5323945497524795
which was contributing to actions being lost in some cases [1], even when
they were assigned to those actuaters, which needed them to be able to
function. Now there's one less case where users are needed but were missing :)

Note that this still doesn't solve the core issue where nothing is responsible
for associating actions created for a particular datablock (and not currently
being used in its active action slot, or in the NLA stack) with that datablock.
That issue is the cause of most action disappearances as well as for other problems
(such as renaming bones being unable to fix unreferenced/unused actions) where there
are diifferences between users' mental models and the data model. Proper fixes are
coming soon (restoring fake users here isn't a proper fix, as it only masks the
fundamental mismatch/problem here).


[1] http://blenderartists.org/forum/showthread.php?357021-BGE-loses-actions
2015-02-15 00:06:18 +13:00
Sergey Sharybin
dde0765de2 CMake: Enable JeMalloc by default
It's really handy to have blender linked against jemalloc because of
much better memory fragmentation handling by that library.

To be noted: if jemalloc library is not found it'll be disabled with
message about that, no compilation error should happen.
2015-02-14 15:13:48 +05:00
Sergey Sharybin
a439c8026a CMake: Add search path for jemalloc which corresponds to own and studio setup 2015-02-14 12:29:48 +05:00
Campbell Barton
7a977df6d4 Refactor array_utils out of BLI_array
BLI_array.h is for resizing array macros, where as array_utils can operate on any arrays.
2015-02-14 08:00:41 +11:00
Campbell Barton
2af905391d cleanup: doxy comments 2015-02-14 08:00:41 +11:00
Campbell Barton
2c1143aa2f Comments: use doxy sections for nodes header 2015-02-14 08:00:41 +11:00
Sergey Sharybin
3ec9b8e0c2 Purge temporary files on abort
This way both BLI_assert() and abort() called directly shouldn't
leave any files in the temp folder.

Previously it was really possible to have gadzillions of files
left over because of assert failures and debug aborts during the
development process.
2015-02-14 01:30:36 +05:00